Skip to content

radiens_core.models.channels

Channel metadata, site position models, and channel-related enums.

CLASS DESCRIPTION
AreaUnits

Area measurement units for electrode sites.

ChannelInfo

Complete channel information for a specific channel.

ChannelMetadata

Channel metadata for a dataset.

KeyIdxs

Channel indices in all three key index spaces.

SignalUnits

Signal measurement units.

SitePosition

Electrode site position and geometry in probe and tissue coordinates.

ATTRIBUTE DESCRIPTION
COLOR_GROUP_UNSET

color_group_idx value for a channel belonging to no color group.

TYPE: Final[int]

SITE_NUM_UNSET

site_num value for a channel with no probe connected.

TYPE: Final[int]

Attributes

COLOR_GROUP_UNSET module-attribute

COLOR_GROUP_UNSET: Final[int] = 2147483647

color_group_idx value for a channel belonging to no color group.

SITE_NUM_UNSET module-attribute

SITE_NUM_UNSET: Final[int] = -23

site_num value for a channel with no probe connected.

Classes

AreaUnits

Bases: IntEnum

Area measurement units for electrode sites.

ATTRIBUTE DESCRIPTION
SQUARE_MICROMETERS

µm², the base unit.

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.

ATTRIBUTE DESCRIPTION
ntv_idx

Native channel index, counted within the signal type. See KeyIdxs for how the three index spaces differ.

TYPE: int

dset_idx

Position in the backing dataset, counted within the signal type.

TYPE: int

sys_idx

System channel index, counted across all signal types.

TYPE: int

signal_type

Signal type of this channel.

TYPE: SignalType

name

User-facing display name.

TYPE: str

ntv_name

Hardware-native channel name.

TYPE: str

is_selected

Whether this channel is currently selected.

TYPE: bool

probe_id

Probe identifier for the sensor this channel belongs to.

TYPE: str

headstage_id

Headstage identifier for this channel.

TYPE: str

sensor_id

Sensor identifier for this channel.

TYPE: str

probe_x

X-coordinate in probe coordinate system (µm). None for non-AMP.

TYPE: float | None

probe_y

Y-coordinate in probe coordinate system (µm). None for non-AMP.

TYPE: float | None

probe_z

Z-coordinate in probe coordinate system (µm). None for non-AMP.

TYPE: float | None

tissue_x

X-coordinate in tissue coordinate system (µm). None for non-AMP.

TYPE: float | None

tissue_y

Y-coordinate in tissue coordinate system (µm). None for non-AMP.

TYPE: float | None

tissue_z

Z-coordinate in tissue coordinate system (µm). None for non-AMP.

TYPE: float | None

site_num

Probe site number label, unique within one probe on one port. SITE_NUM_UNSET when no probe is connected.

TYPE: int

port

Hardware port of the channel's probe. None for non-AMP channels and channels with no probe connected.

TYPE: Port | None

probe_idx

Position of the channel's probe among the probes on port, in plug-in order. Allego displays it one-based (A-2/12 is probe 1, site 12), and omits it when the port has one probe (B/12). None whenever port is.

TYPE: int | None

color_group_idx

Allego color group assignment index. COLOR_GROUP_UNSET when the channel belongs to no group.

TYPE: int

site_shape

Geometric shape of the electrode site. Empty for non-AMP.

TYPE: str

site_area_um2

Surface area in square micrometers. None for non-AMP.

TYPE: float | None

site_lim_x_min

Bounding box min X (µm). None for non-AMP.

TYPE: float | None

site_lim_x_max

Bounding box max X (µm). None for non-AMP.

TYPE: float | None

site_lim_y_min

Bounding box min Y (µm). None for non-AMP.

TYPE: float | None

site_lim_y_max

Bounding box max Y (µm). None for non-AMP.

TYPE: float | None

site_lim_z_min

Bounding box min Z (µm). None for non-AMP.

TYPE: float | None

site_lim_z_max

Bounding box max Z (µm). None for non-AMP.

TYPE: float | None

scs_to_tcs_x

X-offset for probe-to-tissue transform. None for non-AMP.

TYPE: float | None

scs_to_tcs_y

Y-offset for probe-to-tissue transform. None for non-AMP.

TYPE: float | None

scs_to_tcs_z

Z-offset for probe-to-tissue transform. None for non-AMP.

TYPE: float | None

METHOD DESCRIPTION
get_area

Get electrode site area in the requested units, or None for non-AMP channels.

Attributes

bounding_box_center property
bounding_box_center: tuple[float, float, float] | None

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

bounding_box_size property
bounding_box_size: tuple[float, float, float] | None

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

has_position property
has_position: bool

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

site_position property
site_position: SitePosition | None

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: AreaUnits) -> float | None

Get electrode site area in the requested units, or None for non-AMP channels.

PARAMETER DESCRIPTION
unit

Target area unit for conversion.

TYPE: AreaUnits

RETURNS 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.

