Skip to content

radiens_core.videre_client

VidereClient — offline file-based analysis client.

Classes

VidereClient

Bases: BaseFileClient

Client for offline file-based analysis.

Auto-discovers a running Radiens server on the local machine.

Methods taking a dataset accept its metadata, its ID, or a file path. A string is read as a path only if it contains a directory separator (e.g. ./rec.xdat); otherwise it is taken as an ID, and an unknown ID raises ValueError. Pass a Path for a file in the working directory.

Example
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])
METHOD DESCRIPTION
apply_protocol

Run a protocol registered with set_protocol().

bandpass

Apply a band-pass filter to a dataset.

bandstop

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

bulk_bandpass

Apply band-pass filter to multiple datasets at once.

bulk_bandstop

Apply band-stop filter to multiple datasets at once.

bulk_downsample

Downsample multiple datasets at once.

bulk_highpass

Apply high-pass filter to multiple datasets at once.

bulk_lowpass

Apply low-pass filter to multiple datasets at once.

bulk_notch

Apply notch filter to multiple datasets at once.

bulk_slice_time

Slice multiple datasets in time at once.

car

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

clear_data_sources

Clear (unlink) data sources from the server.

close

Close the client's server connections.

copy_data_source_file

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

deselect_channels

Remove signals from a dataset's selection, leaving the rest untouched.

downsample

Downsample a dataset.

export_data_source

Copy a data source to a new file in the same format.

get_all_protocols

List all saved protocols on the server.

get_batch_spectral

Compute spectral analyses for multiple independent requests in one call.

get_channel_metadata

Get a dataset's current channel metadata.

get_detect_params

Fetch active detection configurations per channel.

get_dsp_group

Get DSP filter configuration for a dataset.

get_kpi_bundle_stats

Retrieve cross-channel KPI summaries over time for a linked dataset.

get_kpi_metrics

Retrieve computed KPI signal metrics for a linked dataset.

get_kpi_metrics_series

Retrieve a per-channel KPI metric timeseries for a linked dataset.

get_kpi_status

Get the current KPI computation status for a dataset.

get_neurons

Retrieve neuron descriptors for a linked dataset.

get_protocol

Retrieve a saved protocol by ID.

get_provenance

Get the record of how a dataset came to be.

get_signals

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

get_spectral

Compute a spectral analysis (periodogram, Welch, or STFT) for a dataset.

get_spectral_info

Preview the spectral parameters a request would produce, without reading signal data.

get_spike_sorter_dashboard

Get the spike sorter dashboard for monitoring sorting progress.

get_spike_sorter_ids

Get the IDs of the spikes filesets registered for a dataset.

get_spike_sorter_state

Get the current state and progress of a spike sorter.

get_spikes_by_channel

Retrieve spike timestamps per recording channel.

get_spikes_by_neuron

Retrieve spike timestamps per sorted neuron.

get_spikes_ids

Get the IDs of the spikes filesets registered for a dataset.

get_spikes_spec

Retrieve the metadata of a dataset's spikes fileset.

get_tailing_state

Report whether a dataset's recording is still growing, and how much of it exists.

get_units

List the sorted cells in a fileset, merging each cell's per-site listings.

healthcheck

Verify the server is responsive.

highpass

Apply a high-pass filter to a dataset.

kpi_calculate

Compute KPI for a dataset and wait until it is ready.

kpi_clear

Discard all computed KPI for a dataset, including results cached on disk.

link_data_file

Link a recording file and return its metadata.

list_data_source_ids

List IDs of all currently linked data sources.

list_data_sources

List linked data sources and their metadata.

list_directory

List files in a remote server-side directory.

lowpass

Apply a low-pass filter to a dataset.

move_data_source_file

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

notch

Apply a notch filter to a dataset.

paired_ref

Apply paired re-referencing between two specific channels.

remove_data_source_file

Remove a server-side data source file.

select_channels

Add signals to a dataset's selection, leaving the rest selected.

set_channel_groups

Make a dataset's color groups exactly groups, discarding existing ones.

set_detect_params

Update detection parameters on the given channels.

set_dsp_group

Replace a dataset's stage-2 filters.

set_kpi_packet_dur

Set the KPI packet duration for a dataset.

set_protocol

Register a custom protocol with the server.

set_selected_channels

Make a dataset's channel selection exactly signals.

slice_channels

Select a subset of channels from a dataset.

slice_time

Slice a dataset in time.

spike_sort

Sort an offline recording and return the id of the fileset it wrote, once readable.

spike_sorter_cancel

Cancel a running spike sorter.

spike_sorter_command

Send a command to a running spike sorter.

spike_sorter_delete

Delete a spike sorter and release its resources.

spike_sorter_launch

Launch a new spike sorter on a dataset.

update_detect_params

Update detection thresholds, shadow, window and spike width on the given channels.

virtual_ref

Apply virtual reference re-referencing to a dataset.

ATTRIBUTE DESCRIPTION
server_version

Connected server version as (major, minor, patch).

TYPE: ServerVersion

Attributes

server_version property
server_version: ServerVersion

Connected server version as (major, minor, patch).

A development build reports (inf, inf, inf).

Functions

apply_protocol
apply_protocol(protocol_id: str) -> None

Run a protocol registered with set_protocol().

Outputs are not linked; link them with link_data_file().

PARAMETER DESCRIPTION
protocol_id

The ID of a protocol already registered with the server (e.g. ProtocolSpec.id from set_protocol() or get_all_protocols()).

TYPE: str

bandpass
bandpass(
    dataset: FlexDataset,
    low_freq: float,
    high_freq: float,
    output_path: str | Path,
    *,
    order: int | None = None,
) -> DatasetMetadata

Apply a band-pass filter to a dataset.

PARAMETER DESCRIPTION
dataset

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

TYPE: FlexDataset

low_freq

Lower cutoff frequency in Hz.

TYPE: float

high_freq

Upper cutoff frequency in Hz.

TYPE: float

output_path

Output file. Its suffix sets the format (e.g. .xdat).

TYPE: str | Path

order

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

TYPE: int | None DEFAULT: None

RETURNS DESCRIPTION
DatasetMetadata

Metadata for the new (filtered) dataset.

RAISES DESCRIPTION
ValueError

If output_path's suffix names no supported format.

RadiensError

If the server rejects the transform.

bandstop
bandstop(
    dataset: FlexDataset,
    low_freq: float,
    high_freq: float,
    output_path: str | Path,
    *,
    order: int | None = None,
) -> DatasetMetadata

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

PARAMETER DESCRIPTION
dataset

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

TYPE: FlexDataset

low_freq

Lower cutoff frequency in Hz.

TYPE: float

high_freq

Upper cutoff frequency in Hz.

TYPE: float

output_path

Output file. Its suffix sets the format (e.g. .xdat).

TYPE: str | Path

order

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

TYPE: int | None DEFAULT: None

RETURNS DESCRIPTION
DatasetMetadata

Metadata for the new (filtered) dataset.

RAISES DESCRIPTION
ValueError

If output_path's suffix names no supported format.

RadiensError

If the server rejects the transform.

