elephant.signal_processing.rauc¶

elephant.signal_processing.
rauc
(signal, baseline=None, bin_duration=None, t_start=None, t_stop=None)[source]¶ Calculate the rectified area under the curve (RAUC) for a neo.AnalogSignal.
The signal is optionally divided into bins with duration bin_duration, and the rectified signal (absolute value) is integrated within each bin to find the area under the curve. The mean or median of the signal or an arbitrary baseline may optionally be subtracted before rectification.
Parameters:  signalneo.AnalogSignal
The signal to integrate. If signal contains more than one channel, each is integrated separately.
 baselinepq.Quantity or {‘mean’, ‘median’}, optional
A factor to subtract from the signal before rectification. If ‘mean’, the mean value of the entire signal is subtracted on a channelbychannel basis. If ‘median’, the median value of the entire signal is subtracted on a channelbychannel basis. Default: None
 bin_durationpq.Quantity, optional
The length of time that each integration should span. If None, there will be only one bin spanning the entire signal duration. If bin_duration does not divide evenly into the signal duration, the end of the signal is padded with zeros to accomodate the final, overextending bin. Default: None
 t_startpq.Quantity, optional
Time to start the algorithm. If None, starts at the beginning of signal. Default: None
 t_stoppq.Quantity, optional
Time to end the algorithm. If None, ends at the last time of signal. The signal is cropped using signal.time_slice(t_start, t_stop) after baseline removal. Useful if you want the RAUC for a short section of the signal but want the mean or median calculation (`baseline`=’mean’ or `baseline`=’median’) to use the entire signal for better baseline estimation. Default: None
Returns:  pq.Quantity or neo.AnalogSignal
If the number of bins is 1, the returned object is a scalar or vector pq.Quantity containing a single RAUC value for each channel. Otherwise, the returned object is a neo.AnalogSignal containing the RAUC(s) for each bin stored as a sample, with times corresponding to the center of each bin. The output signal will have the same number of channels as the input signal.
Raises:  ValueError
If signal is not neo.AnalogSignal.
If bin_duration is not None or pq.Quantity.
If baseline is not None, ‘mean’, ‘median’, or pq.Quantity.
See also
neo.AnalogSignal.time_slice
 how t_start and t_stop are used
Examples
>>> import neo >>> import numpy as np >>> import quantities as pq >>> from elephant.signal_processing import rauc >>> signal = neo.AnalogSignal(np.arange(10), sampling_rate=20 * pq.Hz, ... units='mV') >>> rauc(signal) array(2.025) * mV/Hz