simuran.bridges.allen_vbn_bridge module

class simuran.bridges.allen_vbn_bridge.AllenVBNBridge(good_unit_properties: Dict[str, List[T]] = <factory>)

Bases: object

A class to bridge between Allen VBN and other tools.

static brain_regions_in_structure(structure: Optional[str] = None) → Union[List[str], Dict[str, List[str]]]

Get the brain regions in a structure.

Parameters:structure (str, optional) – The structure to get the brain regions for, by default None. If None, return all brain regions.
Returns:brain_regions – The brain regions in the structure.
Return type:list
Raises:ValueError – If the structure is not known.
filter_good_units(unit_table: DataFrame, sort_: bool = False) → DataFrame

Filter out all non-desired units.

See https://allensdk.readthedocs.io/en/latest/_static/examples/nb/visual_behavior_neuropixels_quality_metrics.html for more details.

Settings are: isi_violations < 0.4 nn_hit_rate > 0.9 amplitude_cutoff < 0.1 presence_ratio > 0.9

Parameters:
  • unit_table (pd.DataFrame) – The unit dataframe to filter from, with channel information.
  • sort (bool) – Whether or not to sort the units, which is by depth.
static recorded_regions(recording: Recording) → List[str]
spike_train(recording: Recording, filter_units: bool = True, filter_function: Callable[[AllenVBNBridge, DataFrame, bool], DataFrame] = <function AllenVBNBridge.filter_good_units>, brain_regions: Optional[List[str]] = None) → Tuple[DataFrame, Dict[int, numpy.ndarray]]

Retrieve a spike train for the units in the recording.

Parameters:
  • recording (simuran.Recording) – The recording to retrieve from.
  • filter_units (bool) – Whether to filter out noisy cells, by default True.
  • filter_function (function) – The function to use for filtering, by default filter_good_units.
  • brain_regions (list of str, optional) – The brain regions to filter by, by default None.
Returns:

  • unit_channels (pd.DataFrame)
  • spike_train (dict) – Key is unit_id, value is the spike train.

static trial_info(recording: Recording) → Tuple[DataFrame, Dict[int, numpy.ndarray]]

Retrieve the trial information for the recording.

Parameters:recording (simuran.Recording) – The recording to retrieve from.
Returns:trial_info – The trial information
Return type:dict

See also

https()
//allensdk.readthedocs.io/en/latest/_static/examples/nb/aligning_behavioral_data_to_task_events_with_the_stimulus_and_trials_tables.html