NameError: Name Not Defined for Distributed Mechanism
Posted: Sun Jun 18, 2023 11:05 pm
Hello NEURON users and contributors,
I am new to NEURON with no NMODL experience, but am wondering if there are any suggestions or comments on how to fix an error I have been getting:
After being given the mod file for a distributed mechanism, I am trying to insert a user-defined distributed mechanism into a model of an axon Section. The code of the model is in Python, and running it with Python should simulate an axon being injected with current. The SUFFIX for the mechanism that I am intending to be inserted through the code is 'mathews_KLVA'. When I run the code in Python, the NEURON gui pops up but I get a NameError stating that the name 'mathews_KLVA' is not defined.
Contextual information: I am using a macOS Monterey version 12.0.1 operating system and a 3.8 version of Python. The mod files for all the user-defined distributed mechanisms have been compiled and loaded into NEURON. My .py and mod files are in the same folder but the NEURON package is not. The code of the .py file for my model is below. Sorry, I do not know how to format the code yet. I would appreciate comments on why I am getting the error and how to fix it. Thank you!
from neuron import h, gui
h.load_file("stdrun.hoc")
axon = h.Section(name="axon")
h.hh.insert(axon)
mathews_KLVA.insert(axon)
#t = h.Vector().record(h._ref_t)
#v = h.Vector().record(axon(0.5)._ref_v)
ic = h.IClamp(axon(0))
ic.delay = 2 # ms
ic.dur = 0.1 # ms
ic.amp = 100 # nA
h.finitialize(-65)
h.continuerun(5)
I am new to NEURON with no NMODL experience, but am wondering if there are any suggestions or comments on how to fix an error I have been getting:
After being given the mod file for a distributed mechanism, I am trying to insert a user-defined distributed mechanism into a model of an axon Section. The code of the model is in Python, and running it with Python should simulate an axon being injected with current. The SUFFIX for the mechanism that I am intending to be inserted through the code is 'mathews_KLVA'. When I run the code in Python, the NEURON gui pops up but I get a NameError stating that the name 'mathews_KLVA' is not defined.
Contextual information: I am using a macOS Monterey version 12.0.1 operating system and a 3.8 version of Python. The mod files for all the user-defined distributed mechanisms have been compiled and loaded into NEURON. My .py and mod files are in the same folder but the NEURON package is not. The code of the .py file for my model is below. Sorry, I do not know how to format the code yet. I would appreciate comments on why I am getting the error and how to fix it. Thank you!
from neuron import h, gui
h.load_file("stdrun.hoc")
axon = h.Section(name="axon")
h.hh.insert(axon)
mathews_KLVA.insert(axon)
#t = h.Vector().record(h._ref_t)
#v = h.Vector().record(axon(0.5)._ref_v)
ic = h.IClamp(axon(0))
ic.delay = 2 # ms
ic.dur = 0.1 # ms
ic.amp = 100 # nA
h.finitialize(-65)
h.continuerun(5)