Other data structures, functions, and types
- class radiens.lib.channel_metadata.ChannelMetadata(raw=None)
Container for channel metadata.
- property table
Metadata table providing metadata on each channel (aka signal) in the dataset.
- property attributes
Dictionary of attributes
- index(stype)
Signal indices by signal type and index type. All indices are zero-indexed.
- Parameters:
stype (
SignalType
) – Signal type- Returns:
KeyIdxs (
KeyIdxs
) – Key index object with keysntv
,dset
,sys
See also
Examples
>>> meta.index(SignalType.AMP) >>> KeyIdxs(ntv=[5,1,23,46], dset=[0,1,2,3], sys=[5,1,23,46]) >>> meta.index(SignalType.AIN) >>> KeyIdxs(ntv=[3,2,0,1], dset=[0,1,2,3], sys=[35,34,32,33]) # signal has 32 AMP channels
See also
- sel_index(stype)
Selected signal indices by signal type and index type.
- Parameters:
stype (~radiens.utils.enums.SignalType): Signal type
See also
- num_sigs(stype)
Number of signals for the requested signal type.
- sel_num_sigs(stype)
Number of selected signals for the requested signal type.
- num_sigs_total()
Total number of signals
- property num_selected_sigs_total
Total number of signals
- property sig_units
Dictionary of signal units
- property sensor_spec
Dict with ports (str) as keys mapping to dicts describing headstage, site, and probe wireframe metadata
- class radiens.lib.dataset_metadata.DatasetMetadata(raw_msg=None)
-
- property TR
Alias for
time_range
.
- property channel_metadata
Dataset’s ChannelMetadata, which describes the dataset’s signals (aka channels), probes, positions, etc.
- property attributes
Dataset attributes.
- property path
File system path of the Radiens data file set that backs this DataSource.
- property base_name
File system base name of the Radiens data file set that backs this DataSource.
- property file_type
File type of the Radiens data file set that backs this DataSource.
- property table
Dataset attributes as a table.
- clear_dataset_id()
Clears this DataSource’s dataset ID by setting it to None. This is a power user function. Best practice is to call it when the dataset has been cleared from the Radiens hub.
- class radiens.lib.allego_lib.AllegoState(raw=<class 'allegoserver_pb2.ConfigAndStatus'>)
Container for Allego state.
- property sample_freq
Current system sample frequency in samples/sec [Hz]
- property system_mode
Current Allego mode, e.g. ‘sim-spikes’, etc.
- property port_num_channels
Number of channels on each connected port.
- property cable_length_ft
Headstage cable length in feet for each system port
- property recording
Recording status
- property stream
Streaming status
- property connected
Returns true if there is a headstage connected on any channel.
- property base_name
Returns true if there is a headstage connected on any channel.
- class radiens.lib.signals_snapshot.Signals(raw)
Container for a multi-channel (multi-trace) dataset for amplifier, GPIO analog in, GPIO digital in, and GPIO digital out signals.
All traces for all signal types have the same sampling frequency and start and end times. Thus, the set of traces of each signal type is a 2-D matrix.
- property time_range
dataset time range in seconds
- property TR
Aliases dataset time range.
- property signals
Time-series signals as a named tuple by signal type.
For each signal type, the multi-channel dataset is a 2-D numpy array, with dim 0=trace position and dim 1 is the sample values over the time range.
- property attributes
Dataset attributes
- property channel_metadata
Dataset channel metadata
- concat(other)
Concatenate two Signals objects into a single Signals object.
- Parameters:
other – Signals object to concatenate with self.
- Returns:
Signals – concatenated Signals object.
- class radiens.lib.sig_metrics.SignalMetrics(dsource_id, resp=<class 'common_pb2.KpiBundlePacketMetrics'>)
Container for signal metrics
- property time_range
Signal metrics time range
- property TR
Aliases signal metrics time range
- property ntv_idxs
Signal metrics native channel indices
- property settings
Signal metrics settings (dict)
- property metric_ids
Ordered list of signal metric IDs.
- property packet_idxs
Signal metrics packet indices
- property num_packets
Signal metrics number of packets
- property num_sigs
Signal metrics number of signals
- property packet_dur_sec
Signal metrics packet duration in seconds
- property val
Signal metrics settings as multi-dimensional np.ndarray, with dim 0=packet idx, dim 1=channel index, dim 2=metric index. The ordered metric IDs are available in obj.metric_ids.
Examples:
- access packet 20, channel 23, and metric 1
val[20][23][1]
- access channel 23, metric 1 over all packets:
val[:,23,1]
- access metric 1 over all packets and channels:
z = y[:,:,1]
# returns 2-D array, where dim 0=packet index and dim 1=channelsnp.ravel(z)
# returns 1-D array with packets flattened
- property packet_stats
- print()
Prints a summary of the metrics.
- radiens.utils.util.make_time_range(time_range=None, timestamp=None, fs=None, walltime=None, pbTR=None)
Utility function to compose the TimeRange named tuple composed from either a time range or timestamp list.
- Parameters:
time_range (
list | numpy.ndarray
) – time range in seconds as [time start, time end] (optional, default=None).timestamp (
list | numpy.ndarray
) – timestamp in seconds as [timestamp start, timestamp end] (optional, default=None).fs (
float
) – sampling frequency in samples/sec (required, default=None)walltime (
datetime.datetime
) – wall time of the time range start.pbTR – low-level system parameter not available to user.
Notes:
- TimeRange named tuple fields:
sec
(numpy.ndarray): [time start, time end]timestamp
(numpy.ndarray): [timestamp start, timestamp end]fs
(float): sampling frequencywalltime
: wall time of the time range startdur_sec
(float): imputed time range duration equal toTR.time_range[1]
-TR.time_range[0]
.N
(int): imputednumber of sample points equal toTR.timestamp[1]
-TR.timestamp[0]
.
Either
timestamp
ortime_range
must be provided, withtimestamp
having preference.walltime
is optional.dur_sec
andN
are imputed from the arguments.System use only (not available to user) Either
pbTR
or (fs
and eithertime_range
ortimestamp
) must be provided as arguments.pbTR
has preference.
- class radiens.utils.constants.TimeRange(sec, timestamp, fs, dur_sec, walltime, N)
- N
Alias for field number 5
- dur_sec
Alias for field number 3
- fs
Alias for field number 2
- sec
Alias for field number 0
- timestamp
Alias for field number 1
- walltime
Alias for field number 4