allensdk.model.biophysical.utils module

class allensdk.model.biophysical.utils.AllActiveUtils(description, axon_type)[source]

Bases: allensdk.model.biophysical.utils.Utils

generate_morphology(self, morph_filename)[source]

Load a neurolucida or swc-format cell morphology file.

Parameters:
morph_filename : string

Path to morphology.

load_cell_parameters(self)[source]

Configure a neuron after the cell morphology has been loaded.

class allensdk.model.biophysical.utils.Utils(description)[source]

Bases: allensdk.model.biophys_sim.neuron.hoc_utils.HocUtils

A helper class for NEURON functionality needed for biophysical simulations.

Attributes:
h : object

The NEURON hoc object.

nrn : object

The NEURON python object.

neuron : module

The NEURON module.

generate_morphology(self, morph_filename)[source]

Load a swc-format cell morphology file.

Parameters:
morph_filename : string

Path to swc.

get_recorded_data(self, vec)[source]

Extract recorded voltages and timestamps given the recorded Vector instance. If self.stimulus_sampling_rate is smaller than self.simulation_sampling_rate, resample to self.stimulus_sampling_rate.

Parameters:
vec : neuron.Vector

constructed by self.record_values

Returns:
dict with two keys: ‘v’ = numpy.ndarray with voltages, ‘t’ = numpy.ndarray with timestamps
load_cell_parameters(self)[source]

Configure a neuron after the cell morphology has been loaded.

static nearest_neuron_sampling_rate(hz, target_hz=40000)[source]
read_stimulus(self, stimulus_path, sweep=0)[source]

Load current values for a specific experiment sweep and setup simulation and stimulus sampling rates.

NOTE: NEURON only allows simulation timestamps of multiples of 40KHz. To avoid aliasing, we set the simulation sampling rate to the least common multiple of the stimulus sampling rate and 40KHz.

Parameters:
stimulus path : string

NWB file name

sweep : integer, optional

sweep index

record_values(self)[source]

Set up output voltage recording.

setup_iclamp(self, stimulus_path, sweep=0)[source]

Assign a current waveform as input stimulus.

Parameters:
stimulus_path : string

NWB file name

update_default_cell_hoc(self, description, default_cell_hoc='cell.hoc')[source]

replace the default ‘cell.hoc’ path in the manifest with ‘cell.hoc’ packaged within AllenSDK if it does not exist

allensdk.model.biophysical.utils.create_utils(description, model_type=None)[source]

Factory method to create a Utils subclass.

Parameters:
description : Config instance

used to initialize Utils subclass

model_type : string

Must be one of [PERISOMATIC_TYPE, ALL_ACTIVE_TYPE]. If none, defaults to PERISOMATIC_TYPE

Returns:
Utils instance