/****************************************************************
* FILE ana_G.hoc
*
* init.hoc loads Randy's FR motoneuron and voltage ramp code
* To execute, execute runvc("<modelname>")
* This will save the current and voltage data, for the trace, one point
* per second, with the model name incorporated in the file name
****************************************************************/
objref vecV, vecI, ff
strdef fn, ldfl, myf
/**************************************************
* PROC ana_G() begin
*
* Generate a conductance ramp and record the current and voltage
* Argument is the cell file name
**************************************************/
proc ana_G() {
print "conductance clamp not yet implemented\n"
return
if (numarg() < 1) {
print "ana_FI(): call with FR cell for argument"
return
}
fn = $s1
if (! xopen(fn)) {
printf("Fail to open requested cell file %s\n", fn)
return
}
sprint(myf, "%s/vramp", codeloc)
load_file(myf)
sprint(myf, "%s/FRmnrampvc.ses", codeloc)
load_file(myf)
//V0=-70
// SLOPE=.006
// TR=10000
simple()
vrampon()
rungc(fn)
}
// PROC ana_FI end
// PROC rungc() begin
// To execute, execute runvc("<modelname>")
// This will save the current and voltage data, for the trace, one point
// per second, with the model name incorporated in the file name
proc rungc() {local i
ldfl = $s1
fo=load_file(ldfl)
if (!fo) {
printf("bad file\n")
return
}
objref vecV, vecI, ff
vecI=new Vector()
vecI.record(&VClamp[0].i)
vecV = new Vector()
vecV.record(&v(0.5))
init()
run()
ff = new File()
// sprint(filename,"%s-vc_V0=%d_SLOPE=%.3f_TR=%d.csv",fn,V0,SLOPE,TR)
sprint(fn, "FRvcdata_%s.csv", ldfl)
fo=ff.wopen(fn)
if (!fo) {
printf("Fail to open file %s, code=%d\n", fn, fo)
return
}
ff.printf("label:%s\n", ldfl)
ff.printf("%d\n", (vecI.size-1)/40)
// We only need to save one point per millicsecond, i.e. every 40th point
for (i=0; i<vecI.size; i=i+40) {
ff.printf("%.4f,%.5f\n", vecV.x[i], vecI.x[i])
}
ff.close()
printf("Created output file %s\nUse Excel to analyze IV curve and PIC parameters", fn)
}
// PROC rungc end