f2 = new File()
f2.ropen("../stimulation/sintrainparams.hoc")		// 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
}
f2.close()

period = Onint + Offint		// Interval of no stimulation

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 {
		idx=-1
		for celltype=0, numCellTypes-1 {
			if (strcmp(cellType[celltype].cellType_string, pptype[ppi].s)==0) {
				idx = celltype 
			}
		}
		
		if (idx>-1) {
			for pcitr(&reli, &typei, &jgid, cellType[idx].cellStartGid, cellType[idx].cellEndGid) {
				if (pc.gid_exists(jgid)) {
					//mycell = pc.gid2cell(jgid)

					xpos=xpos_algorithm(jgid,cellType[idx].numCells,cellType[idx].cellStartGid,cellType[idx].dentateXBins,cellType[idx].dentateYBins*cellType[idx].dentateZBins,cellType[idx].dentateXBinSize)	// Algorithmically generate cell position
					ypos=ypos_algorithm(jgid,cellType[idx].numCells,cellType[idx].cellStartGid,cellType[idx].dentateYBins,cellType[idx].dentateZBins,cellType[idx].dentateYBinSize)	// Algorithmically generate cell position
					zpos=zpos_algorithm(jgid,cellType[idx].numCells,cellType[idx].cellStartGid,cellType[idx].dentateZBins,cellType[idx].dentateZBinSize,cellType[idx].layerflag)	// Algorithmically generate cell position
					cellType[idx].CellList[typei].position(xpos,ypos,zpos)	// Record cell position in cell object

					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)
					
					{ranNSlist.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(ranNSlist.object(reli).r)}
					
					{ranPPlist.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(ranPPlist.object(reli).r)}
				}
			}
		}
	}
}
ppSin()