Skip to content

radiens_core.models.stim

Stimulation domain models and enums.

Attributes

FlexStimKeypressIndex module-attribute

FlexStimKeypressIndex = StimKeypressIndex | int

StimKeypressIndex that also accepts a plain int (1-8).

Use with @validate_call::

@validate_call(config=ConfigDict(arbitrary_types_allowed=True))
def set_stim_trigger(self, *, trigger: FlexStimKeypressIndex, on: bool) -> None:
    t = validated(trigger, StimKeypressIndex)
    ...

Classes

StimParams

Bases: BaseModel

Stimulation parameters for a single channel.

All timing values are in microseconds (μs). Current amplitudes are in μA for amplifier channels and V for DAC channels.

Attributes:

Name Type Description
stim_sys_chan_idx int

System channel index (ntvAbsKeyIdx).

stim_shape StimShape | StimShapeStr

Stimulation waveform shape. References StimShape. Also accepts string names (e.g. "biphasic"). Defaults to StimShape.BIPHASIC.

stim_polarity StimPolarity | StimPolarityStr

Stimulation polarity. References StimPolarity. Also accepts string names (e.g. "cathodic_first"). Defaults to StimPolarity.CATHODIC_FIRST.

first_phase_duration float

Duration of the first phase in μs. Defaults to 100.0.

second_phase_duration float

Duration of the second phase in μs. Defaults to 100.0.

interphase_delay float

Delay between phases in μs. Defaults to 0.0.

first_phase_amplitude float

Amplitude of the first phase (μA for amp, V for DAC). Defaults to 0.1.

second_phase_amplitude float

Amplitude of the second phase (μA for amp, V for DAC). Defaults to 0.0.

baseline_voltage float

Baseline voltage in V. Defaults to 0.0.

trigger_edge_or_level StimTriggerEdgeOrLevel | StimTriggerEdgeOrLevelStr

Trigger mode. References StimTriggerEdgeOrLevel. Also accepts string names. Defaults to StimTriggerEdgeOrLevel.EDGE.

trigger_high_or_low StimTriggerHighOrLow | StimTriggerHighOrLowStr

Trigger polarity. References StimTriggerHighOrLow. Also accepts string names. Defaults to StimTriggerHighOrLow.HIGH.

enabled bool

Whether stimulation is enabled for this channel. Defaults to True.

post_trigger_delay float

Delay after trigger before stimulation in μs. Defaults to 0.0.

pulse_or_train StimPulseMode | StimPulseModeStr

Pulse or train mode. References StimPulseMode. Also accepts string names. Defaults to StimPulseMode.SINGLE_PULSE.

number_of_stim_pulses int

Number of pulses in a train. Defaults to 1.

pulse_train_period float

Period of pulses in a train in μs. Defaults to 0.0.

refractory_period float

Refractory period in μs. Defaults to 0.0.

pre_stim_amp_settle float

Pre-stimulation amplifier settle time in μs. Defaults to 0.0.

post_stim_amp_settle float

Post-stimulation amplifier settle time in μs. Defaults to 0.0.

maintain_amp_settle bool

Whether to maintain amplifier settle. Defaults to False.

enable_amp_settle bool

Whether to enable amplifier settle. Defaults to False.

headstage_global_amp_settle bool

Whether to enable global headstage amp settle. Defaults to False.

post_stim_charge_recov_on float

Post-stimulation charge recovery on time in μs. Defaults to 0.0.

post_stim_charge_recov_off float

Post-stimulation charge recovery off time in μs. Defaults to 0.0.

enable_charge_recovery bool

Whether to enable charge recovery. Defaults to False.

trigger_source_is_keypress bool

Whether the trigger source is a keypress. Defaults to False.

trigger_source_idx int | StimKeypressIndex

AIN/DIN system channel index, or keypress number. References StimKeypressIndex if keypress.

Functions

biphasic classmethod
biphasic(
    *,
    amplitude,
    pulse_duration,
    polarity,
    stim_sys_chan_idx,
    enabled=True,
    **overrides,
)

