|
fosanalysis
A framework to evaluate distributed fiber optic sensor data
|
File handler class to get measurement data from sensors. More...
Public Member Functions | |
| __init__ (self, str filename, int chunk_size=1000) | |
| Provides the handler for parsing measuring data files. | |
| close_file (self) | |
| Close the handle to the file and reset all function variables. | |
| tuple[list, dict] | get_measurements (self, int channel=None, datetime start_time=None, datetime end_time=None, segments_gages=None) |
| Generator[dict] | yield_dat_file_values (self) |
| Generator to iterate over all .dat files of current measurement. | |
| Generator[list, dict] | yield_gages_segments_in_chunks (self, segments_gages, int chunk_size=None, int channel=None, datetime start_time=None, datetime end_time=None) |
| Generator to iterate over a dictionary with all strain data, x-axis and tare for the given segment or gage names of chunk_size. | |
| Generator[list, list] | yield_measurements_in_chunks (self, int chunk_size=None, int channel=None, datetime start_time=None, datetime end_time=None) |
| Generator to iterate over the whole file and yields data with size of chunk. | |
Public Attributes | |
| chunk_size = chunk_size | |
| Size of chunks when reading multiple readings at once. | |
| metadata = None | |
| Dictionary, which stores metadata for each file imported. | |
| reader = None | |
| Holds the file reader for selected file. | |
| sensors = None | |
| List of SensorInfo object available in file, contains all sensor specific infos (incl. | |
Protected Member Functions | |
| tuple[int, int] | _get_range_of_segment_gage (self, str name, filereader.SensorInfo sensor) |
| Get start and end index of gage/segment. | |
| _split_to_gages_segments (self, dict meas_dict, filereader.SensorInfo sensor, segments_gages, list strain) | |
| Fill the meas_dict dictionary with all strain data, x-axis and tare for the given segment or gage names. | |
File handler class to get measurement data from sensors.
Currently raw data and exported TSV files from ODiSI 6100 series interrogators by Luna Inc LunaInnovations2020 are supported, see [6].
Definition at line 17 of file filehandler.py.
| fosanalysis.datahandling.filehandler.FileHandler.__init__ | ( | self, | |
| str | filename, | ||
| int | chunk_size = 1000 ) |
Provides the handler for parsing measuring data files.
Different types of files are supported (atm *.dat and *.tsv )
| filename | Path to file to get measurement data. |
| chunk_size | Size of chunks when reading multiple readings at once. For more, see chunk_size. |
Definition at line 24 of file filehandler.py.
|
protected |
Get start and end index of gage/segment.
| name | Name of the segment/gage. |
| sensor | Sensor object with axis, tare, etc. |
Definition at line 242 of file filehandler.py.
|
protected |
Fill the meas_dict dictionary with all strain data, x-axis and tare for the given segment or gage names.
| meas_dict | Dict with all measurement data of segment/gage. |
| sensor | Sensor object with axis, tare, etc. |
| segments_gages | String or list of gage/segment name(s). |
| strain | Strain values as list of arrays. |
Definition at line 213 of file filehandler.py.
| fosanalysis.datahandling.filehandler.FileHandler.close_file | ( | self | ) |
Close the handle to the file and reset all function variables.
Definition at line 56 of file filehandler.py.
| tuple[list, dict] fosanalysis.datahandling.filehandler.FileHandler.get_measurements | ( | self, | |
| int | channel = None, | ||
| datetime | start_time = None, | ||
| datetime | end_time = None, | ||
| segments_gages = None ) |
Reads all measurement files and returns the strain values, x_axis,
tare and timestamps filtered by given parameters.
The values are read in blocks to avoid memory issues.
The values will be split to gages/segments,
if segments_gages are given.
\param channel Selected channel of the file, defines the sensor.
\param start_time Read measurements from given timestamp.
\param end_time Read measurements till given timestamp.
\param segments_gages String or list of strings of gages/segments.
\return List of available timestamps.
\return Data of measurement (strain, xaxis, tare) as dict.
If no segment/gage selected, the dict contains ['All'] key.
Definition at line 68 of file filehandler.py.
| Generator[dict] fosanalysis.datahandling.filehandler.FileHandler.yield_dat_file_values | ( | self | ) |
Generator to iterate over all .dat files of current measurement.
Reads all values of the file and separate it to the channels.
Definition at line 122 of file filehandler.py.
| Generator[list, dict] fosanalysis.datahandling.filehandler.FileHandler.yield_gages_segments_in_chunks | ( | self, | |
| segments_gages, | |||
| int | chunk_size = None, | ||
| int | channel = None, | ||
| datetime | start_time = None, | ||
| datetime | end_time = None ) |
Generator to iterate over a dictionary with all strain data, x-axis and tare for the given segment or gage names of chunk_size.
Separately from it, it returns the timestamps of file.
| segments_gages | String or list of gage/segment name(s). |
| chunk_size | Number of lines to be read in one chunk as int. |
| channel | Selected channel of the file, defines the sensor. |
| start_time | Read measurements from given timestamp. |
| end_time | Read measurements till given timestamp. |
Definition at line 173 of file filehandler.py.
| Generator[list, list] fosanalysis.datahandling.filehandler.FileHandler.yield_measurements_in_chunks | ( | self, | |
| int | chunk_size = None, | ||
| int | channel = None, | ||
| datetime | start_time = None, | ||
| datetime | end_time = None ) |
Generator to iterate over the whole file and yields data with size of chunk.
Returns lists of timestamps and strain values.
| chunk_size | Maximum number of lines to read in lists, see chunk_size. |
| channel | Selected channel of the file, defines the sensor. |
| start_time | Read measurements from given timestamp. |
| end_time | Read measurements till given timestamp. |
Definition at line 135 of file filehandler.py.
| fosanalysis.datahandling.filehandler.FileHandler.chunk_size = chunk_size |
Size of chunks when reading multiple readings at once.
This is equivalent to the number of lines parsed in one go. The higher this value, the more data is held in memory. If the device is tight on memory, reduce it. Defaults to 1000.
Definition at line 44 of file filehandler.py.
| fosanalysis.datahandling.filehandler.FileHandler.metadata = None |
Dictionary, which stores metadata for each file imported.
The field name is used as key.
Definition at line 35 of file filehandler.py.
| fosanalysis.datahandling.filehandler.FileHandler.reader = None |
Holds the file reader for selected file.
Definition at line 32 of file filehandler.py.
| fosanalysis.datahandling.filehandler.FileHandler.sensors = None |
List of SensorInfo object available in file, contains all sensor specific infos (incl.
tare, x-axis, segments...).
Definition at line 38 of file filehandler.py.