Dear all, While I try to solve my doubts on the other thread, I decided to try nestml on my own. For this, I installed docker and did: wget https://raw.githubusercontent.com/steffengraber/nest-docker/master/docker-co... and then: docker-compose up nest-jupyterlab as explained here: https://nest-simulator.readthedocs.io/en/latest/installation/docker.html#doc...
Then, I created a silly Python file that simply does:
import matplotlib.pyplot as plt import nest import numpy as np import os from pynestml.frontend.pynestml_frontend import generate_nest_target NEST_SIMULATOR_INSTALL_LOCATION = nest.ll_api.sli_func("statusdict/prefix ::") generate_nest_target(input_path="izhikevich.nestml", target_path="/tmp/nestml-component", logging_level="ERROR", codegen_opts={"nest_path": NEST_SIMULATOR_INSTALL_LOCATION})
where izhikevich.nestml is nothing else than a brute-force copy and paste of https://github.com/nest/nestml/blob/master/models/neurons/izhikevich.nestml
It should be trivial, but then I get:
-- N E S T -- Copyright (C) 2004 The NEST Initiative
Version: 3.4 Built: Mar 31 2023 12:33:35
This program is provided AS IS and comes with NO WARRANTY. See the file LICENSE for details.
Problems or suggestions? Visit https://www.nest-simulator.org
Type 'nest.help()' to find out more about NEST.
WARNING:root:PyGSL is not available. The stiffness test will be skipped. WARNING:root:Error when importing: No module named 'pygsl' line 44:4 extraneous input 'equations' expecting {NEWLINE, 'end', 'inline', 'recordable', NAME} line 48:4 extraneous input 'parameters' expecting {NEWLINE, 'end', 'inline', 'recordable', 'kernel', NAME} line 59:4 missing 'end' at 'input' line 63:4 extraneous input 'output' expecting {NEWLINE, 'end', NAME} line 77:24 mismatched input '<EOF>' expecting {'end', 'elif', 'else'} [6,GLOBAL, ERROR]: Error occurred during parsing: abort Traceback (most recent call last): File "/opt/data/Izhikevich.py", line 10, in <module> generate_nest_target(input_path="izhikevich.nestml", File "/usr/local/lib/python3.10/dist-packages/pynestml/frontend/pynestml_frontend.py", line 229, in generate_nest_target generate_target(input_path, target_platform="NEST", target_path=target_path, logging_level=logging_level, File "/usr/local/lib/python3.10/dist-packages/pynestml/frontend/pynestml_frontend.py", line 199, in generate_target raise Exception("Error(s) occurred while processing the model") Exception: Error(s) occurred while processing the model
which I do not understand. The syntaxis of nestml seems clear, no "end", right? Then, what am I doing wrong? Thanks! gus.- PS: I still have my doubts, as explained in the other thread, but I thought this is a different issue... sorry if I did wrong!!!
Hello Gustavo,
The “end” keyword was removed recently in NESTML and is not part of a release version yet. I suppose the docker container will have the last released version of NESTML (v5.2.0) which still has the “end” keyword in the models.
The Izhikevich neuron model with “end” keyword can be found here: https://github.com/nest/nestml/blob/v5.2.0/models/neurons/izhikevich.nestml
Please try this model and let us know if you face any issues.
Thanks, Pooja
On 12. Apr 2023, at 22:25, gustavo.patow@udg.edu wrote:
Dear all, While I try to solve my doubts on the other thread, I decided to try nestml on my own. For this, I installed docker and did: wget https://raw.githubusercontent.com/steffengraber/nest-docker/master/docker-co... and then: docker-compose up nest-jupyterlab as explained here: https://nest-simulator.readthedocs.io/en/latest/installation/docker.html#doc...
Then, I created a silly Python file that simply does:
import matplotlib.pyplot as plt import nest import numpy as np import os from pynestml.frontend.pynestml_frontend import generate_nest_target NEST_SIMULATOR_INSTALL_LOCATION = nest.ll_api.sli_func("statusdict/prefix ::") generate_nest_target(input_path="izhikevich.nestml", target_path="/tmp/nestml-component", logging_level="ERROR", codegen_opts={"nest_path": NEST_SIMULATOR_INSTALL_LOCATION})
where izhikevich.nestml is nothing else than a brute-force copy and paste of https://github.com/nest/nestml/blob/master/models/neurons/izhikevich.nestml
It should be trivial, but then I get:
-- N E S T --
Copyright (C) 2004 The NEST Initiative
Version: 3.4 Built: Mar 31 2023 12:33:35
This program is provided AS IS and comes with NO WARRANTY. See the file LICENSE for details.
Problems or suggestions? Visit https://www.nest-simulator.org
Type 'nest.help()' to find out more about NEST.
WARNING:root:PyGSL is not available. The stiffness test will be skipped. WARNING:root:Error when importing: No module named 'pygsl' line 44:4 extraneous input 'equations' expecting {NEWLINE, 'end', 'inline', 'recordable', NAME} line 48:4 extraneous input 'parameters' expecting {NEWLINE, 'end', 'inline', 'recordable', 'kernel', NAME} line 59:4 missing 'end' at 'input' line 63:4 extraneous input 'output' expecting {NEWLINE, 'end', NAME} line 77:24 mismatched input '<EOF>' expecting {'end', 'elif', 'else'} [6,GLOBAL, ERROR]: Error occurred during parsing: abort Traceback (most recent call last): File "/opt/data/Izhikevich.py", line 10, in <module> generate_nest_target(input_path="izhikevich.nestml", File "/usr/local/lib/python3.10/dist-packages/pynestml/frontend/pynestml_frontend.py", line 229, in generate_nest_target generate_target(input_path, target_platform="NEST", target_path=target_path, logging_level=logging_level, File "/usr/local/lib/python3.10/dist-packages/pynestml/frontend/pynestml_frontend.py", line 199, in generate_target raise Exception("Error(s) occurred while processing the model") Exception: Error(s) occurred while processing the model
which I do not understand. The syntaxis of nestml seems clear, no "end", right? Then, what am I doing wrong? Thanks! gus.- PS: I still have my doubts, as explained in the other thread, but I thought this is a different issue... sorry if I did wrong!!! _______________________________________________ NEST Users mailing list -- users@nest-simulator.org To unsubscribe send an email to users-leave@nest-simulator.org
Thanks!!!! This fixed it. However, there are some very minor incompatibilities between the tutorial and the nestml code in 5.2.0, but nothing too complex. Now, I have it running and ready to start the actual coding! Thanks! gus.-
Dear Gustavo,
could you please elaborate more on those incompatibilities?
Or even better, create a pull request https://nest-simulator.readthedocs.io/en/v3.4/developer_space/workflows/development_workflow.html to fix them? That way, all users would benefit from your fixes. If you need help for that, just let us know.
Many thanks and best regards, Jochen!
On 13.04.23 21:43, gustavo.patow@udg.edu wrote:
Thanks!!!! This fixed it. However, there are some very minor incompatibilities between the tutorial and the nestml code in 5.2.0, but nothing too complex. Now, I have it running and ready to start the actual coding! Thanks! gus.- _______________________________________________ NEST Users mailing list --users@nest-simulator.org To unsubscribe send an email tousers-leave@nest-simulator.org
Dear Jochen, The incompatibilities I mentioned are between the tutorial and the nestml version you pointed me to: https://github.com/nest/nestml/blob/v5.2.0/models/neurons/izhikevich.nestml but all of them will disappear when the docker version and the latest nestml version are the same. I mean, when no "end" commands are needed anymore in nestml... In any case, it was renaming v -> V_m and u -> U_m, nothing really important! ;-) cheers gus.-
Hi, I've finally successfully recreated the Izhikevich tutorial, but when I try to run the "homework" (i.e., generate the other results in the paper), I find some strange results. Basically, every time I run the neuron with Simulate(), the new simulation is ACCUMULATED after the previous result. I guess I should reset the voltmeter between simulations somehow, but I couldn't find the adequate commend... Can you give me any hint? Second, I am doing the homework for this tutorial, reproducing the original results. Should it suffice to enter the right values for a, b, c, and d? The results I am getting do not look too similar to the ones in the paper, especially the bursts for the IB and CH neurons... any idea? cheers gus.-
Hi!
I've finally successfully recreated the Izhikevich tutorial, but when I try to run the "homework" (i.e., generate the other results in the paper), I find some strange results. Basically, every time I run the neuron with Simulate(), the new simulation is ACCUMULATED after the previous result. I guess I should reset the voltmeter between simulations somehow, but I couldn't find the adequate commend... Can you give me any hint?
You can reset the data collected in the |voltmeter| by setting its |n_events| field to 0 like so:
|vm = nest.Create("voltmeter") # create and connect neurons, simulate vm.n_events = 0 # data from previous runs is gone |
For more information about the recording backend |memory|, see here: https://nest-simulator.readthedocs.io/en/v3.4/models/recording_backend_memor...
More general information about recording from your simulations is here: https://nest-simulator.readthedocs.io/en/v3.4/devices/record_from_simulation...
Second, I am doing the homework for this tutorial, reproducing the original results. Should it suffice to enter the right values for a, b, c, and d? The results I am getting do not look too similar to the ones in the paper, especially the bursts for the IB and CH neurons... any idea?
I am afraid, I’m not deep enough in the tutorial and can’t help you with this one. One of my colleagues will have to pick this one up.
Cheers, Jochen!
cheers gus.- _______________________________________________ NEST Users mailing list --users@nest-simulator.org To unsubscribe send an email tousers-leave@nest-simulator.org
Thanks, Jochen!!! However, this does not completely solve the problem: now, for the second run of Simulate() the simulation is empty until the end of the previous run, and then the second run starts. I mean:
nest.Simulate(250) # -> generates a simulation from 0 to 250 vm.n_events = 0 # data from previous runs is gone nest.Simulate(250). # -> This simulation goes from 250 to 500. It shows empty results between 0 and 250 for V, and the actual simulation between 250 and 500 for V.
If we examine the voltmeter.events content after both runs, the entry 'times' shows values between 250 and 500, so the command vm.n_events = 0 resets the contents (I checked it), but NOT some internal time counter.
Should I do a full nest.ResetKernel() and rebuilt everything (i.e., the network) for EACH run? No problem, although it sounds strange to me... ;-)
in any case, thanks again!!! gus.-
Hi!
However, this does not completely solve the problem: now, for the second run of Simulate() the simulation is empty until the end of the previous run, and then the second run starts. I mean:
nest.Simulate(250) # -> generates a simulation from 0 to 250 vm.n_events = 0 # data from previous runs is gone nest.Simulate(250). # -> This simulation goes from 250 to 500. It shows empty results between 0 and 250 for V, and the actual simulation between 250 and 500 for V.
If we examine the voltmeter.events content after both runs, the entry 'times' shows values between 250 and 500, so the command vm.n_events = 0 resets the contents (I checked it), but NOT some internal time counter.
Indeed. The setting I gave you only removes the events from the /specific/ device you’re using it on. Nothing else.
You can also reset time by calling |nest.biological_time = 0|. However, that comes with a big fat warning message printed to your screen for good reasons.
Should I do a full nest.ResetKernel() and rebuilt everything (i.e., the network) for EACH run? No problem, although it sounds strange to me... ;-)
Short answer: Yes. This is what you should do.
There is an ongoing discussion https://github.com/nest/nest-simulator/issues/2337 about resetting the /network state/ instead of completely destroying it (i.e. using |ResetKernel|) and rebuilding it. A short summary for why we don’t support that is that if you ask four people what a hypothetical |ResetNetwork| function should do, you probably get five different opinions and is extremely hard to track and reset each and every variable involved in the simulation and it is not even clear to what they should be reset to. Also see #1919 https://github.com/nest/nest-simulator/pull/1919 and the example |pynest/examples/store_restore_network.py| that resulted from it.
Cheers, Jochen!
Dear Jochen,
I have switched to a full network reset with ResetKernel(), and it WORKS like a charm!!! Not only that but now I was able to approximately reproduce ALL plots in the famous figure from Izhikevich's paper!! GREAT!!! Now, I will set out to implement my original target, the paper by Chen and Campbell:
Chen, L., Campbell, S.A. Exact mean-field models for spiking neural networks with adaptation. J Comput Neurosci 50, 445–469 (2022). https://doi.org/10.1007/s10827-022-00825-9
Thank you very much for all your invaluable help!!! cheers gus.-