LogProtocol#
- class pyrost.LogProtocol(datatypes, log_keys, part_keys)#
Log file protocol class. Contains log file keys to retrieve and the data types of the corresponding values.
- Parameters
datatypes (
Dict
[str
,str
]) – Dictionary with attributes’ datatypes. ‘float’, ‘int’, ‘bool’, or ‘str’ are allowed.log_keys (
Dict
[str
,List
[str
]]) – Dictionary with attributes’ log file keys.part_keys (
Dict
[str
,str
]) – Dictionary with the part names inside the log file where the attributes are stored.
- contents()#
Return a list of the attributes stored in the container that are initialised.
- get(attr, value=None)#
Retrieve a dataset, return
value
if the attribute is not found.
- classmethod import_default()#
Return the default
LogProtocol
object.- Return type
- Returns
A
LogProtocol
object with the default parameters.
- classmethod import_ini(ini_file)#
Initialize the container object with an INI file
ini_file
.
- items()#
Return (key, value) pairs of the datasets stored in the container.
- Return type
- Returns
(key, value) pairs of the datasets stored in the container.
- keys()#
Return a list of the attributes available in the container.
- load_attributes(path)#
Return attributes’ values from a log file at the given path.
- load_data(path, idxs=None, return_idxs=False)#
Retrieve the main data array from the log file.
- Parameters
- Returns
Dictionary with data fields and their names retrieved from the log file.
An array of indices of the scan steps read from the log file.
- Return type
A tuple of two elements
- replace(**kwargs)#
Return a new container object with a set of attributes replaced.
- static str_to_list(strings)#
Convert strings to a list of strings.
- to_ini(ini_file)#
Save all the attributes stored in the container to an INI file
ini_file
.- Parameters
ini_file (
str
) – Path to the ini file.
- values()#
Return the attributes’ data stored in the container.
- Return type
- Returns
List of data stored in the container.