cedalion.dataclasses.recording

Recording class definition for timeseries data.

Classes

Recording(timeseries, cdt.NDTimeSeries] =, ...)

Main container for analysis objects.

class cedalion.dataclasses.recording.Recording(
timeseries: ~collections.OrderedDict[str,
cdt.NDTimeSeries] = <factory>,
masks: ~collections.OrderedDict[str,
~xarray.core.dataarray.DataArray] = <factory>,
geo3d: cdt.LabeledPointCloud = <factory>,
geo2d: cdt.LabeledPointCloud = <factory>,
stim: ~pandas.core.frame.DataFrame = <factory>,
aux_ts: ~collections.OrderedDict[str,
cdt.NDTimeSeries] = <factory>,
aux_obj: ~collections.OrderedDict[str,
~typing.Any] = <factory>,
head_model: ~typing.Any | None = None,
meta_data: ~collections.OrderedDict[str,
~typing.Any] = <factory>,
_measurement_lists: ~collections.OrderedDict[str,
~pandas.core.frame.DataFrame] = <factory>,
)[source]

Bases: object

Main container for analysis objects.

The Recording class holds timeseries adjunct objects in ordered dictionaries. It maps to the NirsElement in the snirf format but it also holds additional attributes (masks, headmodel, aux_obj) for which there is no corresponding entity in the snirf format.

timeseries[source]

A dictionary of timeseries objects. The keys are the names of the timeseries.

Type:

OrderedDict[str, NDTimeSeries]

masks[source]

A dictionary of masks. The keys are the names of the masks.

Type:

OrderedDict[str, xr.DataArray]

geo3d[source]

A labeled point cloud representing the 3D geometry of the recording.

Type:

LabeledPointCloud

geo2d[source]

A labeled point cloud representing the 2D geometry of the recording.

Type:

LabeledPointCloud

stim[source]

A dataframe containing the stimulus information.

Type:

pd.DataFrame

aux_ts[source]

A dictionary of auxiliary timeseries objects.

Type:

OrderedDict[str, NDTimeSeries]

aux_obj[source]

A dictionary of auxiliary objects.

Type:

OrderedDict[str, Any]

head_model[source]

A head model object.

Type:

Optional[Any]

meta_data[source]

A dictionary of meta data.

Type:

OrderedDict[str, Any]

timeseries: OrderedDict[str, NDTimeSeries][source]
masks: OrderedDict[str, xr.DataArray][source]
geo3d: LabeledPointCloud[source]
geo2d: LabeledPointCloud[source]
stim: pd.DataFrame[source]
aux_ts: OrderedDict[str, NDTimeSeries][source]
aux_obj: OrderedDict[str, Any][source]
head_model: Any | None = None[source]
meta_data: OrderedDict[str, Any][source]
get_timeseries(key: str | None = None) cdt.NDTimeSeries[source]

Get a timeseries object by key.

Parameters:

key (Optional[str]) – The key of the timeseries to retrieve. If None, the last timeseries is returned.

Returns:

The requested timeseries object.

Return type:

NDTimeSeries

set_timeseries(key: str, value: cdt.NDTimeSeries, overwrite: bool = False)[source]
get_mask(key: str | None = None) DataArray[source]

Get a mask by key.

Parameters:

key (Optional[str]) – The key of the mask to retrieve. If None, the last mask is returned.

Returns:

The requested mask.

Return type:

xr.DataArray

set_mask(
key: str,
value: DataArray,
overwrite: bool = False,
)[source]

Set a mask.

Parameters:
  • key (str) – The key of the mask to set.

  • value (xr.DataArray) – The mask to set.

  • overwrite (bool) – Whether to overwrite an existing mask with the same key. Defaults to False.

get_timeseries_type(key)[source]

Get the type of a timeseries.

Parameters:

key (str) – The key of the timeseries.

Returns:

The type of the timeseries.

Return type:

str

property source_labels[source]

Get the unique source labels from the timeseries.

Returns:

A list of unique source labels.

Return type:

list

property detector_labels[source]

Get the unique detector labels from the timeseries.

Returns:

A list of unique detector labels.

Return type:

list

property wavelengths[source]

Get the unique wavelengths from the timeseries.

Returns:

A list of unique wavelengths.

Return type:

list

property trial_types[source]

Get the unique trial types from the stimulus dataframe.

Returns:

A list of unique trial types.

Return type:

list