PolnProfileFit.h
1//-*-C++-*-
2/***************************************************************************
3 *
4 * Copyright (C) 2003-2009 by Willem van Straten
5 * Licensed under the Academic Free License version 2.1
6 *
7 ***************************************************************************/
8
9// psrchive/More/Polarimetry/Pulsar/PolnProfileFit.h
10
11#ifndef __Pulsar_PolnProfileFit_h
12#define __Pulsar_PolnProfileFit_h
13
14#include "Pulsar/CoherencyMeasurementSet.h"
15#include "Pulsar/PhaseWeight.h"
16
17#include "MEAL/Axis.h"
18#include "Matrix.h"
19#include "Estimate.h"
20#include "Stokes.h"
21#include "FTransformAgent.h"
22#include "toa.h"
23
24// forward declarations
25namespace MEAL
26{
27 class Complex2;
28 template<typename T> class PhaseGradients;
29}
30
31namespace Calibration
32{
33 class ReceptionModel;
35 class StandardSpectra;
36}
37
38namespace Pulsar
39{
40 class PolnProfile;
41 class Profile;
42
44
49
51 {
52
53 public:
54
56 static bool verbose;
57
59 class Analysis;
60
63
66
69
72
74 PolnProfileFit* clone () const;
75
77 void set_maximum_harmonic (unsigned max);
78
80 unsigned get_maximum_harmonic () const { return maximum_harmonic; }
81
83 unsigned get_nharmonic () const { return n_harmonic; }
84
86 void set_regions (const PhaseWeight& pulse, const PhaseWeight& baseline);
87
89 void set_standard (const PolnProfile* standard);
90
92 const PolnProfile* get_standard () const;
93
96
98 void add_observation ( const PolnProfile* );
99
101 void set_observation ( const PolnProfile* );
102
104 void delete_observations ();
105
108
111
114
116 void set_fit_debug (bool flag = true);
117
119 void set_normalize_by_invariant (bool set = true);
120
122 void fit (const PolnProfile* observation);
123
125 void solve ();
126
129
133 void set_equation (Calibration::ReceptionModel*);
134
137
139 double get_reduced_chisq () const;
140
142 void set_phase (const Estimate<double>& phase);
143
145 void set_phase_lock (bool locked);
146
148 void share_phase ();
149
151 void remove_phase ();
152
154 Tempo::toa get_toa (const PolnProfile* observation,
155 const MJD& mjd, double period,
156 const std::string& nsite);
157
159 float ccf_max_phase (const Profile* std, const Profile* obs) const;
160
163
166
169
172
173 protected:
174
175 friend class ScalarProfileFitAnalysis;
176
179
181 unsigned n_harmonic;
182
185
188
191
194
197
200
203
205 std::vector< Reference::To<Calibration::TemplateUncertainty> > uncertainty;
206
209
211 std::vector<unsigned> input_index;
212
215
218
221
224
226 void init ();
227
228 Stokes< std::complex<double> > standard_variance;
229
230 private:
231
233 bool regions_set;
234
235 };
236
237}
238
239#endif
240
A CoherencyMeasurement set and their coordinates.
Definition CoherencyMeasurementSet.h:22
Models a set of transformations and source polarizations.
Definition ReceptionModel.h:28
Computes the normalized complex Stokes parameters in each harmonic.
Definition StandardSpectra.h:26
Combines the uncertainty of the template and the observation.
Definition TemplateUncertainty.h:21
Stores a weight for each Profile phase bin.
Definition PhaseWeight.h:24
Analysis of the matrix template matching algorithm.
Definition PolnProfileFitAnalysis.h:25
void set_fit_debug(bool flag=true)
Set the debug mode in the ReceptionModel.
Definition PolnProfileFit.C:301
void share_phase()
Share a single phase shift between all input observations.
Definition PolnProfileFit.C:322
bool shared_phase
Share a single phase shift between all input observations.
Definition PolnProfileFit.h:184
void remove_phase()
Remove pulse phase from model (may be more efficient, but irreversible)
Definition PolnProfileFit.C:314
Calibration::CoherencyMeasurementSet measurement_set
The template from which measurement sets are constructed.
Definition PolnProfileFit.h:220
unsigned n_harmonic
The number of harmonics in the fit.
Definition PolnProfileFit.h:181
bool phase_lock
Lock the phase to the initial estimate.
Definition PolnProfileFit.h:187
void init()
Construtor helper.
Definition PolnProfileFit.C:90
~PolnProfileFit()
Destructor.
Definition PolnProfileFit.C:76
Estimate< double > get_phase() const
Get the phase offset between the standard and the observation.
Definition PolnProfileFit.C:570
float ccf_max_phase(const Profile *std, const Profile *obs) const
Return the phase shift based on the cross correlation function.
Definition PolnProfileFit.C:625
MEAL::Complex2 * get_transformation() const
Get the transformation between the standard and the observation.
Definition PolnProfileFit.C:296
void set_regions(const PhaseWeight &pulse, const PhaseWeight &baseline)
Set the on-pulse and baseline regions.
Definition PolnProfileFit.C:144
PolnProfileFit * clone() const
Clone.
Definition PolnProfileFit.C:80
const PolnProfile * get_standard() const
Get the standard to which observations will be fit.
Definition PolnProfileFit.C:124
void set_measurement_set(const Calibration::CoherencyMeasurementSet &)
Set the template from which measurment sets will be constructed.
Definition PolnProfileFit.C:373
bool manage_equation_transformation
Manage the equation transformation.
Definition PolnProfileFit.h:165
void add_observation(Calibration::CoherencyMeasurementSet &, const PolnProfile *)
Add the specified observation to the measurement set.
Definition PolnProfileFit.C:402
void solve()
Fit all observations to the standard.
Definition PolnProfileFit.C:521
Calibration::ReceptionModel * get_equation()
Get the measurement equation used to model the fit.
Definition PolnProfileFit.C:551
PolnProfileFit & operator=(const PolnProfileFit &fit)
Assignment operator.
Definition PolnProfileFit.C:52
Reference::To< Calibration::ReceptionModel > equation
The measurement equation used to model the fit.
Definition PolnProfileFit.h:202
void set_observation(const PolnProfile *)
Set the only observation to be fit to the standard.
Definition PolnProfileFit.C:358
Reference::To< MEAL::PhaseGradients< MEAL::Complex2 > > phases
The phase gradient model for each observation added.
Definition PolnProfileFit.h:208
void set_plan(FTransform::Plan *)
Set the fourier transform plan.
Definition PolnProfileFit.C:113
MEAL::Axis< unsigned > index_axis
The gradient index axis.
Definition PolnProfileFit.h:217
void set_normalize_by_invariant(bool set=true)
Normalize each Stokes vector by the mean on-pulse invariant.
Definition PolnProfileFit.C:85
std::vector< unsigned > input_index
The index of each used harmonic in the measurement equation.
Definition PolnProfileFit.h:211
void fit(const PolnProfile *observation)
Fit the specified observation to the standard.
Definition PolnProfileFit.C:337
Calibration::StandardSpectra * get_spectra()
Get the statistical interface to the data.
Definition PolnProfileFit.C:564
bool choose_maximum_harmonic
Set true when set_standard should choose the maximum harmonic.
Definition PolnProfileFit.h:162
bool fit_debug
The fit debug flag.
Definition PolnProfileFit.h:223
Tempo::toa get_toa(const PolnProfile *observation, const MJD &mjd, double period, const std::string &nsite)
Get the arrival time estimate.
Definition PolnProfileFit.C:599
double get_reduced_chisq() const
Get the statistical goodness of fit.
Definition PolnProfileFit.C:543
static bool verbose
Verbosity flag.
Definition PolnProfileFit.h:56
std::vector< Reference::To< Calibration::TemplateUncertainty > > uncertainty
Least-squares normalization includes variable template contribution.
Definition PolnProfileFit.h:205
Reference::To< const PolnProfile > standard_fourier
The Fourier transform of the standard.
Definition PolnProfileFit.h:193
Reference::To< MEAL::Complex2 > transformation
The transformation between the standard and observation.
Definition PolnProfileFit.h:196
unsigned get_nharmonic() const
Get the number of harmonics to be included in fit.
Definition PolnProfileFit.h:83
unsigned maximum_harmonic
The maximum number of harmonics to include in the fit.
Definition PolnProfileFit.h:178
unsigned get_maximum_harmonic() const
Get the maximum number of harmonics to include in fit.
Definition PolnProfileFit.h:80
void set_phase(const Estimate< double > &phase)
Set the phase offset between the observation and the standard.
Definition PolnProfileFit.C:583
Reference::To< const PolnProfile > standard
The standard to which observations will be fit.
Definition PolnProfileFit.h:190
Reference::To< Calibration::StandardSpectra > standard_data
Normalization by total invariant interval with error propagation.
Definition PolnProfileFit.h:199
MEAL::Axis< double > phase_axis
The phase axis.
Definition PolnProfileFit.h:214
void set_standard(const PolnProfile *standard)
Set the standard to which observations will be fit.
Definition PolnProfileFit.C:162
void set_phase_lock(bool locked)
Lock pulse phase; i.e., do not allow pulse phase to vary in fit.
Definition PolnProfileFit.C:309
PolnProfileFit()
Default constructor.
Definition PolnProfileFit.C:38
void set_transformation(MEAL::Complex2 *xform)
Set the transformation between the standard and observation.
Definition PolnProfileFit.C:285
void delete_observations()
Delete any previously added observations.
Definition PolnProfileFit.C:347
void set_maximum_harmonic(unsigned max)
Set the maximum number of harmonics to include in fit.
Definition PolnProfileFit.C:118
Estimate< double > get_total_squared_invariant(const PolnProfile *)
Get the total squared invariant used to normalize the Stokes parameters.
Definition PolnProfileFit.C:396
Polarimetric pulse profile transformations and derivations.
Definition PolnProfile.h:29
Any quantity recorded as a function of pulse phase.
Definition Profile.h:40
Defines the PSRCHIVE library.
Definition CalSource.h:17
void phase(Profile *input)
Compute the phase of the input complex-valued Profile.
Definition Fourier.C:135
STL namespace.

Generated using doxygen 1.14.0