|
fosanalysis
A framework to evaluate distributed fiber optic sensor data
|
File reader class for the .tsv measurement files exported by the ODiSI 6100 series interrogators by Luna Inc LunaInnovations2020.
More...
Public Member Functions | |
| __init__ (self, str filepath, *args, **kwargs) | |
| Initializes a tsv file reader. | |
| read_dat_file (self, dat_file) | |
| Reads only single file and returns all measurement data separated by channels. | |
| tuple[list, dict] | read_meta_infos (self) |
| Method to get sensor data from file. | |
| Generator[datetime, np.array] | read_next_measurement (self, datetime start_time=None, datetime end_time=None, *args, **kwargs) |
| Returns only single entry of measurement 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(self.other_tsv) | |
| Create a file pointer to the TSV file. | |
| filename = filepath | |
| Filename given. | |
| str | itemsep = "\t" |
Stores the item separator, for tsv files it is "\t". | |
| str | other_tsv = self._locate_full_or_gage_file() |
| Checks if both files (_full and _gage) are available, if not it is an empty string. | |
Protected Member Functions | |
| str | _locate_full_or_gage_file (self) |
| Private method to look for both files (_full and _gage) in folder. | |
| tuple[list, list, OrderedDict, OrderedDict] | _read_base_data (self) |
| Get the base data for all measurements. | |
| tuple[list, list] | _read_base_from_file (self, OrderedDict segments, OrderedDict gages) |
| Read gage/segment, x-axis and tare line to discover related data. | |
| _read_gage_segments_info (self, list data, OrderedDict segments, OrderedDict gages) | |
| Read gage and segment line to discover the gages and segments. | |
| dict | _read_metadata (self) |
| Retrieves the meta data of the sensor file. | |
| _set_pos_for_segments_gages (self, list data, OrderedDict segments, OrderedDict gages) | |
| Private method to determine the index of x-positions for segments and gages based on x_axis of full file. | |
File reader class for the .tsv measurement files exported by the ODiSI 6100 series interrogators by Luna Inc LunaInnovations2020.
See [6]. Both - gage files (*_gages.tsv) and full (*_full.tsv) - are supported.
Definition at line 126 of file filereader.py.
| fosanalysis.datahandling.filereader.TsvReader.__init__ | ( | self, | |
| str | filepath, | ||
| * | args, | ||
| ** | kwargs ) |
Initializes a tsv file reader.
| filepath | Path to the .tsv file to read all sensor information. |
| *args | Additional positional arguments, will be passed to the superconstructor. |
| **kwargs | Additional keyword arguments, will be passed to the superconstructor. |
Definition at line 133 of file filereader.py.
|
protected |
Private method to look for both files (_full and _gage) in folder.
If filename is 'gages.tsv' file search for 'full.tsv' and vice versa.
Definition at line 366 of file filereader.py.
|
protected |
Get the base data for all measurements.
It reads the segments, gages, x-axis and tare of the file. Search for '_gages' and '_full' files. In case of '_gages' file separate gages and segments. In case of only existing '_full' file no gages will returned.
Definition at line 208 of file filereader.py.
|
protected |
Read gage/segment, x-axis and tare line to discover related data.
The segments are written into given segments dictionary. The gages are written into given gages dictionary. This information is used later on to split the data.
| segments | Dictionary with named segments is written. |
| gages | Dictionary, with named gages is written. |
Definition at line 278 of file filereader.py.
|
protected |
Read gage and segment line to discover the gages and segments.
The gages are written into given gages dictionary. The segments are written into given segments dictionary. This information is used later on to split the data.
| data | List of line elements, contain the gage and segment names. |
| segments | Dictionary with named segments is written. |
| gages | Dictionary, with named gages is written. |
Definition at line 311 of file filereader.py.
|
protected |
Retrieves the meta data of the sensor file.
Reads the header data like sensor name, length, gage_pitch, ...
Definition at line 187 of file filereader.py.
|
protected |
Private method to determine the index of x-positions for segments and gages based on x_axis of full file.
This method will only be called if both files available. This information is used later to split the data.
| data | List of line elements, contain the x-axis data. |
| segments | Dictionary with named segments. |
| gages | Dictionary, with named gages. |
Definition at line 338 of file filereader.py.
| fosanalysis.datahandling.filereader.TsvReader.read_dat_file | ( | self, | |
| dat_file ) |
Reads only single file and returns all measurement data separated by channels.
Reimplemented from fosanalysis.datahandling.filereader.FileReader.
Definition at line 275 of file filereader.py.
| tuple[list, dict] fosanalysis.datahandling.filereader.TsvReader.read_meta_infos | ( | self | ) |
Method to get sensor data from file.
For TSV only one sensor exists in the file.
Reimplemented from fosanalysis.datahandling.filereader.FileReader.
Definition at line 158 of file filereader.py.
| Generator[datetime, np.array] fosanalysis.datahandling.filereader.TsvReader.read_next_measurement | ( | self, | |
| datetime | start_time = None, | ||
| datetime | end_time = None, | ||
| * | args, | ||
| ** | kwargs ) |
Returns only single entry of measurement as generator to request for multiple times for parts or the whole file.
| start_time | Read measurements from given timestamp. |
| end_time | Read measurements till given timestamp. |
Reimplemented from fosanalysis.datahandling.filereader.FileReader.
Definition at line 250 of file filereader.py.
| fosanalysis.datahandling.filereader.TsvReader.file = open(self.other_tsv) |
Create a file pointer to the TSV file.
Definition at line 154 of file filereader.py.
| fosanalysis.datahandling.filereader.TsvReader.filename = filepath |
Filename given.
Definition at line 144 of file filereader.py.
| str fosanalysis.datahandling.filereader.TsvReader.itemsep = "\t" |
Stores the item separator, for tsv files it is "\t".
Definition at line 146 of file filereader.py.
| str fosanalysis.datahandling.filereader.TsvReader.other_tsv = self._locate_full_or_gage_file() |
Checks if both files (_full and _gage) are available, if not it is an empty string.
Definition at line 150 of file filereader.py.