Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue in generate_code_for() #1047

Open
Asf284 opened this issue May 1, 2024 · 2 comments
Open

Issue in generate_code_for() #1047

Asf284 opened this issue May 1, 2024 · 2 comments

Comments

@Asf284
Copy link

Asf284 commented May 1, 2024

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
Copy link
Contributor

clinssen commented May 8, 2024

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
Copy link
Author

Asf284 commented May 13, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants