Numbers that printed in terminal

The basics of how to develop, test, and use models.
Post Reply
einsinghaf
Posts: 11
Joined: Tue Jun 17, 2014 2:23 pm

Numbers that printed in terminal

Post by einsinghaf »

my code is

Code: Select all

//
frq=40
strdef back_dir,tmp_str,seprt
back_dir         = "./../"
seprt		="/"
print "*******filegen0"

objref fnamegen1
strdef fname1
fnamegen1 = new File()
sprint(fname1,"%s%d%slengh-nseg.txt", back_dir, frq, seprt)
load_file(fname1)
fnamegen1.wopen(fname1)
print "*******filegen1"

objref fnamegen2
strdef fname2
fnamegen2 = new File()
sprint(fname2,"%s%d%scoords.txt", back_dir, frq, seprt)
load_file(fname2)
fnamegen2.wopen(fname2)
print "*******filegen2"

objref fnamegen3
strdef fname3
fnamegen3 = new File()
sprint(fname3,"%s%d%smemcurrent-forallsecs.txt", back_dir, frq, seprt)
load_file(fname3)
fnamegen3.wopen(fname3)
print "*******filegen3"

objref fnamegen4
strdef fname4
fnamegen4 = new File()
sprint(fname4,"%s%d%stdur-tstep-ncmp.txt", back_dir, frq, seprt)
load_file(fname4)
fnamegen4.wopen(fname4)
print "*******filegen4"

objref fnamegen5
strdef fname5
fnamegen5 = new File()
sprint(fname5,"%s%d%ssoma.txt", back_dir, frq, seprt)
load_file(fname5)
fnamegen5.wopen(fname5)
print "*******filegen5"
proc pause() { local t0
  t0 = startsw()
  while (startsw()-t0 < $1) { }
}
pause(10)

objref fnamegen6
strdef fname6
fnamegen6 = new File()
sprint(fname6,"%s%d%sdend.txt", back_dir, frq, seprt)
load_file(fname6)
fnamegen6.wopen(fname6)
print "*******filegen6"
pause(10)

objref fnamegen7
strdef fname7
fnamegen7 = new File()
sprint(fname7,"%s%d%si_in.txt", back_dir, frq, seprt)
load_file(fname7)
fnamegen7.wopen(fname7)
print "*******filegen7"

objref fnamegen8
strdef fname8
fnamegen8 = new File()
sprint(fname8,"%s%d%svoltage_s.txt", back_dir, frq, seprt)
load_file(fname8)
fnamegen8.wopen(fname8)
print "*******filegen8"

objref fnamegen9
strdef fname9
fnamegen9 = new File()
sprint(fname9,"%s%d%svoltage_d.txt", back_dir, frq, seprt)
load_file(fname9)
fnamegen9.wopen(fname9)
print "*******filegen9"

objref fnamegen10
strdef fname10
fnamegen10 = new File()
sprint(fname10,"%s%d%sfreq-del-dur.txt", back_dir, frq, seprt)
load_file(fname10)
fnamegen10.wopen(fname10)
print "*******filegen10"


/////////////  Ball and stick CA1 Model ////////////////
////////////////  Topology //////////////////

create soma,apical
access soma
connect apical(0),soma(1)

///////////////   Geometry  ////////////////
soma{
	//L=30
	//diam=15
	nseg=1
	pt3dclear()
	pt3dadd(0,-15,0,15)
	pt3dadd(0,15,0,15)
}


apical{
	//L=500
	//diam=2
	nseg=1
	pt3dclear()
	pt3dadd(0,15,0,2)
	pt3dadd(0,515,0,2)
}



forall{
	Ra=300
	cm=1
	celsius = 34
}

//////////////////////////////

/////////// calculating 0.1 of lambda for 100hz for all sections...ensures good spatial resolution

func lambda_f(){
return 1e5*sqrt(diam/(4*PI*$1*Ra*cm))       ////// $1 is the frequency for measuring lambda
}

proc geom_nseg(){
     forall{nseg = int ((L/(0.1*lambda_f(100))+0.9)/2)*2 +1}
}

geom_nseg()


////////////////////// Biophysics//////////////

////// Ra and cm is defined earlier in topology

apical{ nseg = 100} 

forall{	  
	  insert pas
	  g_pas = 1/25000
	  e_pas = -70

}

apical{
	insert h
}

/////////Gradient_Variables////////
base = 0e-3
maximum = 1e-3
dhalf=175/5 
dslope=60/5

