Skip to content

radiens_core

Radiens Python client for neuroscience data acquisition and analysis.

Classes

AllegoClient

Bases: BaseClient

Client for real-time data acquisition and streaming.

Auto-discovers running servers. Falls back to well-known allego ports if server discovery is unavailable (no radiensserver running).

Usage::

with AllegoClient() as client:
    params = client.get_stim_params()

Functions

close
close()

Close all gRPC channels managed by this client.

disable_all_triggers
disable_all_triggers()

Disable all trigger channels simultaneously.

Sends the T_NONE sentinel to the hardware, which instructs it to clear all active trigger channel assignments.

Raises:

Type Description
RadiensError

On communication failure or server error.

disable_trigger
disable_trigger(*, channel, port=None)

Disable a specific digital trigger channel.

Parameters:

Name Type Description Default
channel TriggerChannel

The digital input/output channel to disable. Must not be TriggerChannel.T_NONE — use :meth:disable_all_triggers to disable all triggers at once.

required
port Port | None

Hardware port the channel belongs to. Only meaningful in split-ports mode. See :meth:enable_trigger for details.

None

Raises:

Type Description
ValueError

If channel is TriggerChannel.T_NONE.

RadiensError

On communication failure or server error.

enable_trigger
enable_trigger(*, channel, port=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.

Parameters:

Name Type Description Default
channel TriggerChannel

The digital input/output channel to use as a trigger. Must not be TriggerChannel.T_NONE — use :meth:disable_all_triggers to disable all triggers at once.

required
port Port | None

Hardware port the channel belongs to. Only meaningful when the hardware is configured for split-ports mode (SplitFilesByPort). In standard single-port mode the server ignores this value and controls recording across all ports, so None is the correct default.

None

Raises:

Type Description
ValueError

If channel is TriggerChannel.T_NONE.

RadiensError

On communication failure or server error.

flash_sinaps
flash_sinaps(bitfile)

Flash new firmware to the Sinaps probe FPGA.

Parameters:

Name Type Description Default
bitfile str

Path to the FPGA bitfile to flash.

required

Raises:

Type Description
RadiensError

On communication failure or server error.

get_channel_metadata
get_channel_metadata()

Get current channel metadata for all connected channels.

Returns:

Type Description
ChannelMetadata

Complete channel metadata including probe geometry, signal types,

ChannelMetadata

channel indices, and site positions for all channels.

Raises:

Type Description
RadiensError

On communication failure or server error

get_core_config
get_core_config()

Get core hardware configuration settings.

Returns:

Type Description
CoreConfig

Current core hardware configuration including sampling frequency,

CoreConfig

loop duration, and cable delays.

Raises:

Type Description
RadiensError

On communication failure or server error

get_dac_reg
get_dac_reg()

Get current DAC (Analog Output) register settings.

Returns:

Type Description
AnalogOutRegister

The complete DAC register state, including gain, high-pass

AnalogOutRegister

filter configuration, and channel mappings.

Raises:

Type Description
RadiensError

On communication failure or server error

get_dio_reg
get_dio_reg()

Get current DIO (Digital Output) register settings.

Returns:

Type Description
DigitalOutRegister

The complete DIO register state, including current mode and

DigitalOutRegister

per-channel configurations.

Raises:

Type Description
RadiensError

On communication failure or server error

get_dsp_group
get_dsp_group(
    stream_group_id=PRIMARY_CACHE_STREAM_GROUP_ID,
)

Get current DSP filter configurations.

Parameters:

Name Type Description Default
stream_group_id str

The stream group to query (default "default").

PRIMARY_CACHE_STREAM_GROUP_ID

Returns:

Type Description
DSPGroup

The current hardware and software filter parameters.

Raises:

Type Description
RadiensError

On communication failure or server error.

get_intan_impedance
get_intan_impedance(port)

Measure impedance for all channels on a specific port.

Parameters:

Name Type Description Default
port Port

The hardware port to measure (e.g., Port.A)

required

Returns:

Type Description
Impedance

Impedance measurements for all channels on the specified port.

Raises:

Type Description
RadiensError

On communication failure or server error

get_kpi_metrics
get_kpi_metrics(
    metrics,
    channel_indices=None,
    time_range=None,
    signal_type=SignalType.AMP,
    stream_group_id=PRIMARY_CACHE_STREAM_GROUP_ID,
)

Retrieve computed KPI signal metrics from the live cache.

Parameters:

Name Type Description Default
metrics list[KpiMetricId]

List of KPI metric identifiers to compute.

required
channel_indices list[int] | None

Native channel indices (ntvIdxs) to query. None returns metrics for all channels.

None
time_range FlexTimeRange | None

Time range spec. Use [duration, float('nan')] for a lookback window or [start, end] for an absolute range. None defaults to a 5-second lookback window.

None
signal_type SignalType

Signal type to query (default AMP).

AMP
stream_group_id str

Stream group to query (default "default").

PRIMARY_CACHE_STREAM_GROUP_ID

Returns:

Type Description
KpiMetricsResult

Metric values as a (n_channels, n_metrics) numpy array

KpiMetricsResult

with row/column labels.

Raises:

Type Description
RadiensError

On communication failure or server error.

get_kpi_status
get_kpi_status(
    stream_group_id=PRIMARY_CACHE_STREAM_GROUP_ID,
)

Get the current KPI cache status.

Parameters:

Name Type Description Default
stream_group_id str

Stream group to query (default "default").

PRIMARY_CACHE_STREAM_GROUP_ID

Returns:

Type Description
KpiStatus

Number of packets in cache, packet duration, update period,

KpiStatus

memory usage, and tracking state.

Raises:

Type Description
RadiensError

On communication failure or server error.

get_recording_config
get_recording_config()

Get current recording configuration settings.

Returns:

Type Description
RecordingConfig

Current recording configuration including file paths, naming,

RecordingConfig

and recording type settings

Raises:

Type Description
RadiensError

On communication failure or server error

get_signals
get_signals(time_range, signals=None)

Retrieve signal data from the primary live cache.

Parameters:

Name Type Description Default
time_range FlexTimeRange

Time range spec. Most common: TimeRangeSpec.lookback(5.0) or shorthand [duration, float('nan')]. Also accepts [start, end] for absolute SUBSET requests.

required
signals FlexSignalSpec | None

Channel selection — list of amp indices, SignalSpec.amp([...]), or dict for multi-type. None returns all amplifier channels.

None

Returns:

Type Description
SignalArrays

Signal data as numpy arrays (channels x samples).

Raises:

Type Description
RadiensError

On communication failure or server error.

get_sinaps_status_registers
get_sinaps_status_registers()

Get the current Sinaps probe status registers.

Returns:

Type Description
SinapsStatusRegisters

Current status registers including calibration state, active pixel

SinapsStatusRegisters

counts per shank, reference voltages, error flags, and probe

SinapsStatusRegisters

identification information.

Raises:

Type Description
RadiensError

On communication failure or server error.

get_status
get_status()

Get comprehensive system status.

Returns:

Type Description
BackboneStatus

Current streaming status, recording status, port information,

BackboneStatus

connection state, and GPIO channel counts.

Raises:

Type Description
RadiensError

On communication failure or server error.

get_stim_params
get_stim_params()

Get stimulation parameters for all configured channels.

Returns:

Type Description
dict[int, StimParams]

Stimulation parameters keyed by system channel index (ntvAbsKeyIdx).

Raises:

Type Description
RadiensError

On communication failure or server error.

get_stim_step
get_stim_step()

Get current stimulation step size setting.

Returns:

Type Description
StimStepState

Current stimulation step configuration

Raises:

Type Description
RadiensError

On communication failure or server error

get_trigger_state
get_trigger_state()

Get current trigger channel configuration.

Returns:

Type Description
TriggerState

Current trigger state showing enabled channels and ports

Raises:

Type Description
RadiensError

On communication failure or server error

healthcheck
healthcheck(service=ServiceEndpoint.ALLEGO_LIFECYCLE)

Perform lightweight system health verification.

Parameters:

Name Type Description Default
service ServiceEndpoint

Which gRPC service to probe. Defaults to ALLEGO_LIFECYCLE; ALLEGO_CORE is also supported.

ALLEGO_LIFECYCLE

Raises:

Type Description
RadiensError

If the health check fails or the server is unresponsive.

load_all_mosi
load_all_mosi(register_vals)

Load all MOSI register values into the Sinaps probe.

Parameters:

Name Type Description Default
register_vals list[int]

List of 32-bit register values to load.

required

Raises:

Type Description
RadiensError

On communication failure or server error.

manual_stim_trigger
manual_stim_trigger(request)

Manually trigger stimulation.

Deprecated

Use set_stim_trigger() instead.

Parameters:

Name Type Description Default
request ManualStimTriggerRequest

Manual trigger configuration

required

Raises:

Type Description
RadiensError

On communication failure or server error

manual_stim_trigger_toggle
manual_stim_trigger_toggle(request)

Toggle manual stimulation trigger.

Deprecated

Use toggle_stim_trigger() instead.

Parameters:

Name Type Description Default
request ManualStimTriggerToggleRequest

Manual trigger toggle configuration

required

Raises:

Type Description
RadiensError

On communication failure or server error

read_wire_out
read_wire_out(wire_out_address)

Read a wire-out register value from the Sinaps FPGA.

Parameters:

Name Type Description Default
wire_out_address int

Address of the wire-out register to read.

required

Returns:

Type Description
int

Integer value read from the specified wire-out register.

Raises:

Type Description
RadiensError

On communication failure or server error.

restart
restart(*, mode)

Restart the system with the specified backbone mode.

Parameters:

Name Type Description Default
mode BackboneMode

The backbone hardware mode to restart with.

required

Raises:

Type Description
RadiensError

If the restart fails.

scan_ports
scan_ports()

Scan all hardware ports to determine connected headstages and probes.

Returns:

Type Description
ChannelMetadata

Updated channel metadata based on the newly discovered hardware.

Raises:

Type Description
RadiensError

On communication failure or server error

set_core_config
set_core_config(request)

Update core hardware configuration settings.

Deprecated

Use update_core_config() instead.

Parameters:

Name Type Description Default
request SetCoreConfigRequest

Configuration parameters to update.

required

Raises:

Type Description
RadiensError

On communication failure or server error.

set_dac_gain
set_dac_gain(gain)

Set DAC (Analog Output) gain.

Parameters:

Name Type Description Default
gain int

The gain value to set.

required

Raises:

Type Description
RadiensError

On communication failure or server error

set_dac_highpass
set_dac_highpass(enable, cutoff_freq)

Configure DAC (Analog Output) high-pass filter.

Parameters:

Name Type Description Default
enable bool

Whether to enable the high-pass filter.

required
cutoff_freq float

The cutoff frequency in Hz.

required

Raises:

Type Description
RadiensError

On communication failure or server error

set_dac_off
set_dac_off()

Turn off all DAC (Analog Output) streams.

Raises:

Type Description
RadiensError

On communication failure or server error

set_dac_stream
set_dac_stream(dac_idx, ntv_chan_idx)

Map a source channel to a DAC (Analog Output) channel.

Parameters:

Name Type Description Default
dac_idx int

The DAC channel index to configure.

required
ntv_chan_idx int

The source channel index to output.

required

Raises:

Type Description
RadiensError

On communication failure or server error

set_dio_events
set_dio_events(chan_idx, threshold, polarity)

Configure DIO channel to trigger on analog threshold crossings.

Parameters:

Name Type Description Default
chan_idx int

Native channel index.

required
threshold float

Event threshold in microvolts (μV).

required
polarity bool

Event polarity (True for positive-going, False for negative-going).

required

Raises:

Type Description
RadiensError

On communication failure or server error

set_dio_gated
set_dio_gated(polarity)

Set DIO gated mode polarity.

Parameters:

Name Type Description Default
polarity bool

Gated polarity (True for high-active, False for low-active).

required

Raises:

Type Description
RadiensError

On communication failure or server error

set_dio_manual
set_dio_manual(chan_idx, state)

Set DIO channel state manually.

Note

The DIO mode must be set to MANUAL for this to take effect.

Parameters:

Name Type Description Default
chan_idx int

Native channel index.

required
state bool

Desired state (True for high, False for low).

required

Raises:

Type Description
RadiensError

On communication failure or server error

set_dio_pulse
set_dio_pulse(interval_sec, duration_sec, chan_idx=-1)

Configure DIO channel(s) for pulse mode.

Parameters:

Name Type Description Default
interval_sec float

Pulse interval in seconds.

required
duration_sec float

Pulse duration in seconds.

required
chan_idx int

Native channel index (-1 for all channels).

-1

Raises:

Type Description
RadiensError

On communication failure or server error

set_dsp_group
set_dsp_group(
    *,
    stage,
    params,
    stream_group_id=PRIMARY_CACHE_STREAM_GROUP_ID,
)

Update DSP filter configuration for a specific stage.

The server applies per-stage partial updates rather than replacing the full DSPGroup. Use get_dsp_group() to read the current state before making targeted changes.

Parameters:

Name Type Description Default
stage FilterStage

The filter stage to update (e.g. FilterStage.STAGE1).

required
params list[DSPParams]

Filter parameters for this stage.

required
stream_group_id str

The stream group to update (default "default").

PRIMARY_CACHE_STREAM_GROUP_ID
set_kpi_packet_dur
set_kpi_packet_dur(
    packet_dur,
    stream_group_id=PRIMARY_CACHE_STREAM_GROUP_ID,
)

Set the KPI packet duration (integration window).

Parameters:

Name Type Description Default
packet_dur float

Duration of each KPI packet in seconds.

required
stream_group_id str

Stream group to configure (default "default").

PRIMARY_CACHE_STREAM_GROUP_ID

Raises:

Type Description
RadiensError

On communication failure or server error.

set_kpi_update_period
set_kpi_update_period(
    update_period,
    stream_group_id=PRIMARY_CACHE_STREAM_GROUP_ID,
)

Set how often the KPI cache is refreshed from the live signal stream.

Parameters:

Name Type Description Default
update_period float

Update interval in seconds.

required
stream_group_id str

Stream group to configure (default "default").

PRIMARY_CACHE_STREAM_GROUP_ID

Raises:

Type Description
RadiensError

On communication failure or server error.

set_record_state
set_record_state(request)

Set data recording state.

Deprecated

Use start_recording() or stop_recording() instead.

Parameters:

Name Type Description Default
request RecordStateRequest

Record state configuration specifying the desired mode and optional port

required

Raises:

Type Description
RadiensError

If the record state change fails

set_recording_config
set_recording_config(config)

Set recording configuration settings.

Deprecated

Use update_recording_config() instead.

Parameters:

Name Type Description Default
config RecordingConfig

Recording configuration.

required

Raises:

Type Description
RadiensError

On communication failure or server error.

set_stim_params
set_stim_params(params)

Update stimulation parameters for specified channels.

Parameters:

Name Type Description Default
params dict[int, StimParams]

Map from system channel indices to their new stimulation parameters. Each StimParams defines waveform shape, timing, amplitudes, trigger settings, pulse trains, and recovery parameters for that channel.

required

Raises:

Type Description
RadiensError

On communication failure or server error

Note

The underlying gRPC API sets parameters for one channel at a time. This method calls SetStimParams once per channel in the provided dictionary.

Usage

Update stimulation parameters for multiple channels::

# Define stimulation parameters
stim_params = StimParams(
    stim_shape=StimShape.BIPHASIC,
    stim_polarity=StimPolarity.CATHODIC_FIRST,
    first_phase_duration=100.0,  # 100 µs
    second_phase_duration=100.0,  # 100 µs
    interphase_delay=50.0,  # 50 µs
    first_phase_amplitude=100.0,  # 100 µA
    second_phase_amplitude=-100.0,  # 100 µA (opposite polarity)
    baseline_voltage=0.0,
    trigger_edge_or_level=StimTriggerEdge.EDGE,
    trigger_high_or_low=StimTriggerLevel.HIGH,
    enabled=True,
    post_trigger_delay=1000.0,  # 1 ms = 1000 µs
    pulse_or_train=StimPulseMode.SINGLE_PULSE,
    number_of_stim_pulses=1,
    pulse_train_period=20000.0,  # 20 ms = 50 Hz
    refractory_period=10000.0,  # 10 ms
    pre_stim_amp_settle=1000.0,  # 1 ms
    post_stim_amp_settle=1000.0,  # 1 ms
    maintain_amp_settle=False,
    enable_amp_settle=True,
    post_stim_charge_recov_on=1000.0,  # 1 ms
    post_stim_charge_recov_off=0.0,
    enable_charge_recovery=True,
    trigger_source_is_keypress=False,
    trigger_source_idx=0,
    stim_sys_chan_idx=42,
)

# Update channels 42 and 43
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)

