|
fosanalysis
A framework to evaluate distributed fiber optic sensor data
|
File reader class for the .dat measurement files recorded by the ODiSI 6100 series interrogators by Luna Inc LunaInnovations2020.
More...
Public Member Functions | |
| __init__ (self, str filepath, *args, **kwargs) | |
| Initializes a .dat file reader. | |
| read_dat_file (self, dat_file) | |
| Reads single .dat file and parses timestamps and data for each channel Returns a dictionary with channel as key. | |
| tuple[list, dict] | read_meta_infos (self) |
| Method to get sensor data from file. | |
| Generator[datetime, np.array] | read_next_measurement (self, int channel, datetime start_time=None, datetime end_time=None, *args, **kwargs) |
| Returns only single entry of a measurement file as generator to request for multiple times for parts or the whole file. | |
Public Member Functions inherited from fosanalysis.datahandling.filereader.FileReader | |
| __init__ (self, *args, **kwargs) | |
| Constructs a FileReader object. | |
Public Member Functions inherited from fosanalysis.utils.base.Base | |
| __init__ (self, *args, **kwargs) | |
| Construct the object and warn about unused/unknown arguments. | |
Public Attributes | |
| file = open(filepath) | |
| Create a file pointer to the raw data .hdr file. | |
| int | file_version = self.DEFAULT_FILE_VERSION |
| Stores the file version of .dat file. | |
| filename = filepath | |
| File object which is already opened. | |
| str | itemsep = "," |
| Stores the item separator, for dat files the "," is used. | |
| list | measurement_files = [] |
| List of files where the measurement data stores. | |
Static Public Attributes | |
| int | DEFAULT_FILE_VERSION = 9 |
Protected Member Functions | |
| tuple[OrderedDict, OrderedDict] | _extract_segments_gages (self, dict sensor_dict) |
| Private method to extract the gages and segments from metadata dictionary. | |
| np.array | _parse_data (self, strain_data) |
| _read_base_data (self, dict line_dict, list sensor_list) | |
| Reads one line of base data file, parse for channel and record type. | |
| dict | _read_metadata (self, dict meta_dict) |
| Retrieves the meta data of the sensor file with multi channels. | |
| list | _replace_none (self, list values) |
| Private method to replace all 'None' values as NaN values. | |
File reader class for the .dat measurement files recorded by the ODiSI 6100 series interrogators by Luna Inc LunaInnovations2020.
See [6]. The file contains the raw data from measurement, mostly from different channels (1-8 possible).
Definition at line 387 of file filereader.py.
| fosanalysis.datahandling.filereader.DatReader.__init__ | ( | self, | |
| str | filepath, | ||
| * | args, | ||
| ** | kwargs ) |
Initializes a .dat file reader.
| filepath | Path to file object to read in sensor data. |
| *args | Additional positional arguments, will be passed to the superconstructor. |
| **kwargs | Additional keyword arguments, will be passed to the superconstructor. |
Definition at line 397 of file filereader.py.
|
protected |
Private method to extract the gages and segments from metadata dictionary.
The gages/segments are stored in the first line of the .dat files.
| sensor_dict | Dictionary with gages and segments. |
Definition at line 552 of file filereader.py.
|
protected |
Private method to parse the measurement data dependent on type and file version. File version = 7: Data provided as bytecode, type is string. File version = 9: Data provided as list with a divisor of 10. \param strain_data Strain data provided by raw data file,
maybe string or list.
Definition at line 579 of file filereader.py.
|
protected |
Reads one line of base data file, parse for channel and record type.
The method reads the x-axis and tare if available and adds it to the corresponding SensorInfo object of given list.
| line_dict | Current line of hdr.dat with x-axis or tare data. |
| sensor_list | List of SensorInfo objects created by first line. |
Definition at line 473 of file filereader.py.
|
protected |
Retrieves the meta data of the sensor file with multi channels.
Reads the header data like sensor name, length, gage_pitch, ...
| meta_dict | Dictionary with meta infos of first line. |
Definition at line 442 of file filereader.py.
|
protected |
Private method to replace all 'None' values as NaN values.
| values | List with strain data. |
Definition at line 616 of file filereader.py.
| fosanalysis.datahandling.filereader.DatReader.read_dat_file | ( | self, | |
| dat_file ) |
Reads single .dat file and parses timestamps and data for each channel Returns a dictionary with channel as key.
| dat_file | Path of the .dat file to read from. |
Reimplemented from fosanalysis.datahandling.filereader.FileReader.
Definition at line 526 of file filereader.py.
| tuple[list, dict] fosanalysis.datahandling.filereader.DatReader.read_meta_infos | ( | self | ) |
Method to get sensor data from file.
Returns all sensor data available in the .dat file.
Reimplemented from fosanalysis.datahandling.filereader.FileReader.
Definition at line 418 of file filereader.py.
| Generator[datetime, np.array] fosanalysis.datahandling.filereader.DatReader.read_next_measurement | ( | self, | |
| int | channel, | ||
| datetime | start_time = None, | ||
| datetime | end_time = None, | ||
| * | args, | ||
| ** | kwargs ) |
Returns only single entry of a measurement file as generator to request for multiple times for parts or the whole file.
Checks the given channel first.
| channel | Channel of the selected sensor. |
| start_time | Read measurements from given timestamp. |
| end_time | Read measurements till given timestamp. |
Reimplemented from fosanalysis.datahandling.filereader.FileReader.
Definition at line 492 of file filereader.py.
|
static |
Definition at line 395 of file filereader.py.
| fosanalysis.datahandling.filereader.DatReader.file = open(filepath) |
Create a file pointer to the raw data .hdr file.
Definition at line 416 of file filereader.py.
| int fosanalysis.datahandling.filereader.DatReader.file_version = self.DEFAULT_FILE_VERSION |
Stores the file version of .dat file.
Definition at line 414 of file filereader.py.
| fosanalysis.datahandling.filereader.DatReader.filename = filepath |
File object which is already opened.
Definition at line 408 of file filereader.py.
| str fosanalysis.datahandling.filereader.DatReader.itemsep = "," |
Stores the item separator, for dat files the "," is used.
Definition at line 410 of file filereader.py.
| list fosanalysis.datahandling.filereader.DatReader.measurement_files = [] |
List of files where the measurement data stores.
Definition at line 412 of file filereader.py.