bulk_bandpass
bulk_bandpass(
    sources: Sequence[FlexDataset],
    low_freq: float,
    high_freq: float,
    output_dir: str | Path,
    output_suffix: str,
    *,
    order: int | None = None,
) -> None

Apply band-pass filter to multiple datasets at once.

Outputs are written in the first source's file format and are not linked; link them with link_data_file().

PARAMETER DESCRIPTION
sources

Datasets to filter (metadata objects, ID strings, or file paths).

TYPE: Sequence[FlexDataset]

low_freq

Lower cutoff frequency in Hz.

TYPE: float

high_freq

Upper cutoff frequency in Hz.

TYPE: float

output_dir

Directory where output files will be written.

TYPE: str | Path

output_suffix

Appended to each input's base name after an underscore to name its output.

TYPE: str

order

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

TYPE: int | None DEFAULT: None

RAISES DESCRIPTION
ValueError

If sources is empty.

bulk_bandstop
bulk_bandstop(
    sources: Sequence[FlexDataset],
    low_freq: float,
    high_freq: float,
    output_dir: str | Path,
    output_suffix: str,
    *,
    order: int | None = None,
) -> None

Apply band-stop filter to multiple datasets at once.

Outputs are written in the first source's file format and are not linked; link them with link_data_file().

PARAMETER DESCRIPTION
sources

Datasets to filter (metadata objects, ID strings, or file paths).

TYPE: Sequence[FlexDataset]

low_freq

Lower cutoff frequency in Hz.

TYPE: float

high_freq

Upper cutoff frequency in Hz.

TYPE: float

output_dir

Directory where output files will be written.

TYPE: str | Path

output_suffix

Appended to each input's base name after an underscore to name its output.

TYPE: str

order

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

TYPE: int | None DEFAULT: None

RAISES DESCRIPTION
ValueError

If sources is empty.

bulk_downsample
bulk_downsample(
    sources: Sequence[FlexDataset],
    factor: int,
    output_dir: str | Path,
    output_suffix: str,
) -> None

Downsample multiple datasets at once.

Outputs are written in the first source's file format and are not linked; link them with link_data_file().

The signal is not low-pass filtered first; apply bulk_lowpass() beforehand to avoid aliasing.

PARAMETER DESCRIPTION
sources

Datasets to downsample (metadata objects, ID strings, or file paths).

TYPE: Sequence[FlexDataset]

factor

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

TYPE: int

output_dir

Directory where output files will be written.

TYPE: str | Path

output_suffix

Appended to each input's base name after an underscore to name its output.

TYPE: str

RAISES DESCRIPTION
ValueError

If sources is empty.

bulk_highpass
bulk_highpass(
    sources: Sequence[FlexDataset],
    frequency: float,
    output_dir: str | Path,
    output_suffix: str,
    *,
    order: int | None = None,
) -> None

Apply high-pass filter to multiple datasets at once.

Outputs are written in the first source's file format and are not linked; link them with link_data_file().

PARAMETER DESCRIPTION
sources

Datasets to filter (metadata objects, ID strings, or file paths).

TYPE: Sequence[FlexDataset]

frequency

Cutoff frequency in Hz.

TYPE: float

output_dir

Directory where output files will be written.

TYPE: str | Path

output_suffix

Appended to each input's base name after an underscore to name its output.

TYPE: str

order

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

TYPE: int | None DEFAULT: None

RAISES DESCRIPTION
ValueError

If sources is empty.

bulk_lowpass
bulk_lowpass(
    sources: Sequence[FlexDataset],
    frequency: float,
    output_dir: str | Path,
    output_suffix: str,
    *,
    order: int | None = None,
) -> None

Apply low-pass filter to multiple datasets at once.

Outputs are written in the first source's file format and are not linked; link them with link_data_file().

PARAMETER DESCRIPTION
sources

Datasets to filter (metadata objects, ID strings, or file paths).

TYPE: Sequence[FlexDataset]

frequency

Cutoff frequency in Hz.

TYPE: float

output_dir

Directory where output files will be written.

TYPE: str | Path

output_suffix

Appended to each input's base name after an underscore to name its output.

TYPE: str

order

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

TYPE: int | None DEFAULT: None

RAISES DESCRIPTION
ValueError

If sources is empty.

bulk_notch
bulk_notch(
    sources: Sequence[FlexDataset],
    frequency: float,
    bandwidth: float,
    output_dir: str | Path,
    output_suffix: str,
) -> None

Apply notch filter to multiple datasets at once.

Outputs are written in the first source's file format and are not linked; link them with link_data_file().

The notch filter is always second-order, so it takes no order.

PARAMETER DESCRIPTION
sources

Datasets to filter (metadata objects, ID strings, or file paths).

TYPE: Sequence[FlexDataset]

frequency

Center frequency to reject in Hz. Also accepted as the deprecated notch_freq=, removed in 0.1.0.

TYPE: float

bandwidth

Width of the rejection band in Hz. Must be positive.

TYPE: float

output_dir

Directory where output files will be written.

TYPE: str | Path

output_suffix

Appended to each input's base name after an underscore to name its output.

TYPE: str

RAISES DESCRIPTION
ValueError

If sources is empty, or bandwidth is not positive.

bulk_slice_time
bulk_slice_time(
    sources: Sequence[FlexDataset],
    start_sec: float,
    end_sec: float,
    output_dir: str | Path,
    output_suffix: str,
) -> None

Slice multiple datasets in time at once.

The same times apply to every source, so each must cover them.

Outputs are written in the first source's file format and are not linked; link them with link_data_file().

PARAMETER DESCRIPTION
sources

Datasets to slice (metadata objects, ID strings, or file paths).

TYPE: Sequence[FlexDataset]

start_sec

Start, in seconds of stream time.

TYPE: float

end_sec

End, in seconds of stream time.

TYPE: float

output_dir

Directory where output files will be written.

TYPE: str | Path

output_suffix

Appended to each input's base name after an underscore to name its output.

TYPE: str

RAISES DESCRIPTION
ValueError

If sources is empty.

car
car(dataset: FlexDataset, output_path: str | Path) -> DatasetMetadata

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

Subtracts the mean signal across all channels from each channel.

PARAMETER DESCRIPTION
dataset

Dataset to re-reference (metadata object, ID string, or file path).

TYPE: FlexDataset

output_path

Output file. Its suffix sets the format (e.g. .xdat).

TYPE: str | Path

RETURNS DESCRIPTION
DatasetMetadata

Metadata for the new (re-referenced) dataset.

RAISES DESCRIPTION
ValueError

If output_path's suffix names no supported format.

RadiensError

If the server rejects the transform.

clear_data_sources
clear_data_sources(dsource_ids: list[str] | str) -> list[str]

Clear (unlink) data sources from the server.

Warning

An empty list clears every dataset on the server, including ones open in the desktop apps.

PARAMETER DESCRIPTION
dsource_ids

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

TYPE: list[str] | str

RETURNS DESCRIPTION
list[str]

List of successfully cleared IDs.

close
close() -> None

Close the client's server connections.

copy_data_source_file
copy_data_source_file(
    src_path: str | Path, dest_path: str | Path, *, force: bool = False
) -> None

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

PARAMETER DESCRIPTION
src_path

