bionet.ted.asdm.asdm_encode

bionet.ted.asdm.asdm_encode(u, dt, b, d, k=1.0, dte=0.0, y=0.0, interval=0.0, sgn=1, quad_method='trapz', full_output=False)

ASDM time encoding machine.

Encode a finite length signal using an Asynchronous Sigma-Delta Modulator.

Parameters:

u : array_like of floats

Signal to encode.

dt : float

Sampling resolution of input signal; the sampling frequency is 1/dt Hz.

b : float

Encoder bias.

d : float

Encoder threshold.

k : float

Encoder integration constant.

dte : float

Sampling resolution assumed by the encoder (s). This may not exceed dt.

y : float

Initial value of integrator.

interval : float

Time since last spike (in s).

sgn : {+1, -1}

Sign of integrator.

quad_method : {‘rect’, ‘trapz’}

Quadrature method to use (rectangular or trapezoidal).

full_output : bool

If set, the function returns the encoded data block followed by the given parameters (with updated values for y, interval, and sgn). This is useful when the function is called repeatedly to encode a long signal.

Returns:

s : ndarray of floats

If full_output == False, returns the signal encoded as an array of time intervals between spikes.

s, dt, b, d, k, dte, y, interval, sgn, quad_method, full_output : tuple

If full_output == True, returns the encoded signal followed by updated encoder parameters.

Notes

When trapezoidal integration is used, the value of the integral will not be computed for the very last entry in u.