NeuroML / pyNeuroML

A single package in Python unifying scripts and modules for reading, writing, simulating and analysing NeuroML2/LEMS models.
https://docs.neuroml.org/Userdocs/Software/pyNeuroML.html
GNU Lesser General Public License v3.0
36 stars 30 forks source link

Plotting inactivation/activation #197

Closed christian-oreilly closed 1 year ago

christian-oreilly commented 1 year ago

I looked at the documentation on exposures and tried to find the different paths available using list_recording_paths_for_exposures but I could not find a way to get the times-series describing the activation and inactivation variables of HH models. I can get the overall current for a given type of ion currents using iDensity, e.g., in my case

simulation.add_column_to_output_file("output0", column_id="Kdrfast_soma", 
                                         quantity="pop/0/pyr/0/biophys/membraneProperties/Kdrfast_soma/iDensity/")

but I could not find a way to get the activation and inactivation alone. Is it something possible? If not, I think that could be a useful feature as it is convenient to see these gating states to better understand the dynamics of models.

sanjayankur31 commented 1 year ago

I just had a look at the schema docs, and various bits of the gates are exposed (the "dynamics" tab):

https://docs.neuroml.org/Userdocs/Schemas/Channels.html#gatehhrates

Are you looking for q?

There are also utilities to analyse channels:

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

The list_recording_paths_for_exposures method only provides an incomplete list that can be obtained from the model description. (The complete list of exposures requires the model to be instantiated)

christian-oreilly commented 1 year ago

These figures

image

show the dynamics (tau) and steady state for a given gating process (e.g., h: inactivation, m: activation). However, they do not allow us to see how h and m vary with time during the simulation. For that, it would require and exposure similar to iChannel. I am not sure what q stands for, but I supposed it was related to temperature (as in q10)...?

sanjayankur31 commented 1 year ago

Ah, yeh, q is not related to q10. q is what we're looking for here. The gate itself will have id h or m, but the variable in the component that is exposed as the value of the activation variable is q. Here is an example of recording/plotting rate variables:

https://github.com/NeuroML/NeuroML2/blob/2c397d00bd4b9aa03313165777d6ca4cfa437755/LEMSexamples/LEMS_NML2_Ex15_CaDynamics.xml#L348

pgleeson commented 1 year ago

Yes, q is what you require, e.g. for the HH model at https://github.com/NeuroML/NeuroML2/blob/master/LEMSexamples/LEMS_NML2_Ex5_DetCell.xml, m, h, n can be plotted with:

        <Display id="d2" title="Ex5: HH cell with simple morphology: rate variables" timeScale="1ms" xmin="0" xmax="300" ymin="-0.1" ymax="1.1">
                <Line id="m" quantity="hhpop[0]/bioPhys1/membraneProperties/naChans/naChan/m/q" scale="1"  color="#000000" timeScale="1ms"/>
                <Line id="h" quantity="hhpop[0]/bioPhys1/membraneProperties/naChans/naChan/h/q" scale="1"  color="#ff0000" timeScale="1ms"/>
                <Line id="n" quantity="hhpop[0]/bioPhys1/membraneProperties/kChans/kChan/n/q" scale="1"  color="#0000ff" timeScale="1ms"/>
        </Display>

Note: the gate has id m, etc and the variable inside there with its value is called q, e.g. see https://github.com/NeuroML/NeuroML2/blob/master/NeuroML2CoreTypes/Channels.xml#L246-L263