Create biphasic stimulation parameters.

Parameters:

Name Type Description Default
amplitude float

First phase amplitude (μA for amp channels)

required
pulse_duration float

Phase duration in microseconds

required
polarity StimPolarity

Stimulation polarity (cathodic or anodic first)

required
stim_sys_chan_idx int

System channel index

required
**overrides object

Override any other StimParams field

{}

Returns:

Type Description
StimParams

StimParams configured for biphasic stimulation

StimParamsPartial

Bases: BaseModel

Partial version of StimParams where all fields are optional.

Use for filtering/stim event lookup where only a subset of parameters is known. Any field left as None is treated as "don't care" by the callee.

Attributes:

Name Type Description
stim_sys_chan_idx int | None

System channel index (ntvAbsKeyIdx).

stim_shape StimShape | StimShapeStr | None

Stimulation waveform shape.

stim_polarity StimPolarity | StimPolarityStr | None

Stimulation polarity.

first_phase_duration float | None

Duration of the first phase in μs.

second_phase_duration float | None

Duration of the second phase in μs.

interphase_delay float | None

Delay between phases in μs.

first_phase_amplitude float | None

Amplitude of the first phase (μA for amp, V for DAC).

second_phase_amplitude float | None

Amplitude of the second phase (μA for amp, V for DAC).

baseline_voltage float | None

Baseline voltage in V.

trigger_edge_or_level StimTriggerEdgeOrLevel | StimTriggerEdgeOrLevelStr | None

Trigger mode.

trigger_high_or_low StimTriggerHighOrLow | StimTriggerHighOrLowStr | None

Trigger polarity.

enabled bool | None

Whether stimulation is enabled for this channel.

post_trigger_delay float | None

Delay after trigger before stimulation in μs.

pulse_or_train StimPulseMode | StimPulseModeStr | None

Pulse or train mode.

number_of_stim_pulses int | None

Number of pulses in a train.

pulse_train_period float | None

Period of pulses in a train in μs.

refractory_period float | None

Refractory period in μs.

pre_stim_amp_settle float | None

Pre-stimulation amplifier settle time in μs.

post_stim_amp_settle float | None

Post-stimulation amplifier settle time in μs.

maintain_amp_settle bool | None

Whether to maintain amplifier settle.

enable_amp_settle bool | None

Whether to enable amplifier settle.

headstage_global_amp_settle bool | None

Whether to enable global headstage amp settle.

post_stim_charge_recov_on float | None

Post-stimulation charge recovery on time in μs.

post_stim_charge_recov_off float | None

Post-stimulation charge recovery off time in μs.

enable_charge_recovery bool | None

Whether to enable charge recovery.

trigger_source_is_keypress bool | None

Whether the trigger source is a keypress.

trigger_source_idx int | StimKeypressIndex | None

AIN/DIN system channel index, or keypress number.

Functions

valid_keys
valid_keys()

Return a list of only the fields that are not None.

StimPolarity

Bases: IntEnum

Stimulation polarity. Values match proto allego.StimPolarity.

StimPulseMode

Bases: IntEnum

Stimulation pulse mode. Values match proto allego.StimPulseOrTrain.

StimShape

Bases: IntEnum

Stimulation waveform shape. Values match proto allego.StimShape.

StimStep

Bases: IntEnum

Stimulation step size. Values match proto allego.StimStep.

StimStepRequest

Bases: BaseModel

Request to set stimulation step size.

Attributes:

Name Type Description
stim_step StimStep

Target stimulation step size. References StimStep.

StimStepState

Bases: BaseModel

Current stimulation step size setting.

Attributes:

Name Type Description
stim_step StimStep

Current stimulation step size. References StimStep.

StimTriggerEdgeOrLevel

Bases: IntEnum

Stimulation trigger edge/level mode. Values match proto allego.StimTriggerEdgeOrLevel.

StimTriggerHighOrLow

Bases: IntEnum

Stimulation trigger high/low. Values match proto allego.StimTriggerHighOrLow.