Skip to main content

Python reader for exported ODiSI data

Description

This python package defines a reader and helper methods to handle data exported from the Luna ODiSI 6000 optical measuring system. It allows for an easier retrieval of data corresponding to each segment, as well as the possibility to interpolate the results based on additional measurements, such as experimental load. Doing this manually requires some amount of python code, which can be avoided by using this package.

Installation

Install as usual:

pip install python-odisi

Usage

Retrieve data from a *.tsv file

The library can be used to read files in the following manner:

from odisi import read_tsv

d = read_tsv("data_gages.tsv")

# List all gages
gages = d.gages
# List all segments
segments = d.segments
# Get the data for a specific gage, e.g. with the label 'A'
d_gage = d.get_gage("A")
# Get the data for a specific segment, e.g. with the label 'Seg-1'
d_seg, x_seg = d.get_segment("Seg-1")

Interpolation of data

The package allows to easily interpolate an external signal (e.g. the load during the test). For this, two strategies can be followed:

1. Interpolate the data from the sensors using the timestamps from the external signal

import polars as pl

load = pl.read_csv("load_data.csv")
# Assume that the timestamp is in the column 'time'
d.interpolate(load.select(pl.col("time")))

Then you should be able to plot your data against the measured load:

import matplotlib.pyplot as plt

d_gage = d.get_gage("A")
# Assume that the load data is in column 'load'
a_load = load.select(pl.col("load")).to_series()

plt.plot(d_gage, a_load)

2. Interpolate the data from the external signal to match the timestamp from the sensor data

import polars as pl

load = pl.read_csv("load_data.csv")
# Assume that the timestamp is in the column 'time'
new_load = d.interpolate_signal(data=load, time="time")

Then you should be able to plot your data against the measured load:

import matplotlib.pyplot as plt

d_gage = d.get_gage("A")
# Assume that the load data is in column 'load'
a_load = new_load.select(pl.col("load")).to_series()

plt.plot(d_gage, a_load)

In both cases it is assumed that the timestamps from both files are synchronized, i.e. that both measuring computers have synchronized clocks.

Clip data during interpolation

It is probable that the measurements from both data sources (ODiSI and additional system) were started at different times. This produces some annoyances during the processing of the data due to the mismatch in datapoints. To remedy this, the option clip=True can be passed to both interpolation methods (interpolate(...) and interpolate_signal(...)), which will clip the data to the common time interval between both signals.

import polars as pl

load = pl.read_csv("load_data.csv")
# Assume that the timestamp is in the column 'time'
d.interpolate(load.select(pl.col("time")), clip=True)

Export segment data

The data of all segments can be exported to individual csv-files with the following code:

d.export_segments_csv(prefix="my_experiment", path="data_folder")

Tests

The package includes a test suite which should be run with pytest:

poetry run pytest

Citation

@software{Tapia_2023,
    author = {Tapia Camú, Cristóbal},
    title = {{python-odisi: Import data generated by the Luna ODiSI System}},
    url = {https://github.com/cristobaltapia/python-odisi},
    version = {v0.3},
    year = {2023},
}

Release files for python-odisi 0.7.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for python-odisi 0.7.1
File Size Uploaded
python_odisi-0.7.1.tar.gz 19.3 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for python-odisi 0.7.1
File Interpreter ABI Platform
python_odisi-0.7.1-py3-none-any.whl Python 3 none any Details

Total release size: 19.3 MB

Release files / python_odisi-0.7.1.tar.gz

Download URL python_odisi-0.7.1.tar.gz
Size 19.3 MB
Tags Source
SHA-256 checksum
How to use checksums
e078e61b6ec17f37f50125bb31b69cd23460cb46a724b243929fd09a0aa7a580
BLAKE2b-256 checksum
How to use checksums
32de01d7cd02208d637f0316449bf13b69c9380e406632ee9eead10648d8ffe4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.5.9

Release files / python_odisi-0.7.1-py3-none-any.whl

Download URL python_odisi-0.7.1-py3-none-any.whl
Size 11.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1d7dfed2f955bb8cf36d0998b6c69ba2687a576cbb6f48bbea91d4c63d384d03
BLAKE2b-256 checksum
How to use checksums
99bd1cc74f83e1d14622c7ef0c77a5e3657513ad987809f85992cf37e6290ab5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.5.9

Release history Release notifications | RSS feed

This release

0.7.1 This release

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page