radiens_core.models.channels
Channel metadata, site position models, and channel-related enums.
Classes
AreaUnits
Bases: IntEnum
Area measurement units for electrode sites.
ChannelInfo
Bases: BaseModel
Complete channel information for a specific channel.
Identity and index fields are always present. Position fields (probe_x,
probe_y, etc.) are None for non-amplifier channels; use
has_position to guard access. site_position provides a structured
SitePosition view built from the inline fields when position data is
available.
Attributes:
| Name | Type | Description |
|---|---|---|
ntv_idx |
int
|
Native channel index. |
dset_idx |
int
|
Dataset channel index. |
sys_idx |
int
|
System channel index. |
signal_type |
SignalType
|
Signal type of this channel. |
name |
str
|
User-facing display name (from |
ntv_name |
str
|
Hardware-native channel name (from |
is_selected |
bool
|
Whether this channel is currently selected. |
probe_id |
str
|
Probe identifier for the sensor this channel belongs to. |
headstage_id |
str
|
Headstage identifier for this channel. |
sensor_id |
str
|
Sensor identifier for this channel. |
probe_x |
float | None
|
X-coordinate in probe coordinate system (µm). None for non-AMP. |
probe_y |
float | None
|
Y-coordinate in probe coordinate system (µm). None for non-AMP. |
probe_z |
float | None
|
Z-coordinate in probe coordinate system (µm). None for non-AMP. |
tissue_x |
float | None
|
X-coordinate in tissue coordinate system (µm). None for non-AMP. |
tissue_y |
float | None
|
Y-coordinate in tissue coordinate system (µm). None for non-AMP. |
tissue_z |
float | None
|
Z-coordinate in tissue coordinate system (µm). None for non-AMP. |
site_shape |
str
|
Geometric shape of the electrode site. Empty for non-AMP. |
site_area_um2 |
float | None
|
Surface area in square micrometers. None for non-AMP. |
site_lim_x_min |
float | None
|
Bounding box min X (µm). None for non-AMP. |
site_lim_x_max |
float | None
|
Bounding box max X (µm). None for non-AMP. |
site_lim_y_min |
float | None
|
Bounding box min Y (µm). None for non-AMP. |
site_lim_y_max |
float | None
|
Bounding box max Y (µm). None for non-AMP. |
site_lim_z_min |
float | None
|
Bounding box min Z (µm). None for non-AMP. |
site_lim_z_max |
float | None
|
Bounding box max Z (µm). None for non-AMP. |
scs_to_tcs_x |
float | None
|
X-offset for probe-to-tissue transform. None for non-AMP. |
scs_to_tcs_y |
float | None
|
Y-offset for probe-to-tissue transform. None for non-AMP. |
scs_to_tcs_z |
float | None
|
Z-offset for probe-to-tissue transform. None for non-AMP. |
Attributes
bounding_box_center
property
Bounding box center in probe coordinate system (µm), or None for non-AMP.
bounding_box_size
property
Site bounding box size (width, height, depth) in µm, or None for non-AMP.
site_position
property
Structured view of the inline position fields.
Returns a SitePosition built from this channel's inline fields, or
None for non-AMP channels.
Functions
get_area
Get electrode site area in the requested units, or None for non-AMP channels.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
unit
|
AreaUnits
|
Target area unit for conversion. |
required |
Returns:
| Type | Description |
|---|---|
float | None
|
Site area in the requested unit, or None if position data is unavailable. |
ChannelMetadata
Bases: BaseModel
Channel metadata for a dataset.
Contains channel configuration, probe geometry, signal types, and indices for all channels.
Attributes:
| Name | Type | Description |
|---|---|---|
dataset_uid |
str
|
Unique identifier for the dataset. |
fs |
float
|
Sampling frequency in Hertz. |
source_label |
str
|
Label for the data source. |
neighbor_max_radius_um |
float
|
Maximum radius for neighbor search in micrometers. |
signal_units |
dict[SignalType, SignalUnits]
|
Mapping of signal types to their units. |
has_discrete |
bool
|
Whether the dataset contains discrete signals. |
has_continuous_amp |
bool
|
Whether the dataset contains continuous amplifier signals. |
sig_map |
dict[SignalType, KeyIdxs]
|
Mapping of signal types to their indices. |
selected_sig_map |
dict[SignalType, KeyIdxs]
|
Mapping of signal types to their selected indices. |
num_channels |
dict[SignalType, int]
|
Total number of channels per signal type. |
selected_num_channels |
dict[SignalType, int]
|
Number of selected channels per signal type. |
site_positions |
list[SitePosition]
|
Site positions for amplifier channels (parallel to sig_map[AMP].ntv). |
chan_names |
dict[SignalType, list[str]]
|
Display names per channel, parallel to sig_map[st].ntv for each signal type. |
ntv_chan_names |
dict[SignalType, list[str]]
|
Hardware-native names per channel, parallel to sig_map[st].ntv. |
probe_ids |
dict[SignalType, list[str]]
|
Probe IDs per channel, parallel to sig_map[st].ntv. |
headstage_ids |
dict[SignalType, list[str]]
|
Headstage IDs per channel, parallel to sig_map[st].ntv. |
sensor_ids |
dict[SignalType, list[str]]
|
Sensor IDs per channel, parallel to sig_map[st].ntv. |
Attributes
total_selected_channels
property
Total number of selected channels across all signal types.
Functions
get_channel_info
Get complete channel information from native index.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ntv_idx
|
int
|
Native channel index. |
required |
sig_type
|
SignalType
|
Signal type to look up. |
required |
Returns:
| Type | Description |
|---|---|
ChannelInfo
|
Complete channel information including indices, names, hardware IDs, |
ChannelInfo
|
and site position (AMP channels only). |
Raises:
| Type | Description |
|---|---|
DatasetError
|
If ntv_idx not found for the signal type. |
ntv_from_dset
Convert dataset index to native index.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dset_idx
|
int
|
Dataset index. |
required |
sig_type
|
SignalType
|
Signal type. |
required |
Returns:
| Type | Description |
|---|---|
int
|
Native index for the channel. |
Raises:
| Type | Description |
|---|---|
DatasetError
|
If dset_idx not found for the signal type. |
ntv_from_sys
Convert system index to native index.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sys_idx
|
int
|
System index. |
required |
sig_type
|
SignalType
|
Signal type. |
required |
Returns:
| Type | Description |
|---|---|
int
|
Native index for the channel. |
Raises:
| Type | Description |
|---|---|
DatasetError
|
If sys_idx not found for the signal type. |
KeyIdxs
Bases: BaseModel
Channel indices in all three key index spaces.
Attributes:
| Name | Type | Description |
|---|---|---|
ntv |
list[int]
|
Native channel indices. |
dset |
list[int]
|
Dataset channel indices. |
sys |
list[int]
|
System channel indices. |
SignalUnits
Bases: IntEnum
Signal measurement units.
SitePosition
Bases: BaseModel
Electrode site position and geometry in probe and tissue coordinates.
Attributes:
| Name | Type | Description |
|---|---|---|
probe_x |
float
|
X-coordinate in probe coordinate system. |
probe_y |
float
|
Y-coordinate in probe coordinate system. |
probe_z |
float
|
Z-coordinate in probe coordinate system. |
tissue_x |
float
|
X-coordinate in tissue coordinate system. |
tissue_y |
float
|
Y-coordinate in tissue coordinate system. |
tissue_z |
float
|
Z-coordinate in tissue coordinate system. |
site_shape |
str
|
Geometric shape of the electrode site. |
site_area_um2 |
float
|
Surface area of the electrode site in square micrometers. |
site_lim_x_min |
float
|
Minimum X-limit of the site bounding box. |
site_lim_x_max |
float
|
Maximum X-limit of the site bounding box. |
site_lim_y_min |
float
|
Minimum Y-limit of the site bounding box. |
site_lim_y_max |
float
|
Maximum Y-limit of the site bounding box. |
site_lim_z_min |
float
|
Minimum Z-limit of the site bounding box. |
site_lim_z_max |
float
|
Maximum Z-limit of the site bounding box. |
scs_to_tcs_x |
float
|
X-offset for probe to tissue coordinate transformation. |
scs_to_tcs_y |
float
|
Y-offset for probe to tissue coordinate transformation. |
scs_to_tcs_z |
float
|
Z-offset for probe to tissue coordinate transformation. |
Attributes
bounding_box_center
property
Site bounding box center coordinates in probe coordinate system.
bounding_box_size
property
Site bounding box size (width, height, depth) in micrometers.
Functions
get_area
Get site area in the specified units.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
unit
|
AreaUnits
|
Target area unit for conversion |
required |
Returns:
| Type | Description |
|---|---|
float
|
Site area converted to the specified unit |