Set the stimulation step size.

Parameters:

Name Type Description Default
step StimStep

The stimulation step size to set.

required

Raises:

Type Description
RadiensError

On communication failure or server error.

set_stim_trigger
set_stim_trigger(*, trigger, on)

Set the state of a stimulation keypress trigger.

Parameters:

Name Type Description Default
trigger StimKeypressIndex

The keypress trigger index (1-8).

required
on bool

True to activate the trigger, False to deactivate.

required

Raises:

Type Description
RadiensError

On communication failure or server error.

set_stream_state
set_stream_state(request)

Set data streaming state.

Deprecated

Use start_streaming() or stop_streaming() instead.

Parameters:

Name Type Description Default
request StreamStateRequest

Stream state configuration specifying the desired mode

required

Raises:

Type Description
RadiensError

If the stream state change fails

set_trigger_state
set_trigger_state(*, channel, enabled, port)

Set trigger channel state for stimulation control.

.. deprecated:: Use :meth:enable_trigger, :meth:disable_trigger, or :meth:disable_all_triggers instead.

Parameters:

Name Type Description Default
channel TriggerChannel

Trigger channel identifier.

required
enabled bool

Whether the channel should be enabled.

required
port Port

Hardware port identifier.

required

Raises:

Type Description
RadiensError

