Parser¶
This module contains parser to load data from different logfile formats.
The “parse” function is able to detect all possible input formats.
The return is for all functions a dataframe containing the data and a dictionary containing the parsed metadata. Independent of the input format the columns and metadata-names should be identical. Other functions in this module expect these naming conventions.
The one exception is “read_combined_workbench” which parses a combined Workbench logfile (the file next to the “ChannelData”/”MeasurementData” folder that holds all channels) and returns a dict mapping each channel to its own (DataFrame, metadata-dict).
- pyrotoolbox.parsers.parse(fname: str) tuple[DataFrame, dict] | dict[str, tuple[DataFrame, dict]]¶
Reads any pyroscience textfile. Not .pyr files! Returns a dataframe and a dict with metadata.
For a combined Workbench logfile (the file next to the “ChannelData”/”MeasurementData” folder that holds all channels) a dict mapping each channel id to its own (DataFrame, metadata-dict) is returned instead - see read_combined_workbench.
- Parameters:
fname – path to the textfile
- pyrotoolbox.parsers.read_workbench(fname: str) tuple[DataFrame, dict]¶
Loads and parses a Workbench file and returns a pandas DataFrame and a dictionary with metadata
- Parameters:
fname – file name of the logfile
- Returns:
(DataFrame, metadata-dict)
- pyrotoolbox.parsers.read_combined_workbench(fname: str) dict[str, tuple[DataFrame, dict]]¶
Loads a combined Workbench logfile and parses every channel it contains.
The combined logfile is the file next to the “ChannelData”/”MeasurementData” folder that is named like the measurement and holds all channels of all connected devices in a single table. Each channel is parsed exactly like its individual per-channel logfile (see read_workbench).
- Parameters:
fname – file name of the combined logfile
- Returns:
dict mapping channel id (e.g. “A Ch.1”, “A T1”) to (DataFrame, metadata-dict). Each entry is like read_workbench() output for the corresponding per-channel logfile, with one addition: a “comment” column (as in read_developertool) holding the comments logged during the measurement, each placed on the first sample at or after its timestamp. The same comments apply to every channel.
- pyrotoolbox.parsers.read_fireplate_workbench(fname: str) tuple[DataFrame, dict]¶
Loads and parses a Workbench file of a fireplate and returns a pandas DataFrame and a dictionary with metadata
- Parameters:
fname – path to the lofile
- Returns:
DataFrame, metadata-dict
- pyrotoolbox.parsers.read_developertool(fname: str) tuple[DataFrame, dict]¶
Loads and parses a logfile from the PyroDeveloperTool
- Parameters:
fname – path to the logfile
- Returns:
(DataFrame, metadata-dict)
- pyrotoolbox.parsers.read_developertool_directory(pattern: str = '*.txt')¶
parses all files matching the pattern (default *.txt) and returns 3 dictionaries
first dictionary is UID/Name-ChX -> List of Dataframes
second dictionary is UID/Name-ChX -> List of metadata-dicts
third dictionary is UID/Name-ChX -> List of filenames
- Parameters:
pattern – files to load. Default: *.txt
- pyrotoolbox.parsers.read_aquaphoxlogger(fname: str) tuple[DataFrame, dict]¶
Loads and parses a logfile from an AquapHOx-Logger
- Parameters:
fname – path to the logfile
- Returns:
(DataFrame, metadata-dict)
- pyrotoolbox.parsers.read_fsgo2(fname: str) tuple[DataFrame, dict]¶
Loads and parses a logfile from a FSGO2
- Parameters:
fname – path to the logfile
- Returns:
(DataFrame, metadata-dict)
- pyrotoolbox.parsers.read_fdo2_logger(fname: str) tuple[DataFrame, dict]¶
Loads and parses a logfile from the FDO2 Logger
- Parameters:
fname – path to the logfile
- Returns:
(DataFrame, metadata-dict)