Save rxd concentration

A Python package that facilitates development and use of models of biological neural networks

Moderator: tom_morse

Post Reply
Barbara
Posts: 2
Joined: Fri Dec 10, 2021 9:01 am

Save rxd concentration

Post by Barbara »

Hello,

I'm trying to save the 3D distribution of the ions in my model into some format.
In simData the concentrations are only for the traces saved. From:

simConfig.analysis['plotRxDConcentration'] = {'speciesLabel': 'k', 'regionLabel': 'ecs','saveFig': True}

saveData is not an acceptable option.
So I was wondering, is there a way to save the 3D concentration of the ions also in time to recreate a movie of it?


Thanks in advance.

Barbara
ramcdougal
Posts: 240
Joined: Fri Nov 28, 2008 3:38 pm
Location: Yale School of Public Health

Re: Save rxd concentration

Post by ramcdougal »

If you're using NEURON 8.1+, the pure-NEURON solution is to either use h.SaveState (which saves ~everything) or rxd.save_state() and rxd.restore_state(), where the rxd-specific solutions represent state using byte-strings.

See the (admittedly brief) discussion at https://nrn.readthedocs.io/en/latest/py ... ring-state .

NetPyNE allows you to include some pure-NEURON code, so this might be the easiest way. @salvadord may know if there's a NetPyNE-native way to do it.
urdapile
Posts: 1
Joined: Thu Apr 21, 2022 8:26 am

Re: Save rxd concentration

Post by urdapile »

Dear Barbara,
I am part of the team developing and giving support to NetPyNE. In reference to your question, you have access to all the RxD information in the "sim.net" object (at the final timestep). In particular:

ecs = sim.net.rxd['regions']['ecs']['hObj']
k = sim.net.rxd['species']['k']['hObj']

and then

k_in_ecs = k[ecs]

contains the information about the concentration you are searching for at the related nodes. You can go through the nodes collecting information

k_in_ecs.concentration[num_node]
k_in_ecs.nodes[numnode].x3d or .y3d or .z3d

and, in the case of the extracellular region, you have also a 3Darray for the concentration via

k_in_ecs.states3d

Since this information is for the LAST time step, if you want to build a movie, you need to advance the simulation with a number of steps (and store the above variables). This data saving should be done manually (from the respective lists or numpy arrays), as currently there is no method to save the RxD information (or collect it during the simulation, as with "Traces"). I think the better source to see a very nice implementation is in the very exhaustive system that Craig Kelley has built for dealing with a RxD phenomenon in

https://github.com/suny-downstate-medic ... Depression

in particular, see the init.py
joe.w.graham
Posts: 7
Joined: Wed Aug 22, 2007 8:37 pm
Location: Tempe, AZ

Re: Save rxd concentration

Post by joe.w.graham »

Note that there is a NetPyNE example (Jupyter notebook) of making a movie out of RxD concentrations:
https://github.com/suny-downstate-medic ... _tut.ipynb

That may be a good starting point.
Post Reply