On communication failure or server error.

start_recording
start_recording(*, port=None)

Start recording data to disk.

Parameters:

Name Type Description Default
port Port | None

Optional port to start recording on. If omitted, applies system-level control.

None

Raises:

Type Description
RadiensError

If the record state change fails.

start_streaming
start_streaming()

Start data streaming from the hardware.

Raises:

Type Description
RadiensError

If the stream state change fails.

stop_recording
stop_recording(*, port=None)

Stop recording data to disk.

Parameters:

Name Type Description Default
port Port | None

Optional port to stop recording on. If omitted, applies system-level control.

None

Raises:

Type Description
RadiensError

If the record state change fails.

stop_streaming
stop_streaming()

Stop data streaming from the hardware.

Raises:

Type Description
RadiensError

If the stream state change fails.

toggle_stim_trigger
toggle_stim_trigger(*, trigger)

Toggle a stimulation keypress trigger.

Parameters:

Name Type Description Default
trigger StimKeypressIndex

The keypress trigger index (1-8) to toggle.

required

Raises:

Type Description
RadiensError

On communication failure or server error.

transmit_mosi
transmit_mosi()

Transmit the loaded MOSI registers to the Sinaps probe.

Raises:

Type Description
RadiensError

On communication failure or server error.

update_core_config
update_core_config(
    *,
    samp_freq=None,
    loop_dur=None,
    pcache_persistence=None,
    cable_delay=None,
)

Update core hardware configuration settings.

All parameters are optional — only the fields you supply are changed. Fields left as None are not sent to the server and remain unchanged.

Parameters:

Name Type Description Default
samp_freq float | None

Target sampling frequency in Hz.

None
loop_dur float | None

Target stream loop duration in milliseconds.

None
pcache_persistence float | None

PCache persistence duration.

None
cable_delay CableDelay | None

Cable delay configuration for a specific port.

None

Raises:

Type Description
RadiensError

On communication failure or server error.

update_recording_config
update_recording_config(config)

Update recording configuration settings.

The server applies the provided config as a partial update — only the fields present in config are changed. Retrieve the current config with get_recording_config(), modify the fields you need, and pass it back here.

Parameters:

Name Type Description Default
config RecordingConfig

Recording configuration specifying file paths, naming, and recording type (continuous/spikes/both).

required

Raises:

Type Description
RadiensError

On communication failure or server error.

Example

Update the output directory while keeping other settings::

config = client.get_recording_config()
config = config.model_copy(update={"base_file_path": "/new/path"})
client.update_recording_config(config)

BandParams

Bases: BaseModel

Parameters for band-pass or band-stop filter transform nodes.

Attributes

high_frequency instance-attribute
high_frequency

Upper cutoff frequency in Hz.

low_frequency instance-attribute
low_frequency

Lower cutoff frequency in Hz.

order class-attribute instance-attribute
order = None

Filter order; None uses the server default.

BulkSinkParams

Bases: BaseModel

Parameters for BULK_SINK transform nodes.

Attributes

file_type instance-attribute
file_type

Output recording file format.

path instance-attribute
path

Output directory path.

suffix instance-attribute
suffix

Suffix appended to each output file's base name.

BulkSourceParams

Bases: BaseModel

Parameters for BULK_SOURCE transform nodes.

Attributes

sources instance-attribute
sources

One entry per input dataset.

CARParams

Bases: BaseModel

Parameters for Common Average Reference transform nodes (no fields).

CableDelay

Bases: BaseModel

Cable delay configuration for a specific port.

Attributes:

Name Type Description
port Port

The hardware port for which the cable delay is configured. References Port.

cable_delay int

The cable delay value in units specific to the hardware.

is_auto bool

Whether the cable delay is automatically determined by the system.

ChannelSpikeData

Bases: BaseModel

Spike timestamps and neuron labels for a single recording channel.

Attributes:

Name Type Description
ntv_chan_idx int

Native channel index.

timestamps NDArray[float64]

Spike timestamps in seconds, shape (N,).

labels NDArray[int32]

Integer neuron label per spike, shape (N,). Matches the neuron label reported by get_neurons().

waveforms NDArray[float32] | None

Spike waveforms in raw units, shape (N, waveform_n_points), or None if waveforms were not requested.