Source file path on the server.

TYPE: str | Path

dest_path

Destination file path on the server. Must have the same file type as the source.

TYPE: str | Path

force

If True, overwrite existing destination file.

TYPE: bool DEFAULT: False

RAISES DESCRIPTION
ValueError

If a path's suffix does not match a known file type.

deselect_channels
deselect_channels(dataset: FlexDataset, signals: FlexSignalSpec) -> DatasetMetadata

Remove signals from a dataset's selection, leaving the rest untouched.

PARAMETER DESCRIPTION
dataset

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

TYPE: FlexDataset

signals

Channels to deselect. Same forms as set_selected_channels().

TYPE: FlexSignalSpec

RETURNS DESCRIPTION
DatasetMetadata

Refreshed dataset metadata carrying the new selection.

RAISES DESCRIPTION
ValueError

If an index is not present in the dataset.

RadiensError

On communication failure or server error.

downsample
downsample(
    dataset: FlexDataset, factor: int, output_path: str | Path
) -> DatasetMetadata

Downsample a dataset.

The signal is not low-pass filtered first; apply lowpass() beforehand to avoid aliasing.

PARAMETER DESCRIPTION
dataset

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

TYPE: FlexDataset

factor

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

TYPE: int

output_path

Output file. Its suffix sets the format (e.g. .xdat).

TYPE: str | Path

RETURNS DESCRIPTION
DatasetMetadata

Metadata for the new (downsampled) dataset.

RAISES DESCRIPTION
ValueError

If output_path's suffix names no supported format.

RadiensError

If the server rejects the transform.

export_data_source
export_data_source(
    dsource: FlexDataset, dest_path: str | Path, force: bool = False
) -> None

Copy a data source to a new file in the same format.

The suffix of dest_path is ignored; the output keeps the source's file type.

PARAMETER DESCRIPTION
dsource

The data source to export (metadata object, ID string, or file path).

TYPE: FlexDataset

dest_path

Destination file path.

TYPE: str | Path

force

If True, overwrite existing destination file.

TYPE: bool DEFAULT: False

get_all_protocols
get_all_protocols() -> list[ProtocolSpec]

List all saved protocols on the server.

RETURNS DESCRIPTION
list[ProtocolSpec]

Summary of every protocol currently registered.

get_batch_spectral
get_batch_spectral(
    items: Sequence[tuple[FlexDataset, SpectralQuery]],
) -> BatchSpectralResult

Compute spectral analyses for multiple independent requests in one call.

Faster than repeated get_spectral() calls, which cost one round trip each.

PARAMETER DESCRIPTION
items

(dataset, query) pairs, one per spectral request. Each dataset accepts a metadata object, ID string, or file path.

TYPE: Sequence[tuple[FlexDataset, SpectralQuery]]

RETURNS DESCRIPTION
BatchSpectralResult

One SpectralResult per submitted item, in request order.

RAISES DESCRIPTION
RadiensError

On communication failure or server error.

get_channel_metadata
get_channel_metadata(dataset: FlexDataset) -> ChannelMetadata

Get a dataset's current channel metadata.

PARAMETER DESCRIPTION
dataset

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

TYPE: FlexDataset

RETURNS DESCRIPTION
ChannelMetadata

Channel configuration including selection state, probe geometry, and color group assignments.

RAISES DESCRIPTION
RadiensError

On communication failure or server error.

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

ID of a running spike sorter, or a dataset ID to read the dataset's own settings.

TYPE: str

channels

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

TYPE: list[int] | None DEFAULT: None

RETURNS DESCRIPTION
dict[int, SpikeDetectParams]

Map from native channel index to its SpikeDetectParams.

get_dsp_group
get_dsp_group(dataset: FlexDataset) -> DSPGroup

Get DSP filter configuration for a dataset.

A recording opens with the stage-2 chain that was in force when recording started.

PARAMETER DESCRIPTION
dataset

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

TYPE: FlexDataset

RETURNS DESCRIPTION
DSPGroup

The current hardware and software filter parameters.

get_kpi_bundle_stats
get_kpi_bundle_stats(
    dataset: FlexDataset,
    stats: list[FlexBundleStatId],
    window_dur_sec: float | None,
    channel_indices: list[int] | None = None,
    time_range: FlexTimeRange | None = None,
    signal_type: FlexSignalType = AMP,
) -> KpiBundleStatsResult

Retrieve cross-channel KPI summaries over time for a linked dataset.

Each requested stat is a per-channel metric collapsed across the selected channels — for example ("rms", "mean") is the average RMS over the probe, and ("snr", "count") is the number of channels with detected events (channel yield). The per-channel matrix is never returned; use get_kpi_metrics_series() for that.

PARAMETER DESCRIPTION
dataset

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

TYPE: FlexDataset

stats

Bundle stats to compute. Accepts BundleStatId objects, metric names (reduction defaults to MEAN), or (metric, reduction) pairs.

TYPE: list[FlexBundleStatId]

window_dur_sec

Target bin width in seconds. Window boundaries snap to the KPI packet duration, so read each window's bounds from the result rather than assuming i * window_dur_sec. None uses the native packet duration (one window per packet). 0 or a value at least as large as the requested span produces one window over the whole range.

TYPE: float | None

channel_indices

Native channel indices forming the channel population. None uses the selected channels.

TYPE: list[int] | None DEFAULT: None

time_range

Range to read; see FlexTimeRange. None reads all of it. A lookback is not accepted.

TYPE: FlexTimeRange | None DEFAULT: None

signal_type

Signal type to query. Accepts SignalType enum or string name (e.g. "amp"). Defaults to AMP.

TYPE: FlexSignalType DEFAULT: AMP

RETURNS DESCRIPTION
KpiBundleStatsResult

Time-ordered windows, each holding one value per requested stat.

RAISES DESCRIPTION
CapabilityError

If the connected server predates the current KPI metric set.

TimeRangeError

If the range falls outside the dataset, or KPI has not yet been computed over it; see kpi_calculate().

SignalSelectionError

If a requested channel index is not in the dataset.

ValueError

If time_range is a lookback.

RadiensError

On communication failure or server error.

get_kpi_metrics
get_kpi_metrics(
    dataset: FlexDataset,
    metrics: list[FlexKpiMetricId],
    channel_indices: list[int] | None = None,
    time_range: FlexTimeRange | None = None,
    signal_type: FlexSignalType = AMP,
    *,
    service_mode: FlexKpiServiceMode = RANGE,
    stream_lookback_sec: float | None = None,
) -> KpiMetricsResult

Retrieve computed KPI signal metrics for a linked dataset.

PARAMETER DESCRIPTION
dataset

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

TYPE: FlexDataset

metrics

List of KPI metric identifiers. Accepts KpiMetricId objects, KpiMetric members, or metric name strings (case-insensitive).

TYPE: list[FlexKpiMetricId]

channel_indices

Native channel indices to query. None returns the selected channels.

TYPE: list[int] | None DEFAULT: None

time_range

Range to read; see FlexTimeRange. None reads all of it. A lookback is not accepted.

TYPE: FlexTimeRange | None DEFAULT: None

signal_type