for(i=1;i<101;i+=1){
	apical_section = ((2*i)-1)/(2 * 100)
	apical.gbar_h(apical_section) =(base + ( (maximum-base)/(1 + exp((dhalf-i)/dslope)) ))
//	printf("section is %2.3f\n",apical_section)
//	conductance = apical.gbar_h(apical_section)
//	printf("conductance is %2.5f\n",conductance)
}

//////////////////////////////
forall {
	print	secname()
	fnamegen1.printf("%f\t %f\n",nseg,L)
	cntseg=0
	for (x,0){
		cntseg=cntseg+1

		fnamegen2.printf("%f\t %f\t %f\t %f\t %f\t %f\n",\
		x3d(0)+(cntseg-1)*((x3d(n3d()-1)-x3d(0))/nseg),\
		x3d(0)+cntseg*((x3d(n3d()-1)-x3d(0))/nseg),\
		y3d(0)+(cntseg-1)*((y3d(n3d()-1)-y3d(0))/nseg),\
		y3d(0)+cntseg*((y3d(n3d()-1)-y3d(0))/nseg),\
		z3d(0)+(cntseg-1)*((z3d(n3d()-1)-z3d(0))/nseg),\
		z3d(0)+cntseg*((z3d(n3d()-1)-z3d(0))/nseg)\
		)
	}
}
////////////Making Stimuli ///////////////////////
dt=0.025
tstop=200

////////////////Current Clamp /////////////////////////
objref stim
apical stim = new ExpClamp(0.95)
stim.del=10
stim.dur=tstop*.9
stim.freq=frq
stim.amp=.2
//////////////////Recording Vectors///////////////////////
objref currin
currin = new Vector()
currin.record(&stim.i)




/*
volt_s = new Vector()
volt_s.record(&soma.v(0.5))

volt_d = new Vector()
volt_d.record(&apical.v(0.6))
*/
//////////////////////////////////////////////////
/* Simulation Control*/
///////////////////////////////////////////////
v_init=-70

proc initialize(){
     finitialize(v_init)
     fcurrent()
}
proc integrate(){
	while(t<tstop){
		fadvance()
		forall {
			//print	secname()
			for (x,0){

				px=x-(1/nseg)
				if (px < 0) {
					px = 0
				}
				nx=x+(1/nseg)
				if (nx > 1) {
					nx = 1
				}
				Iax_in=(v(px)-v(x))/ri(x)
				Iax_out=(v(x)-v(nx))/ri(nx)
				I_m=Iax_in-Iax_out

				fnamegen3.printf("%f\t %f\n",t,I_m)
			}
		}
		fnamegen5.printf("%f\t %f\t %f\t %f\n",t,soma.v(0),soma.v(0.5),soma.v(1))

		fnamegen6.printf("%f\t %f\t %f\t %f\t %f\t %f\t %f\t %f\t %f\t %f\t %f\t %f\n",t,\
			apical.v(0),apical.v(0.1),apical.v(0.2),apical.v(0.3),apical.v(0.4),apical.v(0.5),\
			apical.v(0.6),apical.v(0.7),apical.v(0.8),apical.v(0.9),apical.v(1))
	}
}
cntcmp=0
forall {
	cntcmp=cntcmp+1
}
proc go(){
     initialize()
     integrate()
}
go()



fnamegen4.printf("%f\n",tstop)
fnamegen4.printf("%f\n",dt)
fnamegen4.printf("%f\n",cntcmp)


fnamegen10.printf("%f\n",stim.freq)
fnamegen10.printf("%f\n",stim.del)
fnamegen10.printf("%f\n",stim.dur)
/////////////Write results to file///////////////

n=currin.printf(fnamegen7,"%g\n")
//fnamegen7.printf("%g\n",currin)
//fnamegen8.printf("%g\n",volt_s)
//fnamegen9.printf("%g\n",volt_d)

fnamegen1.close()
fnamegen2.close()
fnamegen3.close()
fnamegen4.close()
fnamegen5.close()
fnamegen6.close()
fnamegen7.close()
fnamegen8.close()
fnamegen9.close()
fnamegen10.close()
What are these numbers that printed into the terminal?
ted
Site Admin
Posts: 5787
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Numbers that printed in terminal

Post by ted »

Some statements return a numerical value that is printed to the terminal; generally the relevant entry in the Programmers' Reference says what they mean.
Post Reply