radiens_core.allego_client
AllegoClient — real-time data acquisition client.
Classes
AllegoClient
Bases: BaseClient
Client for real-time data acquisition and streaming.
Connects to a local Allego on its default ports.
| METHOD | DESCRIPTION |
|---|---|
close |
Close the client's server connections. |
deselect_channels |
Remove signals from the current selection, leaving the rest untouched. |
disable_all_triggers |
Disable all recording triggers. |
disable_trigger |
Disable a specific digital trigger channel. |
enable_trigger |
Enable a digital trigger channel to start or stop recording. |
flash_sinaps |
Flash new firmware to the Sinaps probe FPGA. |
get_channel_metadata |
Get current channel metadata for all connected channels. |
get_core_config |
Get core hardware configuration settings. |
get_dac_reg |
Get current DAC (Analog Output) register settings. |
get_default_spike_sorter_id |
Return Allego's spike sorter ID, whether or not the sorter is running. |
get_detect_params |
Fetch active detection configurations per channel. |
get_dio_reg |
Get current DIO (Digital Output) register settings. |
get_dsp_group |
Get current DSP filter configurations. |
get_intan_impedance |
Measure impedance for all channels on a specific port. |
get_kpi_metrics |
Retrieve computed KPI signal metrics from the live cache. |
get_kpi_status |
Get the current KPI computation status. |
get_recording_config |
Get current recording configuration settings. |
get_signals |
Retrieve signal data from the primary live cache. |
get_sinaps_status_registers |
Get the current Sinaps probe status registers. |
get_spike_sorter_dashboard |
Get the spike sorter dashboard for real-time monitoring. |
get_spike_sorter_ids |
Get the spike sorter IDs. |
get_spike_sorter_state |
Get the current state and progress of a spike sorter. |
get_status |
Get comprehensive system status. |
get_stim_params |
Get stimulation parameters for all configured channels. |
get_stim_step |
Get current stimulation step size setting. |
get_trigger_state |
Get current trigger channel configuration. |
healthcheck |
Verify the server is responsive. |
load_all_mosi |
Load all MOSI register values into the Sinaps probe. |
read_wire_out |
Read a wire-out register value from the Sinaps FPGA. |
restart |
Restart the system with the specified backbone mode. |
scan_ports |
Scan all hardware ports to determine connected headstages and probes. |
select_channels |
Add signals to the current selection, leaving the rest selected. |
set_channel_groups |
Make the color groups exactly groups, discarding existing assignments. |
set_dac_gain |
Set DAC (Analog Output) gain. |
set_dac_highpass |
Configure DAC (Analog Output) high-pass filter. |
set_dac_off |
Turn off all DAC (Analog Output) streams. |
set_dac_stream |
Map a source channel to a DAC (Analog Output) channel. |
set_dio_events |
Configure DIO channel to trigger on analog threshold crossings. |
set_dio_gated |
Switch DIO to gated mode, where the digital outputs follow the stream and record state. |
set_dio_manual |
Set DIO channel state manually. |
set_dio_pulse |
Configure DIO channel(s) for pulse mode. |
set_dsp_group |
Replace the filters of one DSP stage. |
set_selected_channels |
Make the channel selection exactly signals. |
set_stim_params |
Update stimulation parameters for specified channels. |
set_stim_step |
Set the stimulation step size. |
set_stim_trigger |
Set the state of a stimulation keypress trigger. |
spike_sorter_command |
Send a command to an active spike sorter. |
start_recording |
Start recording data to disk. |
start_streaming |
Start data streaming from the hardware. Does nothing if streaming is on. |
stop_recording |
Stop recording data to disk. |
stop_streaming |
Stop data streaming from the hardware. Does nothing if streaming is off. |
toggle_stim_trigger |
Toggle a stimulation keypress trigger. |
transmit_mosi |
Transmit the loaded MOSI registers to the Sinaps probe. |
update_core_config |
Update core hardware configuration settings. |
update_detect_params |
Update detection thresholds, shadow, window and spike width on the given channels. |
update_recording_config |
Replace the recording configuration. |
| ATTRIBUTE | DESCRIPTION |
|---|---|
server_version |
Connected server version as
TYPE:
|
Attributes
server_version
property
Connected server version as (major, minor, patch).
A development build reports (inf, inf, inf).
Functions
deselect_channels
deselect_channels(signals: FlexSignalSpec) -> ChannelMetadata
Remove signals from the current selection, leaving the rest untouched.
| PARAMETER | DESCRIPTION |
|---|---|
signals
|
Channels to deselect. Same forms as
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ChannelMetadata
|
Refreshed channel metadata reflecting the new selection. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If an index is not present in the connected hardware. |
RadiensError
|
On communication failure or server error. |
disable_all_triggers
Disable all recording triggers.
| RAISES | DESCRIPTION |
|---|---|
RadiensError
|
On communication failure or server error. |
disable_trigger
disable_trigger(*, channel: FlexTriggerChannel, port: FlexPort | None = None) -> None
Disable a specific digital trigger channel.
Unless RecordingConfig.split_files_by_port is set, this disables all triggers.
| PARAMETER | DESCRIPTION |
|---|---|
channel
|
The digital input/output channel to disable.
Accepts
TYPE:
|
port
|
Hardware port the channel belongs to. See
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If |
RadiensError
|
On communication failure or server error. |
enable_trigger
enable_trigger(*, channel: FlexTriggerChannel, port: FlexPort | None = None) -> None
Enable a digital trigger channel to start or stop recording.
When enabled, a voltage transition on channel will automatically
start or stop recording on the hardware. Unless
RecordingConfig.split_files_by_port is set, only one trigger is active, so
enabling one replaces any other.
| PARAMETER | DESCRIPTION |
|---|---|
channel
|
The digital input/output channel to use as a trigger.
Accepts
TYPE:
|
port
|
Hardware port the channel belongs to. Accepts
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If |
RadiensError
|
On communication failure or server error. |
flash_sinaps
flash_sinaps(bitfile: str) -> None
Flash new firmware to the Sinaps probe FPGA.
| PARAMETER | DESCRIPTION |
|---|---|
bitfile
|
Path to the FPGA bitfile to flash.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
RadiensError
|
On communication failure or server error. |
get_channel_metadata
get_channel_metadata() -> ChannelMetadata
Get current channel metadata for all connected channels.
| RETURNS | DESCRIPTION |
|---|---|
ChannelMetadata
|
Complete channel metadata including probe geometry, signal types, channel indices, and site positions for all channels. |
| RAISES | DESCRIPTION |
|---|---|
RadiensError
|
On communication failure or server error. |
get_core_config
get_core_config() -> CoreConfig
Get core hardware configuration settings.
| RETURNS | DESCRIPTION |
|---|---|
CoreConfig
|
Current core hardware configuration including sampling frequency, loop duration, and cable delays. |
| RAISES | DESCRIPTION |
|---|---|
RadiensError
|
On communication failure or server error. |
get_dac_reg
get_dac_reg() -> AnalogOutRegister
Get current DAC (Analog Output) register settings.
| RETURNS | DESCRIPTION |
|---|---|
AnalogOutRegister
|
The complete DAC register state, including gain, high-pass filter configuration, and channel mappings. |
| RAISES | DESCRIPTION |
|---|---|
RadiensError
|
On communication failure or server error. |
get_default_spike_sorter_id
get_default_spike_sorter_id() -> str
Return Allego's spike sorter ID, whether or not the sorter is running.
| RETURNS | DESCRIPTION |
|---|---|
str
|
The spike sorter ID. |
| RAISES | DESCRIPTION |
|---|---|
RadiensError
|
If the server reports no sorter. |
get_detect_params
get_detect_params(
spike_sorter_id: str, channels: list[int] | None = None
) -> dict[int, SpikeDetectParams]
Fetch active detection configurations per channel.
| PARAMETER | DESCRIPTION |
|---|---|
spike_sorter_id
|
Ignored; Allego runs one sorter. Pass
TYPE:
|
channels
|
Optional list of native channel indices. If |
| RETURNS | DESCRIPTION |
|---|---|
dict[int, SpikeDetectParams]
|
Map from native channel index to its |
get_dio_reg
get_dio_reg() -> DigitalOutRegister
Get current DIO (Digital Output) register settings.
| RETURNS | DESCRIPTION |
|---|---|
DigitalOutRegister
|
The complete DIO register state, including current mode and per-channel configurations. |
| RAISES | DESCRIPTION |
|---|---|
RadiensError
|
On communication failure or server error. |
get_dsp_group
Get current DSP filter configurations.
| PARAMETER | DESCRIPTION |
|---|---|
stream_group_id
|
The stream group to query. Defaults to the live signal stream,
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
DSPGroup
|
The current hardware and software filter parameters. |
| RAISES | DESCRIPTION |
|---|---|
RadiensError
|
On communication failure or server error. |
get_intan_impedance
Measure impedance for all channels on a specific port.
| PARAMETER | DESCRIPTION |
|---|---|
port
|
The hardware port to measure. Accepts
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Impedance
|
Impedance measurements for all channels on the specified port. |
| RAISES | DESCRIPTION |
|---|---|
RadiensError
|
On communication failure or server error. |
get_kpi_metrics
get_kpi_metrics(
metrics: list[FlexKpiMetricId],
channel_indices: list[int] | None = None,
signal_type: FlexSignalType = AMP,
stream_group_id: str = PRIMARY_CACHE_STREAM_GROUP_ID,
*,
service_mode: FlexKpiServiceMode = STREAM,
stream_lookback_sec: float | None = None,
) -> KpiMetricsResult
Retrieve computed KPI signal metrics from the live cache.
| PARAMETER | DESCRIPTION |
|---|---|
metrics
|
List of KPI metric identifiers. Accepts
TYPE:
|
channel_indices
|
Native channel indices to query.
|
signal_type
|
Signal type to query. KPI covers amplifier channels only.
Defaults to
TYPE:
|
stream_group_id
|
Stream group to query. Defaults to the live signal stream.
TYPE:
|
service_mode
|
Which answering mode to use.
TYPE:
|
stream_lookback_sec
|
How many seconds of recent signal the moving average
reflects. Used only when service_mode is
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
KpiMetricsResult
|
One value per channel and metric, labeled with the channel of each row and the
metric of each column; see |
| RAISES | DESCRIPTION |
|---|---|
SignalSelectionError
|
If a requested channel index is not in the live stream. |
CapabilityError
|
If the connected server predates the current KPI metric set. |
RadiensError
|
On communication failure or server error. |
get_kpi_status
Get the current KPI computation status.
| PARAMETER | DESCRIPTION |
|---|---|
stream_group_id
|
Stream group to query. Defaults to the live signal stream.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
KpiStatus
|
The KPI computation status; see |
| RAISES | DESCRIPTION |
|---|---|
CapabilityError
|
If the connected server predates the current KPI metric set. |
RadiensError
|
On communication failure or server error. |
get_recording_config
get_recording_config() -> RecordingConfig
Get current recording configuration settings.
| RETURNS | DESCRIPTION |
|---|---|
RecordingConfig
|
Current recording configuration including file paths, naming, and recording type settings. |
| RAISES | DESCRIPTION |
|---|---|
RadiensError
|
On communication failure or server error. |
get_signals
get_signals(
time_range: FlexTimeRange,
signals: FlexSignalSpec | None = None,
*,
apply_dsp: bool = False,
) -> SignalArrays
Retrieve signal data from the primary live cache.
Warning
With apply_dsp set, only selected channels can be read: asking for an
unselected one raises ServerCommunicationError, and so does
signals=None whenever any channel is deselected. Pass
{"amp": "selected"}, or select more channels first with
set_selected_channels().
| PARAMETER | DESCRIPTION |
|---|---|
time_range
|
Range to read from the live cache; see
TYPE:
|
signals
|
Channel selection — list of amp indices,
TYPE:
|
apply_dsp
|
Return the signal filtered by the stream group's stage-2 DSP
group, which is what KPI metrics, the spike sorter and the Allego
monitor see.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
SignalArrays
|
Signal data as numpy arrays (channels x samples). Its |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If a channel index does not exist. |
CapabilityError
|
If the connected server is too old to support this method, or
|
RadiensError
|
On communication failure or server error. |
get_sinaps_status_registers
get_sinaps_status_registers() -> SinapsStatusRegisters
Get the current Sinaps probe status registers.
| RETURNS | DESCRIPTION |
|---|---|
SinapsStatusRegisters
|
Current status registers including calibration state, active pixel counts per shank, reference voltages, error flags, and probe identification information. |
| RAISES | DESCRIPTION |
|---|---|
RadiensError
|
On communication failure or server error. |
get_spike_sorter_dashboard
get_spike_sorter_dashboard(
spike_sorter_id: str, elements: list[FlexDashElement] | None = None
) -> SpikeSorterDashboard
Get the spike sorter dashboard for real-time monitoring.
| PARAMETER | DESCRIPTION |
|---|---|
spike_sorter_id
|
Ignored; Allego runs one sorter. Pass
TYPE:
|
elements
|
Optional list of dashboard elements to include. Each element
can be a
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
SpikeSorterDashboard
|
Dashboard data for the requested elements. |
get_spike_sorter_ids
get_spike_sorter_state
get_spike_sorter_state(spike_sorter_id: str) -> SpikeSorterState
Get the current state and progress of a spike sorter.
| PARAMETER | DESCRIPTION |
|---|---|
spike_sorter_id
|
Ignored; Allego runs one sorter. Pass
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
SpikeSorterState
|
Current state including system status, progress, and messages. |
get_status
get_status() -> BackboneStatus
Get comprehensive system status.
| RETURNS | DESCRIPTION |
|---|---|
BackboneStatus
|
Current streaming status, recording status, port information, connection state, and GPIO channel counts. |
| RAISES | DESCRIPTION |
|---|---|
RadiensError
|
On communication failure or server error. |
get_stim_params
get_stim_params() -> dict[int, StimParams]
Get stimulation parameters for all configured channels.
| RETURNS | DESCRIPTION |
|---|---|
dict[int, StimParams]
|
Stimulation parameters keyed by system channel index. |
| RAISES | DESCRIPTION |
|---|---|
RadiensError
|
On communication failure or server error. |
get_stim_step
get_stim_step() -> StimStepState
Get current stimulation step size setting.
| RETURNS | DESCRIPTION |
|---|---|
StimStepState
|
Current stimulation step configuration. |
| RAISES | DESCRIPTION |
|---|---|
RadiensError
|
On communication failure or server error. |
get_trigger_state
get_trigger_state() -> TriggerState
Get current trigger channel configuration.
| RETURNS | DESCRIPTION |
|---|---|
TriggerState
|
Current trigger state showing enabled channels and ports. |
| RAISES | DESCRIPTION |
|---|---|
RadiensError
|
On communication failure or server error. |
healthcheck
healthcheck(service: ServiceEndpoint = ALLEGO_LIFECYCLE) -> None
Verify the server is responsive.
| PARAMETER | DESCRIPTION |
|---|---|
service
|
Service to probe:
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If service is not an Allego service. |
RadiensError
|
If the health check fails or the server is unresponsive. |
load_all_mosi
Load all MOSI register values into the Sinaps probe.
| PARAMETER | DESCRIPTION |
|---|---|
register_vals
|
List of 32-bit register values to load. |
| RAISES | DESCRIPTION |
|---|---|
RadiensError
|
On communication failure or server error. |
read_wire_out
Read a wire-out register value from the Sinaps FPGA.
| PARAMETER | DESCRIPTION |
|---|---|
wire_out_address
|
Address of the wire-out register to read.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
int
|
Integer value read from the specified wire-out register. |
| RAISES | DESCRIPTION |
|---|---|
RadiensError
|
On communication failure or server error. |
restart
restart(*, mode: FlexBackboneMode) -> None
Restart the system with the specified backbone mode.
Warning
Stops and resets the spike sorter, resets cable delays to their defaults,
and rescans the ports, which has the same effects as scan_ports().
A failed restart leaves the spike sorter stopped. Switching between two
hardware modes closes the current instrument first, so if the new one
fails to open, no instrument is open.
| PARAMETER | DESCRIPTION |
|---|---|
mode
|
The backbone hardware mode to restart with. Accepts
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ServerCommunicationError
|
If streaming is on, the account is not licensed for mode, or the instrument for mode fails to open. |
RadiensError
|
On communication failure or server error. |
scan_ports
scan_ports() -> ChannelMetadata
Scan all hardware ports to determine connected headstages and probes.
Warning
Resets every channel's stimulation parameters, disables all recording triggers, and drops stage 1 filters on ports with nothing connected.
| RETURNS | DESCRIPTION |
|---|---|
ChannelMetadata
|
Updated channel metadata based on the newly discovered hardware. |
| RAISES | DESCRIPTION |
|---|---|
ServerCommunicationError
|
If streaming is on. |
RadiensError
|
On communication failure or server error. |
select_channels
select_channels(signals: FlexSignalSpec) -> ChannelMetadata
Add signals to the current selection, leaving the rest selected.
| PARAMETER | DESCRIPTION |
|---|---|
signals
|
Channels to select. Same forms as
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ChannelMetadata
|
Refreshed channel metadata reflecting the new selection. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If an index is not present in the connected hardware. |
RadiensError
|
On communication failure or server error. |
set_channel_groups
set_channel_groups(groups: Sequence[FlexSignalSpec]) -> ChannelMetadata
Make the color groups exactly groups, discarding existing assignments.
Color groups drive display grouping and ordering in Allego — the probe
wireframe's "Order" tool sets the same thing. Groups are indexed in the order
given, but each signal type within a group gets its own index and a group
matching no channels gets none, so read the resulting indices from
color_group_idxs on the returned metadata rather than assuming 1..N.
| PARAMETER | DESCRIPTION |
|---|---|
groups
|
Desired groups, in order. Each accepts the same forms as
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ChannelMetadata
|
Refreshed channel metadata reflecting the new groups. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If a requested channel is not selected; only selected channels can be grouped. |
RadiensError
|
On communication failure or server error. |
set_dac_gain
set_dac_gain(gain: int) -> None
Set DAC (Analog Output) gain.
| PARAMETER | DESCRIPTION |
|---|---|
gain
|
The gain value to set.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
RadiensError
|
On communication failure or server error. |
set_dac_highpass
Configure DAC (Analog Output) high-pass filter.
| PARAMETER | DESCRIPTION |
|---|---|
enable
|
Whether to enable the high-pass filter.
TYPE:
|
cutoff_freq
|
The cutoff frequency in Hz.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
RadiensError
|
On communication failure or server error. |
set_dac_off
Turn off all DAC (Analog Output) streams.
| RAISES | DESCRIPTION |
|---|---|
RadiensError
|
On communication failure or server error. |
set_dac_stream
Map a source channel to a DAC (Analog Output) channel.
| PARAMETER | DESCRIPTION |
|---|---|
dac_idx
|
The DAC channel index to configure.
TYPE:
|
ntv_chan_idx
|
The source channel index to output.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
RadiensError
|
On communication failure or server error. |
set_dio_events
Configure DIO channel to trigger on analog threshold crossings.
Switches the DIO mode to events. Hardware only; not available with a simulated backbone.
| PARAMETER | DESCRIPTION |
|---|---|
chan_idx
|
Native index of the digital output channel.
TYPE:
|
threshold
|
Event threshold in microvolts (μV).
TYPE:
|
polarity
|
Event polarity (True for positive-going, False for negative-going).
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ServerCommunicationError
|
If the backbone mode does not support event DIO. |
RadiensError
|
On communication failure or server error. |
set_dio_gated
set_dio_gated(polarity: bool) -> None
Switch DIO to gated mode, where the digital outputs follow the stream and record state.
Warning
Clears every digital output's manual and event settings.
| PARAMETER | DESCRIPTION |
|---|---|
polarity
|
Gated polarity (True for high-active, False for low-active).
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ServerCommunicationError
|
If the backbone mode does not support gated DIO. |
RadiensError
|
On communication failure or server error. |
set_dio_manual
Set DIO channel state manually.
Switches the DIO mode to manual.
| PARAMETER | DESCRIPTION |
|---|---|
chan_idx
|
Native index of the digital output channel. An index with no digital output is ignored.
TYPE:
|
state
|
Desired state (True for high, False for low).
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ServerCommunicationError
|
If the backbone mode does not support manual DIO. |
RadiensError
|
On communication failure or server error. |
set_dio_pulse
Configure DIO channel(s) for pulse mode.
Simulated backbone only; not available on hardware.
| PARAMETER | DESCRIPTION |
|---|---|
interval_sec
|
Pulse interval in seconds.
TYPE:
|
duration_sec
|
Pulse duration in seconds.
TYPE:
|
chan_idx
|
Native index of the digital output channel, or
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
RadiensError
|
On communication failure or server error. |
set_dsp_group
set_dsp_group(
*,
stage: FlexFilterStage,
params: list[FlexDSPParams],
stream_group_id: str = PRIMARY_CACHE_STREAM_GROUP_ID,
) -> None
Replace the filters of one DSP stage.
The other stages are left alone. To change one filter, read the stage with
get_dsp_group() and send back the whole list.
Warning
params replaces the stage on every port, and a filter applies only to its
port's channels. List a filter once per port it applies to; a port missing
from the list loses its filters.
| PARAMETER | DESCRIPTION |
|---|---|
stage
|
The filter stage to update. Accepts
TYPE:
|
params
|
Filter parameters for this stage. Each item can be a
TYPE:
|
stream_group_id
|
The stream group to update. Allego accepts only the live signal
stream,
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If a filter sets |
ServerCommunicationError
|
If stage is hardware or stage 1 while recording (stage 2 can be changed at any time), or the server cannot build a filter. |
CapabilityError
|
If a filter sets a non-Butterworth |
set_selected_channels
set_selected_channels(signals: FlexSignalSpec) -> ChannelMetadata
Make the channel selection exactly signals.
Only signal types named in signals are touched — passing a bare list of amp
indices leaves the GPIO selection alone. Clear one type with {"amp": []}.
| PARAMETER | DESCRIPTION |
|---|---|
signals
|
Desired selection — list of amp indices,
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ChannelMetadata
|
Refreshed channel metadata reflecting the new selection. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If an index is not present in the connected hardware. |
RadiensError
|
On communication failure or server error. |
set_stim_params
set_stim_params(params: dict[int, StimParams]) -> None
Update stimulation parameters for specified channels.
Channels are updated in order. If one fails, the channels before it keep their new parameters.
| PARAMETER | DESCRIPTION |
|---|---|
params
|
Map from system channel index to its new stimulation parameters. The
key overrides
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ServerCommunicationError
|
If streaming is on, or a stimulation or trigger-source channel does not exist. |
RadiensError
|
If params is empty, or on communication failure or server error. |
Example
stim_params = StimParams.biphasic(
amplitude=100.0, # μA
pulse_duration=100.0, # μs
polarity=StimPolarity.CATHODIC_FIRST,
stim_sys_chan_idx=42,
trigger_source_idx=StimKeypressIndex.KEYPRESS_1,
)
client.set_stim_params({
42: stim_params,
43: stim_params.model_copy(update={"first_phase_amplitude": 150.0}),
})
set_stim_step
set_stim_step(*, step: StimStep) -> None
Set the stimulation step size.
| PARAMETER | DESCRIPTION |
|---|---|
step
|
The stimulation step size to set.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
RadiensError
|
On communication failure or server error. |
set_stim_trigger
set_stim_trigger(*, trigger: FlexStimKeypressIndex, on: bool) -> None
Set the state of a stimulation keypress trigger.
| PARAMETER | DESCRIPTION |
|---|---|
trigger
|
The keypress trigger index (1-8). Accepts
TYPE:
|
on
|
True to activate the trigger, False to deactivate.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
RadiensError
|
On communication failure or server error. |
spike_sorter_command
spike_sorter_command(
spike_sorter_id: str | None = None,
cmd: FlexSpikeSorterCommand | None = None,
*,
sub_cmd: FlexSpikeSorterSubCommand = NULL,
clusterer_params: SpikeSorterClustererParams | None = None,
feature_params: SpikeSorterFeatureParams | None = None,
neighbor_radius_um: float | None = None,
max_num_site_neighbors: int | None = None,
) -> None
Send a command to an active spike sorter.
Warning
"rebase" and "clear_sort" discard the sorter's spikes. "init"
does too, and also resets its detection thresholds, windows and shadow to
defaults before applying the new neighborhood. A running sorter is turned
back on afterwards.
| PARAMETER | DESCRIPTION |
|---|---|
spike_sorter_id
|
ID of the spike sorter to control.
TYPE:
|
cmd
|
The command to execute. Accepts
TYPE:
|
sub_cmd
|
Optional sub-command. Accepts
TYPE:
|
clusterer_params
|
Optional parameters for the clustering algorithm. Fully
applied only by
TYPE:
|
feature_params
|
Optional parameters for feature extraction. Applied only
by
TYPE:
|
neighbor_radius_um
|
Optional per-site neighbor search radius, in
microns. Only applied when
TYPE:
|
max_num_site_neighbors
|
Optional cap on the number of neighbors kept
per site (closest first). Only applied when
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
TypeError
|
If cmd is omitted. |
RadiensError
|
If cmd is |
start_recording
start_recording(*, port: FlexPort | None = None) -> None
Start recording data to disk.
Warning
Streaming starts first if it is off, which clears the live cache. If
RecordingConfig.recording_type records spikes, the spike sorter is
turned on too.
| PARAMETER | DESCRIPTION |
|---|---|
port
|
Optional port to start recording on. Accepts
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
RadiensError
|
If the record state change fails. |
start_streaming
Start data streaming from the hardware. Does nothing if streaming is on.
Warning
Clears the live cache, so data from an earlier stream can no longer be read.
| RAISES | DESCRIPTION |
|---|---|
RadiensError
|
If the stream state change fails. |
stop_recording
stop_recording(*, port: FlexPort | None = None) -> None
Stop recording data to disk.
| PARAMETER | DESCRIPTION |
|---|---|
port
|
Optional port to stop recording on. Accepts
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
RadiensError
|
If the record state change fails. |
stop_streaming
Stop data streaming from the hardware. Does nothing if streaming is off.
Warning
Turns the spike sorter off.
| RAISES | DESCRIPTION |
|---|---|
ServerCommunicationError
|
If recording is on. KPI computation stops anyway. |
RadiensError
|
If the stream state change fails. |
toggle_stim_trigger
toggle_stim_trigger(*, trigger: FlexStimKeypressIndex) -> None
Toggle a stimulation keypress trigger.
| PARAMETER | DESCRIPTION |
|---|---|
trigger
|
The keypress trigger index (1-8) to toggle. Accepts
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
RadiensError
|
On communication failure or server error. |
transmit_mosi
Transmit the loaded MOSI registers to the Sinaps probe.
| RAISES | DESCRIPTION |
|---|---|
RadiensError
|
On communication failure or server error. |
update_core_config
update_core_config(
*,
samp_freq: float | None = None,
loop_dur: float | None = None,
pcache_persistence: float | None = None,
cable_delay: CableDelay | None = None,
) -> None
Update core hardware configuration settings.
Fields left as None are unchanged. Fails while streaming.
Warning
Stops the spike sorter, even when the call then fails. Changing samp_freq also clears the live cache, resets the sorter, restarts KPI, and lowers any filter edge above the new Nyquist frequency.
| PARAMETER | DESCRIPTION |
|---|---|
samp_freq
|
Target sampling frequency in Hz.
TYPE:
|
loop_dur
|
Not currently settable; the server ignores it.
TYPE:
|
pcache_persistence
|
Not currently settable; the server ignores it.
TYPE:
|
cable_delay
|
Cable delay configuration for a specific port.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
RadiensError
|
On communication failure or server error. |
update_detect_params
update_detect_params(
spike_sorter_id: str, params: SpikeDetectParams, channels: list[int]
) -> None
Update detection thresholds, shadow, window and spike width on the given channels.
Fields in params that are None will not be modified.
| PARAMETER | DESCRIPTION |
|---|---|
spike_sorter_id
|
Ignored; Allego runs one sorter. Pass
TYPE:
|
params
|
The detection parameters to apply.
TYPE:
|
channels
|
List of native channel indices to apply the parameters to. |
| RAISES | DESCRIPTION |
|---|---|
CapabilityError
|
If |
update_recording_config
update_recording_config(config: RecordingConfig) -> None
Replace the recording configuration.
Every field of config is applied. get_recording_config() does not report
datasource_idx, so set it explicitly when round-tripping a config. Fields
are applied one at a time, so if one fails, the fields before it stay applied.
| PARAMETER | DESCRIPTION |
|---|---|
config
|
Recording configuration specifying file paths, naming,
and recording type (continuous/spikes/both).
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ServerCommunicationError
|
If recording is on, or |
RadiensError
|
On communication failure or server error. |