CoreConfig

Bases: BaseModel

Core hardware configuration retrieved from the server.

Attributes:

Name Type Description
allego_core_server_port str

The network port used by the Allego Core server.

base_samp_freq float

Base sampling frequency in Hertz.

stream_loop_dur_ms int

Stream loop duration in milliseconds.

backbone_mode BackboneMode

Current hardware backbone mode. References BackboneMode.

has_xdaq_gpio_expander bool

Whether the system is equipped with an XDAQ GPIO expander.

cable_delays dict[int, CableDelay]

Mapping of port indices to their respective CableDelay configurations.

CurateClient

Bases: BaseFileClient

Client for data curation operations.

Auto-discovers a running radiensserver on the local machine.

Usage::

with CurateClient() as client:
    meta = client.link_data_file("/path/to/recording.xdat")
    new_meta = client.slice_time(meta, 0, 10, "sliced.xdat")

Functions

apply_protocol
apply_protocol(protocol_id)

Re-apply a previously registered protocol by ID.

Parameters:

Name Type Description Default
protocol_id str

The ID of a protocol already registered with the server (e.g., returned from a previous transform call).

required
bandpass
bandpass(
    dataset, low_freq, high_freq, output_path, *, order=None
)

Apply a band-pass filter to a dataset.

Parameters:

Name Type Description Default
dataset FlexDataset

Dataset to filter (metadata or ID).

required
low_freq float

Lower cutoff frequency in Hz.

required
high_freq float

Upper cutoff frequency in Hz.

required
output_path str | Path

Where to save the result.

required
order int | None

Filter order. If None, the server default is used.

None

Returns:

Type Description
DatasetMetadata

Metadata for the new (filtered) dataset.

bandstop
bandstop(
    dataset, low_freq, high_freq, output_path, *, order=None
)

Apply a band-stop (band-reject) filter to a dataset.

Parameters:

Name Type Description Default
dataset FlexDataset

Dataset to filter (metadata or ID).

required
low_freq float

Lower cutoff frequency in Hz.

required
high_freq float

Upper cutoff frequency in Hz.

required
output_path str | Path

Where to save the result.

required
order int | None

Filter order. If None, the server default is used.

None

Returns:

Type Description
DatasetMetadata

Metadata for the new (filtered) dataset.

bulk_bandpass
bulk_bandpass(
    sources,
    low_freq,
    high_freq,
    output_dir,
    output_suffix,
    *,
    order=None,
)

Apply band-pass filter to multiple datasets at once.

Parameters:

Name Type Description Default
sources Sequence[FlexDataset]

Datasets to filter (metadata or IDs).

required
low_freq float

Lower cutoff frequency in Hz.

required
high_freq float

Upper cutoff frequency in Hz.

required
output_dir str | Path

Directory where output files will be written.

required
output_suffix str

Suffix appended to each output file's base name.

required
order int | None

Filter order. If None, the server default is used.

None
bulk_bandstop
bulk_bandstop(
    sources,
    low_freq,
    high_freq,
    output_dir,
    output_suffix,
    *,
    order=None,
)

Apply band-stop filter to multiple datasets at once.

Parameters:

Name Type Description Default
sources Sequence[FlexDataset]

Datasets to filter (metadata or IDs).

required
low_freq float

Lower cutoff frequency in Hz.

required
high_freq float

Upper cutoff frequency in Hz.

required
output_dir str | Path

Directory where output files will be written.

required
output_suffix str

Suffix appended to each output file's base name.

required
order int | None

Filter order. If None, the server default is used.

None
bulk_downsample
bulk_downsample(sources, factor, output_dir, output_suffix)

Downsample multiple datasets at once.

Parameters:

Name Type Description Default
sources Sequence[FlexDataset]

Datasets to downsample (metadata or IDs).

required
factor int

Downsampling factor (e.g., 2, 4, 10).

required
output_dir str | Path

Directory where output files will be written.

required
output_suffix str

Suffix appended to each output file's base name.

required
bulk_highpass
bulk_highpass(
    sources,
    frequency,
    output_dir,
    output_suffix,
    *,
    order=None,
)

Apply high-pass filter to multiple datasets at once.

Parameters:

Name Type Description Default
sources Sequence[FlexDataset]

Datasets to filter (metadata or IDs).

required
frequency float

Cutoff frequency in Hz.

required
output_dir str | Path

Directory where output files will be written.

required
output_suffix str

Suffix appended to each output file's base name.

required
order int | None

Filter order. If None, the server default is used.

None
bulk_lowpass
bulk_lowpass(
    sources,
    frequency,
    output_dir,
    output_suffix,
    *,
    order=None,
)

Apply low-pass filter to multiple datasets at once.

Parameters:

Name Type Description Default
sources Sequence[FlexDataset]

Datasets to filter (metadata or IDs).

required
frequency float

Cutoff frequency in Hz.

required
output_dir str | Path

Directory where output files will be written.

required
output_suffix str

Suffix appended to each output file's base name.

required
order int | None

Filter order. If None, the server default is used.

None
bulk_notch
bulk_notch(
    sources,
    notch_freq,
    bandwidth,
    output_dir,
    output_suffix,
)

Apply notch filter to multiple datasets at once.

The notch filter is always second-order (scipy.signal.iirnotch). Unlike other IIR filters, it does not accept a custom order.

Parameters:

Name Type Description Default
sources Sequence[FlexDataset]

Datasets to filter (metadata or IDs).

required
notch_freq float

Center frequency to reject in Hz.

required
bandwidth float

Width of the rejection band in Hz.

required
output_dir str | Path

Directory where output files will be written.

required
output_suffix str

Suffix appended to each output file's base name.

required
bulk_slice_time
bulk_slice_time(
    sources, start_sec, end_sec, output_dir, output_suffix
)

Slice multiple datasets in time at once.

Parameters:

Name Type Description Default
sources Sequence[FlexDataset]

Datasets to slice (metadata or IDs).

required
start_sec float

Start time in seconds.

required
end_sec float

End time in seconds.

required
output_dir str | Path

Directory where output files will be written.

required
output_suffix str

Suffix appended to each output file's base name.

required
car
car(dataset, output_path)

Apply Common Average Reference (CAR) re-referencing to a dataset.

Subtracts the mean signal across all channels from each channel. This is the most widely used reference scheme in LFP and spike analysis.

Parameters:

Name Type Description Default
dataset FlexDataset

Dataset to re-reference (metadata or ID).

required
output_path str | Path

Where to save the result.

required

Returns:

Type Description
DatasetMetadata

Metadata for the new (re-referenced) dataset.

clear_data_sources
clear_data_sources(dsource_ids)

Clear (unlink) data sources from the server.

Parameters:

Name Type Description Default
dsource_ids list[str] | str

List of IDs (or a single ID) to clear.

required

Returns:

Type Description
list[str]

List of successfully cleared IDs.

close
close()

Close all gRPC channels managed by this client.

copy_data_source_file
copy_data_source_file(src_path, dest_path, *, force=False)

Copy a server-side data source file to a new location.

Parameters:

Name Type Description Default
src_path str | Path

Source file path on the server.

required
dest_path str | Path

Destination file path on the server.

required
force bool

If True, overwrite existing destination file.

False
downsample
downsample(dataset, factor, output_path)

Downsample a dataset.

Parameters:

Name Type Description Default
dataset FlexDataset

Dataset to downsample (metadata or ID).

required
factor int

Downsampling factor (e.g., 2, 4, 10).

