Page 1 of 1

Obtaining Voltage Spike Data

Posted: Thu Jul 12, 2012 9:59 am
by Js Lee

I am currently running my simulations through a desktop computer; however, the time it takes to plot these graphs through the GUI in NEURON is taking forever. Hence, I am trying to run the simulations through a High-Performance Computing Cluster (HPCC) at my college. Is there a way to export the voltage spike data in NEURON to a file so that I can plot the data separately through Python?

Thank you,
Js Lee

Re: Obtaining Voltage Spike Data

Posted: Thu Jul 12, 2012 11:37 am
by ted
If you want the complete time course of membrane potential, use the Vector class's record() method to capture membrane potential at a particular location to a Vector. Example:

Code: Select all

// these statements only need to be executed once
// a good time to do this would be immediately after the model specification code
// i.e. the statements that set up the topology, geometry, and biophysics of the model
objref vvec, tvec
tvec = new Vector()
tvec.record(&t) // record time
vvec = new Vector()
axon vvec.record(&v(1)) // record v at 1 end of axon
If you only need spike times, the best thing to do is to use the NetCon class's record() method to capture spike times to a Vector. For an example, see the Programmer's Reference documentation of the NetCon class; as with Vector recording, this only has to be done once in a program, and an appropriate place for these statements would be right after the model specification has been executed.

In either case, after a simulation you just write the contents of the Vector to a file (see documentation of the Vector and File classes). If you're going to { run, then save results } many times, you might want to create your own procedure to automate this task, e.g.

Code: Select all

proc myrun() {
  run() // launches a simulation
run() is part of NEURON's standard run system. saveresults() is your own procedure that you wrote to open a file, write results to it, and close the file and can be as fancy as you like--most convenient would be if it automatically creates a different file name each time it is called.

Re: Obtaining Voltage Spike Data

Posted: Thu Jul 12, 2012 2:24 pm
by Js Lee
Great! Thank you Ted for your help. I added a new record section within my code, and it works as intended.

Js Lee