Any quantity recorded as a function of pulse phase. More...

#include <Profile.h>

Inheritance diagram for Pulsar::Profile:
Pulsar::ProfileAmps Pulsar::Container Reference::Able Reference::HeapTracked

Classes

class  Extension
 
class  Strategies
 Manages the strategies that implement algorithms. More...
 

Public Types

typedef Functor< std::pair< int, int >const Profile *) > Edges
 

Public Member Functions

 Profile (unsigned nbin=0)
 Default constructor.
 
 Profile (const Profile &profile)
 copy constructor
 
 Profile (const Profile *profile)
 copy constructor
 
 ~Profile ()
 destructor
 
virtual Profileclone () const
 returns a pointer to a new copy of self
 
virtual void resize (unsigned nbin)
 resize the data area
 
const Profileoperator= (const Profile &profile)
 assignment operator More...
 
void copy (const Profile *, bool clone_strategy=true)
 does the work for copy constructor and assignment operator
 
void average (const Profile *that)
 set this to the weighted average of this and that More...
 
void sum (const Profile *profile)
 add profile to this
 
void diff (const Profile *profile)
 subtract profile from this
 
const Profileoperator+= (float offset)
 adds offset to each bin of the profile
 
const Profileoperator-= (float offset)
 subtracts offset from each bin of the profile
 
const Profileoperator*= (float scale)
 multiplies each bin of the profile by scale
 
void scale (double scale)
 multiplies each bin of the profile by scale
 
void offset (double offset)
 offsets each bin of the profile by offset
 
void rotate_phase (double phase)
 rotates the profile by phase (in turns) More...
 
void derivative ()
 compute the derivative of profile with respect to index
 
void zero ()
 set all amplitudes to zero
 
void square_root ()
 calculate the signed sqrt of the absolute value of each bin
 
void absolute ()
 calculare the absolute value of each phase bin
 
void logarithm (double base=10.0, double threshold=0.0)
 calculate the logarithm of each bin with value greater than threshold
 
float max (int bin_start=0, int bin_end=0) const
 Returns the maximum amplitude.
 
float min (int bin_start=0, int bin_end=0) const
 Returns the minimum amplitude.
 
double sum (int bin_start=0, int bin_end=0) const
 Returns the sum of all amplitudes.
 
double sumsq (int bin_start=0, int bin_end=0) const
 Returns the sum of all amplitudes squared.
 
double sumfabs (int bin_start=0, int bin_end=0) const
 Returns the sum of the absolute value.
 
void stats (double *mean, double *variance=0, double *varmean=0, int bin_start=0, int bin_end=0) const
 Calculates the mean, variance, and variance of the mean. More...
 
void stats (float phase, double *mean, double *variance=0, double *varmean=0, float duty_cycle=default_duty_cycle) const
 Convenience interface to stats (start_bin, end_bin) More...
 
double mean (float phase, float duty_cycle=default_duty_cycle) const
 Convenience interface to stats, returns only the mean. More...
 
float find_max_phase (float duty_cycle=default_duty_cycle) const
 Returns the phase of the centre of the region with maximum mean. More...
 
float find_min_phase (float duty_cycle=default_duty_cycle) const
 Returns the phase of the centre of the region with minimum mean. More...
 
void find_transitions (int &highlow, int &lowhigh, int &width) const
 Find the bin numbers at which the mean power transits. More...
 
int find_max_bin (int bin_start=0, int bin_end=0) const
 Returns the bin number with the maximum amplitude.
 
int find_min_bin (int bin_start=0, int bin_end=0) const
 Returns the bin number with the minimum amplitude.
 
void find_peak_edges (int &rise, int &fall) const
 Find the bin numbers at which the cumulative power crosses thresholds.
 
Strategiesget_strategy () const
 Returns the strategy manager.
 
void set_strategy (Strategies *)
 Set the strategy manager.
 
PhaseWeightbaseline () const
 Return a new PhaseWeight instance with the baseline phase bins masked. More...
 
float snr () const
 Returns the signal to noise ratio of the profile. More...
 
void dedisperse (double dm, double ref_freq, double pfold)
 Rotates the profile to remove dispersion delay. More...
 
Estimate< double > shift (const Profile &std) const
 Returns the shift (in turns) between profile and standard.
 
std::vector< float > get_weighted_amps () const
 
double get_centre_frequency () const
 get the centre frequency (in MHz)
 
