radiens_core.curate_client
CurateClient — data curation client.
Attributes
Classes
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
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
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
|
Returns:
| Type | Description |
|---|---|
DatasetMetadata
|
Metadata for the new (filtered) dataset. |
bandstop
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
|
Returns:
| Type | Description |
|---|---|
DatasetMetadata
|
Metadata for the new (filtered) dataset. |
bulk_bandpass
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
|
bulk_bandstop
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
|
bulk_downsample
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
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
|
bulk_lowpass
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
|
bulk_notch
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
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
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 (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. |
copy_data_source_file
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 |
False
|
downsample
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 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 |
False
|
get_all_protocols
List all saved protocols on the server.
Returns:
| Type | Description |
|---|---|
list[ProtocolSpec]
|
Summary of every protocol currently registered. |
get_protocol
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
Verify the radiensserver is responsive.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
service
|
ServiceEndpoint
|
Which gRPC service to probe (default |
RADIENS_LIFECYCLE
|
Raises:
| Type | Description |
|---|---|
RadiensError
|
If the health check fails or the server is unresponsive. |
highpass
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
|
Returns:
| Type | Description |
|---|---|
DatasetMetadata
|
Metadata for the new (filtered) dataset. |
link_data_file
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. |
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 IDs of all currently linked data sources.
Returns:
| Type | Description |
|---|---|
list[str]
|
List of data source IDs. |
list_data_sources
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
|
Returns:
| Type | Description |
|---|---|
dict[str, DatasetMetadata]
|
Map of data source ID to metadata. |
list_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
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
|
Returns:
| Type | Description |
|---|---|
DatasetMetadata
|
Metadata for the new (filtered) dataset. |
move_data_source_file
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 |
False
|
notch
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
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 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 |
False
|
set_protocol
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
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 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
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. |