Waveform I/O¶
Read saved waveform files back into arrays and normalized metadata
Read saved waveform files back into numpy arrays + normalized metadata.
The public entry point for users who want their raw data out of the library's five on-disk formats (NPZ, plain CSV, enhanced CSV, MAT, HDF5) for their own analysis. Reads files written before provenance existed (provenance is then None) and normalizes the three binary formats' differing metadata conventions (see scpi_control.waveform_schema) into one flat dict.
LoadedWaveform
dataclass
¶
LoadedWaveform(time: ndarray, voltage: ndarray, channel: Optional[Union[int, str]], sample_rate: Optional[float], metadata: Dict[str, Any] = dict(), provenance: Optional[AcquisitionProvenance] = None, source_format: str = 'NPZ', source_path: Optional[Path] = None)
One waveform read back from disk, format differences normalized away.
to_dataframe
¶
Return a pandas DataFrame (columns: time, voltage; metadata in .attrs).
Source code in scpi_control/waveform_io.py
load_waveform
¶
Load a waveform file saved by scpi_control (any version, any format).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Union[str, Path]
|
File to read. |
required |
format
|
Optional[str]
|
Force a format ("NPZ", "CSV", "MAT", "HDF5"); None auto-detects from the extension. |
None
|
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If path does not exist. |
ValueError
|
If the format is unknown or the file cannot be parsed. |
ImportError
|
If the format needs an uninstalled optional dependency. |
Source code in scpi_control/waveform_io.py
See Also¶
- Waveform - Waveform acquisition and data handling
- Provenance - Acquisition provenance attached to saved waveforms