Hey All,
This is going to be an extremely novice post, but I am having issues importing NEURON into Python. As someone relatively new to programming I am unsure of where I am going wrong but I keep getting the below:
>>> from neuron import h
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
from neuron import h
ImportError: No module named neuron
My ultimate goal is to rearrange the charts and buttons in NEURON, however, due to the above issue I decided to just edit the hoc files. So far I have accomplish what I've needed to do so by editing the actionpotential.hoc file using a text editor, however, I have been unable to find the code for the buttons on the far right (from "Init" to "Real Time") to rearrange their placement as well. If anyone can share with me the file in which the code for these buttons are located, I would be greatly appreciative. If doing so requires importing NEURON into Python I would appreciate that assistance as well.
Thank you ahead of time for any responses!
Need Help Locating File + NEURON not reflecting changes
Moderator: hines
Need Help Locating File + NEURON not reflecting changes
Last edited by GA_ScottRac on Tue Jan 30, 2018 6:25 pm, edited 1 time in total.
-
- Posts: 267
- Joined: Fri Nov 28, 2008 3:38 pm
- Location: Yale School of Public Health
Re: Python Installation Issues + Need Help Locating File
The import failure means that Python can't find the neuron module. The easiest way to fix this is to reinstall NEURON, and when prompted be sure to agree to let NEURON update your PATH and PYTHONPATH.
(If you just click through the install, this doesn't happen. You could also set the values manually, but the correct values are operating-system specific.)
I'm not 100% sure what panels you're seeing (are you running some specific model code?) but it sounds like you're describing the RunControl panel (Tools - RunControl). On Windows, this code gets installed at C:\nrn\lib\hoc\stdrun.hoc (look for the nrncontrolmenu procedure, around line 419 depending on version). Note that any changes you make there affect all NEURON models running on your system.
The relevant code block follows, just for reference:
(If you just click through the install, this doesn't happen. You could also set the values manually, but the correct values are operating-system specific.)
I'm not 100% sure what panels you're seeing (are you running some specific model code?) but it sounds like you're describing the RunControl panel (Tools - RunControl). On Windows, this code gets installed at C:\nrn\lib\hoc\stdrun.hoc (look for the nrncontrolmenu procedure, around line 419 depending on version). Note that any changes you make there affect all NEURON models running on your system.
The relevant code block follows, just for reference:
Code: Select all
proc nrncontrolmenu() {
xpanel("RunControl")
xpvalue("Init", &v_init, 1, "stdinit()", 1)
xbutton("Init & Run", "run()")
xbutton("Stop", "stoprun=1")
xvalue("Continue til", "runStopAt", 1, "{continuerun(runStopAt) stoprun=1}", 1, 1)
xvalue("Continue for", "runStopIn", 1, "{continuerun(t + runStopIn) stoprun=1}", 1,1)
xbutton("Single Step", "steprun()")
xvalue("t", "t", 2)
xvalue("Tstop", "tstop", 1, "tstop_changed()", 0, 1)
xpvalue("dt", &dt, 1, "setdt()")
xvalue("Points plotted/ms", "steps_per_ms", 1, "setdt()", 0, 1)
xpvalue("Scrn update invl", &screen_update_invl, 1)
// xcheckbox("Quiet", &stdrun_quiet)
xpvalue("Real Time", &realtime)
xpanel()
}
Re: Python Installation Issues + Need Help Locating File
Thank you for your help! I greatly appreciate it.
I found the RunControl panel code in the file you mentioned, however, when I save any edits to it and then run it, NEURON does not reflect the changes. I have run into a similar problem when attempting to change the code of other files in the nrn folder as well. Do you have any suggestions as to how I can fix this?
I found the RunControl panel code in the file you mentioned, however, when I save any edits to it and then run it, NEURON does not reflect the changes. I have run into a similar problem when attempting to change the code of other files in the nrn folder as well. Do you have any suggestions as to how I can fix this?
-
- Posts: 267
- Joined: Fri Nov 28, 2008 3:38 pm
- Location: Yale School of Public Health
Re: Need Help Locating File + NEURON not reflecting changes
You should see the changes if you do Tools - RunControl. Does the window that opens up look as you expect?
Not seeing the changes in whatever you're running is actually a good thing. It suggests that the window you're looking at is from a ses file (do you have any of those?) and can thus be modified there rather than for NEURON as a whole.
For a more specific answer, I'd need to know what model you're looking at. Is it something from ModelDB? Something a colleague gave you?
Not seeing the changes in whatever you're running is actually a good thing. It suggests that the window you're looking at is from a ses file (do you have any of those?) and can thus be modified there rather than for NEURON as a whole.
For a more specific answer, I'd need to know what model you're looking at. Is it something from ModelDB? Something a colleague gave you?
Re: Need Help Locating File + NEURON not reflecting changes
Thank you for your assistance! It turned out that I accidentally had a duplicate nrn folder and that was why my changes were not showing up. Everything is working well now.