Non-homogeneous renewal point process generator as an ARTIFICIAL_CELL

Particularly useful chunks of hoc and/or NMODL code. May be pedestrian or stunningly brilliant, may make you gasp or bring tears to your eyes, but always makes you think "I wish I had written that; I'm sure going to steal it."
Post Reply
Ricardo_Molinari
Posts: 4
Joined: Tue Jan 28, 2020 7:36 am

Non-homogeneous renewal point process generator as an ARTIFICIAL_CELL

Post by Ricardo_Molinari » Thu Feb 13, 2020 9:18 pm

Dear all,
I'm trying to implement a Non-homogeneous renewal point process generator as an ARTIFICIAL_CELL and the following three offsides that I see:
  1. Do we have access to simulation discretization time dt inside the .mod? How could we access it?
  2. Could we use for structures inside BREAKPOINT or even inside .mod ? Becouse I got the following error compiling the file:

    Code: Select all

    syntax error:
     Illegal expression:
     Illegal block at line 25 in file ppg.mod
            for (i=1; i <= N;i++) {
                   ^
    
  3. I nedd to generate a pseudo-random uniform number from [0,1], there is a built-in function for that? I found examples for HOC and python, but not for NMODL files.
Here is the .mod code that I'm trying to implement:

Code: Select all

NEURON	{ 
  ARTIFICIAL_CELL PPG
  RANGE N, y
}

PARAMETER {
	N = 1 	: Gamma order
	y = 0 	: Modulating frequency [Hz]
}

ASSIGNED {
	aux 	: Threshold auxiliar
	thres 	: Threshold
	y_int 	: Integrate over y
	i 		: index
}

PROCEDURE seed(x) {
	set_seed(x)
}

INITIAL {
	aux = 1
	for (i=1; i <= N;i++) {
		aux = aux * rand()
	}
	thres = -(1/N)*log(aux)
}	

BREAKPOINT {
	y_int = y_int + y*dt*1e-3
	if y_int >= thres{
		net_event(t)
		y_int = 0
		aux = 1
		for i = 1,N {
			aux = aux* rand()
		}
		thres = -(1/N)*log(aux)
	}
}
Best regards,
Ricardo Molinari

Post Reply