module documentation

Ramp interface functions

Class RampFunction Protocol signature for ramp functions
Function ramp Create an on-ramp centered at `gamma_t` using `t` as the time-vector. The output will match the shape of `t`. The function to create the ramp is passed with ramp_function. The function must be defined as:...
Function ramp_onoff Takes two time points (gamma_t) and generates an onset+offset-ramp, by generating two ramps over the time-vector (see ramp) and combining by multiplying (ramp1(t) * ramp2(t)) or addition, when invert=True (ramp1(t)+ramp2(t))...
Function ramp_onoff_with_gap Combines two instances of ramp_onoff to create a "gate" for some signal with onset and offset- and a gap in between.
Variable GammaTPair Type specification for gamma_t pair, used in functions with onset and offset
def ramp(t, gamma_t=0.0, width=0.0025, ramp_function=linear_ramp_func, invert=False, dtype=None): (source)

Create an on-ramp centered at `gamma_t` using `t` as the time-vector. The output will match the shape of `t`. The function to create the ramp is passed with ramp_function. The function must be defined as:

 def <ramp_function>(
     t [numpy array, (cut from `t`)],
     gamma_t [float, (temporal center of the ramp)]
     width [float, (width of the ramp)]) -> [numpy array of same size as input]

The numpy array parsed to the function fits the dimension from the cutout:

 (t < (gamma_t + width / 2)) & (t >= (gamma_t - width / 2))

Invert is performed by flipping the ramp part within the above-mentioned range. Rest of the signal is inverted by y = (1 - x)

Parameters
t:np.ndarraytime vector
gamma_t:floatcenter position of the ramp (in the same unit as the time vector)
width:floatwidth of the ramp (in same unit as the time vector)
ramp_function:RampFunctionthe function to create the ramp
invert:boolwhether to invert the output (ramp on or ramp off)
dtype:np.dtypedata type of output vector, defaults to the datatype of t
Returns
np.ndarrayvector of the same shape as t
def ramp_onoff(t, gamma_t=None, width=0.0025, ramp_function=linear_ramp_func, invert=False, dtype=None): (source)

Takes two time points (gamma_t) and generates an onset+offset-ramp, by generating two ramps over the time-vector (see ramp) and combining by multiplying (ramp1(t) * ramp2(t)) or addition, when invert=True (ramp1(t)+ramp2(t))

Parameters
t:np.ndarraytime vector
gamma_t:GammaTPaircenter positions of the onset/offset-ramps (in the same unit as the time vector)
width:floatwidth of the ramp (in same unit as the time vector)
ramp_function:RampFunctionthe function to create the ramp
invert:boolwhether to invert the output
dtype:np.dtypedata type of output vector, defaults to the datatype of t
Returns
np.ndarrayvector of the same shape as t
def ramp_onoff_with_gap(t, stim_gamma_t=None, gap_gamma_t=None, width=0.0025, ramp_function=linear_ramp_func, dtype=None): (source)

Combines two instances of ramp_onoff to create a "gate" for some signal with onset and offset- and a gap in between.

Parameters
ttime vector
stim_gamma_t:GammaTPair|Nonecenter positions of the onset/offset-ramps of the signal (in the same unit as the time vector)
gap_gamma_t:GammaTPair|Nonecenter positions of the onset/offset-ramps of the gap (in the same unit as the time vector)
width:floatwidth of the ramp (in same unit as the time vector)
ramp_function:RampFunctionthe function to create the ramp
dtype:np.dtypedata type of output vector, defaults to the datatype of t
Returns
GammaTPair = (source)

Type specification for gamma_t pair, used in functions with onset and offset