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

Error for dimension="none" when generated with neuroml #56

Open
MarcJavin opened this issue Apr 11, 2018 · 1 comment
Open

Error for dimension="none" when generated with neuroml #56

MarcJavin opened this issue Apr 11, 2018 · 1 comment

Comments

@MarcJavin
Copy link

Hi,

I am working with OpenWorm to generate automatically the ion channels used for the parameters C for the neurons. One of the gates used is a custom type that doesn't exist in NeuroML, which works with the simulation when looking like this (only the first parameter alpha matters here) :

<ComponentType name="customHGate" extends="gateHHInstantaneous" description="Custom gate for h">
        <Parameter name="alpha" dimension="none" />
        <Parameter name="k" dimension="concentration"/>
        <Parameter name="ca_half" dimension="concentration"/>
        <Constant name="SEC" dimension="time" value="1s"/>
        <Requirement name="caConc" dimension="concentration"/>
        <Dynamics>
            <DerivedVariable name="inf" dimension="none" value="1 / (1 + (exp( (ca_half - caConc) / k)))" exposure="inf"/>
            <DerivedVariable name="tau" dimension="time" value="0 * SEC" exposure="tau"/>
            <DerivedVariable name="q" dimension="none" value="inf" exposure="q"/>
            <DerivedVariable name="fcond" dimension="none" value="(1 +((q-1) * alpha))^instances" exposure="fcond"/>
        </Dynamics>
    </ComponentType>

However, when generated with NeuroML, the dimension of alpha is not written as it is none, and one obtains the following (only the parameter alpha changed) :


<ComponentType name="customHGate" extends="gateHHInstantaneous" description="Custom gate for h">
        <Parameter name="alpha" />
        <Parameter name="k" dimension="concentration"/>
        <Parameter name="ca_half" dimension="concentration"/>
        <Constant name="SEC" dimension="time" value="1s"/>
        <Requirement name="caConc" dimension="concentration"/>
        <Dynamics>
            <DerivedVariable name="inf" dimension="none" value="1 / (1 + (exp( (ca_half - caConc) / k)))" exposure="inf"/>
            <DerivedVariable name="tau" dimension="time" value="0 * SEC" exposure="tau"/>
            <DerivedVariable name="q" dimension="none" value="inf" exposure="q"/>
            <DerivedVariable name="fcond" dimension="none" value="(1 +((q-1) * alpha))^instances" exposure="fcond"/>
        </Dynamics>
    </ComponentType>

The problem is that this leads to an error when running JNeuroML :

pyNeuroML >>> jNeuroML >> (ERROR) no dimension for final param: alpha null
pyNeuroML >>> jNeuroML >> (LOG) at org.lemsml.jlems.core.logging.E.multiError(E.java:251)
pyNeuroML >>> jNeuroML >> (LOG) at org.lemsml.jlems.core.logging.E.error(E.java:217)
pyNeuroML >>> jNeuroML >> (LOG) at org.lemsml.jlems.core.type.FinalParam.toString(FinalParam.java:39)
pyNeuroML >>> jNeuroML >> (LOG) at java.lang.String.valueOf(String.java:2994)
pyNeuroML >>> jNeuroML >> (LOG) at java.lang.StringBuilder.append(StringBuilder.java:131)
pyNeuroML >>> jNeuroML >> (LOG) at org.lemsml.jlems.core.type.ParamValue.setValue(ParamValue.java:53)
pyNeuroML >>> jNeuroML >> (LOG) at org.lemsml.jlems.core.type.Component.resolve(Component.java:409)
pyNeuroML >>> jNeuroML >> (LOG) at org.lemsml.jlems.core.type.Component.resolve(Component.java:251)
pyNeuroML >>> jNeuroML >> (LOG) at org.lemsml.jlems.core.type.Component.resolve(Component.java:238)
pyNeuroML >>> jNeuroML >> (LOG) at org.lemsml.jlems.core.type.Component.checkResolve(Component.java:215)
pyNeuroML >>> jNeuroML >> Exception in thread "main" java.lang.NullPointerException
pyNeuroML >>> jNeuroML >> at org.lemsml.jlems.core.type.FinalParam.toString(FinalParam.java:41)
pyNeuroML >>> jNeuroML >> at java.lang.String.valueOf(String.java:2994)
pyNeuroML >>> jNeuroML >> at java.lang.StringBuilder.append(StringBuilder.java:131)
pyNeuroML >>> jNeuroML >> at org.lemsml.jlems.core.type.ParamValue.setValue(ParamValue.java:53)
pyNeuroML >>> jNeuroML >> at org.lemsml.jlems.core.type.Component.resolve(Component.java:409)
pyNeuroML >>> jNeuroML >> at org.lemsml.jlems.core.type.Component.resolve(Component.java:251)
pyNeuroML >>> jNeuroML >> at org.lemsml.jlems.core.type.Component.resolve(Component.java:238)
pyNeuroML >>> jNeuroML >> at org.lemsml.jlems.core.type.Component.checkResolve(Component.java:215)
pyNeuroML >>> jNeuroML >> at org.lemsml.jlems.core.type.Component.resolve(Component.java:471)
pyNeuroML >>> jNeuroML >> at org.lemsml.jlems.core.type.Component.resolve(Component.java:251)
pyNeuroML >>> jNeuroML >> at org.lemsml.jlems.core.type.Component.resolve(Component.java:238)
pyNeuroML >>> jNeuroML >> at org.lemsml.jlems.core.type.Component.checkResolve(Component.java:215)
pyNeuroML >>> jNeuroML >> at org.lemsml.jlems.core.type.Lems.resolve(Lems.java:163)
pyNeuroML >>> jNeuroML >> at org.lemsml.jlems.core.sim.LemsProcess.readModel(LemsProcess.java:82)
pyNeuroML >>> jNeuroML >> at org.neuroml.export.utils.Utils.readLemsNeuroMLFile(Utils.java:256)
pyNeuroML >>> jNeuroML >> at org.neuroml.JNeuroML.loadLemsFile(JNeuroML.java:239)
pyNeuroML >>> jNeuroML >> at org.neuroml.JNeuroML.loadLemsFile(JNeuroML.java:228)
pyNeuroML >>> jNeuroML >> at org.neuroml.JNeuroML.main(JNeuroML.java:453)

Is it possible to update JNeuroML to consider a dimension as none when not specified ?

@pgleeson
Copy link
Member

@RastaMarcus What do you mean precisely by "when generated with NeuroML"? Do you mean a python script using libNeuroML? Note you can also use PyLEMS to write such definitions: https://github.com/LEMS/pylems/blob/master/examples/apitest3.py

I agree it's an issue that the dimension="none" is not written. This is probably down to this line where the default value for dimension is set to none. The generated API then decides that there is no need to print that attribute, as it's the same as the default.

One option for you would be to try the PyLEMS API; another would be to write that definition in its own text file and straight after read in and replace that line with one containing dimension="none".

I'll look into removing the default value in the schema and this will fix the issue in the generated APIs, but it may have a knock on effect else where, so would like to test a bit locally first. The other option of fixing jLems (which is ultimately where the issue arises) I can look at too, but in general it's better to have the explicit requirement to specify dimension="none".

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

No branches or pull requests

2 participants