PolnProfileFitAnalysis.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/Polarimetry/Pulsar/PolnProfileFitAnalysis.h
10
11#ifndef __Pulsar_PolnProfileFitAnalysis_h
12#define __Pulsar_PolnProfileFitAnalysis_h
13
14#include "Pulsar/PolnProfileFit.h"
15#include "MEAL/StokesError.h"
16#include "MEAL/StokesCovariance.h"
17
18#include "MEAL/MuellerTransformation.h"
19
20#include <vector>
21
22namespace Pulsar {
23
26
27 public:
28
30 static bool verbose;
31
33 Analysis ();
34
36 void set_compute_error (bool flag = true);
37
39 void set_fit (PolnProfileFit*);
40
43
46
49
51 double get_c_varphi ();
52
54 double get_C_varphi ();
55
57 double get_expected_relative_error (std::vector<unsigned>& histogram);
58
60 double get_c_varphi_error () const;
61
63 double get_Rmult ();
64
66 double get_cond_var ();
67
70
72 void output_C_varphi (const char* filename);
73
74 protected:
75
78
81
84
86 bool built;
87
89 void build (bool only_relative_error = false);
90
93
96
98 unsigned max_harmonic;
99
101 Jones<double> del_deleta (unsigned i, const Jones<double>& K) const;
102
105
107 void delC_delS( Matrix<8,8,double>& delC_delSre,
108 Matrix<8,8,double>& delC_delSim, unsigned k ) const;
109
111 Jones<double> delrho_delS (unsigned k) const;
112
114 void get_curvature (Matrix<8,8,double>& curvature);
115 void add_curvature (Matrix<8,8,double>& curvature);
116
118 void set_harmonic (unsigned index);
119
121 void evaluate (unsigned index);
122
123 Jones<double> model_result;
124 std::vector< Jones<double> > model_gradient;
125
126 Jones<double> xform_result;
127 std::vector< Jones<double> > xform_gradient;
128
129 Jones<double> phase_result;
130 std::vector< Jones<double> > phase_gradient;
131
134
137
140
142 Matrix <7,7,double> C_JJ;
143
145 Matrix <7,7,double> inv_C_JJ;
146
148 Vector <7,double> C_varphiJ;
149
151 double c_varphi;
152
155
156 double efac;
157
160
162 std::vector< Reference::To<MEAL::Complex2> > inputs;
163
166
167 private:
168
169 void initialize();
170
171 std::vector< double > weights;
172 std::vector< double > store_covariance;
173
174 void compute_weights (unsigned nharmonic);
175
176 };
177
178
181
182 public:
183
185 void set_fit (const PolnProfileFit*);
186
188 void set_spectrum (const Profile*, double rescale_variance = 1.0);
189
191 void set_max_harmonic (unsigned max_harmonic);
192
194 void set_variance (double v);
195
197 double get_mean_variance () const
198 { return 0.5 * (variance.real() + variance.imag()); }
199
201 std::complex<double> get_variance () const { return variance; }
202
205
207 void get_curvature (Matrix<2,2,double>& curvature);
208
210 void delC_delS ( Matrix<2,2,double>& delC_delSre,
211 Matrix<2,2,double>& delC_delSim,
212 unsigned index ) const;
213
214 protected:
215
218
220 const std::complex<float>* amps;
221
223 unsigned max_harmonic;
224
225 Matrix<2,2,double> covariance;
226 std::complex<double> variance;
227 };
228
229}
230
231#endif
Analysis of the matrix template matching algorithm.
Definition PolnProfileFitAnalysis.h:25
void get_curvature(Matrix< 8, 8, double > &curvature)
Get the curvature matrix.
Definition PolnProfileFitAnalysis.C:95
double get_Rmult()
Get the multiple correlation.
Definition PolnProfileFitAnalysis.C:456
unsigned max_harmonic
The maximum harmonic used when computing the optimal basis.
Definition PolnProfileFitAnalysis.h:98
void delC_delS(Matrix< 8, 8, double > &delC_delSre, Matrix< 8, 8, double > &delC_delSim, unsigned k) const
The partial derivative of the covariance matrix wrt Re[S_k] and Im[S_k].
Definition PolnProfileFitAnalysis.C:165
double c_varphi
the variance of the unconditional phase shift
Definition PolnProfileFitAnalysis.h:151
double get_cond_var()
Get the conditional variance of varphi.
Definition PolnProfileFitAnalysis.C:651
Estimate< double > relative_error
The relative arrival time error.
Definition PolnProfileFitAnalysis.h:77
Analysis()
Default constructor.
Definition PolnProfileFitAnalysis.C:29
void set_compute_error(bool flag=true)
When set, estimate the uncertainty in each attribute.
Definition PolnProfileFitAnalysis.C:39
Matrix< 4, 4, double > Xi
Covariances between the four Stokes parameters.
Definition PolnProfileFitAnalysis.h:165
bool built
Flag set true when all three of the above values have been computed.
Definition PolnProfileFitAnalysis.h:86
Vector< 7, double > C_varphiJ
the covariances between the phase shift and each Jones matrix parameter
Definition PolnProfileFitAnalysis.h:148
void output_C_varphi(const char *filename)
Write the terms in C_varhpi out to file.
Jones< double > delrho_delS(unsigned k) const
The partial derivative of rho wrt Stokes parameter.
Definition PolnProfileFitAnalysis.C:157
static bool verbose
Verbosity flag.
Definition PolnProfileFitAnalysis.h:30
void set_fit(PolnProfileFit *)
Set the PolnProfileFit algorithm to be analysed.
Definition PolnProfileFitAnalysis.C:256
Matrix< 7, 7, double > C_JJ
the covariances between the Jones matrix parameters
Definition PolnProfileFitAnalysis.h:142
MEAL::StokesError error
Propagation of uncertainty through the congruence tranformation.
Definition PolnProfileFitAnalysis.h:133
Jones< double > del_deleta(unsigned i, const Jones< double > &K) const
The partial derivative of K with respect to free parameter, eta.
Definition PolnProfileFitAnalysis.C:145
Estimate< double > get_relative_conditional_error() const
Get the relative conditional arrival time error.
Definition PolnProfileFitAnalysis.C:644
void build(bool only_relative_error=false)
Computes the above three numbers.
Definition PolnProfileFitAnalysis.C:284
double get_C_varphi()
Get the variance of varphi.
Definition PolnProfileFitAnalysis.C:562
Estimate< double > relative_conditional_error
The relative conditional arrival time error.
Definition PolnProfileFitAnalysis.h:80
void evaluate(unsigned index)
Evaluate the model and phase (and gradients) of the specified harmonic.
Definition PolnProfileFitAnalysis.C:52
Matrix< 8, 8, double > covariance
the covariance matrix
Definition PolnProfileFitAnalysis.h:139
std::vector< Reference::To< MEAL::Complex2 > > inputs
The original inputs.
Definition PolnProfileFitAnalysis.h:162
Matrix< 8, 8, double > get_correlation() const
Get the correlation coefficients.
Definition PolnProfileFitAnalysis.C:612
MEAL::StokesCovariance stokes_covariance
Propagation of Stokes parameter covariances through congruence xform.
Definition PolnProfileFitAnalysis.h:136
Estimate< double > get_multiple_correlation() const
Get the multiple correlation between phase shift and Jones parameters.
Definition PolnProfileFitAnalysis.C:636
double get_expected_relative_error(std::vector< unsigned > &histogram)
Get the expected relative conditional error given a histogram.
Definition PolnProfileFitAnalysis.C:538
double R2_varphiJ
the multiple correlation squared
Definition PolnProfileFitAnalysis.h:154
double get_c_varphi_error() const
Get the uncertainty in the variance of varphi.
void set_harmonic(unsigned index)
Set the model up to evaluate the specified harmonic.
Definition PolnProfileFitAnalysis.C:44
Matrix< 7, 7, double > inv_C_JJ
the inverse of the covariances between the Jones matrix parameters
Definition PolnProfileFitAnalysis.h:145
bool compute_error
Compute the uncertainty of results.
Definition PolnProfileFitAnalysis.h:159
Reference::To< MEAL::Complex2 > xform
The transformation built into the MTM algorithm.
Definition PolnProfileFitAnalysis.h:95
Reference::To< PolnProfileFit > fit
The PolnProfileFit algorithm to be analysed.
Definition PolnProfileFitAnalysis.h:92
double delR2_varphiJ_delS(Matrix< 8, 8, double > &delC_delS)
The partial derivative of the multiple correlation squared wrt S_k.
Definition PolnProfileFitAnalysis.C:211
double get_c_varphi()
Get the variance of varphi.
Definition PolnProfileFitAnalysis.C:482
Estimate< double > get_relative_error() const
Get the relative arrival time error.
Definition PolnProfileFitAnalysis.C:624
Estimate< double > multiple_correlation
The multiple correlation between phase shift and Jones parameters.
Definition PolnProfileFitAnalysis.h:83
The matrix template matching algorithm.
Definition PolnProfileFit.h:51
PolnProfileFit()
Default constructor.
Definition PolnProfileFit.C:38
Any quantity recorded as a function of pulse phase.
Definition Profile.h:40
Analysis of the scalar template matching algorithm.
Definition PolnProfileFitAnalysis.h:180
Reference::To< const Profile > spectrum
The PolnProfileFit algorithm to be analysed.
Definition PolnProfileFitAnalysis.h:217
void get_curvature(Matrix< 2, 2, double > &curvature)
Get the curvature matrix.
Definition PolnProfileFitAnalysis.C:743
Estimate< double > get_error() const
Get the estimated phase shift error for the fluctuation spectrum.
Definition PolnProfileFitAnalysis.C:817
const std::complex< float > * amps
The amps in the fluctation spectrum.
Definition PolnProfileFitAnalysis.h:220
void set_fit(const PolnProfileFit *)
Set the PolnProfileFit algorithm to be analysed.
Definition PolnProfileFitAnalysis.C:715
void set_max_harmonic(unsigned max_harmonic)
Set the maximum harmonic to be used from the fluctuation spectrum.
Definition PolnProfileFitAnalysis.C:731
void set_spectrum(const Profile *, double rescale_variance=1.0)
Set the fluctuation spectrum of the Profile to be analyzed.
Definition PolnProfileFitAnalysis.C:723
void delC_delS(Matrix< 2, 2, double > &delC_delSre, Matrix< 2, 2, double > &delC_delSim, unsigned index) const
The partial derivative of the covariance matrix wrt Re[S_0] and Im[S_0].
Definition PolnProfileFitAnalysis.C:770
unsigned max_harmonic
The maximum harmonic.
Definition PolnProfileFitAnalysis.h:223
std::complex< double > get_variance() const
Get the variance of the fluctuation spectrum.
Definition PolnProfileFitAnalysis.h:201
double get_mean_variance() const
Get the variance of the fluctuation spectrum.
Definition PolnProfileFitAnalysis.h:197
void set_variance(double v)
Set the variance of the fluctuation spectrum.
Definition PolnProfileFitAnalysis.C:736
Defines the PSRCHIVE library.
Definition CalSource.h:17

Generated using doxygen 1.14.0