ATTRIBUTE DESCRIPTION
dataset_uid

Identifier stored in the recording's own metadata; not the same as DatasetMetadata.id.

TYPE: str

fs

Sampling frequency in Hertz.

TYPE: float

source_label

Label for the data source.

TYPE: str

neighbor_max_radius_um

Maximum radius for neighbor search in micrometers.

TYPE: float

signal_units

Mapping of signal types to their units.

TYPE: dict[SignalType, SignalUnits]

has_discrete

Whether the dataset contains discrete signals.

TYPE: bool

has_continuous_amp

Whether the dataset contains continuous amplifier signals.

TYPE: bool

sig_map

Mapping of signal types to their indices.

TYPE: dict[SignalType, KeyIdxs]

selected_sig_map

Mapping of signal types to their selected indices.

TYPE: dict[SignalType, KeyIdxs]

num_channels

Total number of channels per signal type.

TYPE: dict[SignalType, int]

selected_num_channels

Number of selected channels per signal type.

TYPE: dict[SignalType, int]

site_positions

Site positions for amplifier channels (parallel to sig_map[AMP].ntv).

TYPE: list[SitePosition]

chan_names

Display names per channel, parallel to sig_map[st].ntv for each signal type.

TYPE: dict[SignalType, list[str]]

ntv_chan_names

Hardware-native names per channel, parallel to sig_map[st].ntv.

TYPE: dict[SignalType, list[str]]

probe_ids

Probe IDs per channel, parallel to sig_map[st].ntv.

TYPE: dict[SignalType, list[str]]

headstage_ids

Headstage IDs per channel, parallel to sig_map[st].ntv.

TYPE: dict[SignalType, list[str]]

sensor_ids

Sensor IDs per channel, parallel to sig_map[st].ntv.

TYPE: dict[SignalType, list[str]]

site_nums

Probe site number labels per channel, parallel to sig_map[st].ntv.

TYPE: dict[SignalType, list[int]]

ports

Probe port per channel, parallel to sig_map[st].ntv. See ChannelInfo.port.

TYPE: dict[SignalType, list[Port | None]]

probe_idxs

Probe position on its port per channel, parallel to sig_map[st].ntv. See ChannelInfo.probe_idx.

TYPE: dict[SignalType, list[int | None]]

color_group_idxs

Allego color group indices per channel, parallel to sig_map[st].ntv. COLOR_GROUP_UNSET marks a channel belonging to no group.

TYPE: dict[SignalType, list[int]]

METHOD DESCRIPTION
all_amp_indices

Get all amplifier channel native indices.

get_channel_info

Get complete channel information from native index.

get_num_channels

Get total number of channels for a signal type.

index

Get channel indices for a signal type.

ntv_from_dset

Convert dataset index to native index.

ntv_from_sys

Convert system index to native index.

ntv_indices_for_sites

Return the AMP native index of each site on one probe.

selected_index

Get selected channel indices for a signal type.

sys_indices_for_color_groups

Return sys_idx for all channels whose color_group_idx is in the given list.

sys_indices_for_site_nums

Return sys_idx for each channel whose site_num is in the given list.

Attributes

amp_site_count property
amp_site_count: int

Number of amplifier channel sites.

total_selected_channels property
total_selected_channels: int

Total number of selected channels across all signal types.

Functions

all_amp_indices
all_amp_indices() -> NDArray[int64]

Get all amplifier channel native indices.

get_channel_info
get_channel_info(ntv_idx: int, sig_type: SignalType) -> ChannelInfo

Get complete channel information from native index.

PARAMETER DESCRIPTION
ntv_idx

Native channel index.

TYPE: int

sig_type

Signal type to look up.

TYPE: SignalType

RETURNS DESCRIPTION
ChannelInfo

Complete channel information including indices, names, hardware IDs, and site position (AMP channels only).

RAISES DESCRIPTION
DatasetError

If ntv_idx not found for the signal type.

get_num_channels
get_num_channels(sig_type: SignalType) -> int

Get total number of channels for a signal type.

index
index(sig_type: SignalType) -> KeyIdxs

Get channel indices for a signal type.

ntv_from_dset
ntv_from_dset(dset_idx: int, sig_type: SignalType) -> int

Convert dataset index to native index.

PARAMETER DESCRIPTION
dset_idx

Dataset index.

TYPE: int

sig_type

Signal type.

TYPE: SignalType

RETURNS DESCRIPTION
int

Native index for the channel.

RAISES DESCRIPTION
DatasetError

If dset_idx not found for the signal type.

ntv_from_sys
ntv_from_sys(sys_idx: int, sig_type: SignalType) -> int

Convert system index to native index.

PARAMETER DESCRIPTION
sys_idx

System index.

TYPE: int

sig_type

Signal type.

TYPE: SignalType

RETURNS DESCRIPTION
int

Native index for the channel.

RAISES DESCRIPTION
DatasetError

If sys_idx not found for the signal type.

