Adaptively computes the baseline, assuming normally distributed noise. More...

#include <GaussianBaseline.h>

Inheritance diagram for Pulsar::GaussianBaseline:
Pulsar::IterativeBaseline Pulsar::BaselineEstimator Pulsar::ProfileWeightFunction Pulsar::PhaseWeightFunction Pulsar::Algorithm Reference::Able Reference::HeapTracked

Public Member Functions

 GaussianBaseline ()
 Default constructor.
 
void set_threshold (float sigma)
 Set the threshold below which samples are included in the baseline.
 
float get_threshold () const
 
void set_smoothing (unsigned)
 Set the smoothing factor used during post processing.
 
float get_variance_correction () const
 Get the variance correction factor.
 
TextInterface::Parserget_interface ()
 Return a text interface that can be used to configure this instance.
 
GaussianBaselineclone () const
 Return a copy constructed instance of self.
 
- Public Member Functions inherited from Pulsar::IterativeBaseline
 IterativeBaseline ()
 Default constructor.
 
 ~IterativeBaseline ()
 Destructor.
 
void set_initial_baseline (BaselineEstimator *)
 Set the BaselineEstimator used to find the initial baseline.
 
BaselineEstimatorget_initial_baseline () const
 
float get_threshold () const
 
void set_max_iterations (unsigned iterations)
 Set the maximum number of iterations.
 
void set_run_postprocessing (bool f)
 
bool get_run_postprocessing () const
 
- Public Member Functions inherited from Pulsar::BaselineEstimator
 BaselineEstimator ()
 Default constructor.
 
PhaseWeightbaseline (const Profile *)
 Returns a new PhaseWeight instance.
 
PhaseWeightoperator() (const Profile *)
 Returns a new PhaseWeight instance.
 
PhaseWeightoperate (const Profile *)
 Convenience interface.
 
void set_median_cut (float threshold)
 Cut samples from baseline with median difference over threshold.
 
- Public Member Functions inherited from Pulsar::ProfileWeightFunction
 ProfileWeightFunction ()
 Default constructor.
 
virtual void set_Profile (const Profile *)
 Set the Profile from which the PhaseWeight will be derived.
 
void set_include (PhaseWeight *include)
 Include only the specified phase bins for consideration.
 
void set_exclude (PhaseWeight *include)
 Exclude the specified phase bins from consideration.
 
bool consider (unsigned ibin) const
 Return true if the specified phase bin should be considered.
 
virtual void get_weight (PhaseWeight *weight)
 Returns a PhaseWeight with the Profile attribute set.
 
- Public Member Functions inherited from Reference::Able
 Able (const Able &)
 
Ableoperator= (const Able &)
 
unsigned get_reference_count () const
 
- Public Member Functions inherited from Reference::HeapTracked
 HeapTracked (const HeapTracked &)
 
HeapTrackedoperator= (const HeapTracked &)
 
bool __is_on_heap () const
 

Static Public Member Functions

static double get_variance_correction (double sigma)
 Static worker function for use by other classes.
 
- Static Public Member Functions inherited from Pulsar::ProfileWeightFunction
static ProfileWeightFunctionfactory (const std::string &name_and_parse)
 Construct a new ProfileWeightFunction from a string.
 
- Static Public Member Functions inherited from Reference::Able
static size_t get_instance_count ()
 
- Static Public Member Functions inherited from Reference::HeapTracked
static void * operator new (size_t size, void *ptr=0)
 
static void operator delete (void *location, void *ptr)
 
static void operator delete (void *location)
 
static size_t get_heap_queue_size ()
 

Protected Member Functions

void get_bounds (PhaseWeight *weight, float &lower, float &upper)
 Derived classes must define the bounds.
 
void postprocess (PhaseWeight *weight, const Profile *profile)
 
- Protected Member Functions inherited from Pulsar::IterativeBaseline
void calculate (PhaseWeight *weight)
 Calculate the PhaseWeight.
 
bool get_initial_bounds () const
 Provide access to derived classes.
 
- Protected Member Functions inherited from Reference::Able
Handle__reference (bool active) const
 
void __dereference (bool auto_delete=true) const
 

Protected Attributes

float moment_correction
 Adjustment when computing variance of samples below threshold.
 
float last_mean
 Last mean computed during get_bounds.
 
unsigned smooth_bins
 Smoothing factor used in postprocessing.
 
- Protected Attributes inherited from Pulsar::IterativeBaseline
float threshold
 The threshold below which samples are included in the baseline.
 
unsigned max_iterations
 The maximum number of iterations.
 
bool run_postprocessing
 Run the postprocessing algorithm.
 
Reference::To< BaselineEstimatorinitial_baseline
 The BaselineEstimator used to find the initial baseline.
 
- Protected Attributes inherited from Pulsar::BaselineEstimator
float median_cut
 
- Protected Attributes inherited from Pulsar::ProfileWeightFunction
Reference::To< const Profile, false > profile
 The Profile from which the PhaseWeight will be derived.
 
Reference::To< PhaseWeightinclude
 Included phase bins.
 
Reference::To< PhaseWeightexclude
 Excluded phase bins.
 

Detailed Description

Adaptively computes the baseline, assuming normally distributed noise.

The GaussianBaseline class uses an iterative method to better estimate of the off-pulse baseline. The BaselineWindow algorithm systematically under-estimates the mean of the off-pulse baseline and, for pulsars with small duty cycles, does not make full use of all off-pulse samples (more samples reduce the uncertainty in the estimate of the off-pulse mean).

GaussianBaseline addresses these issues by iteratively computing the mean and r.m.s. and excluding all points that lie greater than threshold (default threshold equals one sigma) away from the current mean. The one-sigma cutoff neatly omits the on-pulse points, but also necessitates correction of the estimate of the variance, which is given by the integral

$ \int_{-t}^{+t} x^2 P(x) $

where $t$ is the threshold (with no cutoff, $t \rightarrow \infty$)

Computation of the correction factor requires an assumption about the probability distribution, $P(x)$; GaussianBaseline assumes normally distributed measurement noise.

After creating the baseline mask, GaussianBaseline performs two clean-up tasks:

1) Any isolated masked samples are converted to not-masked (not necessarily on-pulse), and any isolated not-masked samples are converted to masked. "Isolated" is defined as a single state surrounded by opposite states. This step fills in the few random holes left by samples greater than threshold from the mean.

2) A list is made of all of the transitions from masked to not-masked regions (and vice versa), a box-car smoothed version of the profile is made (default smoothing factor equals 4) and, beginning at each transition from not-masked to masked, masked points are converted to not-masked until the smoothed profile falls below the off-pulse mean. This step peels the baseline mask away from the on-pulse regions (where the pulse is weak, the iterative baseline can creep up the wings of the pulse).

When any of the above steps fails, GaussianBaseline reverts to the dependable BaselineWindow method.


The documentation for this class was generated from the following files:

Generated using doxygen 1.8.17