Skip to content

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 chanName in the proto).

ntv_name str

Hardware-native channel name (from ntvChanName in the proto).

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

Bounding box center in probe coordinate system (µm), or None for non-AMP.

bounding_box_size property
bounding_box_size

Site bounding box size (width, height, depth) in µm, or None for non-AMP.

has_position property
has_position

True if site position data is available (AMP channels only).

site_position property
site_position

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_area(unit)

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

amp_site_count property
amp_site_count

Number of amplifier channel sites.

total_selected_channels property
total_selected_channels

Total number of selected channels across all signal types.

Functions

all_amp_indices
all_amp_indices()

Get all amplifier channel native indices.

get_channel_info
get_channel_info(ntv_idx, sig_type)

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.

get_num_channels
get_num_channels(sig_type)

Get total number of channels for a signal type.

index
index(sig_type)

Get channel indices for a signal type.

ntv_from_dset
ntv_from_dset(dset_idx, sig_type)

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
ntv_from_sys(sys_idx, sig_type)

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.

selected_index
selected_index(sig_type)

Get selected channel indices for a 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
bounding_box_center

Site bounding box center coordinates in probe coordinate system.

bounding_box_size property
bounding_box_size

Site bounding box size (width, height, depth) in micrometers.

Functions

get_area
get_area(unit)

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