virtual void set_centre_frequency (double cfreq)
 set the centre frequency (in MHz)
 
float get_weight () const
 get the weight of the profile
 
virtual void set_weight (float)
 set the weight of the profile
 
void fft_convolve (const Profile *profile)
 convolves this with the given profile (using fft method)
 
void convolve (const Profile *profile)
 convolves this with the given profile in time domain
 
void correlate (const Profile *profile)
 cross-correlates this with the given profile in time domain
 
void correlate_normalized (const Profile *profile)
 cross-correlates and normalizes this with the given profile in time domain
 
void pscrunch ()
 some extensions may have to respond to pscrunch
 
void bscrunch (unsigned nscrunch)
 integrate neighbouring phase bins in profile
 
void bscrunch_to_nbin (unsigned nbin)
 integrate neighbouring phase bins in profile
 
void fold (unsigned nfold)
 integrate neighbouring sections of the profile
 
template<class T >
const T * get () const
 
template<class T >
T * get ()
 
- Public Member Functions inherited from Pulsar::ProfileAmps
 ProfileAmps (unsigned nbin=0)
 Constructor initializes the data array.
 
virtual ~ProfileAmps ()
 Destructor destroys the data array.
 
 ProfileAmps (const ProfileAmps &)
 Copy constructor.
 
unsigned get_nbin () const
 Return the number of bins.
 
const float * get_amps () const
 Return a pointer to the amplitudes array.
 
float * get_amps ()
 Return a pointer to the amplitudes array.
 
template<typename T >
void set_amps (const T *data)
 set the amplitudes array equal to the contents of the data array More...
 
template<typename T >
void set_amps (const std::vector< T > &data)
 set the amplitudes array equal to the contents of the data array More...
 
template<typename T >
void get_amps (std::vector< T > &data) const
 set the amplitudes array equal to the contents of the data array More...
 
void remove (const std::vector< unsigned > &indeces)
 remove the elements specified in the array of indeces 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
 

Static Public Member Functions

static unsigned get_instance_count ()
 returns the number of Profile instances
 
- 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

static bool verbose = false
 flag controls the amount output to stderr by Profile methods More...
 
static Option< bool > rotate_in_phase_domain
 When true, Profile::rotate shifts bins in the phase domain.
 
static Option< float > transition_duty_cycle
 fractional phase window used to find rise and fall of running mean More...
 
static Option< float > default_duty_cycle
 fractional phase window used in most functions More...
 
static Option< Edgespeak_edges_strategy
 The default implementation of the edge detection algorithm. More...
 
- Static Public Attributes inherited from Pulsar::ProfileAmps
static bool no_amps = false
 When true, no memory is allocated for amps. More...
 

Friends

class Integration
 The Integration class may call protected methods.
 

Extension Interface

Additional algorithms or information can be made available through use of Extension classes.

class PolnProfile
 centre frequency of profile (in MHz)
 
class StandardSNR
 centre frequency of profile (in MHz)
 
double centrefreq
 centre frequency of profile (in MHz)
 
float weight
 weight of profile
 
std::vector< Reference::To< Extension > > extension
 The Extensions added to this Profile instance.
 
Reference::To< Strategiesstrategy
 The strategy manager.
 
virtual unsigned get_nextension () const
 Return the number of extensions available.
 
virtual const Extensionget_extension (unsigned iextension) const
 Return a pointer to the specified extension. More...
 
virtual Extensionget_extension (unsigned iextension)
 Return a pointer to the specified extension. More...
 
template<class ExtensionType >
const ExtensionType * get () const
 Template method searches for an Extension of the specified type.
 
template<class ExtensionType >
ExtensionType * get ()
 Template method searches for an Extension of the specified type.
 
virtual void add_extension (Extension *extension)
 Add an Extension to this instance. More...
 
void convolve (const Profile *profile, int direction)
 does the work for convolve and correlate
 
void init ()
 initializes all values to null
 

Additional Inherited Members

- Protected Member Functions inherited from Reference::Able
Handle__reference (bool active) const
 
void __dereference (bool auto_delete=true) const
 

Detailed Description

Any quantity recorded as a function of pulse phase.

The Pulsar::Profile class implements a useful, yet minimal, set of functionality required to store, manipulate, and analyse pulsar profiles. Note that:

  • All methods that change the size of a Profile are protected.
  • The Integration class is declared as a friend.

