brainbox.io.deprecated.one

Functions

load_channel_locations

From an eid, get brain locations from Alyx database analysis.

load_ephys_session

From an eid, hits the Alyx database and downloads a standard default set of dataset types From a local session Path (pathlib.Path), loads a standard default set of dataset types to perform analysis: ‘clusters.channels’, ‘clusters.depths’, ‘clusters.metrics’, ‘spikes.clusters’, ‘spikes.times’, ‘probes.description’

load_lfp

From an eid, hits the Alyx database and downloads the standard set of datasets needed for LFP

load_passive_rfmap

For a given eid load in the passive receptive field mapping protocol data

load_spike_sorting

From an eid, hits the Alyx database and downloads a standard default set of dataset types From a local session Path (pathlib.Path), loads a standard default set of dataset types to perform analysis: ‘clusters.channels’, ‘clusters.depths’, ‘clusters.metrics’, ‘spikes.clusters’, ‘spikes.times’, ‘probes.description’

load_spike_sorting_with_channel

For a given eid, get spikes, clusters and channels information, and merges clusters and channels information before returning all three variables.

load_trials_df

Generate a pandas dataframe of per-trial timing information about a given session.

load_wheel_reaction_times

Return the calculated reaction times for session.

merge_clusters_channels

Takes (default and any extra) values in given keys from channels and assign them to clusters.

load_lfp(eid, one=None, dataset_types=None)[source]

From an eid, hits the Alyx database and downloads the standard set of datasets needed for LFP

Parameters
  • eid

  • dataset_types – additional dataset types to add to the list

Returns

spikeglx.Reader

load_channel_locations(eid, one=None, probe=None, aligned=False)[source]

From an eid, get brain locations from Alyx database analysis.

Parameters
  • eid – session eid or dictionary returned by one.alyx.rest(‘sessions’, ‘read’, id=eid)

  • dataset_types – additional spikes/clusters objects to add to the standard list

Returns

channels

load_ephys_session(eid, one=None, dataset_types=None)[source]

From an eid, hits the Alyx database and downloads a standard default set of dataset types From a local session Path (pathlib.Path), loads a standard default set of dataset types

to perform analysis:

‘clusters.channels’, ‘clusters.depths’, ‘clusters.metrics’, ‘spikes.clusters’, ‘spikes.times’, ‘probes.description’

Parameters
  • eid – experiment UUID or pathlib.Path of the local session

  • one – one instance

  • dataset_types – additional spikes/clusters objects to add to the standard default list

Returns

spikes, clusters, trials (dict of bunch, 1 bunch per probe)

load_spike_sorting(eid, one=None, probe=None, dataset_types=None, force=False)[source]

From an eid, hits the Alyx database and downloads a standard default set of dataset types From a local session Path (pathlib.Path), loads a standard default set of dataset types

to perform analysis:

‘clusters.channels’, ‘clusters.depths’, ‘clusters.metrics’, ‘spikes.clusters’, ‘spikes.times’, ‘probes.description’

Parameters
  • eid – experiment UUID or pathlib.Path of the local session

  • one

  • probe – name of probe to load in, if not given all probes for session will be loaded

  • dataset_types – additional spikes/clusters objects to add to the standard default list

  • force – by default function looks for data on local computer and loads this in. If you

want to connect to database and make sure files are still the same set force=True :return: spikes, clusters (dict of bunch, 1 bunch per probe)

merge_clusters_channels(dic_clus, channels, keys_to_add_extra=None)[source]

Takes (default and any extra) values in given keys from channels and assign them to clusters. If channels does not contain any data, the new keys are added to clusters but left empty.

Parameters
  • dic_clus – dict of bunch, 1 bunch per probe, containing cluster information

  • channels – dict of bunch, 1 bunch per probe, containing channels information

  • keys_to_add_extra – Any extra keys contained in channels (will be added to default

[‘acronym’, ‘atlas_id’]) :return: clusters (dict of bunch, 1 bunch per probe), with new keys values.

load_spike_sorting_with_channel(eid, one=None, probe=None, dataset_types=None, aligned=False, force=False)[source]

For a given eid, get spikes, clusters and channels information, and merges clusters and channels information before returning all three variables.

Parameters
  • eid

  • one

  • dataset_types – additional dataset_types to load

  • aligned – whether to get the latest user aligned channel when not resolved or use

histology track :return: spikes, clusters, channels (dict of bunch, 1 bunch per probe)

load_passive_rfmap(eid, one=None)[source]

For a given eid load in the passive receptive field mapping protocol data

Parameters
  • eid – eid or pathlib.Path of the local session

  • one

Returns

rf_map

load_wheel_reaction_times(eid, one=None)[source]

Return the calculated reaction times for session. Reaction times are defined as the time between the go cue (onset tone) and the onset of the first substantial wheel movement. A movement is considered sufficiently large if its peak amplitude is at least 1/3rd of the distance to threshold (~0.1 radians).

Negative times mean the onset of the movement occurred before the go cue. Nans may occur if there was no detected movement withing the period, or when the goCue_times or feedback_times are nan.

Parameters
  • eid (str) – Session UUID

  • one (oneibl.ONE) – An instance of ONE for loading data. If None a new one is instantiated using the defaults.

Returns

reaction times

Return type

array-like

load_trials_df(eid, one=None, maxlen=None, t_before=0.0, t_after=0.0, ret_wheel=False, ret_abswheel=False, wheel_binsize=0.02)[source]

Generate a pandas dataframe of per-trial timing information about a given session. Each row in the frame will correspond to a single trial, with timing values indicating timing session-wide (i.e. time in seconds since session start). Can optionally return a resampled wheel velocity trace of either the signed or absolute wheel velocity.

The resulting dataframe will have a new set of columns, trial_start and trial_end, which define via t_before and t_after the span of time assigned to a given trial. (useful for bb.modeling.glm)

Parameters
  • eid (str) – Session UUID string to pass to ONE

  • one (oneibl.one.OneAlyx, optional) – one object to use for loading. Will generate internal one if not used, by default None

  • maxlen (float, optional) – Maximum trial length for inclusion in df. Trials where feedback - response is longer than this value will not be included in the dataframe, by default None

  • t_before (float, optional) – Time before stimulus onset to include for a given trial, as defined by the trial_start column of the dataframe. If zero, trial_start will be identical to stimOn, by default 0.

  • t_after (float, optional) – Time after feedback to include in the trail, as defined by the trial_end column of the dataframe. If zero, trial_end will be identical to feedback, by default 0.

  • ret_wheel (bool, optional) – Whether to return the time-resampled wheel velocity trace, by default False

  • ret_abswheel (bool, optional) – Whether to return the time-resampled absolute wheel velocity trace, by default False

  • wheel_binsize (float, optional) – Time bins to resample wheel velocity to, by default 0.02

Returns

Dataframe with trial-wise information. Indices are the actual trial order in the original data, preserved even if some trials do not meet the maxlen criterion. As a result will not have a monotonic index. Has special columns trial_start and trial_end which define start and end times via t_before and t_after

Return type

pandas.DataFrame