Signal type to query. Accepts SignalType enum or string name (e.g. "amp"). Defaults to AMP.

TYPE: FlexSignalType DEFAULT: AMP

service_mode

Which answering mode to use. RANGE (the default) aggregates exactly over the requested range. STREAM applies only to live streams; on a recording it returns NaN.

TYPE: FlexKpiServiceMode DEFAULT: RANGE

stream_lookback_sec

Moving-average window in seconds. Used only when service_mode is STREAM.

TYPE: float | None DEFAULT: None

RETURNS DESCRIPTION
KpiMetricsResult

One value per channel and metric, labeled with the channel of each row and the metric of each column; see KpiMetricsResult.

RAISES DESCRIPTION
CapabilityError

If the connected server predates the current KPI metric set.

TimeRangeError

If the range falls outside the dataset, or KPI has not yet been computed over it; see kpi_calculate().

SignalSelectionError

If a requested channel index is not in the dataset.

ValueError

If time_range is a lookback.

RadiensError

On communication failure or server error.

get_kpi_metrics_series
get_kpi_metrics_series(
    dataset: FlexDataset,
    metrics: list[FlexKpiMetricId],
    window_dur_sec: float | None,
    channel_indices: list[int] | None = None,
    time_range: FlexTimeRange | None = None,
    signal_type: FlexSignalType = AMP,
) -> KpiMetricsSeriesResult

Retrieve a per-channel KPI metric timeseries for a linked dataset.

Returns one (n_channels, n_metrics) snapshot per time window, each aggregating exactly the KPI packets in that window. Use this instead of repeated get_kpi_metrics() calls to track metrics over a recording.

PARAMETER DESCRIPTION
dataset

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

TYPE: FlexDataset

metrics

List of KPI metric identifiers. Accepts KpiMetricId objects, KpiMetric members, or metric name strings (case-insensitive).

TYPE: list[FlexKpiMetricId]

window_dur_sec

Target bin width in seconds. Window boundaries snap to the KPI packet duration, so read each window's bounds from the result rather than assuming i * window_dur_sec. None uses the native packet duration (one window per packet). 0 or a value at least as large as the requested span produces a single window, equivalent to get_kpi_metrics().

TYPE: float | None

channel_indices

Native channel indices to query. None returns the selected channels.

TYPE: list[int] | None DEFAULT: None

time_range

Range to read; see FlexTimeRange. None reads all of it. A lookback is not accepted.

TYPE: FlexTimeRange | None DEFAULT: None

signal_type

Signal type to query. Accepts SignalType enum or string name (e.g. "amp"). Defaults to AMP.

TYPE: FlexSignalType DEFAULT: AMP

RETURNS DESCRIPTION
KpiMetricsSeriesResult

Time-ordered windows sharing one channel/metric ordering.

RAISES DESCRIPTION
CapabilityError

If the connected server predates the current KPI metric set.

TimeRangeError

If the range falls outside the dataset, or KPI has not yet been computed over it; see kpi_calculate().

SignalSelectionError

If a requested channel index is not in the dataset.

ValueError

If time_range is a lookback.

RadiensError

On communication failure or server error.

get_kpi_status
get_kpi_status(dataset: FlexDataset) -> KpiStatus

Get the current KPI computation status for a dataset.

PARAMETER DESCRIPTION
dataset

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

TYPE: FlexDataset

RETURNS DESCRIPTION
KpiStatus

The KPI computation status; see KpiStatus.

RAISES DESCRIPTION
CapabilityError

If the connected server predates the current KPI metric set.

RadiensError

On communication failure or server error.

get_neurons
get_neurons(
    dataset: FlexDataset,
    channels: FlexSignalSpec | None = None,
    time_range: FlexTimeRange | None = None,
    *,
    spikes_id: str | None = None,
) -> NeuronsResult

Retrieve neuron descriptors for a linked dataset.

Returns spike count, rate, SNR, waveform peak amplitude, and probe position per site. A cell appears under every site that recorded it, and the unclustered (0) and bad/delete bins are included; use get_units() for one entry per cell.

PARAMETER DESCRIPTION
dataset

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

TYPE: FlexDataset

channels

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

TYPE: FlexSignalSpec | None DEFAULT: None

time_range

Range to read; see FlexTimeRange. None reads all of it. A lookback is not accepted.

TYPE: FlexTimeRange | None DEFAULT: None

spikes_id

ID of the spikes fileset to read. None uses the first entry of DatasetMetadata.associated_spikes_ids.

TYPE: str | None DEFAULT: None

RETURNS DESCRIPTION
NeuronsResult

Neuron descriptors grouped by native channel index.

RAISES DESCRIPTION
ValueError

If a channel index is not in the dataset, or time_range is a lookback.

RadiensError

If spikes_id is not given and the dataset has no spikes fileset, or on communication failure or server error.

get_protocol
get_protocol(protocol_id: str) -> ProtocolSpec

Retrieve a saved protocol by ID.

PARAMETER DESCRIPTION
protocol_id

ID of the protocol to retrieve.

TYPE: str

RETURNS DESCRIPTION
ProtocolSpec

Minimal summary of the protocol.

get_provenance
get_provenance(dataset: FlexDataset) -> Provenance

Get the record of how a dataset came to be.

The record lists, in order, every operation that shaped the dataset's samples: filters, decimations, channel and time slices, sensor remaps, and the detect, measure and sort steps that produced a derived fileset. A sort operation carries its seed, which SpikeSorterLaunchParams.seed accepts to reproduce the sort on a server that supports seeded sorts.

The stage-2 chain in force when recording started is returned separately. It is a display setting and did not alter the recorded samples.

PARAMETER DESCRIPTION
dataset

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

TYPE: FlexDataset

RETURNS DESCRIPTION
Provenance

The record and the stage-2 chain. A dataset written before records existed gets a record reconstructed from its older metadata and has no stage-2 chain.

RAISES DESCRIPTION
CapabilityError

If the connected server is too old to support this method.

RadiensError

On communication failure or server error.

get_signals
get_signals(
    dataset: FlexDataset,
    time_range: FlexTimeRange | None = None,
    signals: FlexSignalSpec | None = None,
    *,
    apply_dsp: bool = False,
) -> SignalArrays

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

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
dataset

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

TYPE: FlexDataset

time_range

Range to read; see FlexTimeRange. None reads all of it.

TYPE: FlexTimeRange | None DEFAULT: None

signals

Signal selection (e.g. list of amplifier channel indices), or {"amp": "selected"} for the dataset's channel selection. None returns all amplifier channels.

TYPE: FlexSignalSpec | None DEFAULT: None

apply_dsp

Return the signal filtered by the dataset's current stage-2 DSP group, which KPI metrics are computed through and a newly launched sort detects on. False (the default) returns unfiltered wideband. Use this when comparing samples against spike times or KPI metrics: those come from the server's causal filters, so a zero-phase filter applied client-side puts features at different times. Filter state does not carry over between calls: the same range read with the same stage-2 chain and channel selection returns the same samples.

TYPE: bool DEFAULT: False

RETURNS DESCRIPTION
SignalArrays

The requested signal data as numpy arrays. Its time_range is the range served, which is shorter than requested when the server holds less, e.g. the range runs past the end of the recording.