This arrangement protects the size of each Profile object from becoming unsynchronized with the Integration in which it is contained. The data in each Profile may still be manipulated through public methods.

Member Function Documentation

◆ add_extension()

void Pulsar::Profile::add_extension ( Extension ext)
virtual

Add an Extension to this instance.

The derived class must ensure that only one instance of the Extension type is stored.

Derived classes need only define this method, as the non-const version implemented by the Profile base class simply calls this method.

◆ average()

void Pulsar::Profile::average ( const Profile profile)

set this to the weighted average of this and that

A series of additions using this operator preserves the relationship:

$ \bar{x} = \sum_{i=1}^N W(x_i) x_i / W(\bar{x}) $

where $ W(x_i) $ is the weight assigned to $ x_i $ and

$ W(\bar{x}) = \sum_{i=1}^N W(x_i) $

Referenced by Pulsar::Integration::combine(), and Pulsar::TimeIntegrate::transform().

◆ baseline()

Pulsar::PhaseWeight * Pulsar::Profile::baseline ( ) const

Return a new PhaseWeight instance with the baseline phase bins masked.

Return a PhaseWeight mask with the baseline phase bins enabled.

Referenced by Pulsar::FluxPlot::get_flux_error(), Pulsar::FortranSNR::get_snr(), and Pulsar::AdaptiveSNR::get_snr().

◆ dedisperse()

void Pulsar::Profile::dedisperse ( double  dm,
double  ref_freq,
double  pfold 
)

Rotates the profile to remove dispersion delay.

A convenience interface to Profile::rotate_phase. Rotates the profile in order to remove the dispersion delay with respect to a reference frequency.

Parameters
dmthe dispersion measure (in ${\rm pc\, cm}^{-3}$)
ref_freqthe reference frequency (in MHz)
pfoldthe folding periond (in seconds)

◆ find_max_phase()

float Pulsar::Profile::find_max_phase ( float  duty_cycle = default_duty_cycle) const

Returns the phase of the centre of the region with maximum mean.

Returns the centre phase of the region with maximum mean

Parameters
duty_cyclewidth of the region over which the mean is calculated

Referenced by Pulsar::Statistics::get_peak().

◆ find_min_phase()

float Pulsar::Profile::find_min_phase ( float  duty_cycle = default_duty_cycle) const

Returns the phase of the centre of the region with minimum mean.

Returns the centre phase of the region with minimum mean

Parameters
duty_cyclewidth of the region over which the mean is calculated

Referenced by Pulsar::find_spike_edges(), Pulsar::NoiseStatistics::get_nfnr(), Pulsar::PhaseSNR::get_snr(), and Pulsar::InfoLabel::plot().

◆ find_transitions()

void Pulsar::Profile::find_transitions ( int &  hi2lo,
int &  lo2hi,
int &  width 
) const

Find the bin numbers at which the mean power transits.

Finds the transitions at which the mean power of a sliding window drops below the mean power (high to low) and at which it jumps back above the mean power (low to high). The function is best-suited to detect the transitions of a pulsed calibrator profile, which is usually a square wave with 0.5 duty cycle. The width of the sliding window is given by Pulsar::Profile::transition_duty_cycle.

Return values
hi2lobin at which the mean power drops (from left to right)
lo2hibin at which the mean power jumps (from left to right)
widthnumber of bins in the sliding window used to find transitions

Referenced by Pulsar::ProfilePlot::draw_transitions(), and Pulsar::SquareWave::get_snr().

◆ get() [1/2]

template<class T >
T* Pulsar::Profile::get ( )

e.g. Profile* profile; MyExtension* ext = profile->get<MyExtension>();

◆ get() [2/2]

template<class T >
const T* Pulsar::Profile::get ( ) const

e.g. const Profile* profile; const MyExtension* ext = profile->get<MyExtension>();

◆ get_extension() [1/2]

Pulsar::Profile::Extension * Pulsar::Profile::get_extension ( unsigned  iext)
virtual

Return a pointer to the specified extension.

Simply calls get_extension const

◆ get_extension() [2/2]

const Pulsar::Profile::Extension * Pulsar::Profile::get_extension ( unsigned  iext) const
virtual

Return a pointer to the specified extension.

Derived classes need only define this method, as the non-const version implemented by the Profile base class simply calls this method.

Referenced by copy().

◆ get_weighted_amps()

vector< float > Pulsar::Profile::get_weighted_amps ( ) const

