MedianSlider.h

Classes

MedianSlider -- Class to compute sliding median (full description)

class MedianSlider

Interface

Public Members
MedianSlider ()
MedianSlider ( int halfwin )
MedianSlider ( const MedianSlider &other )
~MedianSlider ()
MedianSlider & operator = ( const MedianSlider &other )
void cleanup ()
Float add ( Float d,Bool flag=False )
Float add ()
Float next ( uInt n=1 )
Float add ( const Vector<Float> &d,const Vector<Bool> &flag )
Float add ( const Vector<Float> &d )
Int nval ()
Float median ()
Float prevVal ( uInt n,Bool &flag )
Float midpoint ( Bool &flag )
Float midpoint ()
Float diff ( Bool &flag )
Float diff ()
static size_t objsize ( int halfwin )
Bool assure ()

Description

Review Status

Date Reviewed:
yyyy/mm/dd

Synopsis

MedianSlider is a class for efficient computing of sliding medians.

Example

Motivation

Flagging Agents make extended use of sliding medians.

To Do

Member Description

MedianSlider ()

MedianSlider ( int halfwin )

MedianSlider ( const MedianSlider &other )

~MedianSlider ()

MedianSlider & operator = ( const MedianSlider &other )

void cleanup ()

Float add ( Float d,Bool flag=False )

Adds a datum to the slider. Once the window is full, newer values will push out older values. Returns the new median value. If flag is set to true, adds a "flagged" datum, one which takes up space in the window but is skipped during median computations.

Float add ()

Adds a flagged datum

Float next ( uInt n=1 )

Adds N flagged datums

Float add ( const Vector<Float> &d,const Vector<Bool> &flag )

Adds several datums at once (with corresponding flags)

Float add ( const Vector<Float> &d )

Adds several non-flagged datums at once

Int nval ()

Returns the number of values currently in the window. This is less than the window width initially. Int size ();

Returns the number of non-flagged values in window

Float median ()

Returns the current median value

Float prevVal ( uInt n,Bool &flag )

Returns a previous value (from n steps ago) from the sliding window

Float midpoint ( Bool &flag )

Returns value from midpoint (center) of window, possibly with flag

Float midpoint ()

Float diff ( Bool &flag )

Returns the difference between the current median and the value at window center. Optionally, also returns flag of median center

Float diff ()

static size_t objsize ( int halfwin )

returns total memory usage (in bytes) for a given halfwin size

Bool assure ()

For testing purposes only: verifies current value of median. Throws an exception if it fails.