python-odisi


Namepython-odisi JSON
Version 0.4.1 PyPI version JSON
download
home_pagehttps://github.com/cristobaltapia/python-odisi
SummaryImport and post-process data generated by the Luna ODiSI System
upload_time2024-04-08 17:51:07
maintainerNone
docs_urlNone
authorCristóbal Tapia Camú
requires_python<4.0,>=3.10
licenseMIT
keywords odisi reader import
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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:

```bash
pip install python-odisi
```

## Usage

### Retrieve data from a \*.tsv file

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

```python
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

```python
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:

```python
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

```python
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:

```python
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.

```python
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:

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

## Tests

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

```bash
poetry run pytest
```

## Citation

```bib
@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},
}
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/cristobaltapia/python-odisi",
    "name": "python-odisi",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.10",
    "maintainer_email": null,
    "keywords": "odisi, reader, import",
    "author": "Crist\u00f3bal Tapia Cam\u00fa",
    "author_email": "crtapia@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/eb/5e/dcb1960889d441da20b721305ab90507db2c1c8292e7908491a877ca4723/python_odisi-0.4.1.tar.gz",
    "platform": null,
    "description": "# Python reader for exported ODiSI data\n\n## Description\n\nThis python package defines a reader and helper methods to handle data exported from the Luna ODiSI 6000 optical measuring system.\nIt 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.\nDoing this manually requires some amount of python code, which can be avoided by using this package.\n\n## Installation\n\nInstall as usual:\n\n```bash\npip install python-odisi\n```\n\n## Usage\n\n### Retrieve data from a \\*.tsv file\n\nThe library can be used to read files in the following manner:\n\n```python\nfrom odisi import read_tsv\n\nd = read_tsv(\"data_gages.tsv\")\n\n# List all gages\ngages = d.gages\n# List all segments\nsegments = d.segments\n# Get the data for a specific gage, e.g. with the label 'A'\nd_gage = d.gage(\"A\")\n# Get the data for a specific segment, e.g. with the label 'Seg-1'\nd_seg, x_seg = d.segment(\"Seg-1\")\n```\n\n### Interpolation of data\n\nThe package allows to easily interpolate an external signal (e.g. the load during the test).\nFor this, two strategies can be followed:\n\n#### 1. Interpolate the data from the sensors using the timestamps from the external signal\n\n```python\nimport polars as pl\n\nload = pl.read_csv(\"load_data.csv\")\n# Assume that the timestamp is in the column 'time'\nd.interpolate(load.select(pl.col(\"time\")))\n```\n\nThen you should be able to plot your data against the measured load:\n\n```python\nimport matplotlib.pyplot as plt\n\nd_gage = d.gage(\"A\")\n# Assume that the load data is in column 'load'\na_load = load.select(pl.col(\"load\")).to_series()\n\nplt.plot(d_gage, a_load)\n```\n\n#### 2. Interpolate the data from the external signal to match the timestamp from the sensor data\n\n```python\nimport polars as pl\n\nload = pl.read_csv(\"load_data.csv\")\n# Assume that the timestamp is in the column 'time'\nnew_load = d.interpolate_signal(data=load, time=\"time\")\n```\n\nThen you should be able to plot your data against the measured load:\n\n```python\nimport matplotlib.pyplot as plt\n\nd_gage = d.gage(\"A\")\n# Assume that the load data is in column 'load'\na_load = new_load.select(pl.col(\"load\")).to_series()\n\nplt.plot(d_gage, a_load)\n```\n\nIn both cases it is assumed that the timestamps from both files are synchronized, i.e. that both measuring computers have synchronized clocks.\n\n### Clip data during interpolation\n\nIt is probable that the measurements from both data sources (ODiSI and additional system) were started at different times.\nThis produces some annoyances during the processing of the data due to the mismatch in datapoints.\nTo 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.\n\n```python\nimport polars as pl\n\nload = pl.read_csv(\"load_data.csv\")\n# Assume that the timestamp is in the column 'time'\nd.interpolate(load.select(pl.col(\"time\")), clip=True)\n```\n\n### Export segment data\n\nThe data of all segments can be exported to individual csv-files with the following code:\n\n```python\nd.export_segments_csv(prefix=\"my_experiment\", path=\"data_folder\")\n```\n\n## Tests\n\nThe package includes a test suite which should be run with pytest:\n\n```bash\npoetry run pytest\n```\n\n## Citation\n\n```bib\n@software{Tapia_2023,\n    author = {Tapia Cam\u00fa, Crist\u00f3bal},\n    title = {{python-odisi: Import data generated by the Luna ODiSI System}},\n    url = {https://github.com/cristobaltapia/python-odisi},\n    version = {v0.3},\n    year = {2023},\n}\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Import and post-process data generated by the Luna ODiSI System",
    "version": "0.4.1",
    "project_urls": {
        "Homepage": "https://github.com/cristobaltapia/python-odisi",
        "Repository": "https://github.com/cristobaltapia/python-odisi"
    },
    "split_keywords": [
        "odisi",
        " reader",
        " import"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d6223f7f96fe11f098266e6a618e897a812aca58cc4cf22e60e2812b0224333d",
                "md5": "b02b0c9f3eff5e7aafa1bd807398587a",
                "sha256": "81cd426278a25c5835491ea5d0cc824d167930b71ec495bd6b25d666017415ba"
            },
            "downloads": -1,
            "filename": "python_odisi-0.4.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b02b0c9f3eff5e7aafa1bd807398587a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.10",
            "size": 8607,
            "upload_time": "2024-04-08T17:51:06",
            "upload_time_iso_8601": "2024-04-08T17:51:06.773857Z",
            "url": "https://files.pythonhosted.org/packages/d6/22/3f7f96fe11f098266e6a618e897a812aca58cc4cf22e60e2812b0224333d/python_odisi-0.4.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "eb5edcb1960889d441da20b721305ab90507db2c1c8292e7908491a877ca4723",
                "md5": "7a72da3567887f9da75dcb019489a1cf",
                "sha256": "54a8348a00974e2595dfec49b62976667958980835aa56bad0af17ffbc04da4e"
            },
            "downloads": -1,
            "filename": "python_odisi-0.4.1.tar.gz",
            "has_sig": false,
            "md5_digest": "7a72da3567887f9da75dcb019489a1cf",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.10",
            "size": 8412,
            "upload_time": "2024-04-08T17:51:07",
            "upload_time_iso_8601": "2024-04-08T17:51:07.916341Z",
            "url": "https://files.pythonhosted.org/packages/eb/5e/dcb1960889d441da20b721305ab90507db2c1c8292e7908491a877ca4723/python_odisi-0.4.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-08 17:51:07",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "cristobaltapia",
    "github_project": "python-odisi",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "python-odisi"
}
        
Elapsed time: 0.21518s