Skip to content

radiens_core.videre_client

VidereClient — offline file-based analysis client.

Attributes

Classes

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_detect_params
get_detect_params(spike_sorter_id, channels=None)

Fetch active detection configurations per channel.

Parameters:

Name Type Description Default
spike_sorter_id str

Unique ID of the spike sorter.

required
channels list[int] | None

Optional list of native channel indices. If None, returns params for all configured channels.

None

Returns:

Type Description
dict[int, SpikeDetectParams]

Map from native channel index to its SpikeDetectParams.

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,
    *,
    spikes_id=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
spikes_id str | None

Explicit spikes datasource ID. When None (the default), uses the first entry from DatasetMetadata.associated_spikes_ids.

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_spike_sorter_dashboard
get_spike_sorter_dashboard(spike_sorter_id, elements=None)

Get the spike sorter dashboard for monitoring sorting progress.

Parameters:

Name Type Description Default
spike_sorter_id str

Unique ID of the spike sorter to query.

required
elements list[DashElement] | None

Optional list of dashboard elements to include. If None, returns all default elements.

None

Returns:

Type Description
SpikeSorterDashboard

Comprehensive dashboard data including summary metrics and port status.

get_spike_sorter_ids
get_spike_sorter_ids(dataset)

Get the IDs of all active spike sorters for a dataset.

Parameters:

Name Type Description Default
dataset FlexDataset

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

required

Returns:

Type Description
list[str]

List of active spike sorter IDs.

get_spike_sorter_state
get_spike_sorter_state(spike_sorter_id)

Get the current state and progress of a spike sorter.

Parameters:

Name Type Description Default
spike_sorter_id str

Unique ID of the spike sorter to query.

required

Returns:

Type Description
SpikeSorterState

Current state including system status, progress, and messages.

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

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
spikes_id str | None

Explicit spikes datasource ID. When None (the default), uses the first entry from DatasetMetadata.associated_spikes_ids.

None

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,
    *,
    spikes_id=None,
)

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
spikes_id str | None

Explicit spikes datasource ID. When None (the default), uses the first entry from DatasetMetadata.associated_spikes_ids.

None

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, *, spikes_id=None)

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
spikes_id str | None

Explicit spikes datasource ID. When None (the default), uses the first entry from DatasetMetadata.associated_spikes_ids.

None

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(fpath, file_type=None)

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

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_detect_params
set_detect_params(spike_sorter_id, params, channels)

Bulk-apply threshold, shadow, and window updates to targeted channels.

Fields in params that are None will not be modified.

Parameters:

Name Type Description Default
spike_sorter_id str

Unique ID of the spike sorter.

required
params SpikeDetectParams

The detection parameters to apply.

required
channels list[int]

List of native channel indices to apply the parameters to.

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

spike_sorter_cancel
spike_sorter_cancel(spike_sorter_id)

Cancel a running spike sorter.

Sends an OFF command. After this call, the server removes the sorter immediately — subsequent calls to get_spike_sorter_state or get_spike_sorter_dashboard with the same ID will raise ServerCommunicationError ("not found"). Use spike_sorter_delete() afterward only if auto-cleanup did not occur.

Equivalent to spike_sorter_command(id, SpikeSorterCommand.OFF).

Parameters:

Name Type Description Default
spike_sorter_id str

Unique ID of the spike sorter to cancel.

required
spike_sorter_command
spike_sorter_command(
    spike_sorter_id,
    cmd,
    *,
    sub_cmd=SpikeSorterSubCommand.NULL,
)

Send a command to a running spike sorter.

Parameters:

Name Type Description Default
spike_sorter_id str

Unique ID of the spike sorter to control.

required
cmd SpikeSorterCommand

The command to execute (e.g., OFF, REBASE, CLEAR_SORT).

required
sub_cmd SpikeSorterSubCommand

Optional sub-command modifier.

NULL
spike_sorter_delete
spike_sorter_delete(spike_sorter_id)

Delete a spike sorter and release its resources.

Parameters:

Name Type Description Default
spike_sorter_id str

Unique ID of the spike sorter to delete.

required

Raises:

Type Description
RadiensError

On communication failure or server error.

spike_sorter_launch
spike_sorter_launch(params)

Launch a new spike sorter on a dataset.

Parameters:

Name Type Description Default
params SpikeSorterLaunchParams

Parameters for the sorter launch, including the target dataset ID, optional clustering/feature parameters, and noise discovery settings.

required

Returns:

Type Description
SpikeSorterLaunchResult

The unique ID and type of the launched sorter.

Raises:

Type Description
RadiensError

On communication failure or server error.

Functions