Program functions between Mac and Windows

The basics of how to develop, test, and use models.
Post Reply
LauraD
Posts: 13
Joined: Wed Oct 24, 2018 12:09 pm

Program functions between Mac and Windows

Post by LauraD »

Hello all,
So we have a portion of the code attached below (couldn't fit the rest), that works both on a Mac and a Windows computer.
However with, stim.amp = 0.2 it creates a spike surpassing threshold on the Windows computer but on the Mac we have to raise the amplitude to 0.4 in order to record a spike (completely different pattern though).
Any advice on how to keep the program working consistently between computers?
Kind Regards,
Laura Dovek

Code: Select all

	endtemplate SemilunarGranuleCell


for i=0, nsgccell-1 {SGCcell[i] = new SemilunarGranuleCell(i)}

objref stim
SGCcell[0].soma stim = new Izap(0.5)
stim.del = 100
stim.dur = 3000
stim.f0 = 2
stim.f1 = 100
stim.amp = 0.2


objref  VmT
objref VmMat[2]
VmT = new Vector()
for i=0,0 {
	VmMat[i] = new Vector()
	}

proc VecMx() { local i
	VmT.append(t)
	for i=0,0 {
		VmMat[i].append( SGCcell[i].soma.v(0.5))
		}
	}

objref Spike[2]
for i=0,0 {
	Spike[i] = new Vector()
	}
strdef Spkstr
objref dfile
dfile = new File()

proc SpkMx() { local i, j
	k = 0
     	for i=0,0 {
		Spike[i].spikebin(VmMat[i], 0)
		}
dfile.wopen("sgcspike.txt")

	while(k <  VmT.size) {
	for j = 0,0 {
	if(Spike[j].x[k] != 0) {
	dfile.printf("%f\t%d\n", VmT.x[k], j)}
	}
	k +=1 }
dfile.close("sgcspike.txt")
	}

strdef strmat
objref efile
efile = new File()

	efile.wopen("SGCMempot.txt")
	efile.printf("t\t")
for i = 0, 0 {
	efile.printf("%s\t", SGCcell[i])}
	efile.printf("\n")
efile.close("SGCMempot.txt")

proc sMatrix(){ local  i
	efile.aopen("SGCMempot.txt")
	efile.printf("%f\t", t)
	for i = 0, 0 {
	efile.printf("%f\t", SGCcell[i].soma.v(0.5))}
	efile.printf("\n")
	efile.close("SGCMempot.txt")

}


objref  VmT
objref VmMat[nsgccell]
VmT = new Vector()
for i=0, 0{
	VmMat[i] = new Vector()
	}

proc VecMx() { local i
	VmT.append(t)
	for i=0, 0{
		VmMat[i].append( SGCcell[i].soma.v(0.5))
		}
	}


proc init() { local dtsav, temp, secsav
finitialize(v_init)
t = -1000
dtsav = dt
secondorder =0
dt= 10
	// if cvode is on, turn it off to do large fixed step
temp= cvode.active()
if (temp!=0) {cvode.active(0)}
while(t<-100) { fadvance() print t}
	//restore cvode if reqd
if (temp!=0) {cvode.active(1)}
dt = dtsav
secondorder =2
t = 0
if (cvode.active()){
cvode.re_init()
}else{
fcurrent()
}
//frecord_init()
}
proc continuerun() {local rt
	eventcount =0
	eventslow =1
	stoprun =0
	if (using_cvode_) {
	cvode.event($1)
	}
	while(t < $1 && stoprun == 0) {
	step()
	sMatrix()
	//gMatrix()
	VecMx()
	rt = stopsw()
	if (rt > realtime) {
		realtime = rt
		if (!stdrun_quiet) fastflushPlot()
		doNotify()
		if (realtime == 2 && eventcount > 50) {
			eventslow = int(eventcount/50)+1
		}
		eventcount = 0
	}else{
		eventcount = eventcount +1
		if ((eventcount%eventslow) == 0) {
			doEvents()
		}
	}
	}
	flushPlot()
}

objectvar save_window_, rvp_
objectvar scene_vector_[4]
objectvar ocbox_, ocbox_list_, scene_, scene_list_
{ocbox_list_ = new List()  scene_list_ = new List()}

{
xpanel("RunControl", 0)
v_init = -60
xvalue("Init","v_init", 1,"stdinit()", 1, 1 )
xbutton("Init & Run","run()")
xbutton("Stop","stoprun=1")
runStopAt = 5
xvalue("Continue til","runStopAt", 1,"{continuerun(runStopAt) stoprun=1}", 1, 1 )
runStopIn = 1
xvalue("Continue for","runStopIn", 1,"{continuerun(t + runStopIn) stoprun=1}", 1, 1 )
xbutton("Single Step","steprun()")
t = 0
xvalue("t","t", 2 )
tstop = 3200	//1500
xvalue("Tstop","tstop", 1,"tstop_changed()", 0, 1 )
dt = 0.1
xvalue("dt","dt", 1,"setdt()", 0, 1 )
steps_per_ms = 10	//40
xvalue("Points plotted/ms","steps_per_ms", 1,"setdt()", 0, 1 )
xpanel(544,121)
}
{
save_window_ = new Graph(0)
save_window_.size(0,tstop,-80,40)
scene_vector_[2] = save_window_
{save_window_.view(0, -80, tstop, 120, 290, 470, 579.84, 208)}
graphList[0].append(save_window_)
save_window_.save_name("graphList[0].")
//save_window_.addexpr("SGCcell[1].soma.v(0.5)",1,1)
save_window_.addexpr("SGCcell[0].soma.v(0.5)",2,1)
save_window_.addexpr("Izap[0].i",3,1)
}
save_window_ = new Graph(0)
save_window_.size(0,1000,-2,2)
scene_vector_[3] = save_window_
{save_window_.view(0, -80, tstop, 120, 290, 470, 579.84, 208)}
graphList[1].append(save_window_)
save_window_.save_name("graphList[1].")
save_window_.addexpr("Izap[0].i",3,1)

proc rrun(){
//initSGCcell()
run()
SpkMx()
}
rrun()
objectvar scene_vector_[1]
{doNotify()}
ted
Site Admin
Posts: 6286
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Program functions between Mac and Windows

Post by ted »

Results are supposed to be identical across operating systems, and from version to version of NEURON.

That said, you didn't provide enough information to get a completely informed response to your question.
What versions of NEURON are running on your Mac and MSWin machines?
Lack of complete source code (all necessary hoc, ses, and other files needed to execute a simulation) means we have no way to reproduce the problem you encountered, let alone diagnose the cause or fix it.
LauraD
Posts: 13
Joined: Wed Oct 24, 2018 12:09 pm

Re: Program functions between Mac and Windows

Post by LauraD »

Hello Dr. Carnevale,
On the Windows computer, we are running Neuron 7.4 64 bit. with windows 7

On the Macbook Pro I am running High Sierra version 10.13.6 with Neuron 7.6

The folder was transfered from one computer to the other and then recompiled.
We have all the same mod files, ses files etc.

Kind Regards,
Laura Dovek
hines
Site Admin
Posts: 1682
Joined: Wed May 18, 2005 3:32 pm

Re: Program functions between Mac and Windows

Post by hines »

Please email me a zip file with all the mod, py, ses, hoc files needed along with instructions on launching the model to produce the result
to michael.hines@yale.edu .
I will try to reproduce the problem, diagnose, and fix the issue. There are two dimensions here: (mac, mswin) and (7.4, 7.6) as well as
the detailed implementation of your model. I see that you are using cvode but don't know if randomness is involved. If I reproduce your problem,
my next step would be to compare the initial state of the simulations.
Post Reply