// genesis
// used for sinusoidal stimulation of the PF beam
// rmaex March 2017
/* This is an extended object, which computes sine (simulation time)
every processing step.
Made after documentation in Extended.doc.
*/
float TWOPI = 2 * 3.141593
float modulation
create neutral /sine
// Create field called output
addfield /sine output
addfield /sine period
addfield /sine amplitude
addfield /sine background_level
addfield /sine phase
// Define a PROCESS and make the sine object a device
// class object
addaction /sine PROCESS __sinePROCESS__
addclass /sine device
// PROCESS action script function
function __sinePROCESS__(action)
modulation = {sin {{TWOPI} * {getstat -time} / {getfield . period} + {getfield . phase}}}
setfield . output {{getfield . amplitude} * {modulation} + {getfield . background_level}}
end
// create the sine object
addobject sine /sine -author "J. R. Maex" \
-description "Computes sine of simulation time"