Skip to main content

Import and post-process data generated by the Luna ODiSI System

Project description

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.gage("A")
# Get the data for a specific segment, e.g. with the label 'Seg-1'
d_seg, x_seg = d.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.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.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},
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python_odisi-0.5.1.tar.gz (10.9 kB view details)

Uploaded Source

Built Distribution

python_odisi-0.5.1-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

Details for the file python_odisi-0.5.1.tar.gz.

File metadata

  • Download URL: python_odisi-0.5.1.tar.gz
  • Upload date:
  • Size: 10.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.12.4 Linux/6.10.4-200.fc40.x86_64

File hashes

Hashes for python_odisi-0.5.1.tar.gz
Algorithm Hash digest
SHA256 e3df570b80c456fbb3bbe68fda6b716d38df04fe0c44e6b5db56e378728aad1c
MD5 72a5b336ac84c278e82a9024cd6086c9
BLAKE2b-256 90fb76442a9a320bf8f6d2d30648031d852793837d83fe6f08e52b1eb747270e

See more details on using hashes here.

File details

Details for the file python_odisi-0.5.1-py3-none-any.whl.

File metadata

  • Download URL: python_odisi-0.5.1-py3-none-any.whl
  • Upload date:
  • Size: 11.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.12.4 Linux/6.10.4-200.fc40.x86_64

File hashes

Hashes for python_odisi-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 01151d26136b22dd550b2937051052913cdc4e1ab99619774f0a8ff1e347c457
MD5 2e6e3f18e42797bf413d065b0c54929a
BLAKE2b-256 5de85cd64467ad01c0a529755ffc03bb6e4c3fe627bbe4fdb1b02b7a3e1756f3

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page