RAISES DESCRIPTION
ValueError

If a channel index is not in the dataset, or, with an older server, the range ends before the dataset starts.

CapabilityError

If apply_dsp is set and the connected server predates it, or the range is a lookback and the server is too old to serve one.

RadiensError

On communication failure or server error.

get_spectral
get_spectral(dataset: FlexDataset, query: SpectralQuery) -> SpectralResult

Compute a spectral analysis (periodogram, Welch, or STFT) for a dataset.

PARAMETER DESCRIPTION
dataset

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

TYPE: FlexDataset

query

Channels, alignment windows, algorithm, and units to compute.

TYPE: SpectralQuery

RETURNS DESCRIPTION
SpectralResult

Frequency (and, for TIME_RESOLVED mode, time) axes plus per-channel power for each requested range.

RAISES DESCRIPTION
RadiensError

On communication failure or server error.

get_spectral_info
get_spectral_info(
    *,
    fs: float,
    duration_sec: float,
    num_channels: int,
    query: SpectralQuery,
    dataset: FlexDataset | None = None,
) -> SpectralInfoResult

Preview the spectral parameters a request would produce, without reading signal data.

PARAMETER DESCRIPTION
fs

Sampling rate, in Hz.

TYPE: float

duration_sec

Signal duration to preview against, in seconds.

TYPE: float

num_channels

Number of channels to preview against.

TYPE: int

query

Algorithm, window, and frequency-range settings to preview. query.ntv_chan_idxs, query.ranges and query.units are ignored. With query.apply_dsp set, dataset's current stage-2 chain is reported in applied_dsp_params.

TYPE: SpectralQuery

dataset

Dataset whose stage-2 chain fills applied_dsp_params. Used only with query.apply_dsp.

TYPE: FlexDataset | None DEFAULT: None

RETURNS DESCRIPTION
SpectralInfoResult

Achieved frequency/time resolution, algorithm-specific parameters, output shape, and an estimated memory footprint.

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 monitoring sorting progress.

PARAMETER DESCRIPTION
spike_sorter_id

Unique ID of the spike sorter to query.

TYPE: str

elements

Optional list of dashboard elements to include. Each element can be a DashElement enum, string name (e.g. "general"), or int value (1-8). None requests ENABLED_PORTS and GENERAL.

TYPE: list[FlexDashElement] | None DEFAULT: None

RETURNS DESCRIPTION
SpikeSorterDashboard

Dashboard data for the requested elements.

get_spike_sorter_ids
get_spike_sorter_ids(dataset: FlexDataset) -> list[str]

Get the IDs of the spikes filesets registered for a dataset.

Deprecated

Use get_spikes_ids() instead. This returns spikes fileset IDs, not spike sorter IDs.

PARAMETER DESCRIPTION
dataset

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

TYPE: FlexDataset

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

Unique ID of the spike sorter to query.

TYPE: str

RETURNS DESCRIPTION
SpikeSorterState

Current state including system status, progress, and messages.

get_spikes_by_channel
get_spikes_by_channel(
    dataset: FlexDataset,
    channels: FlexSignalSpec | None = None,
    time_range: FlexTimeRange | None = None,
    include_waveforms: bool = False,
    *,
    spikes_id: str | None = None,
) -> dict[int, ChannelSpikeData]

Retrieve spike timestamps per recording channel.

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

PARAMETER DESCRIPTION
dataset

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

TYPE: FlexDataset

channels

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

TYPE: FlexSignalSpec | None DEFAULT: None

time_range

Range to read; see FlexTimeRange. None reads all of it. A lookback is not accepted.

TYPE: FlexTimeRange | None DEFAULT: None

include_waveforms

If True, also fetch each spike's neuron label and waveform snippet, spanning the detecting site and its detection neighborhood. Costs an extra request, and the payload grows with the neighborhood size. Default False.

TYPE: bool DEFAULT: False

spikes_id

ID of the spikes fileset to read. None uses the first entry of DatasetMetadata.associated_spikes_ids.

TYPE: str | None DEFAULT: None

RETURNS DESCRIPTION
dict[int, ChannelSpikeData]

Map from native channel index to spike data.

RAISES DESCRIPTION
ValueError

If a channel index is not in the dataset, or time_range is a lookback.

RadiensError

If spikes_id is not given and the dataset has no spikes fileset, or on communication failure or server error.

get_spikes_by_neuron
get_spikes_by_neuron(
    dataset: FlexDataset,
    channels: FlexSignalSpec | None = None,
    time_range: FlexTimeRange | None = None,
    include_waveforms: bool = False,
    *,
    spikes_id: str | None = None,
) -> dict[int, NeuronSpikeData]

Retrieve spike timestamps per sorted neuron.

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

PARAMETER DESCRIPTION
dataset

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

TYPE: FlexDataset

channels

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

TYPE: FlexSignalSpec | None DEFAULT: None

time_range

Range to read; see FlexTimeRange. None reads all of it. A lookback is not accepted.

TYPE: FlexTimeRange | None DEFAULT: None

include_waveforms

If True, also fetch each spike's waveform, one row per spike on the neuron's own sites; see NeuronSpikeData.waveforms. Costs an extra request, and the payload grows with the neighborhood size. Default False.

TYPE: bool DEFAULT: False

spikes_id

ID of the spikes fileset to read. None uses the first entry of DatasetMetadata.associated_spikes_ids.

TYPE: str | None DEFAULT: None

RETURNS DESCRIPTION
dict[int, NeuronSpikeData]

Map from integer neuron label to spike data. Labels are unique within a probe, so on a multi-probe recording units sharing a label are merged.

RAISES DESCRIPTION
CapabilityError

If include_waveforms is set and the connected server cannot attribute waveforms to neurons.

ValueError

If a channel index is not in the dataset, or time_range is a lookback.

RadiensError

If spikes_id is not given and the dataset has no spikes fileset, or on communication failure or server error.

get_spikes_ids
get_spikes_ids(dataset: FlexDataset) -> list[str]

Get the IDs of the spikes filesets registered for a dataset.

The same list as DatasetMetadata.associated_spikes_ids. A sort still running is not listed.

PARAMETER DESCRIPTION
dataset

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

TYPE: FlexDataset

RETURNS DESCRIPTION
list[str]

List of spikes fileset IDs.

get_spikes_spec
get_spikes_spec(dataset: FlexDataset, *, spikes_id: str | None = None) -> SpikesSpec

Retrieve the metadata of a dataset's spikes fileset.

PARAMETER DESCRIPTION
dataset

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

TYPE: FlexDataset

spikes_id

ID of the spikes fileset to read. None uses the first entry of DatasetMetadata.associated_spikes_ids.

TYPE: str | None DEFAULT: None

RETURNS DESCRIPTION
SpikesSpec

The fileset's ID, neuron count, enabled channels, detection settings and the time range its spikes cover.

RAISES DESCRIPTION
RadiensError

If spikes_id is not given and the dataset has no spikes fileset, or on communication failure or server error.

get_tailing_state
get_tailing_state(dataset: FlexDataset) -> TailingState

Report whether a dataset's recording is still growing, and how much of it exists.

