Models a pulse profile using multiple components. More...

#include <ComponentModel.h>

Inheritance diagram for Pulsar::ComponentModel:
Pulsar::ProfileShiftEstimator Pulsar::ShiftEstimator Pulsar::Algorithm Reference::Able Reference::HeapTracked

Public Member Functions

 ComponentModel ()
 Default constructor.
 
 ComponentModel (const std::string &filename)
 Load model from file.
 
double get_gate_duty_cycle () const
 Get the fraction of the pulse period modelled (in turns)
 
virtual void set_gate_duty_cycle (double turns)
 Set the fraction of the pulse period modelled (in turns)
 
Estimate< double > get_shift () const
 Return the shift estimate.
 
std::string get_name () const
 Return the name of the file from which the component model was loaded.
 
TextInterface::Parserget_interface ()
 Return a text interface that can be used to configure this instance.
 
ComponentModelclone () const
 Return a copy constructed instance of self.
 
MEAL::Univariate< MEAL::Scalar > * get_model ()
 Get the component model.
 
double get_reduced_chisq () const
 Return the statistical goodness-of-fit.
 
double get_absolute_phase () const
 Return the absolute phase.
 
void load (const char *fname)
 
void unload (const char *fname) const
 
void set_log_height (bool flag=true)
 All heights will be treated as log(height)
 
bool get_log_height () const
 
void set_retain_memory (bool flag=true)
 Previous best fit model will be first guess on next call to get_shift.
 
bool get_retain_memory () const
 
void set_fix_widths (bool flag=true)
 
bool get_fix_widths () const
 
void set_fit_primary_first (bool flag=true)
 
bool get_fit_primary_first () const
 
void set_report_absolute_phases (bool flag=true)
 
bool get_report_absolute_phases () const
 
void set_report_widths (bool flag=true)
 
bool get_report_widths () const
 
void add_component (double centre, double concentration, double height, const char *name)
 
void remove_component (unsigned icomp)
 
MEAL::ScaledVonMisesget_component (unsigned icomp)
 
unsigned get_ncomponents () const
 
void align (const Profile *profile)
 Roughly align the phases and heights of the components to match the Profile.
 
void align_to_model (Profile *profile)
 Roughly align the Profile to match the phases and heights of the components. More...
 
void get_best_alignment (const Profile *profile, double &phase, double &scale)
 Returns the best fit phase and scale that aligns the model to the Profile.
 
void fix_relative_phases ()
 Fix the relative phases of the components.
 
void set_zap_height_ratio (float r)
 Remove components with small heights.
 
float get_zap_height_ratio () const
 
void set_zap_concentration_ratio (float r)
 Remove components with large concentrations (narrow widths)
 
float get_zap_concentration_ratio () const
 
void set_fit_derivative (bool flag)
 
void set_threshold (float t)
 
void set_infit (unsigned icomponent, unsigned iparam, bool infit)
 
void set_infit (const char *fitstring)
 
void fit (const Profile *profile)
 
float get_chisq () const
 
unsigned get_nfree () const
 
void evaluate (float *vals, unsigned nvals, int icomp=-1)
 
- Public Member Functions inherited from Pulsar::ProfileShiftEstimator
void set_observation (const Profile *p)
 Set the profile from which the shift will be estimated.
 
const Profileget_observation () const
 Get the profile from which the shift will be estimated.
 
- Public Member Functions inherited from Pulsar::ShiftEstimator
virtual double get_snr () const
 Return the profile S/N ratio.
 
virtual void preprocess (Archive *)
 Prepare the data for use. More...
 
- 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
 

Protected Member Functions

void freeze (unsigned icomponent) const
 
void unfreeze (unsigned icomponent) const
 
void build () const
 
void check (const char *method, unsigned icomponent) const
 
void clear ()
 
void init ()
 
- Protected Member Functions inherited from Reference::Able
Handle__reference (bool active) const
 
void __dereference (bool auto_delete=true) const
 

Protected Attributes

std::vector< Reference::To< MEAL::ScaledVonMises > > components
 
std::vector< Reference::To< MEAL::ScaledVonMises > > backup
 
std::vector< std::string > component_names
 
std::vector< Reference::To< MEAL::ScaledVonMisesDeriv > > derivative
 
std::map< unsigned, std::string > comments
 comments, indexed by line number
 
Reference::To< MEAL::ScalarParameterphase
 
Reference::To< MEAL::Univariate< MEAL::Scalar > > model
 
double gate
 
bool fit_derivative
 
float threshold
 
bool log_height
 
bool retain_memory
 
bool fix_widths
 
bool fit_primary_first
 
bool report_absolute_phases
 
bool report_widths
 
float zap_height_ratio
 
float zap_concentration_ratio
 
- Protected Attributes inherited from Pulsar::ProfileShiftEstimator
Reference::To< const Profileobservation
 

Additional Inherited Members

- Static Public Member Functions inherited from Pulsar::ShiftEstimator
static ShiftEstimatorfactory (const std::string &name_and_parse)
 Construct a new ShiftEstimator 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 ()
 
- Static Public Attributes inherited from Pulsar::ShiftEstimator
static bool verbose = false
 

Detailed Description

Models a pulse profile using multiple components.

For now, only the von Mises distribution is used

Member Function Documentation

◆ add_component()

void ComponentModel::add_component ( double  centre,
double  concentration,
double  height,
const char *  name 
)
Parameters
centrethe centre of the component in turns of pulse phase
concentrationthe concentration of the component equal 1 / variance in radians
heightis the absolute height of the component

◆ align_to_model()

void ComponentModel::align_to_model ( Profile profile)

Roughly align the Profile to match the phases and heights of the components.

rotates the profile to match the phase of the model

References Pulsar::Profile::rotate_phase(), and Pulsar::Profile::scale().


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

Generated using doxygen 1.8.17