Reader¶
- class simframe.io.Reader(writer, description='')[source]¶
Bases:
object
General class for reading output files. Every
Writer
class should also provide a reader for its data files.Custom
Reader
must provide a methodReader.output()
that reads a single output file and returns the data set as typeSimpleNamespace
.The general
Reader
class provides a function that stitches together allSimpleNamespaces
theReader.output()
method provides into a singleSimpleNamespace
by adding another dimension along the integration variableIntVar
.- Attributes
description
Description of the
Reader
.
Methods
all
()Functions that reads all output files and combines them into a single
SimpleNamespace
.Method to list all data files in a directory
output
(file)Function that returns the data of a single output file.
sequence
(field)Function that returns the entire sequence of a specific field.
Attributes Summary
Description of the
Reader
.Methods Summary
all
()Functions that reads all output files and combines them into a single
SimpleNamespace
.Method to list all data files in a directory
output
(file)Function that returns the data of a single output file.
sequence
(field)Function that returns the entire sequence of a specific field.
Attributes Documentation
- description¶
Description of the
Reader
.
Methods Documentation
- all()[source]¶
Functions that reads all output files and combines them into a single
SimpleNamespace
.- Returns
dataset – Namespace of data set.
- Return type
SimpleNamespace
Notes
This function is reading one output files to get the structure of the data and calls
read.sequence()
for every field in the data structure.
- listfiles()[source]¶
Method to list all data files in a directory
- Returns
files – List of strings of all found data files sorted alphanumerically.
- Return type
list
Notes
Function only searches for files that match the pattern specified by the
Writer
’sfilename
andextension
attributes.
- output(file)[source]¶
Function that returns the data of a single output file.
- Parameters
file (str) – Path to file that should be read.
- Returns
data – Data set of a single output file.
- Return type
SimpleNamespace
- sequence(field)[source]¶
Function that returns the entire sequence of a specific field.
- Parameters
field (str) – String with location of requested field
- Returns
seq – Array with requested values
- Return type
array
Notes
field
is addressing the values just as in the parent frame object. E.g."groupA.groupB.fieldC"
is addressingFrame.groupA.groupB.fieldC
.