required
output_path str | Path

Where to save the result.

required

Returns:

Type Description
DatasetMetadata

Metadata for the new (downsampled) dataset.

export_data_source
export_data_source(dsource, dest_path, force=False)

Export a data source to a new file.

Parameters:

Name Type Description Default
dsource FlexDataset

The data source to export (ID or metadata object).

required
dest_path str | Path

Destination file path.

required
force bool

If True, overwrite existing destination file.

False
get_all_protocols
get_all_protocols()

List all saved protocols on the server.

Returns:

Type Description
list[ProtocolSpec]

Summary of every protocol currently registered.

get_protocol
get_protocol(protocol_id)

Retrieve a saved protocol by ID.

Parameters:

Name Type Description Default
protocol_id str

ID of the protocol to retrieve.

required

Returns:

Type Description
ProtocolSpec

Minimal summary of the protocol.

healthcheck
healthcheck(service=ServiceEndpoint.RADIENS_LIFECYCLE)

Verify the radiensserver is responsive.

Parameters:

Name Type Description Default
service ServiceEndpoint

Which gRPC service to probe (default RADIENS_LIFECYCLE). RADIENS_CORE is also supported.

RADIENS_LIFECYCLE

Raises:

Type Description
RadiensError

If the health check fails or the server is unresponsive.

highpass
highpass(dataset, frequency, output_path, *, order=None)

Apply a high-pass filter to a dataset.

Parameters:

Name Type Description Default
dataset FlexDataset

Dataset to filter (metadata or ID).

required
frequency float

Cutoff frequency in Hz.

required
output_path str | Path

Where to save the result.

required
order int | None

Filter order. If None, the server default is used.

None

Returns:

Type Description
DatasetMetadata

Metadata for the new (filtered) dataset.

link_data_file(path)

Link a recording file and return its metadata.

Also discovers and registers any associated .spikes file found alongside the recording. If found, the returned DatasetMetadata will have associated_spikes_ids populated, enabling the spike data methods on VidereClient.

Parameters:

Name Type Description Default
path str | Path

Path to the recording file (e.g. .xdat, .rhd).

required

Returns:

Type Description
DatasetMetadata

Metadata for the linked dataset.

Raises:

Type Description
RadiensError

On communication failure or server error.

list_data_source_ids
list_data_source_ids()

List IDs of all currently linked data sources.

Returns:

Type Description
list[str]

List of data source IDs.

list_data_sources
list_data_sources(dsource_ids=None)

List linked data sources and their metadata.

Parameters:

Name Type Description Default
dsource_ids list[str] | str | None

Optional list of specific IDs to query. If None, lists all.

None

Returns:

Type Description
dict[str, DatasetMetadata]

Map of data source ID to metadata.

list_directory
list_directory(directory)

List files in a remote server-side directory.

Parameters:

Name Type Description Default
directory str | Path

Server-side directory path to list.

required

Returns:

Type Description
list[FileInfo]

Metadata for each file found in the directory.

lowpass
lowpass(dataset, frequency, output_path, *, order=None)

Apply a low-pass filter to a dataset.

Parameters:

Name Type Description Default
dataset FlexDataset

Dataset to filter (metadata or ID).

required
frequency float

Cutoff frequency in Hz.

required
output_path str | Path

Where to save the result.

required
order int | None

Filter order. If None, the server default is used.

None

Returns:

Type Description
DatasetMetadata

Metadata for the new (filtered) dataset.

move_data_source_file
move_data_source_file(src_path, dest_path, *, force=False)

Move a server-side data source file to a new location.

Parameters:

Name Type Description Default
src_path str | Path

Source file path on the server.

required
dest_path str | Path

Destination file path on the server.

required
force bool

If True, overwrite existing destination file.

False
notch
notch(dataset, frequency, bandwidth, output_path)

Apply a notch filter to a dataset.

The notch filter is always second-order (scipy.signal.iirnotch). Unlike other IIR filters, it does not accept a custom order.

Parameters:

Name Type Description Default
dataset FlexDataset

Dataset to filter (metadata or ID).

required
frequency float

Center frequency to reject, in Hz (e.g., 60.0 for line noise).

required
bandwidth float

Width of the rejection band in Hz.

required
output_path str | Path

Where to save the result.

required

Returns:

Type Description
DatasetMetadata

Metadata for the new (filtered) dataset.

paired_ref
paired_ref(
    dataset, ref_channel, target_channel, output_path
)

Apply paired re-referencing between two specific channels.

References one target channel against one reference channel.

Parameters:

Name Type Description Default
dataset FlexDataset

Dataset to re-reference (metadata or ID).

required
ref_channel int

Native channel index of the reference electrode.

required
target_channel int

Native channel index of the channel to re-reference.

required
output_path str | Path

Where to save the result.

required

Returns:

Type Description
DatasetMetadata

Metadata for the new (re-referenced) dataset.

remove_data_source_file
remove_data_source_file(path, *, force=False)

Remove a server-side data source file.

Parameters:

Name Type Description Default
path str | Path

File path on the server to remove.

required
force bool

If True, force removal even if the file is in use.

False
set_protocol
set_protocol(nodes, edges, *, protocol_id=None)

Register a custom protocol with the server.

Build a directed acyclic graph of transform nodes and register it for later execution with apply_protocol(). The server validates the graph and returns a summary.

Use TransformNode factory methods to construct nodes, and TransformEdge to wire them together::

src  = TransformNode.source(meta)
hp   = TransformNode.highpass(300.0)
car  = TransformNode.car()
snk  = TransformNode.sink("result", "/output", RadiensFileType.XDAT)

edges = [
    TransformEdge(source=src.id, target=hp.id),
    TransformEdge(source=hp.id, target=car.id),
    TransformEdge(source=car.id, target=snk.id),
]

spec = client.set_protocol([src, hp, car, snk], edges)
client.apply_protocol(spec.id)

Parameters:

Name Type Description Default
nodes list[TransformNode]

Ordered list of transform nodes forming the graph.

required
edges list[TransformEdge]

Directed edges connecting the nodes by ID.

required
protocol_id str | None

Optional protocol ID. A UUID is generated if not provided.

None

Returns:

Type Description
ProtocolSpec

Summary of the validated (server-registered) protocol.

Raises:

Type Description
RadiensError

If the server marks one or more nodes as invalid.

slice_channels
slice_channels(dataset, channels, output_path)

Select a subset of channels from a dataset.

Parameters:

Name Type Description Default
dataset FlexDataset

Dataset to slice (metadata or ID).

required
channels Sequence[int]

System-wide channel indices to keep.

required
output_path str | Path

Where to save the result.

required

Returns:

Type Description
DatasetMetadata

Metadata for the new dataset containing only the selected channels.

slice_time
slice_time(dataset, start_sec, end_sec, output_path)

Slice a dataset in time.

Parameters:

Name Type Description Default
dataset FlexDataset

Dataset to slice (metadata or ID).

required
start_sec float

Start time in seconds.

required
end_sec float

End time in seconds.

required
output_path str | Path

Where to save the result.

required

Returns:

Type Description
DatasetMetadata

Metadata for the new (sliced) dataset.

virtual_ref
virtual_ref(dataset, ref_channel, output_path)

Apply virtual reference re-referencing to a dataset.

References all channels against a single nominated electrode.

Parameters:

Name Type Description Default
dataset FlexDataset

Dataset to re-reference (metadata or ID).

required
ref_channel int

Native channel index of the reference electrode.

required
output_path str | Path

Where to save the result.

