libpyvinyl.BaseData
- class libpyvinyl.BaseData(key, expected_data, data_dict=None, filename=None, file_format_class=None, file_format_kwargs=None)[source]
- Class:
The abstract data class.
Inheriting classes represent simulation input and/or output data and provide a harmonized user interface to simulation data of various kinds rather than a data format. Their purpose is to provide a harmonized user interface to common data operations such as reading/writing from/to disk.
- Parameters:
key (
str
) – The key to identify the Data Object.expected_data (
dict
) – A placeholder dict for expected data. The keys of this dict are expected to be found during the execution of get_data(). The value for each key can be None.data_dict (
Optional
[dict
]) – The dict to map by this DataClass. It has to be None if a file mapping was already set, defaults to None.filename (
Optional
[str
]) – The filename of the file to map by this DataClass. It has to be None if a dict mapping was already set, defaults to None.file_format_class (class, optional) – The FormatClass to map the file by this DataClass, It has to be None if a dict mapping was already set, defaults to None
file_format_kwargs (
Optional
[dict
]) – The kwargs needed to map the file, defaults to None.
- __init__(key, expected_data, data_dict=None, filename=None, file_format_class=None, file_format_kwargs=None)[source]
- Parameters:
key (
str
) – The key to identify the Data Object.expected_data (
dict
) – A placeholder dict for expected data. The keys of this dict are expected to be found during the execution of get_data(). The value for each key can be None.data_dict (
Optional
[dict
]) – The dict to map by this DataClass. It has to be None if a file mapping was already set, defaults to None.filename (
Optional
[str
]) – The filename of the file to map by this DataClass. It has to be None if a dict mapping was already set, defaults to None.file_format_class (class, optional) – The FormatClass to map the file by this DataClass, It has to be None if a dict mapping was already set, defaults to None
file_format_kwargs (
Optional
[dict
]) – The kwargs needed to map the file, defaults to None.
Methods
__init__
(key, expected_data[, data_dict, ...])- type key:
from_dict
(data_dict, key)Create a Data Object mapping a data dict.
from_file
(filename, format_class, key, **kwargs)Create a Data Object mapping a file.
get_data
(**kwargs)Return the data in a dictionary
Print supported formats
set_dict
(data_dict)Set a mapping dict for this DataClass.
set_file
(filename, format_class, **kwargs)Set a mapping file for this DataClass.
write
(filename, format_class[, key])Write the data mapped by the Data Object into a file and return a Data Object mapping the file.
Attributes
The data_dict of the class instance for calculator usage
The expected_data of the class instance for calculator usage
The FormatClass to map the file by this DataClass
The kwargs needed to map the file
The filename of the file to map by this DataClass.
The key of the class instance for calculator usage
Returns an overview of the keys of the mapped dict or the filename of the mapped file
If this data class is a file mapping or python dict mapping.