allensdk.brain_observatory.ecephys.nwb_util module

allensdk.brain_observatory.ecephys.nwb_util.add_ecephys_electrodes(nwbfile: NWBFile, channels: List[dict], electrode_group: EcephysElectrodeGroup, channel_number_whitelist: ndarray | None = None)[source]

Add electrode information to an ecephys nwbfile electrode table.

Parameters:
nwbfilepynwb.NWBFile

The nwbfile to add electrodes data to

channelsList[dict]
A list of ‘channel’ dictionaries containing the following fields:

id: The unique id for a given electrode/channel probe_id: The unique id for an electrode’s/channel’s device valid_data: Whether the data for an electrode/channel is usable local_index: The local index of an electrode/channel on a

given device

probe_vertical_position: Length-wise position of electrode/channel

on device (microns)

probe_horizontal_position: Width-wise position of electrode/channel

on device (microns)

structure_id: The LIMS id associated with an anatomical

structure

structure_acronym: Acronym associated with an anatomical

structure

anterior_posterior_ccf_coordinate dorsal_ventral_ccf_coordinate left_right_ccf_coordinate

Optional fields which may be used in the future: impedence: The impedence of a given channel. filtering: The type of hardware filtering done a channel.

(e.g. “1000 Hz low-pass filter”)

electrode_groupEcephysElectrodeGroup

The pynwb electrode group that electrodes should be associated with

channel_number_whitelistOptional[np.ndarray], optional

If provided, only add electrodes (a.k.a. channels) specified by the whitelist (and in order specified), by default None

allensdk.brain_observatory.ecephys.nwb_util.add_probe_to_nwbfile(nwbfile, probe_id, sampling_rate, lfp_sampling_rate, has_lfp_data, name, location='See electrode locations')[source]

Creates objects required for representation of a single extracellular ephys probe within an NWB file.

Parameters:
nwbfilepynwb.NWBFile

file to which probe information will be assigned.

probe_idint

unique identifier for this probe

sampling_rate: float,

sampling rate of the neuropixels probe

lfp_sampling_rate: float

sampling rate of LFP

has_lfp_data: bool

True if LFP data is available for the probe, otherwise False

namestr, optional

human-readable name for this probe. Practically, we use tags like “probeA” or “probeB”

locationstr, optional

A required field for the EcephysElectrodeGroup. Because the group contains a number of electrodes/channels along the neuropixels probe, location will vary significantly. Thus by default this field is: “See electrode locations” where the nwbfile.electrodes table will provide much more detailed location information.

Returns
——
nwbfilepynwb.NWBFile

the updated file object

probe_nwb_devicepynwb.device.Device

device object corresponding to this probe

probe_nwb_electrode_grouppynwb.ecephys.ElectrodeGroup

electrode group object corresponding to this probe

allensdk.brain_observatory.ecephys.nwb_util.add_ragged_data_to_dynamic_table(table, data, column_name, column_description='')[source]

Builds the index and data vectors required for writing ragged array data to a pynwb dynamic table

Parameters:
tablepynwb.core.DynamicTable

table to which data will be added (as VectorData / VectorIndex)

datadict

each key-value pair describes some grouping of data

column_namestr

used to set the name of this column

column_descriptionstr, optional

used to set the description of this column

Returns:
nwbfilepynwb.NWBFile