Python API for the Open Acquisition System for IEPE Sensors (OASIS)
Project description
OASIS Board Python Package
Used in the following packages:
- oasis-gui
- oasis-tui
+-------------------+
| oasis-api |
| (Python library) |
+-------------------+
^
+-------------------+---------------------+
| | |
+----------------+ +----------------+ +----------------+
| oasis-cli | | oasis-tui | | oasis-gui |
| (flags & args) | | (guided menus) | | (desktop/web) |
+----------------+ +----------------+ +----------------+
HDF5 File Format for OASIS Measurements
Overview
Measurement data is stored in HDF5 files in a tidy data format, making it easy to analyze, visualize, and share.
Structure
- The main dataset is stored at the root as
/data. - The file contains attributes describing metadata and the measurement setup.
Data Table: /data
-
Shape:
(N, )whereN = number of channels × number of time points -
Each row represents a single observation:
- channel: Integer (1–8), channel number
- time: Float (seconds), timestamp of the sample
- signal: Float (volts), measured signal value
Example (first few rows):
| channel | time | signal |
|---|---|---|
| 1 | 0.00000 | 0.0324 |
| 1 | 0.00100 | 0.0451 |
| ... | ... | ... |
| 8 | 9.99900 | 0.0078 |
-
Units:
- The
signalcolumn is stored in volts.
- The
File Attributes (Metadata)
schema_version: HDF5 schema version used by the fileduration_s: Duration of acquisition (in seconds)sampling_frequency_hz: Sampling frequency (in Hz)voltage_ranges: Array of voltage ranges for each channel (in volts)channels: Number of channels (typically 8)board_count: Number of contributing boards in the filechannels_per_board: Channel counts per contributing boardformat description: Human-readable schema description- Merged files additionally store
source_files,source_labels, andmerge_align_mode
Why Tidy Data?
- Each variable forms a column: channel, time, signal
- Each observation forms a row: one reading from one channel at one time
- Each type of observational unit forms a table: all data is in
/data - This format makes the data easy to filter, aggregate, and visualize in Python (Pandas), R, MATLAB, etc.
How to Read the File (Python Example)
import h5py
import numpy as np
with h5py.File("measurement.h5", "r") as f:
data = f["data"][:]
print("Fields:", data.dtype.names) # ('channel', 'time', 'signal')
print("First row:", data[0])
print("Sampling frequency:", f.attrs["sampling_frequency_hz"])
print("Voltage ranges:", f.attrs["voltage_ranges"])
Viewing
- Use HDFView or Vitables to inspect your data and metadata visually.
Compatibility
oasis-apiv4.0.0-b1targets OASIS firmware v4 boards.- Stored serial acquisitions require USB CDC+MSC firmware support (
>= 4.0.0.a2). - The current serial acquisition path does not support legacy v3 CDC payload transfer boards.
load_h5()expects the current tidy schema with thesignalfield; legacy v3 HDF5 files written withvoltageare not supported by this release.
Device Information
Device information is written with one direct API call; the firmware no longer
opens an interactive serial menu for OASIS.SetDeviceInfo().
board.set_device_info(
architecture_id=2, # 0=Original OASIS, 1=OASIS-UROS, 2=OASIS-ERIS
hw_major=1,
hw_minor=0,
adc_bits=18,
teds=0,
wss=0,
device_name="OASIS-01",
)
Distributed Acquisition Helpers
OasisBoard now includes helpers for multi-board distributed workflows:
-
This release line is intended for firmware v4 boards.
-
Stored acquisitions in
mode="serial"require firmware>= 4.0.0.a2on OASIS USB CDC+MSC devices. -
Measurement payload is copied from USB MSC volumes, not transferred over CDC.
-
Live streaming remains CDC-based.
-
acquire(...)- Standard acquisition call; on firmware >=
4.0.0.a2this also performs one-wire distributed primary-board signaling automatically.
- Standard acquisition call; on firmware >=
-
collect_distributed_serial_files(...)- Copies
.OASISraw/.OASISmetafrom multiple board-specific USB MSC volumes and writes local files.
- Copies
-
stack_distributed_measurements(...)- Loads multiple distributed files and stacks them into a single array.
-
collect_and_stack_distributed(...)- One-shot helper for USB MSC collection by board serial port + optional manual file sources + stacking.
-
merge_h5_files(...)- Merges multiple OASIS
.h5files into one consistent dataset with global channel numbering. - Stores merge metadata (
board_count,channels_per_board,source_files,source_labels).
- Merges multiple OASIS
Example:
from oasis_api import OasisBoard
primary = OasisBoard(mode="serial", port="/dev/cu.usbmodem11101", baudrate=1000000)
resolved = "dist_run"
primary.acquire(t_sample=0.25, f_sample=2000, custom_filename=resolved)
result = primary.collect_and_stack_distributed(
filename=resolved,
serial_ports=["/dev/cu.usbmodem11101", "/dev/cu.usbmodem11201"],
t_sample=0.25,
f_sample=2000,
output_dir="./distributed_pull",
)
stacked = result["stacked"] # (n_devices, 8, n_samples)
flattened = result["flattened"] # (n_devices*8, n_samples)
Merge Existing H5 Files
from oasis_api import OasisBoard
result = OasisBoard.merge_h5_files(
input_files=["board1.h5", "board2.h5"],
output_file="merged.h5",
align="truncate", # or "pad"
overwrite=True,
)
print(result)
Merged files can be loaded and plotted without prior knowledge of board count:
board = OasisBoard(mode="offline")
board.load_h5("merged.h5")
board.plot_data() # adapts to total channel count with board-aware labels (e.g. board_1:CH1)
Project details
Release history Release notifications | RSS feed
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 oasis_api-4.0.0.tar.gz.
File metadata
- Download URL: oasis_api-4.0.0.tar.gz
- Upload date:
- Size: 41.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.2.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
acfe830813b16e481ac7749a9e4df9c6a6ca8600dca7435112406265e291afe9
|
|
| MD5 |
450238f9a42dd2801b8f99e213a9046a
|
|
| BLAKE2b-256 |
18a589a96a46e403e7d9c6a0ffb348c9657c5e8ab5ab571ac5b11208c2da0e0f
|
File details
Details for the file oasis_api-4.0.0-py3-none-any.whl.
File metadata
- Download URL: oasis_api-4.0.0-py3-none-any.whl
- Upload date:
- Size: 21.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.2.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fe5072d776c2668d1901dbf35e3fefca18f1cec78f7d7e2f11aa40c29a9bb387
|
|
| MD5 |
ea51d9039e059d572d5375874696839d
|
|
| BLAKE2b-256 |
cfd1cca946c002346d75b992d9cb283106ba6246c07ba4608c3522822acf1275
|