biophysics_fitting ❭ simulator ❭ Simulator_Setup
Simulator_Setup¶
- class biophysics_fitting.simulator.Simulator_Setup¶
Class for setting up cells with biophysical details.
This class is an inherent attribute of the
Simulatorclass, and should only be accessed as such. This class concerns with setting up a cell with biophysical details.Usually, a simulation contains fixed parameters, specific to the cell (e.g. the filename of the morphology) and/or stimulus protocol (e.g. recording sites). Such fixed parameters can be defined by adding
set_fixed_params()toparam_modify_funs. A typical usecase is to use the fixed parameters to specify to soma distance for a voltage trace of the apical dendrite. Make sure that theSimulatorstim_run_funreads the parameterrecSiteand sets up the stimulus accordingly (seeSimulator).Example:
>>> def param_modify_function(params): >>> # alter params >>> return params >>> def cell_params_generator(params, template): >>> cell_params = template.copy() >>> # Fill in template with params >>> return cell_params >>> def cell_param_modify_function(cell_params): >>> # alter cell_params >>> return cell_params >>> def cell_generator(cell_params): >>> return single_cell_parser.create_cell(cell_params) >>> def cell_modify_functions(cell): >>> # alter cell >>> return cell >>> s = Simulator() # instantiate simulator object >>> fixed_params = {'stim_1.measure_fun.recSite': 835, 'stim_1.stim_setup.dist': 835} >>> s.setup.params_modify_funs.append([ 'fixed_params', partial(set_fixed_params, fixed_params=fixed_params) ]) >>> s.setup.cell_param_generator = cell_params_generator >>> s.setup.cell_generator = cell_generator >>> s.setup.params_modify_funs.append(['modify_param_1', param_modify_fun]) >>> s.setup.cell_param_modify_funs.append(['modify_cell_param_1', cell_param_modify_fun]) >>> s.setup.cell_modify_funs.append(['modify_cell_1', cell_modify_fun])Notable methods:
>>> s.setup.get(params) cell, paramsEach function that receives the biophysical parameter vector (i.e.
cell_param_modify_funsandcell_modify_funs) only sees a subset of the parameter vector that is provided by the user. This subset is determined by the name by which the function is registered.Example:
>>> params = { >>> 'apical_scaling.scale': 2, >>> 'ephys.soma.gKv': 0.001, >>> 'ephys.soma.gNav': 0.01 >>> } >>> def scale_apical(params, **kwargs): >>> params['scale'] = kwargs['scale'] >>> def ephys(cell, **kwargs): >>> cell.soma.gKv = kwargs['soma.gKv'] >>> cell.soma.gNav = kwargs['soma.Nav'] >>> s.setup.params_modify_funs.append([ 'apical_scaling', # name must equal the prefix of the parameter, i.e. 'apical_scaling' partial(scale_apical, 'scale' = 2)]) >>> s.setup.cell_modify_funs.append([ 'ephys', # name must equal the prefix of the parameter, i.e. 'ephys' partial(ephys, 'soma.gKv'=1, 'soma.gNav'=2)])- Attributes:¶
- cell_param_generator¶
A function that generates a
NTParameterSetcell parameter object.- Type:¶
callable
- stim_response_measure_funs¶
List of functions that extract voltage traces from the cell.
- Type:¶
list
- Methods:¶
check()Check if the setup is correct.
_check_not_none(var, varname, procedure_description)Convenience method to check if the output of some method is not None.
_check_first_element_of_name_is_the_same(list1, list2)Check if the first element of the names of two lists are the same.
Get the names of the stimuli.
Get the stimulus setup function by stimulus name.
get_stim_run_fun_by_stim(stim)Get the stimulus run function by stimulus name.
Get the stimulus response measure function by stimulus name.
get_params(params)Get the modified biophysical parameters.
get_cell_params(params)Get the cell parameters as an NTParameterSet from the parameter vector.
get_cell_params_with_default_sim_prams(params, recordingSites, tStart, tStop, dt, Vinit, T)Get a neuron parameter object.
get(params)Get the cell with set up biophysics and params.