nest / nestml

A domain specific language for neuron and synapse models in spiking neural network simulation
GNU General Public License v2.0
44 stars 46 forks source link

Issue in generate_code_for() #1047

Open Asf284 opened 2 months ago

Asf284 commented 2 months ago

I am facing an issue with pynestml.codegeneration.nest_code_generator_utils. I am trying to run stdp_windows.ipynb in the EBRAIN jupyterlab environment.

module_name, neuron_model_name, synapse_model_name = NESTCodeGeneratorUtils.generate_code_for( "iaf_psc_delta_neuron.nestml", nestml_stdp_model, post_ports=["post_spikes"])

When I run this, I get an error that says IndexError. As much as I understand this is happening because the generate_code_for() function tries to find names of neurons and synapses through the findall method from re. In the iaf_psc_delta_neuron.nestml file there is no neuron or synapse name declared. There is model iaf_psc_delta_neuron:. I don't know if I am doing something wrong. Can anyone give me an lead on this?

`--------------------------------------------------------------------------- IndexError Traceback (most recent call last) Cell In[7], line 1 ----> 1 module_name, neuron_model_name, synapse_model_name = NESTCodeGeneratorUtils.generate_code_for( 2 "iaf_psc_delta_neuron.nestml", 3 nestml_stdp_model, 4 post_ports=["post_spikes"])

File /srv/main-spack-instance-2309/spack/var/spack/environments/ebrains-23-09/.spack-env/view/lib/python3.8/site-packages/pynestml/codegeneration/nest_code_generator_utils.py:89, in NESTCodeGeneratorUtils.generate_code_for(cls, nestml_neuron_model, nestml_synapse_model, post_ports, mod_ports, uniq_id, logging_level) 86 nestml_neuron_model = nestml_model_file.read() 88 # update neuron model name inside the file ---> 89 neuron_model_name_orig = re.findall(r"neuron\ [^:\s]:", nestml_neuron_model)[0][7:-1] 90 neuron_model_name_uniq = neuron_model_name_orig + uniq_id 91 nestml_model = re.sub(r"neuron\ [^:\s]:", 92 "neuron " + neuron_model_name_uniq + ":", nestml_neuron_model)

IndexError: list index out of range`

image

clinssen commented 2 months ago

Hi, I think there is an issue with the versions. It would be great if you could try this with the latest NESTML code from the master branch. Could you try running python3 -m pip install git+https://github.com/nest/nestml/?

Asf284 commented 1 month ago

I used the master branch to import nestml with the command python3 -m pip install git+https://github.com/nest/nestml/, but I again encountered the same error. This was done on the EBRAINS platform. image