Setting a property tag for a population of type population (not populationlist) causes jlems to throw an error
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 38/100
Línea de trabajo
Reproduce el fallo con el ejemplo de Python del issue, utilizando el backend jNeuroML/jLEMS y las etiquetas de propiedades de la población. Lee RunnableAccessor.java alrededor de la línea 139 y StateInstance.java en countMIs, en la línea 788, para seguir el estado singleAMI y multiA. Está hecho cuando el ejemplo se ejecuta en jLEMS sin eliminar las etiquetas de propiedades.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Python script:
#!/usr/bin/env python3
"""
Create a simple network with two populations.
"""
import random
import numpy as np
from neuroml.utils import component_factory
from pyneuroml import pynml
from pyneuroml.lems import LEMSSimulation
import neuroml.writers as writers
nml_doc = component_factory("NeuroMLDocument", id="IzNet")
iz0 = nml_doc.add(
"Izhikevich2007Cell",
id="iz2007RS0",
v0="-60mV",
C="100pF",
k="0.7nS_per_mV",
vr="-60mV",
vt="-40mV",
vpeak="35mV",
a="0.03per_ms",
b="-2nS",
c="-50.0mV",
d="100pA",
)
# Inspect the component, also show all members:
iz0.info(True)
# Create a component of type ExpOneSynapse, and add it to the document
syn0 = nml_doc.add(
"ExpOneSynapse", id="syn0", gbase="65nS", erev="0mV", tau_decay="3ms"
)
# Check what we have so far:
nml_doc.info(True)
# Also try:
print(nml_doc.summary())
# create the network: turned of validation because we will add populations next
net = nml_doc.add("Network", id="IzNet", validate=False)
# create the first population
size0 = 5
pop0 = component_factory("Population", id="IzPop0", component=iz0.id, size=size0)
# Set optional color property. Note: used later when generating plots
pop0.add("Property", tag="color", value="0 0 .8")
net.add(pop0)
# create the second population
size1 = 5
pop1 = component_factory("Population", id="IzPop1", component=iz0.id, size=size1)
pop1.add("Property", tag="color", value=".8 0 0")
net.add(pop1)
# network should be valid now that it contains populations
net.validate()
# create a projection from one population to another
proj = net.add(
"Projection",
id="proj",
presynaptic_population=pop0.id,
postsynaptic_population=pop1.id,
synapse=syn0.id,
)
# We do two things in the loop:
# - add pulse generator inputs to population 1 to make neurons spike
# - create synapses between the two populations with a particular probability
random.seed(123)
prob_connection = 0.8
count = 0
for pre in range(0, size0):
# pulse generator as explicit stimulus
pg = nml_doc.add(
"PulseGenerator",
id="pg_%i" % pre,
delay="0ms",
duration="10000ms",
amplitude="%f nA" % (0.1 + 0.1 * random.random()),
)
exp_input = net.add(
"ExplicitInput", target="%s[%i]" % (pop0.id, pre), input=pg.id
)
# synapses between populations
for post in range(0, size1):
if random.random() <= prob_connection:
syn = proj.add(
"Connection",
id=count,
pre_cell_id="../%s[%i]" % (pop0.id, pre),
post_cell_id="../%s[%i]" % (pop1.id, post),
)
count += 1
nml_doc.info(True)
print(nml_doc.summary())
# write model to file and validate
nml_file = "izhikevich2007_network.nml"
writers.NeuroMLWriter.write(nml_doc, nml_file)
print("Written network file to: " + nml_file)
pynml.validate_neuroml2(nml_file)
# Create simulation, and record data
simulation_id = "example_izhikevich2007network_sim"
simulation = LEMSSimulation(
sim_id=simulation_id, duration=1000, dt=0.1, simulation_seed=123
)
simulation.assign_simulation_target(net.id)
simulation.include_neuroml2_file(nml_file)
simulation.create_event_output_file(
"pop0", "%s.0.spikes.dat" % simulation_id, format="ID_TIME"
)
for pre in range(0, size0):
simulation.add_selection_to_event_output_file(
"pop0", pre, "IzPop0[{}]".format(pre), "spike"
)
simulation.create_event_output_file(
"pop1", "%s.1.spikes.dat" % simulation_id, format="ID_TIME"
)
for pre in range(0, size1):
simulation.add_selection_to_event_output_file(
"pop1", pre, "IzPop1[{}]".format(pre), "spike"
)
lems_simulation_file = simulation.save_to_file()
# Run the simulation
pynml.run_lems_with_jneuroml(
lems_simulation_file, max_memory="2G", nogui=True, plot=False
)
# Load the data from the file and plot the spike times
# using the pynml generate_plot utility function.
data_array_0 = np.loadtxt("%s.0.spikes.dat" % simulation_id)
data_array_1 = np.loadtxt("%s.1.spikes.dat" % simulation_id)
times_0 = data_array_0[:, 1]
times_1 = data_array_1[:, 1]
ids_0 = data_array_0[:, 0]
ids_1 = [id + size0 for id in data_array_1[:, 0]]
pynml.generate_plot(
[times_0, times_1],
[ids_0, ids_1],
"Spike times",
show_plot_already=False,
save_figure_to="%s-spikes.png" % simulation_id,
xaxis="time (s)",
yaxis="cell ID",
colors=["b", "r"],
linewidths=["0", "0"],
markers=[".", "."],
)
Output (failure):
pyNeuroML >>> INFO - Loading NeuroML2 file: /home/asinha/Documents/02_Code/00_mine/NeuroML/documentation/source/Userdocs/NML2_examples/izhikevich2007_network.nml
pyNeuroML >>> INFO - Loading LEMS file: LEMS_example_izhikevich2007network_sim.xml and running with jNeuroML
pyNeuroML >>> INFO - Executing: (java -Xmx2G -Djava.awt.headless=true -jar "/home/asinha/Documents/02_Code/00_mine/NeuroML/documentation/.venv/lib/python3.10/site-packages/pyneuroml/lib/jNeuroML-0.12.0-jar-with-dependencies.jar" "LEMS_example_izhikevich2007network_sim.xml" -nogui -I '') in directory: .
pyNeuroML >>> CRITICAL - *** Problem running command:
Command 'java -Xmx2G -Djava.awt.headless=true -jar "/home/asinha/Documents/02_Code/00_mine/NeuroML/documentation/.venv/lib/python3.10/site-packages/pyneuroml/lib/jNeuroML-0.12.0-jar-with-dependencies.jar" "LEMS_example_izhikevich2007network_sim.xml" -nogui -I ''' returned non-zero exit status 1.
pyNeuroML >>> CRITICAL - jNeuroML >> jNeuroML v0.12.0
jNeuroML >> Loading: /home/asinha/Documents/02_Code/00_mine/NeuroML/documentation/source/Userdocs/NML2_examples/LEMS_example_izhikevich2007network_sim.xml with jLEMS, NO GUI mode...
jNeuroML >> org.lemsml.jlems.core.run.ConnectionError: Can't get predicate [0] from IzPop0[population], original path: ../IzPop0[0]
jNeuroML >> component has singeMI=false
jNeuroML >> at org.lemsml.jlems.core.sim.RunnableAccessor.getRelativeStateInstance(RunnableAccessor.java:140)
jNeuroML >> at org.lemsml.jlems.core.run.WithBuilder.postBuild(WithBuilder.java:37)
jNeuroML >> at org.lemsml.jlems.core.run.Builder.postBuild(Builder.java:25)
jNeuroML >> at org.lemsml.jlems.core.run.StateType.build(StateType.java:340)
jNeuroML >> at org.lemsml.jlems.core.run.StateInstance.checkBuilt(StateInstance.java:1187)
jNeuroML >> at org.lemsml.jlems.core.run.StateInstance.checkBuilt(StateInstance.java:1199)
jNeuroML >> at org.lemsml.jlems.core.run.StateInstance.checkBuilt(StateInstance.java:1199)
jNeuroML >> at org.lemsml.jlems.core.type.Lems.build(Lems.java:359)
jNeuroML >> at org.lemsml.jlems.core.sim.Sim.run(Sim.java:232)
jNeuroML >> at org.lemsml.jlems.core.sim.Sim.run(Sim.java:154)
jNeuroML >> at org.lemsml.jlems.core.sim.Sim.run(Sim.java:145)
jNeuroML >> at org.neuroml.export.utils.Utils.loadLemsFile(Utils.java:527)
jNeuroML >> at org.neuroml.export.utils.Utils.runLemsFile(Utils.java:493)
jNeuroML >> at org.neuroml.JNeuroML.main(JNeuroML.java:606)
jNeuroML >> INFO Oct 19,2022 13:17 (INFO) Loading LEMS file from: /home/asinha/Documents/02_Code/00_mine/NeuroML/documentation/source/Userdocs/NML2_examples/LEMS_example_izhikevich2007network_sim.xml
jNeuroML >> INFO Oct 19,2022 13:17 (INFO) Reading from: /home/asinha/Documents/02_Code/00_mine/NeuroML/documentation/source/Userdocs/NML2_examples/LEMS_example_izhikevich2007network_sim.xml
jNeuroML >>
pyNeuroML >>> ERROR - execute_command_in_dir returned with output: jNeuroML v0.12.0
Loading: /home/asinha/Documents/02_Code/00_mine/NeuroML/documentation/source/Userdocs/NML2_examples/LEMS_example_izhikevich2007network_sim.xml with jLEMS, NO GUI mode...
org.lemsml.jlems.core.run.ConnectionError: Can't get predicate [0] from IzPop0[population], original path: ../IzPop0[0]
component has singeMI=false
at org.lemsml.jlems.core.sim.RunnableAccessor.getRelativeStateInstance(RunnableAccessor.java:140)
at org.lemsml.jlems.core.run.WithBuilder.postBuild(WithBuilder.java:37)
at org.lemsml.jlems.core.run.Builder.postBuild(Builder.java:25)
at org.lemsml.jlems.core.run.StateType.build(StateType.java:340)
at org.lemsml.jlems.core.run.StateInstance.checkBuilt(StateInstance.java:1187)
at org.lemsml.jlems.core.run.StateInstance.checkBuilt(StateInstance.java:1199)
at org.lemsml.jlems.core.run.StateInstance.checkBuilt(StateInstance.java:1199)
at org.lemsml.jlems.core.type.Lems.build(Lems.java:359)
at org.lemsml.jlems.core.sim.Sim.run(Sim.java:232)
at org.lemsml.jlems.core.sim.Sim.run(Sim.java:154)
at org.lemsml.jlems.core.sim.Sim.run(Sim.java:145)
at org.neuroml.export.utils.Utils.loadLemsFile(Utils.java:527)
at org.neuroml.export.utils.Utils.runLemsFile(Utils.java:493)
at org.neuroml.JNeuroML.main(JNeuroML.java:606)
INFO Oct 19,2022 13:17 (INFO) Loading LEMS file from: /home/asinha/Documents/02_Code/00_mine/NeuroML/documentation/source/Userdocs/NML2_examples/LEMS_example_izhikevich2007network_sim.xml
INFO Oct 19,2022 13:17 (INFO) Reading from: /home/asinha/Documents/02_Code/00_mine/NeuroML/documentation/source/Userdocs/NML2_examples/LEMS_example_izhikevich2007network_sim.xml
It runs fine if one uses the NEURON simulation backend. To make it run in jneuroml/jlems, one needs to remove the property tag for the two populations.
Analysis (short!)
This is where the error message is generated:
The addition of the property tag to the population makes seems to set singleAMI to false. I think this is being his is being set here in countMIs on the basis of the size of multiA:
- Lenguaje dominante
- Java
- Estrellas
- 13
- Forks
- 11
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de LEMS/jLEMS
-
bug
Dificultad 3/5 1-2 días Aptitud para principiantes 35/100
-
bug
Dificultad 3/5 1-2 días Aptitud para principiantes 45/100
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 45/100
-
bug
Dificultad 3/5 1-2 días Aptitud para principiantes 35/100
-
As a user I want to set a recording frequency different from the simulation/integration time stepAbiertoenhancement help required
Dificultad 4/5 3-5 días Aptitud para principiantes 38/100
Todos los issues de LEMS/jLEMS
Issues similares
-
[Bug]: REST API URL starting with "http" but no scheme (e.g. httpbin.org/get) is not given an http:// prefixPosiblemente ocupada @ItsDeadlyProgrammer la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
appsmithorg/appsmith#42471 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
code-maintenance
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
Los mantenedores suelen responder en 1 día
-
bug priority: medium Review effort [1-5]: 3 status: needs-triage type: bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
carlos-emr/carlos#5258 ·
Los mantenedores suelen responder en 1 día
-
bug: author create/update with an unknown avatarId returns 404 instead of 400 UNKNOWN_REFERENCEPosiblemente ocupada @Vinu2111 la tomó hoy. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
atomityhq/blog-cms#59 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
PlatformSpecific.hasGreenThreads incorrectly returns false for JDK updates and non-GA versionsAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
Los mantenedores suelen responder en 1 día