required

Returns:

Type Description
DatasetMetadata

Metadata for the new (re-referenced) dataset.

DownsampleParams

Bases: BaseModel

Parameters for downsample transform nodes.

Attributes

factor instance-attribute
factor

Downsampling factor (e.g., 2, 4, 10).

FileInfo

Bases: BaseModel

Filesystem entry metadata returned by list_directory.

Attributes:

Name Type Description
path str

Full filesystem path to the file.

base_name str

Base name of the file without directory components.

file_type RadiensFileType

Type of the recording file. References RadiensFileType.

dataset_uid str

Unique identifier for the dataset.

num_channels int

Number of channels in the file.

duration_sec float

Total duration of the recording in seconds.

sample_rate int

Sampling rate in Hertz.

num_bytes int

Size of the file in bytes.

HighLowPassParams

Bases: BaseModel

Parameters for high-pass or low-pass filter transform nodes.

Attributes

frequency instance-attribute
frequency

Cutoff frequency in Hz.

order class-attribute instance-attribute
order = None

Filter order; None uses the server default.

KpiMetric

Bases: IntEnum

KPI metric identifier. Values match proto common.KpiMetricsEnum.

KpiMetricId

Bases: BaseModel

Identifies a single KPI metric (mode + name pair).

mode The computation mode (BASE, AVG, or STREAM). name The metric to compute.

KpiMetricsResult

Bases: BaseModel

Result of a KPI metrics query.

values is a 2-D numpy array of shape (n_channels, n_metrics) where rows correspond to channel_indices and columns to metrics.

channel_indices Native channel indices (ntvIdxs) in row order. metrics KPI metric IDs in column order. signal_type Signal type for all channels in this result. values Metric values: shape (n_channels, n_metrics). time_range Time range over which these metrics were computed.

KpiMode

Bases: IntEnum

KPI computation mode. Values match proto common.KpiMetricsMode.

KpiStatus

Bases: BaseModel

Status of the KPI computation cache.

stream_group_id Stream group or datasource ID this status belongs to. num_packets_memory Number of KPI packets held in memory. packet_dur Duration of each KPI packet in seconds. update_period How often the KPI cache is updated, in seconds. persistence Exponential averaging persistence factor. beta Beta parameter for the averaging filter. is_tracking_signal_cache Whether the KPI cache is currently tracking the live signal cache. num_packets Total number of packets processed. memory_bytes Approximate memory used by the KPI cache in bytes. num_sigs Number of signals being tracked (None if not yet active). time_range Time range covered by the current KPI cache (None if not yet active).

NeuronInfo

Bases: BaseModel

Descriptive statistics for a single sorted neuron.

Attributes:

Name Type Description
neuron_id str

Unique neuron identifier string.

site_ntv_chan_idx int

Native channel index of the primary recording site.

spike_label str

Neuron label as a string (e.g. "1", "2").

spike_count int

Total number of spikes detected.

spike_rate float

Mean spike rate in Hz.

mean_abs_peak_wfm float

Mean absolute peak waveform amplitude.

snr float

Signal-to-noise ratio.

pos_probe list[float]

Probe coordinate [x, y, z] in microns.

pos_tissue list[float]

Tissue coordinate [x, y, z] in microns.

NeuronSpikeData

Bases: BaseModel

Spike timestamps for a single sorted neuron.

Attributes:

Name Type Description
label int

Integer neuron label. Correlates with NeuronInfo.spike_label (string) from get_neurons().

ntv_chan_idx int

Native channel index of the primary recording site for this neuron. -1 if the channel could not be determined from the spike spec.

timestamps NDArray[float64]

Spike timestamps in seconds, shape (N,).

waveforms NDArray[float32] | None

Spike waveforms in raw units, shape (N, waveform_n_points), or None if waveforms were not requested.

NeuronsResult

Bases: BaseModel

Neuron descriptors organized by recording channel.

Attributes:

Name Type Description
neurons_by_channel dict[int, list[NeuronInfo]]

Map from native channel index to a list of neuron descriptors detected on that channel.

NotchParams

Bases: BaseModel

Parameters for notch filter transform nodes.

Note

The notch filter is always second-order (scipy.signal.iirnotch). Unlike other IIR filters, it does not accept a custom order.

Attributes

bandwidth instance-attribute
bandwidth

Width of the rejection band in Hz.

notch_frequency instance-attribute
notch_frequency

Center frequency to reject in Hz.

PairedRefParams

Bases: BaseModel

Parameters for paired reference transform nodes.

Attributes

ref_channel instance-attribute
ref_channel

Native channel index of the reference electrode.

target_channel instance-attribute
target_channel

Native channel index of the channel to re-reference.

ProtocolSpec

Bases: BaseModel

Minimal summary of a saved protocol.

Returned by get_protocol and get_all_protocols.

Attributes:

Name Type Description
id str

Unique identifier for the protocol.

node_count int

Number of nodes defined in the protocol.

ServiceEndpoint

Bases: StrEnum

gRPC service endpoint identifier.

Mirrors the proto GrpcServiceType enum values used as keys in the ServerSpec.service map returned by GetRadiensServers.

SetCoreConfigRequest

Bases: BaseModel

Request to update core hardware configuration.

Attributes:

Name Type Description
samp_freq float | None

Target sampling frequency in Hertz. Defaults to None.

loop_dur float | None

Target loop duration in milliseconds. Defaults to None.

pcache_persistence float | None

PCache persistence duration. Defaults to None.

cable_delay CableDelay | None

Specific cable delay configuration to set. References CableDelay. Defaults to None.

SinkParams

Bases: BaseModel

Parameters for SINK transform nodes.

Attributes

base_name instance-attribute
base_name

Output base filename (without extension or directory).

file_type instance-attribute
file_type

Output recording file format.

path instance-attribute
path

Output directory path.

SliceChannelsParams

Bases: BaseModel

Parameters for channel-slice transform nodes.

Attributes

channels instance-attribute
channels

System-wide channel indices to keep.

SliceTimeParams

Bases: BaseModel

Parameters for time-slice transform nodes.

Attributes

end_sec instance-attribute
end_sec

End of the time window in seconds.

start_sec instance-attribute
start_sec

Start of the time window in seconds.

SourceParams

Bases: BaseModel

Parameters for SOURCE transform nodes.

Attributes

base_name instance-attribute
base_name

Base filename (without extension or directory).

dataset_id class-attribute instance-attribute
dataset_id = ''

ID of the linked dataset (empty for new sources).

file_type instance-attribute
file_type

Recording file format.

path instance-attribute
path

Directory path containing the dataset.

SpikesSpec

Bases: BaseModel

Spike interface metadata for a linked dataset.

Attributes:

Name Type Description
biointerface_id str

Unique identifier for the spike interface; used as spikeSorterID in RPC calls that require it.

dataset_uid str

Dataset UID this spike interface is associated with.

num_neurons int

Total number of sorted neurons across all channels.

num_sites int

Number of recording sites (channels) with spike data.

enabled_channel_indices list[int]

Native channel indices of enabled recording sites, sorted in ascending order.

time_range tuple[float, float]

Full time range of the recording in seconds (start, end).

spike_time_range tuple[float, float]

Time range over which spike data is available in seconds (start, end).

TransformEdge

Bases: BaseModel

A directed edge connecting two nodes in a protocol graph.

Use the source and target fields to specify connectivity by node ID.

Attributes

id class-attribute instance-attribute
id = Field(default_factory=lambda: str(uuid4()))

Edge ID (auto-generated UUID if not provided).

source instance-attribute
source

ID of the source transform node.

target instance-attribute
target

ID of the target transform node.

TransformNode

Bases: BaseModel

A node in a curation protocol transform graph.

Construct nodes using the factory class methods for convenience::

src = TransformNode.source(dataset_meta)
hp  = TransformNode.highpass(frequency=300.0)
snk = TransformNode.sink("filtered", "/output", RadiensFileType.XDAT)

edges = [
    TransformEdge(source=src.id, target=hp.id),
    TransformEdge(source=hp.id, target=snk.id),
]

Then pass [src, hp, snk] and edges to CurateClient.set_protocol().

Notes

Each factory method sets the correct type and params for its transform. When constructing manually, the params object must match the type (e.g., CAR_REF requires params=CARParams()).

Attributes

id class-attribute instance-attribute
id = Field(default_factory=lambda: str(uuid4()))

Node ID (auto-generated UUID if not provided).

params class-attribute instance-attribute
params = None

Operation parameters; see each factory method for the expected type.

type instance-attribute
type

Transform operation this node performs.

Functions

bandpass classmethod
bandpass(low_frequency, high_frequency, order=None)

Create a BANDPASS_FILTER node.

low_frequency: Lower cutoff frequency in Hz. high_frequency: Upper cutoff frequency in Hz. order: Filter order; None uses the server default.

bandstop classmethod
bandstop(low_frequency, high_frequency, order=None)

Create a BANDSTOP_FILTER node.

low_frequency: Lower cutoff frequency in Hz. high_frequency: Upper cutoff frequency in Hz. order: Filter order; None uses the server default.

bulk_sink classmethod
bulk_sink(suffix, path, file_type)

Create a BULK_SINK node.

suffix: Suffix appended to each output file's base name. path: Output directory path. file_type: Output recording file format.

bulk_source classmethod
bulk_source(datasets)

Create a BULK_SOURCE node from multiple linked datasets.

datasets: Metadata for all input datasets.

car classmethod
car()

Create a CAR_REF (Common Average Reference) node.

downsample classmethod
downsample(factor)

Create a DOWNSAMPLE node.

factor: Downsampling factor (e.g., 2, 4, 10).

highpass classmethod
highpass(frequency, order=None)

Create a HIGHPASS_FILTER node.

frequency: Cutoff frequency in Hz. order: Filter order; None uses the server default.

lowpass classmethod
lowpass(frequency, order=None)

Create a LOWPASS_FILTER node.

frequency: Cutoff frequency in Hz. order: Filter order; None uses the server default.

notch classmethod
notch(notch_frequency, bandwidth)

Create a NOTCH_FILTER node.

The notch filter is always second-order (scipy.signal.iirnotch). Unlike other IIR filters, it does not accept a custom order.

notch_frequency: Center frequency to reject in Hz. bandwidth: Width of the rejection band in Hz.

paired_ref classmethod
paired_ref(ref_channel, target_channel)

Create a PAIRED_REF node.

ref_channel: Native channel index of the reference electrode. target_channel: Native channel index of the channel to re-reference.

sink classmethod
sink(base_name, path, file_type)

Create a SINK node.

base_name: Output base filename (without extension or directory). path: Output directory path. file_type: Output recording file format.

slice_channels classmethod
slice_channels(channels)

Create a SLICE_CHANNELS node.

channels: System-wide channel indices to keep.

slice_time classmethod
slice_time(start_sec, end_sec)

Create a SLICE_TIME node.

start_sec: Start of the time window in seconds. end_sec: End of the time window in seconds.

source classmethod
source(dataset)

Create a SOURCE node from a linked dataset.

dataset: Metadata for the input dataset (returned by link_data_file).

virtual_ref classmethod
virtual_ref(ref_channel)

Create a VIRTUAL_REF node.

ref_channel: Native channel index of the reference electrode.

TransformNodeType

Bases: IntEnum

Transform node type for curation protocol graphs.

Values match proto common.TransformNodeType.

TriggerChannel

Bases: IntEnum

Trigger channel identifier. Values match proto allego.TriggerChannel.

VidereClient

Bases: BaseFileClient

Client for offline file-based analysis.

Auto-discovers a running radiensserver on the local machine.

Usage::

with VidereClient() as client:
    meta = client.link_data_file("/path/to/recording.xdat")
    sigs = client.get_signals(meta, time_range=[0, 1], signals=[0, 1, 2])

Functions

clear_data_sources
clear_data_sources(dsource_ids)

Clear (unlink) data sources from the server.

Parameters:

Name Type Description Default
dsource_ids list[str] | str

List of IDs (or a single ID) to clear.

required

Returns:

Type Description
list[str]

List of successfully cleared IDs.

close
close()

Close all gRPC channels managed by this client.

copy_data_source_file
copy_data_source_file(src_path, dest_path, *, force=False)

Copy a server-side data source file to a new location.

Parameters:

Name Type Description Default
src_path str | Path

Source file path on the server.

required
dest_path str | Path

Destination file path on the server.

required
force bool

If True, overwrite existing destination file.

False
export_data_source
export_data_source(dsource, dest_path, force=False)

Export a data source to a new file.

Parameters:

Name Type Description Default
dsource FlexDataset

The data source to export (ID or metadata object).

required
dest_path str | Path

Destination file path.

required
force bool

If True, overwrite existing destination file.

False
get_dsp_group
get_dsp_group(dataset)

Get DSP filter configuration for a dataset.

Parameters:

Name Type Description Default
dataset FlexDataset

Dataset to query (metadata object, ID string, or file path).

required

Returns:

Type Description
DSPGroup

The current hardware and software filter parameters.

get_kpi_metrics
get_kpi_metrics(
    dataset,
    metrics,
    channel_indices=None,
    time_range=None,
    signal_type=SignalType.AMP,
)

Retrieve computed KPI signal metrics for a linked dataset.

Parameters:

Name Type Description Default
dataset FlexDataset

Dataset to query (metadata object, ID string, or file path).

required
metrics list[KpiMetricId]

List of KPI metric identifiers to retrieve.

required
channel_indices list[int] | None

Native channel indices (ntvIdxs) to query. None returns metrics for all channels.

None
time_range FlexTimeRange | None

Time range within the dataset (e.g. [start, end] in seconds). None returns metrics over the full recording. Lookback mode is not supported for offline files.

None
signal_type SignalType

Signal type to query (default AMP).

AMP

Returns:

Type Description
KpiMetricsResult

Metric values as a (n_channels, n_metrics) numpy array with row/column labels.

Raises:

Type Description
ValueError

If lookback time range mode is used (not supported offline).

RadiensError

On communication failure or server error.

get_kpi_status
get_kpi_status(dataset)

Get the current KPI cache status for a dataset.

Parameters:

Name Type Description Default
dataset FlexDataset

Dataset to query (metadata object, ID string, or file path).

required

Returns:

Type Description
KpiStatus

Number of packets in cache, packet duration, memory usage, and availability state.

get_neurons
get_neurons(dataset, channels=None, time_range=None)

Retrieve neuron descriptors for a linked dataset.

Returns spike count, rate, SNR, waveform peak amplitude, and probe position for each sorted neuron, organized by recording channel.

Parameters:

Name Type Description Default
dataset FlexDataset

Dataset to query (metadata object, ID string, or file path).

required
channels FlexSignalSpec | None

Channels to include. Accepts a list[int] of amplifier channel indices, a SignalSpec, "all", or None. None returns all amplifier channels.

