@@ -21,8 +21,8 @@ def __init__(self, dt=None, cvode_active=True, cvode_minstep=None,
2121 """Constructor
2222
2323 Args:
24- dt (float): the integration time step used by neuron .
25- cvode_active (bool): should neuron use the variable time step
24+ dt (float): the integration time step used by Neuron .
25+ cvode_active (bool): should Neuron use the variable time step
2626 integration method
2727 cvode_minstep (float): the minimum time step allowed for a cvode
2828 step. Default is 0.0.
@@ -34,27 +34,21 @@ def __init__(self, dt=None, cvode_active=True, cvode_minstep=None,
3434 "./data/".
3535 """
3636
37- if platform .system () == 'Windows' :
38- # hoc.so does not exist on NEURON Windows
39- # although \\hoc.pyd can work here, it gives an error for
40- # nrn_nobanner_ line
41- self .disable_banner = False
42- self .banner_disabled = False
43- else :
44- self .disable_banner = True
45- self .banner_disabled = False
46-
37+ # hoc.so does not exist on NEURON Windows or MacOS
38+ # although \\hoc.pyd can work here, it gives an error for
39+ # nrn_nobanner_ line
40+ self .disable_banner = platform .system () not in ['Windows' , 'Darwin' ]
41+ self .banner_disabled = False
4742 self .mechanisms_directory = mechanisms_directory
48- self .neuron .h .load_file ('stdrun.hoc' )
4943
5044 self .dt = dt if dt is not None else self .neuron .h .dt
51- self .neuron .h .dt = self .dt
5245
53- self .neuron .h .cvode_active (1 if cvode_active else 0 )
5446 self .cvode_minstep_value = cvode_minstep
5547
5648 self .cvode_active = cvode_active
5749
50+ self .set_neuron_variables ()
51+
5852 self .random123_globalindex = random123_globalindex
5953
6054 @property
@@ -93,11 +87,9 @@ def _nrn_disable_banner():
9387 ctypes .c_int .in_dll (nrndll , 'nrn_nobanner_' ).value = 1
9488
9589 # pylint: disable=R0201
96- # TODO function below should probably a class property or something in that
97- # sense
9890 @property
9991 def neuron (self ):
100- """Return neuron module"""
92+ """Return Neuron module"""
10193
10294 if self .disable_banner and not self .banner_disabled :
10395 NrnSimulator ._nrn_disable_banner ()
@@ -112,6 +104,12 @@ def neuron(self):
112104
113105 return neuron
114106
107+ def set_neuron_variables (self ):
108+ """Set Neuron variables"""
109+ self .neuron .h .load_file ('stdrun.hoc' )
110+ self .neuron .h .dt = self .dt
111+ self .neuron .h .cvode_active (1 if self .cvode_active else 0 )
112+
115113 def run (
116114 self ,
117115 tstop = None ,
0 commit comments