ProfileStats.h
1//-*-C++-*-
2/***************************************************************************
3 *
4 * Copyright (C) 2005 by Willem van Straten
5 * Licensed under the Academic Free License version 2.1
6 *
7 ***************************************************************************/
8
9// psrchive/More/General/Pulsar/ProfileStats.h
10
11#ifndef __Pulsar_ProfileStats_h
12#define __Pulsar_ProfileStats_h
13
14#include "Pulsar/PhaseWeight.h"
15#include "Pulsar/Algorithm.h"
16#include "Pulsar/HasBaselineEstimator.h"
17
18#include "PhaseRange.h"
19#include "TextInterface.h"
20#include "Estimate.h"
21
22namespace Pulsar
23{
24 class Profile;
26 class SNRatioEstimator;
27 class WidthEstimator;
28 class Integration;
29
32 {
33 public:
34
36 static unsigned get_instance_count ();
37
39 ProfileStats (const Profile* profile = 0);
40
43
46
48 ProfileStats* clone () const;
49
52 ProfileWeightFunction* get_include_estimator () const;
53
56 ProfileWeightFunction* get_exclude_estimator () const;
57
59 void set_profile (const Profile*);
60 void set_Profile (const Profile* profile) { set_profile(profile); }
61
63 void set_integration (const Integration*);
64 void set_Integration (const Integration* subint) { set_integration(subint); }
65 Integration* get_Integration() const;
66
68 void select_profile (const Profile*);
69
71 void deselect_onpulse (const Profile* profile, float threshold);
72
75 ProfileWeightFunction* get_onpulse_estimator () const;
76
79
81 void set_regions (const PhaseWeight& pulse, const PhaseWeight& baseline);
82
84 void get_regions (PhaseWeight& pulse, PhaseWeight& base) const;
85
87 unsigned get_onpulse_nbin () const;
88
90 bool get_onpulse (unsigned ibin) const;
91
93 void set_onpulse (unsigned ibin, bool);
94
96 unsigned get_baseline_nbin () const;
97
99 bool get_baseline (unsigned ibin) const;
100
102 Estimate<double> get_total (bool subtract_baseline = true) const;
103
106
109
112
115
118 SNRatioEstimator* get_snratio_estimator () const;
119
121 void set_snr_estimator (const std::string& name);
122
124 double get_snr () const;
125
128
131 WidthEstimator* get_width_estimator () const;
132
134 void set_pulse_width_estimator (const std::string& name);
135
138
141
144
146 class Interface;
147
148 protected:
149
152
155
158
161
164
166 bool regions_set = false;
167
170
173
176
179
182
185
188
191
193 void build () const;
194
195 private:
196
198 mutable bool built = false;
199 };
200
201}
202
203
204#endif
205
206
207
Data manipulation implementations.
Definition Algorithm.h:19
HasBaselineEstimator()
Default constructor.
Definition HasBaselineEstimator.C:15
Array of Profiles integrated over the same time interval.
Definition Integration.h:37
Stores a weight for each Profile phase bin.
Definition PhaseWeight.h:24
Profile statistics text interface.
Definition ProfileStatsInterface.h:21
void set_snr_estimator(const std::string &name)
Set the signal-to-noise ratio estimator.
Definition ProfileStats.C:516
unsigned get_baseline_nbin() const
Get the number of phase bins in the baseline window.
Definition ProfileStats.C:304
PhaseWeight * get_baseline()
Return the off-pulse baseline mask.
Definition ProfileStats.C:396
Reference::To< PhaseWeight > exclude
The excluded phase bin mask.
Definition ProfileStats.h:190
void set_exclude_estimator(ProfileWeightFunction *)
The algorithm used to find the excluded phase bins.
Definition ProfileStats.C:93
void set_regions(const PhaseWeight &pulse, const PhaseWeight &baseline)
Set the on-pulse and baseline regions.
Definition ProfileStats.C:238
PhaseWeight * get_all()
Return the all pulse phase bin mask.
Definition ProfileStats.C:408
void set_profile(const Profile *)
Set the Profile from which statistics will be derived.
Definition ProfileStats.C:110
Reference::To< PhaseWeight > baseline
The off-pulse baseline mask.
Definition ProfileStats.h:172
static unsigned get_instance_count()
Get the number of ProfileStats instances in existence.
Definition ProfileStats.C:22
Reference::To< SNRatioEstimator > snratio_estimator
The algorithm used to compute the signal-to-noise ratio.
Definition ProfileStats.h:160
void set_snratio_estimator(SNRatioEstimator *)
The algorithm used to estimate the signal-to-noise ratio.
Definition ProfileStats.C:221
bool regions_set
True when the onpulse and baseline regions have been set.
Definition ProfileStats.h:166
TextInterface::Parser * get_snr_interface()
Get the text interface of the signal-to-noise ratio estimator.
Definition ProfileStats.C:534
Reference::To< const Profile, false > profile
The Profile from which statistics will be derived.
Definition ProfileStats.h:151
Reference::To< WidthEstimator > width_estimator
The algorithm used to estimate the pulse width.
Definition ProfileStats.h:163
void set_onpulse_estimator(ProfileWeightFunction *)
The algorithm used to find the on-pulse phase bins.
Definition ProfileStats.C:165
void set_width_estimator(WidthEstimator *)
The algorithm used to estimate the pulse width.
Definition ProfileStats.C:206
Reference::To< const Integration, false > integration
The Integration from which additional metadata can be obtained.
Definition ProfileStats.h:154
void set_onpulse(unsigned ibin, bool)
Set if the specified phase bin is in the on pulse window.
Definition ProfileStats.C:324
~ProfileStats()
Destructor.
Definition ProfileStats.C:64
TextInterface::Parser * get_pulse_width_interface()
Get the text interface of the pulse width estimator.
Definition ProfileStats.C:555
void select_profile(const Profile *)
Set the Profile that defines the baseline and on-pulse regions.
Definition ProfileStats.C:123
TextInterface::Parser * get_interface()
Return a text interface that can be used to configure this instance.
Definition ProfileStats.C:574
PhaseWeight * get_onpulse()
Return the on-pulse phase bin mask.
Definition ProfileStats.C:384
Reference::To< PhaseWeight > all
All phase bins (subject to include and exclude)
Definition ProfileStats.h:175
Estimate< double > get_total(bool subtract_baseline=true) const
Returns the total flux of the on-pulse phase bins.
Definition ProfileStats.C:259
double get_snr() const
Get the signal-to-noise ratio.
Definition ProfileStats.C:522
Reference::To< ProfileWeightFunction > onpulse_estimator
The algorithm used to find the on-pulse phase bins.
Definition ProfileStats.h:157
Reference::To< PhaseWeight > onpulse
The on-pulse phase bin mask.
Definition ProfileStats.h:169
Estimate< double > baseline_variance
The variance of the total intensity baseline.
Definition ProfileStats.h:178
void set_baseline_estimator(ProfileWeightFunction *)
The algorithm used to find the off-pulse phase bins.
Definition ProfileStats.C:182
Estimate< double > get_baseline_variance() const
Returns the variance of the baseline.
Definition ProfileStats.C:347
void deselect_onpulse(const Profile *profile, float threshold)
Deselect onpulse phase bins in profile that fall below threshold.
Definition ProfileStats.C:143
Reference::To< PhaseWeight > include
The included phase bin mask.
Definition ProfileStats.h:184
unsigned get_onpulse_nbin() const
Get the number of phase bins in the on pulse window.
Definition ProfileStats.C:297
Reference::To< ProfileWeightFunction > include_estimator
The algorithm used to find the included phase bins.
Definition ProfileStats.h:181
void set_pulse_width_estimator(const std::string &name)
Set the pulse width estimator.
Definition ProfileStats.C:543
void build() const
Computes the phase bin masks.
Definition ProfileStats.C:415
void set_integration(const Integration *)
Set the Integration from which additional metadata can be obtained.
Definition ProfileStats.C:561
void set_include_estimator(ProfileWeightFunction *)
The algorithm used to find the included phase bins.
Definition ProfileStats.C:76
::Phase::Value get_pulse_width() const
Get the pulse width.
Definition ProfileStats.C:549
ProfileStats(const Profile *profile=0)
Default constructor.
Definition ProfileStats.C:28
Reference::To< ProfileWeightFunction > exclude_estimator
The algorithm used to find the excluded phase bins.
Definition ProfileStats.h:187
void get_regions(PhaseWeight &pulse, PhaseWeight &base) const
Set the on-pulse and baseline regions.
Definition ProfileStats.C:251
ProfileStats * clone() const
Clone operator.
Definition ProfileStats.C:69
PhaseWeight algorithms that receive an input Profile.
Definition ProfileWeightFunction.h:22
Any quantity recorded as a function of pulse phase.
Definition Profile.h:40
Algorithms that estimate the signal-to-noise ratio of pulse profiles.
Definition SNRatioEstimator.h:23
Algorithms that estimate the width of the pulse profile.
Definition WidthEstimator.h:27
Defines the PSRCHIVE library.
Definition CalSource.h:17

Generated using doxygen 1.14.0