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 method Reader.output() that reads a single output file and returns the data set as type SimpleNamespace.

The general Reader class provides a function that stitches together all SimpleNamespaces the Reader.output() method provides into a single SimpleNamespace by adding another dimension along the integration variable IntVar.

Attributes:
description

Description of the Reader.

Methods

all()

Functions that reads all output files and combines them into a single SimpleNamespace.

listfiles()

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

Description of the Reader.

Methods Summary

all()

Functions that reads all output files and combines them into a single SimpleNamespace.

listfiles()

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’s filename and extension 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 addressing Frame.groupA.groupB.fieldC.