This release is a pre-release and may not be stable for production use.
ICOschema
Backend-agnostic data model for sensor/hardware recordings and their derived computations.
Install
uv venv --allow-existing
uv sync --all-extras
Usage
Note: In the example below we assume you installed Matplotlib:
uv pip install matplotlib
Other codebases should only import Recording/DatasetBundle from the top-level package:
from ICOschema import Recording, DatasetBundle
import matplotlib.pyplot as plt
recording = Recording.from_hdf5("test/test_with_sensors.hdf5")
df = recording.to_dataframe()
plt.plot(recording.timestamps, recording.channel1)
plt.show()
recording.to_hdf5("some_file.hdf5")
bundle = DatasetBundle.from_hdf5("some_file.hdf5") # recording + any DerivedDataset computations
# Note: The code below does not work, since `derived` is not defined
# Adding the code for `derived` from the example below will not work,
# since then `my_wavelet_transform` is not defined.
bundle = bundle.with_computation("wavelet_coefficients/channel1/details", derived)
bundle.to_hdf5("some_file.hdf5")
Example use cases
Inspect a recording without loading a full DataFrame:
recording = Recording.from_hdf5("some_file.hdf5")
print(recording.signal_loss_percentage)
print(recording.summary()) # JSON-encodable dict: per-channel min/max/mean/std, sensor info
Add a derived computation and persist it alongside the recording:
from ICOschema.schema.generated.python.dataset import DerivedDataset
bundle = DatasetBundle.from_hdf5("some_file.hdf5")
coeffs = my_wavelet_transform(bundle.recording.channel1)
derived = DerivedDataset(
key="wavelet_coefficients/channel1/details",
values=coeffs.flatten().tolist(),
shape=list(coeffs.shape),
dtype=str(coeffs.dtype),
produced_by="wavelet_transform@1.0.0",
)
bundle = bundle.with_computation(derived.key, derived)
bundle.to_hdf5("processed_file.hdf5")
Replace a recording after cleanup, keeping existing computations:
bundle = DatasetBundle.from_hdf5("some_file.hdf5")
filled = fill_dropped_packets(bundle.recording) # some dataloss fill logic
bundle = bundle.with_recording(filled)
bundle.to_hdf5("some_file.hdf5")
Development
Regenerate the Python dataclasses after editing the schema:
uv run gen-python .\ICOschema\schema\linkml\dataset.yaml > .\ICOschema\schema\generated\python\dataset.py
Run the tests:
uv run pytest
Schema
classDiagram
class Recording {
+HardwareMetadata hardware_metadata
+RecordingMetadata recording_metadata
+RecordingData recording_data
}
class RecordingMetadata {
+string start_time
}
class RecordingData {
+int[] timestamp
+int[] counter
+float[] channel1
+float[] channel2
+float[] channel3
}
class HardwareMetadata {
+string revision
+string adc_reference_voltage
+ChannelMetadata channel1_metadata
+ChannelMetadata channel2_metadata
+ChannelMetadata channel3_metadata
}
class ChannelMetadata {
+Sensor sensor
+Compensation[] compensations
}
class Sensor {
+string sensor_id
+string sensor_type
+string name
+string unit
+string dimension
+float phys_min
+float phys_max
+float volt_min
+float volt_max
}
class Compensation {
<<abstract>>
+int order
}
class Conversion {
<<abstract>>
}
class NoConversion
class LinearConversion {
+float gain
+float offset
}
class PolynomialConversion {
+float[] coefficients
}
class FrequencyCompensation {
<<abstract>>
}
class DerivedDataset {
+string key
+float[] values
+int[] shape
+string dtype
+string unit
+string produced_by
+string produced_at
+string params
+string description
}
class DatasetBundle {
+Recording recording
+Map~string, DerivedDataset~ computations
}
Compensation <|-- Conversion
Compensation <|-- FrequencyCompensation
Conversion <|-- NoConversion
Conversion <|-- LinearConversion
Conversion <|-- PolynomialConversion
Recording *-- HardwareMetadata
Recording *-- RecordingMetadata
Recording *-- RecordingData
HardwareMetadata *-- "1" ChannelMetadata : channel1_metadata
HardwareMetadata o-- "0..1" ChannelMetadata : channel2_metadata
HardwareMetadata o-- "0..1" ChannelMetadata : channel3_metadata
ChannelMetadata *-- Sensor
ChannelMetadata *-- "1..*" Compensation : compensations
DatasetBundle *-- Recording
DatasetBundle o-- "0..*" DerivedDataset : computations
Open questions
- All channels in a
RecordingDatashare onetimestamp/counterarray set, i.e. one sample rate per recording. Mixing sensors with different data rates on different channels isn't representable yet — would likely need a per-channel rate/timestamp instead of one shared pair.
Development
In the text below we assume that you installed:
and that you want to release version <VERSION> of the package. Please just replace this version number with the version that you want to release (e.g. 0.1.0).
Release
-
Change the version number and commit your changes:
just release <VERSION>
Note: GitHub Actions will publish a package based on the tagged commit and upload it to PyPi.
-
Create a new release here
- Insert the version number
<VERSION>into the tag field - For the release title use “Version
<VERSION>” - Paste the release notes for the lastest release into the main text field
- Click on “Publish Release”
Note: Alternatively you can also use the
ghcommand:gh release create <VERSION>
to create the release notes.
- Insert the version number
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file icoschema-0.1.0b1.tar.gz.
File metadata
- Download URL: icoschema-0.1.0b1.tar.gz
- Upload date:
- Size: 194.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
673739b520b266f019b6ef0e256e1018bf77c79dbd0d785a9fc9edc0e2b2c0cb
|
|
| MD5 |
6972128bb4c694fb8df1ef746adab511
|
|
| BLAKE2b-256 |
495b8c93880772997529e68d3ecfeb02475905a79ebe26425506e9aae78a7b38
|
Provenance
The following attestation bundles were made for icoschema-0.1.0b1.tar.gz:
Publisher:
publish.yaml on ift-tuwien/ICOschema
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
icoschema-0.1.0b1.tar.gz -
Subject digest:
673739b520b266f019b6ef0e256e1018bf77c79dbd0d785a9fc9edc0e2b2c0cb - Sigstore transparency entry: 2663276783
- Sigstore integration time:
-
Permalink:
ift-tuwien/ICOschema@57f22087332b2b2a35e78aa9887e0767cd8f0ab7 -
Branch / Tag:
refs/tags/0.1.0b1 - Owner: https://github.com/ift-tuwien
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@57f22087332b2b2a35e78aa9887e0767cd8f0ab7 -
Trigger Event:
push
-
Statement type:
File details
Details for the file icoschema-0.1.0b1-py3-none-any.whl.
File metadata
- Download URL: icoschema-0.1.0b1-py3-none-any.whl
- Upload date:
- Size: 19.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0166f935394c86e0c45785985a9d879e4ae1564e52ce0cdea03debbc8fb77b69
|
|
| MD5 |
7a5252448e6151821bb6496e4183ad60
|
|
| BLAKE2b-256 |
2eee89c38657d76669c3149becf5610e23aea93af07bca8f242e981175c1e2de
|
Provenance
The following attestation bundles were made for icoschema-0.1.0b1-py3-none-any.whl:
Publisher:
publish.yaml on ift-tuwien/ICOschema
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
icoschema-0.1.0b1-py3-none-any.whl -
Subject digest:
0166f935394c86e0c45785985a9d879e4ae1564e52ce0cdea03debbc8fb77b69 - Sigstore transparency entry: 2663276799
- Sigstore integration time:
-
Permalink:
ift-tuwien/ICOschema@57f22087332b2b2a35e78aa9887e0767cd8f0ab7 -
Branch / Tag:
refs/tags/0.1.0b1 - Owner: https://github.com/ift-tuwien
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@57f22087332b2b2a35e78aa9887e0767cd8f0ab7 -
Trigger Event:
push
-
Statement type: