elephant.signal_processing.derivative¶

elephant.signal_processing.
derivative
(signal)[source]¶ Calculate the derivative of a neo.AnalogSignal.
Parameters:  signalneo.AnalogSignal
The signal to differentiate. If signal contains more than one channel, each is differentiated separately.
Returns:  derivative_signeo.AnalogSignal
The returned object is a neo.AnalogSignal containing the differences between each successive sample value of the input signal divided by the sampling period. Times are centered between the successive samples of the input. The output signal will have the same number of channels as the input signal.
Raises:  TypeError
If signal is not a neo.AnalogSignal.
Examples
>>> import neo >>> import numpy as np >>> import quantities as pq >>> from elephant.signal_processing import derivative >>> signal = neo.AnalogSignal([0, 3, 4, 11, 1], sampling_rate=1 * pq.Hz, ... units='mV') >>> print(derivative(signal)) [[ 3.] [ 1.] [ 7.] [12.]] mV*Hz