Stores a weight for each Profile phase bin. More...

#include <PhaseWeight.h>

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

Classes

class  Interface
 Archive statistics text interface. More...
 

Public Member Functions

 PhaseWeight ()
 Default constructor.
 
 PhaseWeight (const Profile *)
 Construct with all phase bins selected.
 
 PhaseWeight (unsigned nbin)
 
 PhaseWeight (unsigned nbin, float set_all)
 
 PhaseWeight (const PhaseWeight &weight)
 Copy constructor.
 
 PhaseWeight (const std::vector< float > &weight)
 Copy vector of float constructor.
 
 ~PhaseWeight ()
 Destructor.
 
const PhaseWeightoperator= (const PhaseWeight &weight)
 Assignment operator.
 
const PhaseWeightoperator+= (const PhaseWeight &weight)
 Forms the sum of this and weight.
 
const PhaseWeightoperator*= (const PhaseWeight &weight)
 Forms the product of this and weight.
 
float & operator[] (unsigned i)
 Array operator.
 
const float & operator[] (unsigned i) const
 Array operator.
 
void resize (unsigned nbin)
 Resize the weights array.
 
unsigned get_nbin () const
 Get the number of weights in the array.
 
double get_frequency () const
 Get the reference frequency.
 
void set_frequency (double f)
 Set the reference frequency.
 
void set_all (float weight)
 Set all weights to the specified value.
 
void negate ()
 Set all weights to the logical negation of their current value.
 
double get_weight_sum () const
 Get the sum of all weights.
 
unsigned get_nonzero_weight_count () const
 Get the count of all non-zero weights.
 
std::string get_start_index () const
 Get the beginning of the phase region with non-zero weight. More...
 
std::string get_end_index () const
 Get the end of the phase region with non-zero weight. More...
 
double get_weight_max () const
 Get the max of all weights.
 
void get_weights (std::vector< float > &weights) const
 Get the weights. More...
 
void weight_Profile (Profile *profile) const
 Weight the Profile amplitudes by the weights. More...
 
void set_Profile (const Profile *profile) const
 Set the Profile from which statistics are calculated. More...
 
double get_weighted_sum () const
 Get the weighted total of the amplitudes. More...
 
float get_avg () const
 Get the weighted average of the Profile amplitudes.
 
float get_rms () const
 Get the weighted rms of the Profile amplitudes.
 
float get_min () const
 Get the minimum amplitude with non-zero weight.
 
float get_max () const
 Get the minimum amplitude with non-zero weight.
 
float get_median () const
 Get the median amplitude with non-zero weight.
 
float get_median_difference () const
 Get the median difference between the median and non-zero amplitudes.
 
Estimate< double > get_mean () const
 Get the weighted mean of the Profile amplitudes. More...
 
Estimate< double > get_variance () const
 Get the weighted variance of the Profile amplitudes. More...
 
void stats (const Profile *profile, double *mean, double *variance=0, double *varmean=0, double *varvar=0) const
 Get the statistics of the weighted phase bins (deprecated interface)
 
float * get_weights ()
 Return the base address of the weights array.
 
const float * get_weights () const
 Return the base address of the weights array.
 
void get_filtered (std::vector< float > &amps, bool equal=false, float wt=0) const
 Return the filtered amplitudes for which weight != val.
 
- 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 fill_non_zero (const char *method) const
 fill the non_zero vector
 
void build () const
 Compute the mean and variance attributes.
 
void init ()
 Initialize attributes to default values.
 
void check_Profile (const char *method) const
 Check that the profile attribute is set.
 
void check_weight (unsigned nbin, const char *method) const
 Check that the size of the weights vector is equal to nbin.
 
- Protected Member Functions inherited from Reference::Able
Handle__reference (bool active) const
 
void __dereference (bool auto_delete=true) const
 

Protected Attributes

double reference_frequency
 The reference frequency.
 
std::vector< float > weight
 The weights.
 
Reference::To< const Profile, false > profile
 The Profile to which the weights apply.
 
bool built
 Flag set when the statistics have been calculated.
 
Estimate< double > mean
 The weighted mean of the Profile.
 
Estimate< double > variance
 The weighted variance of the Profile.
 
float median
 The median of all phase bins with non-zero weight.
 
bool median_computed
 
float median_diff
 The median difference of all phase bins with non-zero weight.
 
bool median_diff_computed
 
std::vector< float > non_zero
 working space for median computation
 

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

Stores a weight for each Profile phase bin.

This class implements a useful set of methods required to create, store, and manipulate a weighted set of Profile phase bins.

Member Function Documentation

◆ get_end_index()

string Pulsar::PhaseWeight::get_end_index ( ) const

Get the end of the phase region with non-zero weight.

Retrieve the end of the phase region with non-zero weight.

Referenced by Pulsar::PhaseWeight::Interface::Interface().

◆ get_mean()

Estimate< double > Pulsar::PhaseWeight::get_mean ( ) const

Get the weighted mean of the Profile amplitudes.

Get the weighted mean of the Profile.

Referenced by Pulsar::PolnStatistics::setup_stats().

◆ get_start_index()

string Pulsar::PhaseWeight::get_start_index ( ) const

Get the beginning of the phase region with non-zero weight.

Retrieve the beginning of the phase region with non-zero weight.

Referenced by Pulsar::PhaseWeight::Interface::Interface().

◆ get_variance()

Estimate< double > Pulsar::PhaseWeight::get_variance ( ) const

Get the weighted variance of the Profile amplitudes.

Get the weighted variance of the Profile.

Referenced by Pulsar::SimPolnTiming::extrapolate_benefit(), and Pulsar::FluxPlot::get_flux_error().

◆ get_weighted_sum()

double Pulsar::PhaseWeight::get_weighted_sum ( ) const

Get the weighted total of the amplitudes.

Get the weighted total of the Profile amplitudes.

◆ get_weights()

void Pulsar::PhaseWeight::get_weights ( std::vector< float > &  weights) const

Get the weights.

Retrieve the weights.

Referenced by Pulsar::PhaseWeightShift::calculate(), and Pulsar::FourthMomentStats::debias().

◆ set_Profile()

void Pulsar::PhaseWeight::set_Profile ( const Profile profile) const

◆ weight_Profile()

void Pulsar::PhaseWeight::weight_Profile ( Profile profile) const

Weight the Profile amplitudes by the weights.

Weigh the Profile amplitudes by the weights.

References Pulsar::ProfileAmps::get_amps(), and Pulsar::ProfileAmps::get_nbin().


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

Generated using doxygen 1.8.17