The returned available_time_range is the recording's current extent; DatasetMetadata.time_range keeps the extent from when the server first loaded it. With a recent Radiens server, reads with an open range, such as get_signals(dsid), follow the current extent.

KPI follows the growing file from the first call that sees it LIVE. If the recording was linked before it started, call this again once it is live. Requires a license that includes live monitoring.

PARAMETER DESCRIPTION
dataset

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

TYPE: FlexDataset

RETURNS DESCRIPTION
TailingState

The recording verdict and the extent available at call time.

RAISES DESCRIPTION
CapabilityError

If the connected server is too old to support this method.

RadiensError

On communication failure or server error.

get_units
get_units(
    dataset: FlexDataset,
    channels: FlexSignalSpec | None = None,
    *,
    spikes_id: str | None = None,
) -> list[Unit]

List the sorted cells in a fileset, merging each cell's per-site listings.

get_neurons() lists a cell once under every site that saw it. This merges those listings: counts and rates sum, and the site, SNR and depth come from the listing with the most spikes. Unclustered spikes (label 0) and the bad/delete bins are left out.

PARAMETER DESCRIPTION
dataset

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

TYPE: FlexDataset

channels

Channels whose listings to include; None is every amplifier channel. A cell is kept if any of its sites is included, and its counts and rates cover only the included sites.

TYPE: FlexSignalSpec | None DEFAULT: None

spikes_id

ID of the spikes fileset to read. None uses the first entry of DatasetMetadata.associated_spikes_ids.

TYPE: str | None DEFAULT: None

RETURNS DESCRIPTION
list[Unit]

One entry per sorted cell, ascending by label.

RAISES DESCRIPTION
ValueError

If a channel index is not in the dataset.

RadiensError

If spikes_id is not given and the dataset has no spikes fileset, or on communication failure or server error.

healthcheck
healthcheck(service: ServiceEndpoint = RADIENS_LIFECYCLE) -> None

Verify the server is responsive.

PARAMETER DESCRIPTION
service

Service to probe: RADIENS_LIFECYCLE, RADIENS_CORE, RADIENS_SPIKE_SORTER, RADIENS_DEV or RADIENS_DASHBOARDS.

TYPE: ServiceEndpoint DEFAULT: RADIENS_LIFECYCLE

RAISES DESCRIPTION
ValueError

If service is not a radiensserver service.

RadiensError

If the health check fails or the server is unresponsive.

highpass
highpass(
    dataset: FlexDataset,
    frequency: float,
    output_path: str | Path,
    *,
    order: int | None = None,
) -> DatasetMetadata

Apply a high-pass filter to a dataset.

PARAMETER DESCRIPTION
dataset

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

TYPE: FlexDataset

frequency

Cutoff frequency in Hz.

TYPE: float

output_path

Output file. Its suffix sets the format (e.g. .xdat).

TYPE: str | Path

order

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

TYPE: int | None DEFAULT: None

RETURNS DESCRIPTION
DatasetMetadata

Metadata for the new (filtered) dataset.

RAISES DESCRIPTION
ValueError

If output_path's suffix names no supported format.

RadiensError

If the server rejects the transform.

kpi_calculate
kpi_calculate(dataset: FlexDataset) -> None

Compute KPI for a dataset and wait until it is ready.

Returns once KPI covers the dataset's current time range: the whole file, unless the recording is still being written.

PARAMETER DESCRIPTION
dataset

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

TYPE: FlexDataset

RAISES DESCRIPTION
CapabilityError

If the connected server predates the current KPI metric set.

RadiensError

On communication failure or server error.

kpi_clear
kpi_clear(dataset: FlexDataset) -> None

Discard all computed KPI for a dataset, including results cached on disk.

Computation stops until kpi_calculate() is called or a KPI, detection or stage-2 setting changes, either of which restarts it. Those changes do not need a clear first; the server recomputes on its own.

PARAMETER DESCRIPTION
dataset

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

TYPE: FlexDataset

RAISES DESCRIPTION
CapabilityError

If the connected server predates the current KPI metric set.

RadiensError

On communication failure or server error.

link_data_file(
    fpath: str | Path, file_type: RadiensFileType | None = None, *, live: bool = False
) -> DatasetMetadata

Link a recording file and return its metadata.

Also registers any .spikes file found alongside the recording, so it joins the sorts already known for this recording in associated_spikes_ids and the spike data methods on VidereClient can read it.

PARAMETER DESCRIPTION
fpath

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

TYPE: str | Path

file_type

Recording file type. None infers it from the path's suffix; inference covers common suffixes only, so pass it explicitly otherwise.

TYPE: RadiensFileType | None DEFAULT: None

live

Opt into live monitoring for a recording that is still being written, like "Open Live" in Videre. Required for KPI to follow a growing file; without it, KPI covers only the extent at link time. Has no effect on a finalized recording. Requires a license that includes live monitoring.

TYPE: bool DEFAULT: False

RETURNS DESCRIPTION
DatasetMetadata

Metadata for the linked dataset. For a recording still being written, time_range is the extent when the server first loaded it, even with live set; get_tailing_state() reports the current extent.

RAISES DESCRIPTION
ValueError

If file_type is None and no file type claims the path's suffix.

CapabilityError

If live is true and the connected server is too old to support it.

RadiensError

On communication failure or server error.

list_data_source_ids
list_data_source_ids() -> list[str]

List IDs of all currently linked data sources.

RETURNS DESCRIPTION
list[str]

List of data source IDs.

list_data_sources
list_data_sources(
    dsource_ids: list[str] | str | None = None,
) -> dict[str, DatasetMetadata]

List linked data sources and their metadata.

Each entry costs an extra request, so pass dsource_ids when only a few are of interest.

PARAMETER DESCRIPTION
dsource_ids

IDs to list, or a single ID. None lists all.

TYPE: list[str] | str | None DEFAULT: None

RETURNS DESCRIPTION
dict[str, DatasetMetadata]

Map of data source ID to metadata.

list_directory
list_directory(directory: str | Path) -> list[FileInfo]

List files in a remote server-side directory.

PARAMETER DESCRIPTION
directory

Server-side directory path to list. ~ and relative paths are resolved on this machine, as for the other file methods.

TYPE: str | Path

RETURNS DESCRIPTION
list[FileInfo]

Metadata for each file found in the directory.

RAISES DESCRIPTION
CapabilityError

If the connected server is too old to support this method.

RadiensError

On communication failure or server error.

lowpass
lowpass(
    dataset: FlexDataset,
    frequency: float,
    output_path: str | Path,
    *,
    order: int | None = None,
) -> DatasetMetadata

Apply a low-pass filter to a dataset.

PARAMETER DESCRIPTION
dataset

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

TYPE: FlexDataset

frequency

Cutoff frequency in Hz.

TYPE: float

output_path

Output file. Its suffix sets the format (e.g. .xdat).

TYPE: str | Path

order

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

TYPE: int | None DEFAULT: None

RETURNS DESCRIPTION
DatasetMetadata

Metadata for the new (filtered) dataset.

RAISES DESCRIPTION
ValueError

If output_path's suffix names no supported format.

RadiensError

If the server rejects the transform.

