NeuroML / org.neuroml.export

Export from NeuroML & LEMS
http://neuroml.org
GNU Lesser General Public License v3.0
8 stars 10 forks source link

Improve path related errors to help users figure out what is wrong with their paths #98

Open sanjayankur31 opened 1 year ago

sanjayankur31 commented 1 year ago

At the moment, while trying to get the correct path to record from a synapse, the errors are not very helpful to users. They're of this form:

Exception in thread "main" java.lang.NullPointerException: Cannot invoke "org.lemsml.jlems.core.type.Component.getComponentType()" because "c" is null
        at org.neuroml.export.neuron.LEMSQuantityPathNeuron.getExposure(LEMSQuantityPathNeuron.java:91)
        at org.neuroml.export.neuron.LEMSQuantityPathNeuron.getExposure(LEMSQuantityPathNeuron.java:117)
        at org.neuroml.export.neuron.LEMSQuantityPathNeuron.getDimension(LEMSQuantityPathNeuron.java:151)
        at org.neuroml.export.neuron.NeuronWriter.getMainScript(NeuronWriter.java:1415)
        at org.neuroml.export.neuron.NeuronWriter.generateMainScriptAndMods(NeuronWriter.java:288)
        at org.neuroml.export.neuron.NeuronWriter.generateAndRun(NeuronWriter.java:156)
        at org.neuroml.JNeuroML.main(JNeuroML.java:525)

I wonder if it is possible for us to print some more information, for example---what component was it trying to get the componentType of? That'll help users figure out where the error is in the path.

borismarin commented 1 year ago

@sanjayankur31 could you please provide a test case?

sanjayankur31 commented 1 year ago

Sure---I ran into this when trying to record state variables here:

https://github.com/sanjayankur31/Human-L2-3-Cortical-Microcircuit/blob/feat/neuroml/NeuroML2/synapses/testProbAMPANMDA.py#L82

I didn't know that one needed to use the : operator, so I was trying things like this:

TestPop/0/0/synapses/probAMPANMDASyn/0/i_AMPA

I ended up adding a quick check like this to get some more info:

https://github.com/NeuroML/org.neuroml.export/commit/16ab87e7757ba47e4994f53cad3b7a5f2e831846


I added info on the : operator to docs now (but worth checking if I've written it all correctly please):

https://docs.neuroml.org/Userdocs/Paths.html