ntv_indices_for_sites
ntv_indices_for_sites(
    site_nums: list[int], *, port: Port, probe_idx: int = 0
) -> list[int]

Return the AMP native index of each site on one probe.

A site number is unique only within one probe on one port, so the probe is part of the lookup. Pass a result to SignalSpec.amp(), or to get_channel_info() for the sys_idx that stimulation takes.

PARAMETER DESCRIPTION
site_nums

Probe site number labels to look up.

TYPE: list[int]

port

Port the probe is on.

TYPE: Port

probe_idx

Probe position on port; see ChannelInfo.probe_idx.

TYPE: int DEFAULT: 0

RETURNS DESCRIPTION
list[int]

Native indices in the same order as site_nums.

RAISES DESCRIPTION
DatasetError

If a site number is not on that probe.

selected_index
selected_index(sig_type: SignalType) -> KeyIdxs

Get selected channel indices for a signal type.

sys_indices_for_color_groups
sys_indices_for_color_groups(
    sig_type: SignalType, color_group_idxs: list[int]
) -> list[int]

Return sys_idx for all channels whose color_group_idx is in the given list.

PARAMETER DESCRIPTION
sig_type

Signal type to search.

TYPE: SignalType

color_group_idxs

Color group indices to include.

TYPE: list[int]

RETURNS DESCRIPTION
list[int]

sys_idx values for all matching channels, in channel order.

sys_indices_for_site_nums
sys_indices_for_site_nums(sig_type: SignalType, site_nums: list[int]) -> list[int]

Return sys_idx for each channel whose site_num is in the given list.

Deprecated

Use ntv_indices_for_sites(), which takes the port and probe that make a site number unique.

PARAMETER DESCRIPTION
sig_type

Signal type to search.

TYPE: SignalType

site_nums

Probe site number labels to look up.

TYPE: list[int]

RETURNS DESCRIPTION
list[int]

sys_idx values in the same order as site_nums.

RAISES DESCRIPTION
DatasetError

If a site_num has no matching channel, or matches channels on more than one probe.

KeyIdxs

Bases: BaseModel

Channel indices in all three key index spaces.

ATTRIBUTE DESCRIPTION
ntv

Native channel index — where the channel sits in the acquisition hardware, counted within its signal type. Stable for the life of the recording, and the index space every SignalSpec selection is written in.

TYPE: list[int]

dset

Position of the channel in this dataset, counted within its signal type. Renumbered from zero when a dataset is sliced, so it does not identify a channel across a slice.

TYPE: list[int]

sys

System channel index — the channel's position across all signal types at once, so amplifier, analog, and digital channels share one numbering. This is the space VidereClient.slice_channels takes.

TYPE: list[int]

SignalUnits

Bases: IntEnum

Signal measurement units.

SitePosition

Bases: BaseModel

Electrode site position and geometry in probe and tissue coordinates.

ATTRIBUTE DESCRIPTION
probe_x

X-coordinate in probe coordinate system (µm).

TYPE: float

probe_y

Y-coordinate in probe coordinate system (µm).

TYPE: float

probe_z

Z-coordinate in probe coordinate system (µm).

TYPE: float

tissue_x

X-coordinate in tissue coordinate system (µm).

TYPE: float

tissue_y

Y-coordinate in tissue coordinate system (µm).

TYPE: float

tissue_z

Z-coordinate in tissue coordinate system (µm).

TYPE: float

site_shape

Geometric shape of the electrode site.

TYPE: str

site_area_um2

Surface area of the electrode site in square micrometers.

TYPE: float

site_lim_x_min

Minimum X-limit of the site bounding box (µm).

TYPE: float

site_lim_x_max

Maximum X-limit of the site bounding box (µm).

TYPE: float

site_lim_y_min

Minimum Y-limit of the site bounding box (µm).

TYPE: float

site_lim_y_max

Maximum Y-limit of the site bounding box (µm).

TYPE: float

site_lim_z_min

Minimum Z-limit of the site bounding box (µm).

TYPE: float

site_lim_z_max

Maximum Z-limit of the site bounding box (µm).

TYPE: float

scs_to_tcs_x

X-offset for probe to tissue coordinate transformation (µm).

TYPE: float

scs_to_tcs_y

Y-offset for probe to tissue coordinate transformation (µm).

TYPE: float

scs_to_tcs_z

Z-offset for probe to tissue coordinate transformation (µm).

TYPE: float

METHOD DESCRIPTION
get_area

Get site area in the specified units.

Attributes

bounding_box_center property
bounding_box_center: tuple[float, float, float]

Site bounding box center coordinates in probe coordinate system.

bounding_box_size property
bounding_box_size: tuple[float, float, float]

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

Functions

get_area
get_area(unit: AreaUnits) -> float

Get site area in the specified units.

PARAMETER DESCRIPTION
unit

Target area unit for conversion

TYPE: AreaUnits

RETURNS DESCRIPTION
float

Site area converted to the specified unit