move_data_source_file
move_data_source_file(
    src_path: str | Path, dest_path: str | Path, *, force: bool = False
) -> None

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

PARAMETER DESCRIPTION
src_path

Source file path on the server.

TYPE: str | Path

dest_path

Destination file path on the server. Must have the same file type as the source.

TYPE: str | Path

force

If True, overwrite existing destination file.

TYPE: bool DEFAULT: False

RAISES DESCRIPTION
ValueError

If a path's suffix does not match a known file type.

notch
notch(
    dataset: FlexDataset, frequency: float, bandwidth: float, output_path: str | Path
) -> DatasetMetadata

Apply a notch filter to a dataset.

The notch filter is always second-order, so it takes no order.

PARAMETER DESCRIPTION
dataset

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

TYPE: FlexDataset

frequency

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

TYPE: float

bandwidth

Width of the rejection band in Hz. Must be positive.

TYPE: float

output_path

Output file. Its suffix sets the format (e.g. .xdat).

TYPE: str | Path

RETURNS DESCRIPTION
DatasetMetadata

Metadata for the new (filtered) dataset.

RAISES DESCRIPTION
ValueError

If output_path's suffix names no supported format, or bandwidth is not positive.

RadiensError

If the server rejects the transform.

paired_ref
paired_ref(
    dataset: FlexDataset, ref_channel: int, target_channel: int, output_path: str | Path
) -> DatasetMetadata

Apply paired re-referencing between two specific channels.

References one target channel against one reference channel.

PARAMETER DESCRIPTION
dataset

Dataset to re-reference (metadata object, ID string, or file path).

TYPE: FlexDataset

ref_channel

Native channel index of the reference electrode.

TYPE: int

target_channel

Native channel index of the channel to re-reference.

TYPE: int

output_path

Output file. Its suffix sets the format (e.g. .xdat).

TYPE: str | Path

RETURNS DESCRIPTION
DatasetMetadata

Metadata for the new (re-referenced) dataset.

RAISES DESCRIPTION
ValueError

If output_path's suffix names no supported format.

RadiensError

If the server rejects the transform.

remove_data_source_file
remove_data_source_file(path: str | Path, *, force: bool = False) -> None

Remove a server-side data source file.

A dataset linked from this file is unlinked first, including one open in the desktop apps.

PARAMETER DESCRIPTION
path

File path on the server to remove.

TYPE: str | Path

force

Has no effect.

TYPE: bool DEFAULT: False

RAISES DESCRIPTION
ValueError

If a path's suffix does not match a known file type.

select_channels
select_channels(dataset: FlexDataset, signals: FlexSignalSpec) -> DatasetMetadata

Add signals to a dataset's selection, leaving the rest selected.

PARAMETER DESCRIPTION
dataset

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

TYPE: FlexDataset

signals

Channels to select. Same forms as set_selected_channels().

TYPE: FlexSignalSpec

RETURNS DESCRIPTION
DatasetMetadata

Refreshed dataset metadata carrying the new selection.

RAISES DESCRIPTION
ValueError

If an index is not present in the dataset.

RadiensError

On communication failure or server error.

set_channel_groups
set_channel_groups(
    dataset: FlexDataset, groups: Sequence[FlexSignalSpec]
) -> DatasetMetadata

Make a dataset's color groups exactly groups, discarding existing ones.

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
dataset

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

TYPE: FlexDataset

groups

Desired groups, in order. Each accepts the same forms as set_selected_channels().

TYPE: Sequence[FlexSignalSpec]

RETURNS DESCRIPTION
DatasetMetadata

Refreshed dataset metadata carrying 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_detect_params
set_detect_params(
    spike_sorter_id: str, params: SpikeDetectParams, channels: list[int]
) -> None

Update detection parameters on the given channels.

Deprecated

Use update_detect_params() instead.

PARAMETER DESCRIPTION
spike_sorter_id

As for update_detect_params().

TYPE: str

params

As for update_detect_params().

TYPE: SpikeDetectParams

channels

As for update_detect_params().

TYPE: list[int]

set_dsp_group
set_dsp_group(
    dataset: FlexDataset, *, stage: FlexFilterStage, params: list[FlexDSPParams]
) -> None

Replace a dataset's stage-2 filters.

Only stage 2 can be changed on a dataset; hardware and stage-1 filters are part of how the recording was made. KPI for the dataset is recomputed through the new chain in the background; call kpi_calculate() to wait for it.

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
dataset

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

TYPE: FlexDataset

stage

The filter stage to update. Must resolve to FilterStage.STAGE2 ("stage2" or 2).

TYPE: FlexFilterStage

params

Filter parameters for this stage. Each item can be a DSPParams or a DSPParamsDict. Every filter goes in stage, whatever its own stage.

TYPE: list[FlexDSPParams]

RAISES DESCRIPTION
ValueError

If a filter sets zero_phase, which is not supported, or breaks a field rule that DSPParams documents.

ServerCommunicationError

If stage is not stage 2, or the server cannot build a filter.

CapabilityError

If a filter sets a non-Butterworth family or a ripple_db and the connected server predates them.

set_kpi_packet_dur
set_kpi_packet_dur(dataset: FlexDataset, packet_dur: float) -> None

Set the KPI packet duration for a dataset.

KPI for the dataset is recomputed in the background; call kpi_calculate() to wait for it.

PARAMETER DESCRIPTION
dataset

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

TYPE: FlexDataset

packet_dur

Duration of each KPI packet in seconds.

TYPE: float

RAISES DESCRIPTION
CapabilityError

If the connected server predates the current KPI metric set.

RadiensError

On communication failure or server error.

set_protocol
set_protocol(
    nodes: list[TransformNode],
    edges: list[TransformEdge],
    *,
    protocol_id: str | None = None,
) -> ProtocolSpec

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)
PARAMETER DESCRIPTION
nodes

Ordered list of transform nodes forming the graph.

TYPE: list[TransformNode]

edges

Directed edges connecting the nodes by ID.

TYPE: list[TransformEdge]

protocol_id

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

TYPE: str | None DEFAULT: None

RETURNS DESCRIPTION
ProtocolSpec

Summary of the validated (server-registered) protocol.

RAISES DESCRIPTION
RadiensError

If the server marks one or more nodes as invalid.

set_selected_channels
set_selected_channels(dataset: FlexDataset, signals: FlexSignalSpec) -> DatasetMetadata

Make a dataset's 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
dataset

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

TYPE: FlexDataset

signals

Desired selection — list of amp indices, "all", SignalSpec.amp([...]), or a dict for multiple signal types.

TYPE: FlexSignalSpec

RETURNS DESCRIPTION
DatasetMetadata

Refreshed dataset metadata carrying the new selection.

RAISES DESCRIPTION
ValueError

If an index is not present in the dataset.

RadiensError

On communication failure or server error.

slice_channels
slice_channels(
    dataset: FlexDataset, channels: Sequence[int], output_path: str | Path
) -> DatasetMetadata

Select a subset of channels from a dataset.

PARAMETER DESCRIPTION
dataset

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

TYPE: FlexDataset

channels

System channel indices (KeyIdxs.sys) to keep, which number amplifier, analog and digital channels together. Channels left out are dropped, analog and digital ones included.

