PyNN icon indicating copy to clipboard operation
PyNN copied to clipboard

Support retrieving the current value of state variables without recording

Open apdavison opened this issue 10 years ago • 5 comments

I propose to extend the get() method of Population, PopulationView and Assembly to allow returning the current value of state variables, such as the membrane potential.

apdavison avatar Jan 06 '16 16:01 apdavison

Hello, Does the current version has this feature?

ruthvik92 avatar Jul 26 '17 16:07 ruthvik92

No, this has not yet been implemented.

apdavison avatar Jul 29 '17 14:07 apdavison

Any idea about when this feature will be released? May be I could try looking into this if this is not a juggernaut task.

ruthvik92 avatar Aug 08 '17 05:08 ruthvik92

There is no particular timeline for implementing this. I would be happy for you to look into it.

A few suggestions for the implementation:

  • in the definition for common.Population.get(), you will see that the parameters are retrieved through a private method _get_parameter_dict(), which then calls _get_parameters(). The latter method is implemented separately for each simulator, i.e. as neuron.Population._get_parameters(), nest.Population._get_parameters(), etc.
  • to retrieve state variables through Population.get(), I suggest first creating a method _get_state_variables() for each simulator Population class.
  • implementing _get_state_variables() should be quite simple
    • for NEURON, something like [cell._cell.v for cell in population.all_cells] will give you the values of v for a whole population
    • for NEST, the equivalent is nest.GetStatus(p.all_cells.tolist(), 'V_m')
    • for Brian, I don't remember off the top of my head how to access the state variables, but I think it's quite simple
  • you will have to take care of translating variable names (e.g. 'v' --> 'V_m' for NEST) and units (e.g. pA --> nA for currents in NEST). The information needed for this is mostly in the celltype definitions in standardmodels.cells or in nest.recording, etc.

apdavison avatar Aug 08 '17 09:08 apdavison

I wrote a few lines of code as you suggested, I tested it with Neuron and I could read the membrane potentials. I haven't tried it with Brian or Nest. Thank you for your valuable insights.

ruthvik92 avatar Aug 23 '17 18:08 ruthvik92