Skip to content
This repository was archived by the owner on Feb 26, 2025. It is now read-only.

Commit 7e3cace

Browse files
authored
Merge pull request #381 from BlueBrain/mech_dir
Add ability to choose which directory the mechanisms are loaded from.
2 parents 6d41854 + 641593d commit 7e3cace

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

bluepyopt/ephys/simulators.py

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)