svcore
1.9
|
Obtain the median (or other percentile) of a moving window across a time series. More...
#include <MovingMedian.h>
Public Member Functions | |
MovingMedian (int size, double percentile=50.f) | |
~MovingMedian () | |
MovingMedian (const MovingMedian &)=delete | |
MovingMedian & | operator= (const MovingMedian &)=delete |
void | setPercentile (double p) |
void | push (T value) |
T | get () const |
int | size () const |
void | reset () |
void | resize (int target) |
void | checkIntegrity () const |
Private Member Functions | |
void | calculateIndex () |
void | put (T value) |
void | drop (T value) |
void | check () const |
Static Private Member Functions | |
static void | put (T *const sorted, int size, T value) |
static void | drop (T *const sorted, int size, T value) |
Private Attributes | |
int | m_size |
double | m_percentile |
int | m_index |
T * | m_frame |
T * | m_sorted |
Detailed Description
template<typename T>
class MovingMedian< T >
Obtain the median (or other percentile) of a moving window across a time series.
Construct the MovingMedian object, then push() each new value in the time series and get() the median of the most recent window. The size of the window, and the percentile calculated, can both be changed after construction.
Note that for even-sized windows, the "median" is taken to be the value at the start of the second half when sorted, e.g. for size 4, the element at index 2 (zero-based) in the sorted window.
Not thread-safe.
Definition at line 41 of file MovingMedian.h.
Constructor & Destructor Documentation
|
inline |
Definition at line 44 of file MovingMedian.h.
References MovingMedian< T >::calculateIndex(), MovingMedian< T >::m_frame, MovingMedian< T >::m_sorted, and MovingMedian< T >::size().
Referenced by MovingMedian< T >::~MovingMedian().
|
inline |
Definition at line 53 of file MovingMedian.h.
References MovingMedian< T >::m_frame, MovingMedian< T >::m_sorted, MovingMedian< T >::MovingMedian(), and MovingMedian< T >::operator=().
|
delete |
Member Function Documentation
|
delete |
Referenced by MovingMedian< T >::~MovingMedian().
|
inline |
Definition at line 61 of file MovingMedian.h.
References MovingMedian< T >::calculateIndex(), and MovingMedian< T >::m_percentile.
Referenced by FFTModel::getPeaks().
|
inline |
Definition at line 66 of file MovingMedian.h.
References MovingMedian< T >::drop(), MovingMedian< T >::m_frame, MovingMedian< T >::m_size, and MovingMedian< T >::put().
Referenced by FFTModel::getPeaks().
|
inline |
Definition at line 77 of file MovingMedian.h.
References MovingMedian< T >::m_index, and MovingMedian< T >::m_sorted.
Referenced by FFTModel::getPeaks().
|
inline |
Definition at line 81 of file MovingMedian.h.
References MovingMedian< T >::m_size.
Referenced by MovingMedian< T >::MovingMedian().
|
inline |
Definition at line 85 of file MovingMedian.h.
References MovingMedian< T >::m_frame, MovingMedian< T >::m_size, and MovingMedian< T >::m_sorted.
|
inline |
Definition at line 90 of file MovingMedian.h.
References MovingMedian< T >::calculateIndex(), MovingMedian< T >::drop(), MovingMedian< T >::m_frame, MovingMedian< T >::m_size, MovingMedian< T >::m_sorted, and MovingMedian< T >::put().
Referenced by FFTModel::getPeaks().
|
inline |
Definition at line 116 of file MovingMedian.h.
References MovingMedian< T >::check().
|
inlineprivate |
Definition at line 127 of file MovingMedian.h.
Referenced by MovingMedian< T >::MovingMedian(), MovingMedian< T >::resize(), and MovingMedian< T >::setPercentile().
|
inlineprivate |
Definition at line 133 of file MovingMedian.h.
Referenced by MovingMedian< T >::push(), and MovingMedian< T >::resize().
|
inlinestaticprivate |
Definition at line 137 of file MovingMedian.h.
|
inlineprivate |
Definition at line 150 of file MovingMedian.h.
Referenced by MovingMedian< T >::push(), and MovingMedian< T >::resize().
|
inlinestaticprivate |
Definition at line 154 of file MovingMedian.h.
|
inlineprivate |
Definition at line 173 of file MovingMedian.h.
References MovingMedian< T >::m_size.
Referenced by MovingMedian< T >::checkIntegrity().
Member Data Documentation
|
private |
Definition at line 121 of file MovingMedian.h.
Referenced by MovingMedian< T >::check(), MovingMedian< T >::push(), MovingMedian< T >::reset(), MovingMedian< T >::resize(), and MovingMedian< T >::size().
|
private |
Definition at line 122 of file MovingMedian.h.
Referenced by MovingMedian< T >::setPercentile().
|
private |
Definition at line 123 of file MovingMedian.h.
Referenced by MovingMedian< T >::get().
|
private |
Definition at line 124 of file MovingMedian.h.
Referenced by MovingMedian< T >::MovingMedian(), MovingMedian< T >::push(), MovingMedian< T >::reset(), MovingMedian< T >::resize(), and MovingMedian< T >::~MovingMedian().
|
private |
Definition at line 125 of file MovingMedian.h.
Referenced by MovingMedian< T >::get(), MovingMedian< T >::MovingMedian(), MovingMedian< T >::reset(), MovingMedian< T >::resize(), and MovingMedian< T >::~MovingMedian().
The documentation for this class was generated from the following file:
Generated by 1.8.11