Page 1 of 1

saving recordings automatically

Posted: Wed Oct 23, 2019 5:36 am
by guloncu
Hi,
I have created a cell on GUI and I am applying IClamp, SinClamp and INoise from soma. I am recording the voltage from a segment and saving that as .dat file from "print" dropdown menu. But, I have to do this process for hundreds of time. Is there a way I can automatize this process?

Thanks

Re: saving recordings automatically

Posted: Mon Oct 28, 2019 1:09 pm
by ted
It's called programming. If you've never done it before, it's time to start learning, hire somebody to do it for you, or develop a collaboration with somebody who knows how. We strongly suggest Python for all new programming projects. Fortunately, it's easy to use GUI-built models with Python. Here's a stub to help get you (or your collaborator) going. It assumes that you have saved your GUI-built model to a session file called mymodel.ses (by using NEURON Main Menu / File / save session).

Code: Select all

from neuron import h,gui
h.load_file('mymodel.ses')

# here insert statements that set up recording of t (time) 
# and v from the segment of interest
# to a pair of instances of the Vector class

# here define a procedure called save_data()
# that expects an integer numerical argument
# and writes the contents of the time and voltage vectors to an output file
# called result_i.dat
# where i is the value of the argument

NUMRUNS = 3 # for testing; change to whatever value you like

for i in range(NUMRUNS):
  h.run()
  save_data(i)