-
Notifications
You must be signed in to change notification settings - Fork 0
axon_model.m
models.axon_model is the 'core' of the NEURON-MATLAB interface implemented in ViNERS. models.axon_model generates and runs multithreaded NEURON simulations, executing tools.make_from_template to generate customised axon models with specified ultrastructural and biophysical properties. The expectation is that the model is called in a parfor loop like so:
parfor ii = 1:nSimulations
result(ii,:) = axon_model(ii, VE_field or [], model, arguments{:});
end
where VE_field is the output of tools.load_Ve_field.
models.axon_model
is called by models.membrane_currents, models.axon_thresholds, and models.nerve_stimulation, and utilises models/Gaines2016_v3 and models/Gaines2016_v3. See also models.analysis_interface.hoc
-
Sundt
,Gaines
,MRG
: select model to simulate. models/Gaines2016_v3 contains the implementations of both theGaines
(myelinated afferent) andMRG
(myelinated efferent) models. models/sundt2015_v1 contains the implementation of theSundt
model. -
-debug
,-echo
: Create a duplicate NEURON process in a shell so that the execution of the NEURON code can be debugged -
-stimulus
: set stimulus waveform and possibly current levels. See plots.preview_stimulus for more details. if-stim
is not set, construct a biphasic stimulus using-pw [pulse-width (ms)]
(default: 400 µs, with a 20 µs inter-phase gap) and-delay [time (ms)]
(default: 30 ms). for-fixed-stim
the parameter-uA
is also relevent as it sets stim levels (default: 10 µA - 1 mA, 25 steps). -
-fixed-stimuli
: skip threshold-finding procedure and use the values instimulus.a
(µA) to compute axon responses to predeterimined stimulus levels. Used by models.nerve_stimulation. -
-sweep-range [init LB UB]
: set initial guess and lower/upper bounds for threshold-finding procedure. Ignored if-fixed-stim
is set. -
-constantlength [val (mm)]
: set length of simulated axon. If not set, the unmyelinated axon has a standard length of 2 mm and the myelinated axon length depends on the fascicle diameter (31 nodes are simulated). Most of the time I set this to 8 mm for myelinated axons and 6 mm for unmyelinated axons. -
fibreDiam [diameter (µm)]
sets the outer (fibre) diameter. -
g_ratio [g]
,-gratio [g]
sets the g-ratio, the ratio between the inner (axon) diameter and the outer (fibre) diameter. This is used to generate models which match the distributions generated using models.axon_population -
-xy [intercept or 3d trajectory (mm)]
: set axon location
-
-spike
: return output spiketimes, computed in neuron -
-volt
: return membrane voltages at all nodes (slower) -
-current
: return membrane voltages and currents at all sections (nodes and internodes). This gets bottlenecked by disk IO and is very slow, do not do this unless necessary. -
-spk-volt [AP_threshold (mV)]
, default -20 mV. What Vm is considered the rising edge of a spike? -
-t-start [time (ms)]
, default 0 ms. Don't start writing output untilt >= t_begin
, helps make smaller files and faster simulations.
-
-sphase [value or 'rand']
: set spatial phase of the axon (displace along trajectory by ±1 node length) -
simDuration [time (ms)]
, default 100 ms. This is probably overkill. The duration of recordings generated using the outputs ofmodels.axon_model
does not depend on this setting. -
-get-parameters
: return list of axon model parameters (matches inputs needed by tools.make_from_template for models/Gaines2016_v3 or models/sundt2015_v1. Each item in this list of parameters is also an acceptable'parameter-name',[value]
input. -
-sensitivity [values]
: argument vector for Sobol' sensitivity analysis. -
-no-analysis
: skip analysis of NEURON output to extract parameters such as threshold and conduction velocity. -
-vClamp
: Run 3-level voltage-clamp-type experiment.-inactivation
runs an inactivation experiment (different set of stim amplitudes and timings).-vClamp-full
returns the currents and voltages for each stimulus level (at the voltage-clamped node, settable using-VClamp-node [node_id]
) -
-postprocess [handle]
: run a custom post-processing step instead of the standard make_cache_file. handle must be of the form[waves,result] = handle(cache_file,waves,vars,result)
-
-term
: instead of sampling the middle of the axon, sample the distal end of the axon (returns a slightly different current profile). -
-r-vector
: return result as a vector not a struct
On Windows, if NEURON runs into an error it will stop and wait for user input. With models.axon_model, this manifests as the program hanging. Thus, if models.membrane_currents or models.axon_thresholds is just sitting there doing nothing for a very long time (more than a few minutes elapse between pressing 'run' and the appearance of the first [002] Spike at: 0.11 uA
or similar), try cancelling (ctrl-C) and running
models.membrane_currents('-debug','-no-parallel')
. This will show the NEURON console in a duplicate process, allowing you to see what error has occurred. The most common source of error is due to nrnmech.dll
was not correctly copied from ~/source/nrnmech/
. This will be the case if the console window is showing you something like:
1
Reading stimulus files
begin model setup
1
C:/nrn/bin/nrniv.exe: node_sensory is not a MECHANISM
in C:\Users\ceiber\AppData\Local\Temp\pn-mdl-6244\/nrn-00.hoc near line 141
insert node_sensory // mod file declaring nodal channel properties
This should look like:
1
Reading stimulus files
begin model setup
1
from ../models import analysis
1
Doing internal threshold
Writing file C:/Users/ceiber/AppData/Local/Temp/pn-mdl-6244//NEURON_vm0.dat
Changed dt
Another error I experienced recently (which was diagnosed using models.membrane_currents(opts,'-debug','-no-parallel')
Can't load NEURON resources from /cygdrive/C/nrn/lib/nrn.def\[aults\] 1
Reading stimulus files
begin model setup
C:/nrn/bin/nrniv.exe: Couldn't find: noload.hoc
in C:\\Users\\ceiber\\AppData\\Local\\Temp\\pn-mdl-3948/nrn-00.hoc near line 37 load_file("noload.hoc")
This was a NEURON installation issue with NEURON 8.0, uninstalling and reinstalling NEURON with the default settings fixed the issue.