fosanalysis
A framework to evaluate distributed fiber optic sensor data
Loading...
Searching...
No Matches
fosanalysis.datahandling.tsvutils Namespace Reference

Utility functions for Luna ODiSI 6100 TSV files. More...

Functions

None tsv_extract_time_intervals (str input_file, str output_file, list list_of_time_intervals)
 Extracts the parts of the measurement data into smaller .tsv files.
 
 tsv_print_metadata_table (str root_dir, str pattern="*", list keys=["Channel", "Sensor Name", "Sensor Serial Number", "Length (m)", "Date"], str table_style="Markdown")
 Read the metadata from all files matching the pattern in a given directory root_dir, extract selected metadata entries (keys) and display them in a nicely formatted table.
 

Detailed Description

Utility functions for Luna ODiSI 6100 TSV files.

Author
Bertram Richter
Date
2025

Function Documentation

◆ tsv_extract_time_intervals()

None fosanalysis.datahandling.tsvutils.tsv_extract_time_intervals ( str input_file,
str output_file,
list list_of_time_intervals )

Extracts the parts of the measurement data into smaller .tsv files.

The parts are given by time intervals. The file header is copied as is. A measurement line is copied to the output_file if its timestamp \(t\) falls within at least one of the given time intervals: \(t_{\mathrm{s}} \leq t \leq t_{\mathrm{e}}\). Overlapping intervals are supported.

Warning
The output_file is overwritten without asking for confirmation!
Parameters
input_fileString with the path of the input file (.tsv)
output_fileString with the path of the output file (.tsv)
list_of_time_intervalsList of time intervals. Each interval is given as tuple of its the limits (start time \(t_{\mathrm{s}}\), end time \(t_{\mathrm{e}}\)). Both limits can be either datetime.datetime or None. Setting one or both of the limits to None results in an (half) unlimited open interval. It is not necessary that the exact interval boundaries appear in the data.

Definition at line 17 of file tsvutils.py.

◆ tsv_print_metadata_table()

fosanalysis.datahandling.tsvutils.tsv_print_metadata_table ( str root_dir,
str pattern = "*",
list keys = ["Channel", "Sensor Name", "Sensor Serial Number", "Length (m)", "Date"],
str table_style = "Markdown" )

Read the metadata from all files matching the pattern in a given directory root_dir, extract selected metadata entries (keys) and display them in a nicely formatted table.

Use this function to quickly gain an overview over the content of a directory with measurement files exported to TSV format by Luna ODiSI. The file filtering is done with Python built-in module glob. The table formatting is done with brplotviz.

Parameters
root_dirDirectory to scan for TSV files matching the pattern.
patternFile name pattern to select TSV files, according to the specification of the Python glob module.
keysList of dictionary keys to extract. These are the description texts in the file header.
table_styleTable output style supported by brplotviz. Please consider the brplotviz documentation for available options.

Definition at line 54 of file tsvutils.py.