stimulation
Overview
Members
- class stimulation.ArbitraryStimulation(token: str, sequence_list: List[ApiObject])
Bases:
object
A class that holds any stimulation that could be passed to the MaxLab system. Initialized with a list of
ApiObject
.- Parameters:
token (
str
) – The unique token identifying the sequencesequence_list (
List[ApiObject]
) – A list ofApiObject
defining the sequence
- build_sequence(initial_delay: float = 5, persistent=True) Sequence
Creates an
mx.Sequence
from the sequence list.- Parameters:
initial_delay (
float
) – The delay time in ms for downloading the stim sequence. Defaults to5
persistent (
bool
) – Defaults toTrue
- Returns:
Initialized stimulation sequence
- Return type:
mx.Sequence
- get_duration() float
Returns the duration of a sequence list, in seconds.
- Parameters:
sequence_list (
mx.ApiObject
list) – List of API objects that define a sequence.- Returns:
The duration of the sequence, in frames.
- Return type:
float
- class stimulation.Stimulation(token: str, dac_source: int, amplitude: float = 100, phase: float = 500, pulses_per_train: int = 10, num_trains: int = 1, pulse_interval: float = 10, pulse_train_interval: float = 1, stim_units: List[int] | None = None, well: int = 0)
Bases:
ArbitraryStimulation
Class that represents a regular stimulation,, as created by the MaxLab GUI.
- Parameters:
token (
str
) – unique identifierdac_source (
int
) – The DAC channel to send signals to. Must be 0, 1, or 2.amplitude (
float
, optional) – Amplitude of biphasic pulse, in mV. Suggested values between 0 and 1000. Defaults to 100.phase (
float
, optional) – Stimulation pulse phase duration (half of a square wave), in us. Suggested values between 100 and 1000. Defaults to 500.pulses_per_train (
int
, optional) – number of pulses per train. Defaults to 10.num_trains (
int
, optional) – Number of pulse trains. Defaults to 1.pulse_interval (
float
, optional) – Time between pulses within a single train, in ms. Suggested values between 1 and 100. Defaults to 10.pulse_train_interval (
float
, optional) – Time between pulse trains, in s. Suggested values between 0.01 and 10. Defaults to 1.stim_units (
Optional[List[int]]
, optional) – List of stimulation stim_units. Must have a length of less than 32. If None, just sends stimuli to the desired DAC channel. Otherwise, powering on and off stim units is included in the sequence. If this is used, ensure that all stimulation units are powered off to begin with.well (
int
, optional) – The well number, used for Events, defaults to 0
- classmethod combine_stimuli(stim1: Self, stim2: Self, token: str) ArbitraryStimulation
Combine two
Stimulation
objects into a sequence that runs them simultaneously.A more general version of this function may be written to support combining arbitrary stimuli, not just
Stimulation
objects. Currently, this code depends onmx.Event
objects of a specific format to determine when stimuli start and end, making it inappropriate for general use. Not configured to deal withmx.DelayCycles
objects.- Parameters:
stim1 (
Self
) – The firstStimulation
object.stim2 (
Self
) – The secondStimulation
object.token (
str
) – The unique identifier token for the sequence.
- Returns:
An ArbitraryStimulation object combining the two
Stimulation
objects.- Return type:
ArbitraryStimulation
- classmethod from_frequency(token: str, dac_source: int, frequency: float, duration: float, amplitude: float = 100, phase: float = 500, num_trains: int = 1, pulse_train_interval: float = 1, stim_units: List[int] | None = None, well=0) Self
Constructor method. Creates a regular stimulation of a given frequency. Phase can be customized, but is restricted to being at a rate that enables the desired frequency.
- Parameters:
token (
str
) – Unique identifierdac_source (
int
) – The DAC channel to send signals to. Must be 0, 1, or 2.frequency (
float
) – The frequency of the stimulation, in Hz.duration (
float
) – How long the stimulus should last (for a single train), in s.amplitude (
float
, optional) – Amplitude of biphasic pulse, in mV. Suggested values between 0 and 1000. Defaults to 100.phase (
float
, optional) – Stimulation pulse phase duration (half of a period), in us. Suggested values between 100 and 1000. Defaults to 500. Must be less than than 5,000/frequency.num_trains (
int
, optional) – Number of pulse trains. Defaults to 1.pulse_train_interval (
float
, optional) – Time between pulse trains, in s. Suggested values between 0.01 and 10. Defaults to 1.stim_units (
Optional[List[int]]
, optional) – List of stimulation stim_units. Must have a length of less than 32. If None, just sends stimuli to the desired DAC channel. Otherwise, powering on and off stim units is included in the sequence. IF THIS IS USED, ENSURE THAT ALL STIM_UNITS ARE POWERED OFF TO BEGIN WITH.well (
int
, optional) – The well number, used for Events, defaults to 0
- Returns:
A Stimulation object representing the stimulus pattern.
- Return type:
Self