returns a vector representation of the array of amplitudes, with all zero-weighted points cleaned out

Referenced by Pulsar::LinePhasePlot::draw().

◆ mean()

double Pulsar::Profile::mean ( float  phase,
float  duty_cycle = default_duty_cycle 
) const

Convenience interface to stats, returns only the mean.

Parameters
phasecentre of region
duty_cyclewidth of region
Returns
mean of region

Referenced by Pulsar::find_spike_edges(), and Pulsar::InfoLabel::plot().

◆ operator=()

const Pulsar::Profile & Pulsar::Profile::operator= ( const Profile input)

assignment operator

Sets all attributes of this Profile equal to that of the input Profile, resizes and copies the amps array.

◆ rotate_phase()

void Pulsar::Profile::rotate_phase ( double  phase)

rotates the profile by phase (in turns)

Rotate the profile by the specified phase. The profile will be rotated such that the power at phase will be found at phase zero. ie.

$t^\prime=t+\phi P$

where $t^\prime$ is the new start time (rising edge of bin 0), $t$ is the original start time, $\phi$ is equal to phase, and $P$ is the period at the time of folding.

References FTransform::shift().

Referenced by Pulsar::ComponentModel::align_to_model(), Pulsar::ProfileShiftFit::apply_scale_and_shift(), and Pulsar::MoreProfiles::rotate_phase().

◆ snr()

float Pulsar::Profile::snr ( ) const

Returns the signal to noise ratio of the profile.

This method calls Profile::snr_strategy

Referenced by Pulsar::SNRWeight::get_weight().

◆ stats() [1/2]

void Pulsar::Profile::stats ( double *  mean,
double *  variance = 0,
double *  varmean = 0,
int  istart = 0,
int  iend = 0 
) const

Calculates the mean, variance, and variance of the mean.

Returns the mean, variance, and variance of the mean over the specified interval.

Return values
meanthe mean of the interval
variancethe variance of the interval
varmeanthe variance of the mean of the interval
Parameters
istartthe first bin of the interval
iendone greater than the last bin of the interval

Referenced by Pulsar::ProfilePlot::draw_transitions(), Pulsar::NoiseStatistics::get_nfnr(), Pulsar::PhaseSNR::get_snr(), Pulsar::SquareWave::get_snr(), Pulsar::InfoLabel::plot(), and Pulsar::Archive::rms_baseline().

◆ stats() [2/2]

void Pulsar::Profile::stats ( float  phase,
double *  mean,
double *  variance = 0,
double *  varmean = 0,
float  duty_cycle = default_duty_cycle 
) const

Convenience interface to stats (start_bin, end_bin)

Parameters
phasecentre of region
Return values
meanthe mean of the interval
variancethe variance of the interval
varmeanthe variance of the mean of the interval
Parameters
phasecentre of region over which statistics will be calculated
duty_cyclewidth of region

Member Data Documentation

◆ default_duty_cycle

Pulsar::Option< float > Pulsar::Profile::default_duty_cycle
static

fractional phase window used in most functions

Default fractional pulse phase window used to calculate statistics related to the baseline.

Referenced by Pulsar::Smooth::Smooth().

◆ peak_edges_strategy

Pulsar::Option< Pulsar::Profile::Edges > Pulsar::Profile::peak_edges_strategy
static

The default implementation of the edge detection algorithm.

The PeakEdgesInterpreter class sets the peak_edges_strategy attribute according to commands specified either in the configuration file or via the psrsh interpreter. It enables convenient experimentation with the peak edges estimation algorithm.

◆ transition_duty_cycle

Pulsar::Option< float > Pulsar::Profile::transition_duty_cycle
static

fractional phase window used to find rise and fall of running mean

Fractional pulse phase window used to calculate the transitions in Pulsar::Profile::find_cal_transition

◆ verbose


The documentation for this class was generated from the following files:
  • Profile.h
  • Profile.C
  • Profile_average.C
  • Profile_derivative.C
  • Profile_rotate.C
  • ProfileExtension.h
  • Profile_baseline.C
  • Profile_convolve.C
  • Profile_dedisperse.C
  • Profile_find_minmax_phase.C
  • Profile_find_peak_edges.C
  • Profile_find_transitions.C
  • Profile_shift.C
  • Profile_snr.C
  • Profile_stats.C
  • StrategySet.C

Generated using doxygen 1.8.17