None
time_range FlexTimeRange | None

Time range within the dataset (e.g. [start, end] in seconds). None returns neurons over the full recording. Lookback mode is not supported for offline files.

None

Returns:

Type Description
NeuronsResult

Neuron descriptors grouped by native channel index.

Raises:

Type Description
ValueError

If lookback time range mode is used (not supported offline).

RadiensError

On communication failure or server error.

get_signals
get_signals(dataset, time_range=None, signals=None)

Retrieve signal data for a specific time range and channel selection.

Parameters:

Name Type Description Default
dataset FlexDataset

Dataset to query (metadata object, ID string, or file path).

required
time_range FlexTimeRange | None

Time range specification (e.g. [start, end] in seconds). None returns the full recording. Lookback mode is not supported for offline files.

None
signals FlexSignalSpec | None

Signal selection (e.g. list of amplifier channel indices). None returns all amplifier channels.

None

Returns:

Type Description
SignalArrays

The requested signal data as numpy arrays.

Raises:

Type Description
ValueError

If lookback time range mode is used (not supported offline).

RadiensError

On communication failure or server error.

get_spikes_by_channel
get_spikes_by_channel(
    dataset,
    channels=None,
    time_range=None,
    include_waveforms=False,
)

Retrieve spike timestamps and neuron labels per recording channel.

Returns one ChannelSpikeData entry per channel that has spikes in the requested time range.

Parameters:

Name Type Description Default
dataset FlexDataset

Dataset to query (metadata object, ID string, or file path).

required
channels FlexSignalSpec | None

Channels to include. Accepts a list[int] of amplifier channel indices, a SignalSpec, "all", or None. None returns all amplifier channels.

None
time_range FlexTimeRange | None

Time range within the dataset (e.g. [start, end] in seconds). None returns spikes over the full recording. Lookback mode is not supported for offline files.

None
include_waveforms bool

If True, also fetch waveform snippets for each spike. Adds a second RPC call. Default False.

False

Returns:

Type Description
dict[int, ChannelSpikeData]

Map from native channel index to spike data.

Raises:

Type Description
ValueError

If lookback time range mode is used (not supported offline).

RadiensError

On communication failure or server error.

get_spikes_by_neuron
get_spikes_by_neuron(
    dataset,
    channels=None,
    time_range=None,
    include_waveforms=False,
)

Retrieve spike timestamps per sorted neuron.

Same data as get_spikes_by_channel() but regrouped by neuron identity rather than by channel.

Parameters:

Name Type Description Default
dataset FlexDataset

Dataset to query (metadata object, ID string, or file path).

required
channels FlexSignalSpec | None

Channels to include. Accepts a list[int] of amplifier channel indices, a SignalSpec, "all", or None. None returns all amplifier channels.

None
time_range FlexTimeRange | None

Time range within the dataset (e.g. [start, end] in seconds). None returns spikes over the full recording. Lookback mode is not supported for offline files.

None
include_waveforms bool

If True, also fetch waveform snippets for each spike. Adds a second RPC call. Default False.

False

Returns:

Type Description
dict[int, NeuronSpikeData]

Map from integer neuron label to spike data.

Raises:

Type Description
ValueError

If lookback time range mode is used (not supported offline).

RadiensError

On communication failure or server error.

get_spikes_spec
get_spikes_spec(dataset)

Retrieve spike interface metadata for a linked dataset.

Parameters:

Name Type Description Default
dataset FlexDataset

Dataset to query (metadata object, ID string, or file path).

required

Returns:

Type Description
SpikesSpec

Spike metadata including the biointerface ID, enabled channel indices, and spike time range.

Raises:

Type Description
RadiensError

On communication failure or server error.

healthcheck
healthcheck(service=ServiceEndpoint.RADIENS_LIFECYCLE)

Verify the radiensserver is responsive.

Parameters:

Name Type Description Default
service ServiceEndpoint

Which gRPC service to probe (default RADIENS_LIFECYCLE). RADIENS_CORE is also supported.

RADIENS_LIFECYCLE

Raises:

Type Description
RadiensError

If the health check fails or the server is unresponsive.

kpi_calculate
kpi_calculate(dataset)

Trigger KPI computation for a linked dataset.

Must be called before get_kpi_metrics returns useful data on a freshly linked file.

Parameters:

Name Type Description Default
dataset FlexDataset

Dataset to compute KPIs for (metadata object, ID string, or file path).

required

Raises:

Type Description
RadiensError

On communication failure or server error.

kpi_clear
kpi_clear(dataset)

Clear the KPI cache for a dataset.

Resets accumulated KPI state. Useful before rerunning with changed parameters.

Parameters:

Name Type Description Default
dataset FlexDataset

Dataset to clear KPI state for (metadata object, ID string, or file path).

required

Raises:

Type Description
RadiensError

On communication failure or server error.

link_data_file(path)

Link a recording file and return its metadata.

Also discovers and registers any associated .spikes file found alongside the recording. If found, the returned DatasetMetadata will have associated_spikes_ids populated, enabling the spike data methods on VidereClient.

Parameters:

Name Type Description Default
path str | Path

Path to the recording file (e.g. .xdat, .rhd).

required

Returns:

Type Description
DatasetMetadata

Metadata for the linked dataset.

Raises:

Type Description
RadiensError

On communication failure or server error.

list_data_source_ids
list_data_source_ids()

List IDs of all currently linked data sources.

Returns:

Type Description
list[str]

List of data source IDs.

list_data_sources
list_data_sources(dsource_ids=None)

List linked data sources and their metadata.

Parameters:

Name Type Description Default
dsource_ids list[str] | str | None

Optional list of specific IDs to query. If None, lists all.

None

Returns:

Type Description
dict[str, DatasetMetadata]

Map of data source ID to metadata.

list_directory
list_directory(directory)

List files in a remote server-side directory.

Parameters:

Name Type Description Default
directory str | Path

Server-side directory path to list.

required

Returns:

Type Description
list[FileInfo]

Metadata for each file found in the directory.

move_data_source_file
move_data_source_file(src_path, dest_path, *, force=False)

Move a server-side data source file to a new location.

Parameters:

Name Type Description Default
src_path str | Path

Source file path on the server.

required
dest_path str | Path

Destination file path on the server.

required
force bool

If True, overwrite existing destination file.

False
remove_data_source_file
remove_data_source_file(path, *, force=False)

Remove a server-side data source file.

Parameters:

Name Type Description Default
path str | Path

File path on the server to remove.

required
force bool

If True, force removal even if the file is in use.

False
set_dsp_group
set_dsp_group(dataset, *, stage, params)

Update DSP filter configuration for a specific dataset and stage.

Parameters:

Name Type Description Default
dataset FlexDataset

Dataset to update (metadata object, ID string, or file path).

required
stage FilterStage

The filter stage to update (e.g. STAGE1, STAGE2).

required
params list[DSPParams]

List of filter parameters for this stage.

required
set_kpi_packet_dur
set_kpi_packet_dur(dataset, packet_dur)

Set the KPI packet duration (integration window) for a dataset.

Parameters:

Name Type Description Default
dataset FlexDataset

Dataset to configure (metadata object, ID string, or file path).

required
packet_dur float

Duration of each KPI packet in seconds.

required

Raises:

Type Description
RadiensError

On communication failure or server error.

VirtualRefParams

Bases: BaseModel

Parameters for virtual reference transform nodes.

Attributes

ref_channel instance-attribute
ref_channel

Native channel index of the reference electrode.