wonambi.trans.peaks module

wonambi.trans.peaks.get_slopes(data, s_freq, level='all', smooth=0.05)[source]

Get the slopes (average and/or maximum) for each quadrant of a slow wave, as well as the combination of quadrants 2 and 3.

Parameters:
  • data (ndarray) – raw data as vector

  • s_freq (int) – sampling frequency

  • level (str) – if ‘average’, returns average slopes (uV / s). if ‘maximum’, returns the maximum of the slope derivative (uV / s**2). if ‘all’, returns all.

  • smooth (float or None) – if not None, signal will be smoothed by moving average, with a window of this duration

Returns:

tuple of ndarray – each array is len 5, with q1, q2, q3, q4 and q23. First array is average slopes and second is maximum slopes.

Notes

This function is made to take automatically detected start and end times AS WELL AS manually delimited ones. In the latter case, the first and last zero has to be detected within this function.

wonambi.trans.peaks.peaks(data, method='max', axis='time', limits=None)[source]

Return the values of an index where the data is at max or min

Parameters:
  • method (str, optional) – ‘max’ or ‘min’

  • axis (str, optional) – the axis where you want to detect the peaks

  • limits (tuple of two values, optional) – the lowest and highest limits where to search for the peaks

  • data (instance of Data) – one of the datatypes

Returns:

instance of Data – with one dimension less that the input data. The actual values in the data can be not-numberic, for example, if you look for the max value across electrodes

Notes

This function is useful when you want to find the frequency value at which the power is the largest, or to find the time point at which the signal is largest, or the channel at which the activity is largest.