lunapi.lwf¶
Reader for Luna’s .lwf (Luna Waveform) binary format.
Public functions¶
- lwf_summary(paths, *, recur=False) -> pd.DataFrame
Scan one or more .lwf files and return a per-file summary without loading any signal data.
- read_lwf(paths, *, recur=False) -> LWFResult
Load one or more .lwf files into a single result object containing a numpy array of signal data, a per-event metadata DataFrame, and a per-channel metadata DataFrame.
Classes¶
Return value of |
Functions¶
|
Summarise one or more .lwf files without loading signal data. |
|
Load one or more .lwf files into an |
Module Contents¶
- class lunapi.lwf.LWFResult[source]¶
Bases:
NamedTupleReturn value of
read_lwf().- data[source]¶
Signal data decoded to physical units (µV etc.). When the file was written with
annot-ch-match=T,n_channelsis 1 and the detecting channel for each event is inmeta['annot_ch'].- Type:
np.ndarray, shape (n_waves, n_channels, n_samples)
- meta[source]¶
Per-event metadata columns:
id,tag,file,annot,instance,annot_ch,meta,anchor_sec,annot_start_sec,annot_stop_sec,wave_start_sec,wave_stop_sec.- Type:
pd.DataFrame, shape (n_waves, …)
- lunapi.lwf.lwf_summary(paths: str | pathlib.Path | Iterable, *, recur: bool = False) pandas.DataFrame[source]¶
Summarise one or more .lwf files without loading signal data.
- Parameters:
paths – A .lwf file, a directory, or a list of either.
recur – Recurse into subdirectories when paths is a directory.
- Returns:
pd.DataFrame with one row per file and columns
file,id,tag,startdate,starttime,align,annots,n_waves,n_channels,channels,srs,n_features.
- lunapi.lwf.read_lwf(paths: str | pathlib.Path | Iterable, *, recur: bool = False) LWFResult[source]¶
Load one or more .lwf files into an
LWFResult.All files must share the same channel labels and sample rates. All waveform events must have the same number of samples.
- Parameters:
paths – A .lwf file, a directory, or a list of either.
recur – Recurse into subdirectories when paths is a directory.
- Returns:
Named tuple with fields
data,meta,channels,attrs.datahas shape(n_waves, n_channels, n_samples)with values in physical units. When written withannot-ch-match=T,n_channelsis 1 and each event’s channel is inmeta['annot_ch'].- Return type: