Page 1 of 1

Question about saving current data

Posted: Wed Jan 17, 2007 12:42 pm
by Meena
Hi,

I am trying to save the sodium current at the soma in my model in an .asc file.
This current would be called soma.i_na(0.5)

When I try getting the current profile in Neuron's "current" graph, I have no problem, I see a very small negative ( inward current) on my screen, this is what I expect to see as well.

But when I try saving this data using a vector into a .asc file, and replotting it using Microsoft Excel, I get a completely different profile.

I feel that I am making no error when I save this current, and yet, I cannot undertstand why I don't see the right profile.

Here's how I saved it and printed it onto a file:

objref recina
recina = new Vector()
recina.record(&soma.i_na(0.5))

objref savcurrent
savcurrent = new File()
savcurrent.wopen("current_soma.asc")
objref current_matrix
current_matrix = new Matrix()

savcurrent.wopen("current_soma.asc")
savcurrent.printf(" Time I_Na\n")
current_matrix.resize(rect.size(),2)
current_matrix.setcol(0, rect)
current_matrix.setcol(1, recina)
current_matrix.fprint(savcurrent, " %g")
savcurrent.close()

Can you please as advise as to what maybe going wrong ?
Am I missing something?

Thanks,
Meena

Posted: Fri Jan 19, 2007 5:04 am
by Raj
Where is your run() command?

General structure should be something like this (in pseudo code):

Code: Select all

myVector.record

run()

myVector.save

Posted: Fri Jan 19, 2007 2:47 pm
by ted
Quite to the point, Raj. To underscore and explain this, see the documentation of the
Vector class's record() method
http://www.neuron.yale.edu/neuron/stati ... tml#record
where you will find the following
Save the stream of values of "var" during a simulation into the vdest vector. Previous record and play specifications of this Vector (if any) are destroyed.

Details: Transfers take place on exit from finitialize() and on exit from fadvance().
and this bit of example code:

Code: Select all

objref dv
dv = new Vector()
dv.record(&terminal.v(.5))
init()	// or push the "Init and Run" button on the control panel
run()
Comment: the init() is superfluous with any recent version of NEURON.

Posted: Fri Jan 26, 2007 3:06 pm
by Meena
Thanks for the pointer Ted & Raj,

It works fine now and I managed to save the data that I was infact hoping to save!