f2 = new File()
sprint(cmdstr,"../datasets/phasic_%g.dat", PhasicData)
f2.ropen(cmdstr)		// Open the celltype

numppTypes = f2.scanvar			// Scan the first line, which contains a number giving the

objref pptype[numppTypes]
double fmax[numppTypes], noise[numppTypes], depth[numppTypes], phase[numppTypes]

for i=0, numppTypes-1 {
	pptype[i] = new String()
	f2.scanstr(pptype[i].s)
	fmax[i] = f2.scanvar
	noise[i] = f2.scanvar
	depth[i] = f2.scanvar
	phase[i] = f2.scanvar
	print pptype[i].s, ": ", fmax[i], " Hz, ", phase[i], " phase"
}
f2.close()


period = Onint + Offint		// Oscillation period in ms

proc ppSin() { local ppi, i, wgt, reli, typei, jgid, celltype, counter, jstart, jend, jtot localobj mycell		// Connect the perforant path cells to the model cells
	// find ppecsin index
	for ppi=0, numppTypes-1 {
		for celltype=0, numCellTypes-1 {
			if (strcmp(cellType[celltype].cellType_string, pptype[ppi].s)==0 &&  strcmp(cellType[celltype].technicalType, "sintrain")==0 ) {
				idx = celltype 
				for pcitr(&reli, &typei, &jgid, cellType[idx].cellStartGid, cellType[idx].cellEndGid) {
					if (pc.gid_exists(jgid)) {

						cellType[idx].CellList[typei].fmax(fmax[ppi]) // max freq
						cellType[idx].CellList[typei].start(0)
						cellType[idx].CellList[typei].noise(noise[ppi])

						//mod_params
						cellType[idx].CellList[typei].period(period)
						cellType[idx].CellList[typei].number(1e9) // number of periods - last to the end of the simulation
						cellType[idx].CellList[typei].depth(depth[ppi]) // this should be argument 7 instead of noise, since we know diff inrns modulated diff'ly
						cellType[idx].CellList[typei].phase(phase[ppi]*period/360)
						
						{ranstimlist.object(reli).r.negexp(1)}// Set up the generator to pick a uniform dist of numbers between 0 and 1
						{cellType[idx].CellList[typei].setnoiseFromRandomNS(ranstimlist.object(reli).r)}
						
						{raninitlist.object(reli).r.uniform(0,1)}// Set up the generator to pick a uniform dist of numbers between 0 and 1
						{cellType[idx].CellList[typei].setnoiseFromRandomPP(raninitlist.object(reli).r)}
					}
				}
			}
		}
	}
}
ppSin()