Hi Ted
I have a question about the code you have uploaded for stimulation of a spherical neuron... when I run it by jupyter notebook, I get this error:
ValueError Traceback (most recent call last)
<ipython-input-7-46c659da76e0> in <module>
19 for sec in h.allsec():
20 sec.insert('extracellular')
---> 21 sec.insert('xtra')
22
23
ValueError: argument not a density mechanism name.
I have compiled xtra.mod and hoc files, would you help me solve the problem?
Thanks
"xtra is not a mechanism"
-
- Site Admin
- Posts: 6384
- Joined: Wed May 18, 2005 4:50 pm
- Location: Yale University School of Medicine
- Contact:
Re: Extracellular stimulation and recording
Hi, firoozeh. Open a terminal and cd into the directory that contains the py, hoc, ses, and mod files. At the system prompt execute
nrngui stimsphere.hoc
Did that work? What did NEURON print to the terminal?
Exit NEURON and try
python -i stimsphere.py
(or maybe you have to execute
python3 -i stimsphere.py
)
Did that work? If it didn't, what did NEURON print to the terminal?
nrngui stimsphere.hoc
Did that work? What did NEURON print to the terminal?
Exit NEURON and try
python -i stimsphere.py
(or maybe you have to execute
python3 -i stimsphere.py
)
Did that work? If it didn't, what did NEURON print to the terminal?
Re: Extracellular stimulation and recording
Thanks for your reply,
I changed cd into my current directory,(which is E:\....)
After executing nrngui stimsphere.hoc I got this in NEURON:
C:\nrn\bin\nrniv.exe: xtra is not a MECHANISM
in stimsphere.hoc near line 13
insert xtra
^
xopen("stimsphere.hoc")
NEURONMainMenu[0].execute1("{xopen("st...")
NEURONMainMenu[0].load_file(0, "E:/9616408...")
NEURONMainMenu[0].load("*.hoc", 0)
After that I tried python -i stimspehre.py
and python3 -i stimsphere.py
nrnhui opened, and It works properly...
so This means it works right!
But why still I got the error "xtra is not a MECHANISM", after executing nrngui stimsphere.hoc?
Thanks
I changed cd into my current directory,(which is E:\....)
After executing nrngui stimsphere.hoc I got this in NEURON:
C:\nrn\bin\nrniv.exe: xtra is not a MECHANISM
in stimsphere.hoc near line 13
insert xtra
^
xopen("stimsphere.hoc")
NEURONMainMenu[0].execute1("{xopen("st...")
NEURONMainMenu[0].load_file(0, "E:/9616408...")
NEURONMainMenu[0].load("*.hoc", 0)
After that I tried python -i stimspehre.py
and python3 -i stimsphere.py
nrnhui opened, and It works properly...
so This means it works right!
But why still I got the error "xtra is not a MECHANISM", after executing nrngui stimsphere.hoc?
Thanks
-
- Site Admin
- Posts: 6384
- Joined: Wed May 18, 2005 4:50 pm
- Location: Yale University School of Medicine
- Contact:
Re: Extracellular stimulation and recording
An error message of the form
foo is not a mechanism
means that your hoc or python file uses a mechanism called foo, but either
1. you haven't compiled the mod file that defines the properties of foo
or
2. if you did compile it, the results of compilation were written in some directory where NEURON doesn't know to look.
So open a terminal, cd to the directory where the model's hoc, ses, and py files are located, and then execute this command:
nrnivmodl
If compilation is successful, you should now be able to execute your model's main hoc or py file.
Let me know if this solves the problem.
foo is not a mechanism
means that your hoc or python file uses a mechanism called foo, but either
1. you haven't compiled the mod file that defines the properties of foo
or
2. if you did compile it, the results of compilation were written in some directory where NEURON doesn't know to look.
So open a terminal, cd to the directory where the model's hoc, ses, and py files are located, and then execute this command:
nrnivmodl
If compilation is successful, you should now be able to execute your model's main hoc or py file.
Let me know if this solves the problem.
Re: Extracellular stimulation and recording
I tried to do exactly what you said, I copy all my terminal here:
(my desired directory was on E:/...)
<<
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
Try the new cross-platform PowerShell https://aka.ms/pscore6
PS C:\Users\user> cd E:\9616408039_new\new_NEURON\stimsphere
PS E:\9616408039_new\new_NEURON\stimsphere> nrnivmodl
x86_64-w64-mingw32-gcc.exe -DDLL_EXPORT -DPIC -I/cygdrive/c/nrn/bin//../include -I/cygdrive/c/nrn/bin//../src/scopmath -I/c
ygdrive/c/nrn/bin//../src/nrnoc -I/cygdrive/c/nrn/bin//../src/oc -c mod_func.c
x86_64-w64-mingw32-gcc.exe -shared mod_func.o xtra.o \
-L/cygdrive/c/nrn/bin//../bin -lnrniv -lpthread -o 1084.nrnmech.dll
#rebase -b 0x64000000 -v nrnmech.dll
nrnmech.dll was built successfully.
>>
Have I done something wrong?
still I get "xtra is no mechanism" after executing nrngui .....
(my desired directory was on E:/...)
<<
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
Try the new cross-platform PowerShell https://aka.ms/pscore6
PS C:\Users\user> cd E:\9616408039_new\new_NEURON\stimsphere
PS E:\9616408039_new\new_NEURON\stimsphere> nrnivmodl
x86_64-w64-mingw32-gcc.exe -DDLL_EXPORT -DPIC -I/cygdrive/c/nrn/bin//../include -I/cygdrive/c/nrn/bin//../src/scopmath -I/c
ygdrive/c/nrn/bin//../src/nrnoc -I/cygdrive/c/nrn/bin//../src/oc -c mod_func.c
x86_64-w64-mingw32-gcc.exe -shared mod_func.o xtra.o \
-L/cygdrive/c/nrn/bin//../bin -lnrniv -lpthread -o 1084.nrnmech.dll
#rebase -b 0x64000000 -v nrnmech.dll
nrnmech.dll was built successfully.
>>
Have I done something wrong?
still I get "xtra is no mechanism" after executing nrngui .....
-
- Site Admin
- Posts: 6384
- Joined: Wed May 18, 2005 4:50 pm
- Location: Yale University School of Medicine
- Contact:
Re: "xtra is not a mechanism"
(I split these posts from the thread that they were part of, because these have nothing to do with extracellular stimulation and everything to do with adding new mechanisms to NEURON)
In the directory where you ran nrnivmodl
execute this command
nrngui
NEURON will print several lines of messages to the terminal. Copy and paste all those lines into your reply.
Next: quit PowerShell. Then start an ordinary cmd terminal, cd to the directory that contains the nrnmech.dll file, and execute
nrngui stimsphere.hoc
Did that work?
In the directory where you ran nrnivmodl
execute this command
nrngui
NEURON will print several lines of messages to the terminal. Copy and paste all those lines into your reply.
Next: quit PowerShell. Then start an ordinary cmd terminal, cd to the directory that contains the nrnmech.dll file, and execute
nrngui stimsphere.hoc
Did that work?
Re: "xtra is not a mechanism"
I execute nrngui after running nrnivmodl in powershell...
After typing nrngui , This message appeared: "How do you want to open this file?"
I couldnt select any app....
After exiting powerShell, when open bash and change cd and type "nrngui stimsphere.hoc', neuron gui opened and this shows:
<<
NEURON -- VERSION 8.0.0-2-g0e9a0517+ HEAD (0e9a0517+) 2021-04-30
Duke, Yale, and the BlueBrain Project -- Copyright 1984-2021
See http://neuron.yale.edu/neuron/credits
loading membrane mechanisms from E:\9616408039_new\new_NEURON\stimsphere\nrnmech.dll
Additional mechanisms from files
xtra.mod
1
1
1
Vector[3]
>>
Although my operating system is Windows, If I do this in cmd, I didnt get result...
I dont know whats wrong with my files....
After typing nrngui , This message appeared: "How do you want to open this file?"
I couldnt select any app....
After exiting powerShell, when open bash and change cd and type "nrngui stimsphere.hoc', neuron gui opened and this shows:
<<
NEURON -- VERSION 8.0.0-2-g0e9a0517+ HEAD (0e9a0517+) 2021-04-30
Duke, Yale, and the BlueBrain Project -- Copyright 1984-2021
See http://neuron.yale.edu/neuron/credits
loading membrane mechanisms from E:\9616408039_new\new_NEURON\stimsphere\nrnmech.dll
Additional mechanisms from files
xtra.mod
1
1
1
Vector[3]
>>
Although my operating system is Windows, If I do this in cmd, I didnt get result...
I dont know whats wrong with my files....
-
- Site Admin
- Posts: 6384
- Joined: Wed May 18, 2005 4:50 pm
- Location: Yale University School of Medicine
- Contact:
Re: "xtra is not a mechanism"
The problem isn't your files. NEURON and Windows have changed a lot since 2021. Uninstall NEURON, then download and install the latest version from nrn.readthedocs.io. Then delete the nrnmech.dll file, run nrnivmodl, and see what works.