TYPE: Sequence[int]

output_path

Output file. Its suffix sets the format (e.g. .xdat).

TYPE: str | Path

RETURNS DESCRIPTION
DatasetMetadata

Metadata for the new dataset containing only the selected channels.

RAISES DESCRIPTION
ValueError

If output_path's suffix names no supported format.

RadiensError

If a channel index is not in the dataset, or the server rejects the transform.

slice_time
slice_time(
    dataset: FlexDataset, start_sec: float, end_sec: float, output_path: str | Path
) -> DatasetMetadata

Slice a dataset in time.

PARAMETER DESCRIPTION
dataset

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

TYPE: FlexDataset

start_sec

Start, in seconds of stream time.

TYPE: float

end_sec

End, in seconds of stream time.

TYPE: float

output_path

Output file. Its suffix sets the format (e.g. .xdat).

TYPE: str | Path

RETURNS DESCRIPTION
DatasetMetadata

Metadata for the new (sliced) dataset.

RAISES DESCRIPTION
ValueError

If output_path's suffix names no supported format.

RadiensError

If the server rejects the transform, e.g. a range outside the dataset.

spike_sort
spike_sort(params: SpikeSorterLaunchParams, *, stall_sec: float = 120.0) -> str

Sort an offline recording and return the id of the fileset it wrote, once readable.

Launches the sort with spike_sorter_launch(), then waits until the sort has finished and its fileset can be read.

There is no overall time limit, since sort duration depends on the recording. The call fails only if the sort stops making progress: neither phase nor frac_complete changes for stall_sec. On failure the sort is turned off before the error is raised.

PARAMETER DESCRIPTION
params

As for spike_sorter_launch(). Configure the dataset's DSP and detection thresholds first.

TYPE: SpikeSorterLaunchParams

stall_sec

How long the state may stay put before the sort is declared stuck.

TYPE: float DEFAULT: 120.0

RETURNS DESCRIPTION
str

The spikes_id to pass to the spike readers.

RAISES DESCRIPTION
ValueError

If params.dsource_id is unset.

ServerCommunicationError

If the sorter reports an error, or it stopped and no fileset was registered within a short grace period.

TimeoutError

If the sort stalled.

RadiensError

On communication failure or server error.

spike_sorter_cancel
spike_sorter_cancel(spike_sorter_id: str) -> None

Cancel a running spike sorter.

Equivalent to spike_sorter_command(id, SpikeSorterCommand.OFF). The sorter is removed immediately, so later calls with the same ID raise ServerCommunicationError.

PARAMETER DESCRIPTION
spike_sorter_id

Unique ID of the spike sorter to cancel.

TYPE: str

spike_sorter_command
spike_sorter_command(
    spike_sorter_id: str,
    cmd: FlexSpikeSorterCommand,
    *,
    sub_cmd: FlexSpikeSorterSubCommand = NULL,
    neighbor_radius_um: float | None = None,
    max_num_site_neighbors: int | None = None,
) -> None

Send a command to a running spike sorter.

PARAMETER DESCRIPTION
spike_sorter_id

Unique ID of the spike sorter to control.

TYPE: str

cmd

The command to execute. Accepts SpikeSorterCommand enum or string (e.g. "off", "rebase", "clear_sort").

TYPE: FlexSpikeSorterCommand

sub_cmd

Optional sub-command modifier. Accepts SpikeSorterSubCommand enum or string ("null", "detect_only").

TYPE: FlexSpikeSorterSubCommand DEFAULT: NULL

neighbor_radius_um

Optional per-site neighbor search radius, in microns. Only applied when cmd is "init"; ignored otherwise. If unset, the current radius is kept.

TYPE: float | None DEFAULT: None

max_num_site_neighbors

Optional cap on the number of neighbors kept per site (closest first). Only applied when cmd is "init"; ignored otherwise. If unset, all neighbors within the radius are kept when neighbor_radius_um is set; with both unset the current neighborhood is kept.

TYPE: int | None DEFAULT: None

Warning

"init" clears the sorter's spikes and resets its detection thresholds, windows and shadow to defaults. On an offline sort it ends the sort and discards its output, so pass the neighborhood to spike_sorter_launch instead.

spike_sorter_delete
spike_sorter_delete(spike_sorter_id: str) -> None

Delete a spike sorter and release its resources.

An ID the server does not know is ignored.

PARAMETER DESCRIPTION
spike_sorter_id

Unique ID of the spike sorter to delete.

TYPE: str

RAISES DESCRIPTION
ValueError

If spike_sorter_id is empty.

RadiensError

On communication failure or server error.

spike_sorter_launch
spike_sorter_launch(params: SpikeSorterLaunchParams) -> SpikeSorterLaunchResult

Launch a new spike sorter on a dataset.

Returns as soon as the sort starts; use spike_sort() to wait for the result. The new fileset appears in DatasetMetadata.associated_spikes_ids once the sort completes, and never for a sort that is cancelled or fails.

Warning

Sorting starts during this call, so every setting must be in params. spike_sorter_command(..., "init", ...) is too late: it ends an offline sort and discards its output. On a recording still being written, relaunching replaces the previous sort and its output.

The sort uses the dataset's stage-2 DSP and detection thresholds as they are at launch; the stage-2 chain may be empty. Configure both first (set_dsp_group(stage=FilterStage.STAGE2), update_detect_params() with the dataset ID).

Each launch on an offline recording writes a new fileset alongside earlier ones.

PARAMETER DESCRIPTION
params

Target dataset ID, sub_cmd ("detect_only" skips clustering), and optional clustering, feature and neighborhood settings.

TYPE: SpikeSorterLaunchParams

RETURNS DESCRIPTION
SpikeSorterLaunchResult

The unique ID and type of the launched sorter. The sorter is removed shortly after it completes; its ID then names the output fileset.

RAISES DESCRIPTION
CapabilityError

If params.seed is set and the connected server cannot reproduce a sort from it.

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

ID of a running spike sorter, or a dataset ID to configure the dataset before launching a sort. On a dataset, KPI is recomputed with the new settings in the background; call kpi_calculate() to wait.

TYPE: str

params

The detection parameters to apply.

TYPE: SpikeDetectParams

channels

List of native channel indices to apply the parameters to.

TYPE: list[int]

RAISES DESCRIPTION
CapabilityError

If params.spike_width_sec is set and the connected server predates it.

virtual_ref
virtual_ref(
    dataset: FlexDataset, ref_channel: int, output_path: str | Path
) -> DatasetMetadata

Apply virtual reference re-referencing to a dataset.

References all channels against a single nominated electrode.

PARAMETER DESCRIPTION
dataset

Dataset to re-reference (metadata object, ID string, or file path).

TYPE: FlexDataset

ref_channel

Native channel index of the reference electrode.

TYPE: int

output_path

Output file. Its suffix sets the format (e.g. .xdat).

TYPE: str | Path

RETURNS DESCRIPTION
DatasetMetadata

Metadata for the new (re-referenced) dataset.

RAISES DESCRIPTION
ValueError

If output_path's suffix names no supported format.

RadiensError

If the server rejects the transform.