Other data structures, functions, and types
- class radiens.lib.channel_metadata.ChannelMetadata(raw=None)
 Container for channel metadata.
- property table
 Table containing per-channel metadata, with one row per channel.
- Returns:
 pd.DataFrame – Each row describes one channel. Column identifiers are as follows:
- port (
str) Port label from acquisition hardware
- port (
 - chan_name (
str) Channel name
- chan_name (
 - chan_type (
SignalType) Signal type
- chan_type (
 - sys_key_idx (
int) Immutable absolute index of channel assigned at time of recording
- sys_key_idx (
 - ntv_key_idx (
int) Immutable relative (to signal type) channel index of the channel assigned at time of recording
- ntv_key_idx (
 - dataset_key_idx (
int) Dataset channel index relative to signal type
- dataset_key_idx (
 - dataset_key_idx_abs (
int) Absolute channel index
- dataset_key_idx_abs (
 - site_num (
int) Site identifier on the probe
- site_num (
 - color_group_idx (
int) Internal color group index used for visualization
- color_group_idx (
 - selected (
bool) Whether the channel is selected
- selected (
 - audio (
list[bool]) List of two booleans indicating left and right audio channels ([is_audio_left, is_audio_right])
- audio (
 - site_shape (
str) Geometric descriptor of the site
- site_shape (
 - site_ctr_x/y/z (
float) Coordinates of the site center relative to the sensor
- site_ctr_x/y/z (
 - site_lim_x/y/z_[min/max] (
float) Site bounding box limits
- site_lim_x/y/z_[min/max] (
 - site_ctr_tcs_x/y/z (
float) Site center in tissue coordinate system (TCS)
- site_ctr_tcs_x/y/z (
 - sensor_units (
SignalUnits) Physical units of the signal
- sensor_units (
 - site_area_um2 (
float) Area of the site in µm²
- site_area_um2 (
 - scs_to_tcs (
float) Offset from sensor to tissue coordinate system
- scs_to_tcs (
 - sensor_id (
str) Full sensor identifier
- sensor_id (
 - probe_id (
str) Identifier for the probe
- probe_id (
 - headstage_id (
str) Identifier for the headstage
- headstage_id (
 - ntv_chan_name (
str) Native channel name from hardware
- ntv_chan_name (
 - sensor_uid (
str) Unique sensor identifier
- sensor_uid (
 
- 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_delay_spec
 Cable delay specification for each system 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
timestamportime_rangemust be provided, withtimestamphaving preference.walltimeis optional.dur_secandNare imputed from the arguments.System use only (not available to user) Either
pbTRor (fsand eithertime_rangeortimestamp) must be provided as arguments.pbTRhas 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