The original scalar template matching algorithm. More...

#include <ScalarTemplateMatching.h>

Inheritance diagram for Pulsar::ScalarTemplateMatching:
Reference::Able Reference::HeapTracked

Public Member Functions

 ScalarTemplateMatching ()
 Default constructor.
 
 ~ScalarTemplateMatching ()
 Destructor.
 
void set_standard (const Profile *standard)
 Set the standard to which observations will be fit.
 
const Profileget_standard () const
 Get the standard to which observations will be fit.
 
void add_observation (const Profile *)
 Add the specified profile to be fit to the standard/template.
 
void set_observation (const Profile *)
 Set the only profile to be fit to the standard/template.
 
void delete_observations ()
 Delete any previously added observations.
 
void fit (const Profile *observation)
 Fit the specified observation to the standard.
 
void solve ()
 Fit all observations to the standard.
 
Estimate< double > get_phase () const
 Get the phase offset between the standard and the observation in radians. More...
 
Estimate< double > get_scale () const
 Get the scale factor between the standard and the observation.
 
void set_maximum_harmonic (unsigned max)
 Set the maximum number of harmonics to include in fit.
 
unsigned get_maximum_harmonic () const
 Get the maximum number of harmonics to include in fit.
 
void set_choose_maximum_harmonic (bool flag)
 Set the maximum number of harmonics to include in fit.
 
bool get_choose_maximum_harmonic () const
 Get the maximum number of harmonics to include in fit.
 
unsigned get_nharmonic () const
 Get the number of harmonics to be included in fit.
 
void set_regions (const PhaseWeight &pulse, const PhaseWeight &baseline)
 Set the on-pulse and baseline regions.
 
void set_plan (FTransform::Plan *)
 Set the fourier transform plan.
 
void set_compute_reduced_chisq (bool flag)
 When true, compute the reduced chisq; when false, assume it is unity.
 
double get_reduced_chisq () const
 Get the statistical goodness of fit.
 
- 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 Attributes

static bool verbose = false
 Verbosity flag.
 

Protected Member Functions

void init ()
 Construtor helper.
 
void model_profile ()
 Implement the solve method using the original model_profile algorithm.
 
- Protected Member Functions inherited from Reference::Able
Handle__reference (bool active) const
 
void __dereference (bool auto_delete=true) const
 

Protected Attributes

Reference::To< FluctuationSpectrumStatsstats
 Used to compute the variance of the off-pulse harmonics.
 
unsigned maximum_harmonic
 The maximum number of harmonics to include in the fit.
 
bool choose_maximum_harmonic
 Set true when set_standard should choose the maximum harmonic.
 
unsigned n_harmonic
 The number of harmonics in the fit.
 
bool compute_reduced_chisq
 Compute the reduced chisq (using the expected variance of the residual profile) More...
 
std::vector< Data > data
 Standards and observations.
 
Estimate< double > best_shift
 
Estimate< double > best_scale
 
double chisq
 
unsigned nfree
 

Additional Inherited Members

- 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 ()
 

Detailed Description

The original scalar template matching algorithm.

This class implements the Taylor (1992) algorithm, using the Van Wijngaarden–Dekker–Brent method to minimize the objective merit function.

The algorithm was implemented before psrchive existed, in a function named model_profile. There were many arguments to this function:

int model_profile (unsigned npts, unsigned narrays, const float* const* prf, const float* const* std, double* scale, double* sigma_scale, double* shift, double* sigma_shift, double* chisq, bool verbose)

and it was becoming a nuisance to maintain, extend or optimize it; therefore, this class was wrapped around it to manage complexity.

Member Function Documentation

◆ get_phase()

Estimate< double > ScalarTemplateMatching::get_phase ( ) const

Get the phase offset between the standard and the observation in radians.

Get the phase offset between the observation and the standard.

Member Data Documentation

◆ compute_reduced_chisq

bool Pulsar::ScalarTemplateMatching::compute_reduced_chisq
protected

Compute the reduced chisq (using the expected variance of the residual profile)

When set to false, incorrectly assume that the reduced chisq is equal to unity.


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

Generated using doxygen 1.8.17