RecordingMetadata#
- class neurodent.core.RecordingMetadata(metadata_path: str | Path | None, *, n_channels: int | None = None, f_s: float | None = None, dt_end: datetime | None = None, channel_names: list[str] | None = None, V_units: str | None = None, mult_to_uV: float | None = None)[source]#
Bases:
objectStores metadata information for neural recordings.
This class handles recording metadata including channel information, sampling rates, timestamps, and voltage units. It can be initialized either from a CSV metadata file (for backward compatibility with DDF binary format) or directly from parameters.
- Variables:
metadata_path (
str | Path | None) – Path to metadata CSV file if loaded from filemetadata_df (
pd.DataFrame | None) – DataFrame containing metadata if loaded from filen_channels (
int) – Number of channels in the recordingf_s (
float) – Sampling frequency in HzV_units (
str | None) – Voltage units (e.g., ‘µV’, ‘mV’, ‘V’)mult_to_uV (
float | None) – Multiplication factor to convert to microvoltsprecision (
str | None) – Data precision/dtype (e.g., ‘float32’, ‘int16’)dt_end (
datetime | None) – End datetime of recordingchannel_names (
list[str]) – List of channel names
Examples
From parameters: >>> meta = RecordingMetadata( … None, … n_channels=4, … f_s=1000.0, … dt_end=datetime(2023, 1, 1), … channel_names=[‘ch1’, ‘ch2’, ‘ch3’, ‘ch4’] … )
From CSV file: >>> meta = RecordingMetadata(‘/path/to/metadata.csv’)
- __init__(metadata_path: str | Path | None, *, n_channels: int | None = None, f_s: float | None = None, dt_end: datetime | None = None, channel_names: list[str] | None = None, V_units: str | None = None, mult_to_uV: float | None = None) None[source]#
Initialize RecordingMetadata either from a file path or direct parameters.
- Parameters:
metadata_path (
str | Path | None) – Path to metadata CSV file. If provided, other parameters are ignored and metadata is loaded from the file.n_channels (
int, optional) – Number of channels in the recordingf_s (
float, optional) – Sampling frequency in Hzdt_end (
datetime, optional) – End datetime of recordingchannel_names (
list[str], optional) – List of channel namesV_units (
str, optional) – Voltage units (e.g., ‘µV’, ‘mV’, ‘V’)mult_to_uV (
float, optional) – Multiplication factor to convert to microvolts
- Raises:
ValueError – If metadata_path is None and required parameters are missing
- classmethod from_dict(data: dict) RecordingMetadata[source]#
Create RecordingMetadata from a dictionary (from JSON deserialization).
- classmethod from_json(file_path: Path) RecordingMetadata[source]#
Load RecordingMetadata from a JSON file.