@@ -17,8 +17,22 @@ class NrnSimulator(object):
1717 """Neuron simulator"""
1818
1919 def __init__ (self , dt = None , cvode_active = True , cvode_minstep = None ,
20- random123_globalindex = None ):
21- """Constructor"""
20+ random123_globalindex = None , mechanisms_directory = None ):
21+ """Constructor
22+
23+ Args:
24+ dt (float): the integration time step used by neuron.
25+ cvode_active (bool): should neuron use the variable time step
26+ integration method
27+ cvode_minstep (float): the minimum time step allowed for a cvode
28+ step. Default is 0.0.
29+ random123_globalindex (int): used to set the global index used by
30+ all instances of the Random123 instances of Random
31+ mechanisms_directory (str): path to the parent directory of the
32+ directory containing the mod files. If the mod files are in
33+ "./data/mechanisms", then mechanisms_directory should be
34+ "./data/".
35+ """
2236
2337 if platform .system () == 'Windows' :
2438 # hoc.so does not exist on NEURON Windows
@@ -30,6 +44,7 @@ def __init__(self, dt=None, cvode_active=True, cvode_minstep=None,
3044 self .disable_banner = True
3145 self .banner_disabled = False
3246
47+ self .mechanisms_directory = mechanisms_directory
3348 self .neuron .h .load_file ('stdrun.hoc' )
3449
3550 self .dt = dt if dt is not None else self .neuron .h .dt
@@ -90,6 +105,11 @@ def neuron(self):
90105
91106 import neuron # NOQA
92107
108+ if self .mechanisms_directory is not None :
109+ neuron .load_mechanisms (
110+ self .mechanisms_directory , warn_if_already_loaded = False
111+ )
112+
93113 return neuron
94114
95115 def run (
0 commit comments