FluxCalibratorPolicy.h
1//-*-C++-*-
2/***************************************************************************
3 *
4 * Copyright (C) 2003 - 2018 by Willem van Straten
5 * Licensed under the Academic Free License version 2.1
6 *
7 ***************************************************************************/
8
9// psrchive/More/Polarimetry/Pulsar/FluxCalibratorPolicy.h
10
11#ifndef __Pulsar_FluxCalibratorPolicy_H
12#define __Pulsar_FluxCalibratorPolicy_H
13
14#include "Pulsar/FluxCalibrator.h"
15#include "MEAL/ScalarMath.h"
16#include "MEAL/ScalarParameter.h"
17#include "MEAL/ScalarConstant.h"
18#include "Types.h"
19
20namespace Pulsar {
21
24 {
25
26 public:
27
29 Policy ();
30
32 virtual Policy* clone () const = 0;
33
35 virtual void integrate (Signal::Source source, unsigned ireceptor,
36 const Estimate<double>& cal_hi,
37 const Estimate<double>& cal_lo) = 0;
38
40 void get ( std::vector< Estimate<double> >& S_sys,
41 std::vector< Estimate<double> >& S_cal ) const;
42
44 void set ( const std::vector< Estimate<double> >& S_sys,
45 const std::vector< Estimate<double> >& S_cal );
46
48 virtual void set_nreceptor (unsigned);
49
51 unsigned get_nreceptor () const;
52
54 void set_S_std (double S_std);
55
57 double get_S_std () const;
58
60 void set_valid (bool f = true) { valid = f; }
61
63 bool get_valid () const { return valid; }
64
66 bool get_solution_available () const;
67
70
73
75 Estimate<double> get_S_sys (unsigned receptor) const;
76
78 Estimate<double> get_S_cal (unsigned receptor) const;
79
80 protected:
81
83 mutable bool valid;
84
86 double S_std;
87
89 mutable std::vector< Estimate<double> > S_cal;
90
92 mutable std::vector< Estimate<double> > S_sys;
93
95 mutable bool calculated;
96
98 void calculate () const;
99
101 virtual void compute (unsigned ireceptor,
104
105 };
106
109 {
110
111 public:
112
114 VariableGain ();
115
116 VariableGain* clone () const;
117
118 void integrate (Signal::Source source, unsigned ireceptor,
119 const Estimate<double>& cal_hi,
120 const Estimate<double>& cal_lo);
121
122 protected:
123
125 std::vector< MeanEstimate<double> > mean_ratio_on;
126
128 std::vector< MeanEstimate<double> > mean_ratio_off;
129
131 void add_ratio_on (unsigned receptor, Estimate<double>& ratio_on);
132
134 void add_ratio_off (unsigned receptor, Estimate<double>& ratio_on);
135
137 void compute (unsigned ireceptor,
140
141 private:
142
143 /*
144 Use the ScalarMath class to calculate the variances.
145 These are static because they cost a bit during construction.
146 */
147 MEAL::ScalarParameter ratio_on;
148 MEAL::ScalarParameter ratio_off;
150
151 MEAL::ScalarMath flux_cal;
152 MEAL::ScalarMath flux_sys;
153 };
154
157 {
158
159 public:
160
162 ConstantGain ();
163
164 ConstantGain* clone () const;
165
167 void set_nreceptor (unsigned);
168
169 void integrate (Signal::Source source, unsigned ireceptor,
170 const Estimate<double>& cal_hi,
171 const Estimate<double>& cal_lo);
172
174 Estimate<double> get_scale (unsigned ireceptor) const;
176 void get_scale ( std::vector< Estimate<double> >& );
177
179 void set_scale (unsigned ireceptor, const Estimate<double>&);
181 void set_scale ( const std::vector< Estimate<double> >& );
182
184 Estimate<double> get_gain (unsigned ireceptor) const;
185
187 Estimate<double> get_gain_ratio (unsigned ireceptor) const;
189 void get_gain_ratio ( std::vector< Estimate<double> >& );
190
192 void set_gain_ratio (unsigned ireceptor, const Estimate<double>&);
194 void set_gain_ratio ( const std::vector< Estimate<double> >& );
195
197 Estimate<double> get_gain () const;
198
199 protected:
200
202 std::vector< MeanEstimate<double> > mean_hi_on;
204 std::vector< MeanEstimate<double> > mean_lo_on;
205
207 std::vector< MeanEstimate<double> > mean_hi_off;
209 std::vector< MeanEstimate<double> > mean_lo_off;
210
212 void compute (unsigned ireceptor,
215
216 void invalidate (unsigned ireceptor);
217
218 std::vector< Estimate<double> > scale;
219 std::vector< Estimate<double> > gain_ratio;
220
221 private:
222
223 /*
224 Use the ScalarMath class to calculate the variances.
225 */
226 MEAL::ScalarParameter ratio_hi;
227 MEAL::ScalarParameter ratio_lo;
229
230 MEAL::ScalarMath flux_cal;
231 MEAL::ScalarMath flux_sys;
232
233 };
234}
235
236#endif
Used when gain remains constant between FluxCal-On and Off observations.
Definition FluxCalibratorPolicy.h:157
ConstantGain()
Default constructor.
Definition FluxCalibratorConstantGain.C:16
Flux calibration data for each receptor.
Definition FluxCalibratorPolicy.h:24
Used when gain varies between FluxCal-On and Off observations.
Definition FluxCalibratorPolicy.h:109
VariableGain()
Default constructor.
Definition FluxCalibratorVariableGain.C:18
void get_scale(std::vector< Estimate< double > > &)
Get the scale for each receptor.
Estimate< double > get_scale(unsigned ireceptor) const
Get the scale for the specified receptor.
Definition FluxCalibratorConstantGain.C:158
std::vector< MeanEstimate< double > > mean_lo_off
Mean of off-source observations with noise diode off.
Definition FluxCalibratorPolicy.h:209
void set_gain_ratio(unsigned ireceptor, const Estimate< double > &)
Set the gain ratio for the specified receptor.
std::vector< MeanEstimate< double > > mean_hi_on
Mean of on-source observations with noise diode emitting.
Definition FluxCalibratorPolicy.h:202
std::vector< MeanEstimate< double > > mean_hi_off
Mean of off-source observations with noise diode emitting.
Definition FluxCalibratorPolicy.h:207
void set_gain_ratio(const std::vector< Estimate< double > > &)
Set the gain ratio for each receptor.
Estimate< double > get_gain_ratio(unsigned ireceptor) const
Get the gain ratio for the specified receptor.
Estimate< double > get_gain(unsigned ireceptor) const
Get the gain for the specified receptor.
Definition FluxCalibratorConstantGain.C:172
ConstantGain * clone() const
Return a new default constructed copy of self.
Definition FluxCalibratorConstantGain.C:23
void get_gain_ratio(std::vector< Estimate< double > > &)
Get the gain ratio for each receptor.
void integrate(Signal::Source source, unsigned ireceptor, const Estimate< double > &cal_hi, const Estimate< double > &cal_lo)
Integrate an observation of the reference source.
Definition FluxCalibratorConstantGain.C:29
std::vector< MeanEstimate< double > > mean_lo_on
Mean of on-source observations with noise diode off.
Definition FluxCalibratorPolicy.h:204
void set_scale(unsigned ireceptor, const Estimate< double > &)
Set the scale for the specified receptor.
void set_scale(const std::vector< Estimate< double > > &)
Set the scale for each receptor.
ConstantGain()
Default constructor.
Definition FluxCalibratorConstantGain.C:16
void set_nreceptor(unsigned)
Set the number of receptors.
Definition FluxCalibratorConstantGain.C:56
void compute(unsigned ireceptor, Estimate< double > &S_cal, Estimate< double > &S_sys)
Compute the fluxes of the reference source and system.
Definition FluxCalibratorConstantGain.C:77
virtual void compute(unsigned ireceptor, Estimate< double > &S_cal, Estimate< double > &S_sys)=0
Compute the fluxes of the reference source and system.
bool get_solution_available() const
Return true when a solution is available.
Definition FluxCalibratorPolicy.C:59
Estimate< double > get_S_cal() const
Return the total calibrator flux density.
Definition FluxCalibratorPolicy.C:97
virtual void integrate(Signal::Source source, unsigned ireceptor, const Estimate< double > &cal_hi, const Estimate< double > &cal_lo)=0
Integrate an observation of the reference source.
std::vector< Estimate< double > > S_sys
System equivalent flux density in each receptor.
Definition FluxCalibratorPolicy.h:92
virtual Policy * clone() const =0
Return a new default constructed copy of self.
bool calculated
Flag set when S_cal and S_sys have been computed.
Definition FluxCalibratorPolicy.h:95
void set_valid(bool f=true)
Set the data validity flag.
Definition FluxCalibratorPolicy.h:60
Policy()
Default constructor.
Definition FluxCalibratorPolicy.C:16
virtual void set_nreceptor(unsigned)
Set the number of receptors.
Definition FluxCalibratorPolicy.C:47
double S_std
Flux density of the standard candle.
Definition FluxCalibratorPolicy.h:86
void get(std::vector< Estimate< double > > &S_sys, std::vector< Estimate< double > > &S_cal) const
Get the flux densities for each receptor.
Definition FluxCalibratorPolicy.C:31
double get_S_std() const
Get the flux density of the standard candle.
Definition FluxCalibratorPolicy.C:131
bool valid
Flag set when data are valid.
Definition FluxCalibratorPolicy.h:83
bool get_valid() const
Get the data validity flag.
Definition FluxCalibratorPolicy.h:63
Estimate< double > get_S_sys() const
Return the total system equivalent flux density.
Definition FluxCalibratorPolicy.C:88
void calculate() const
Calulate S_cal and S_sys for both receptors.
Definition FluxCalibratorPolicy.C:136
unsigned get_nreceptor() const
Get the number of receptors.
Definition FluxCalibratorPolicy.C:54
void set(const std::vector< Estimate< double > > &S_sys, const std::vector< Estimate< double > > &S_cal)
Set the flux densities for each receptor.
Definition FluxCalibratorPolicy.C:22
void set_S_std(double S_std)
Set the flux density of the standard candle.
Definition FluxCalibratorPolicy.C:124
std::vector< Estimate< double > > S_cal
Calibrator flux density in each receptor.
Definition FluxCalibratorPolicy.h:89
void compute(unsigned ireceptor, Estimate< double > &S_cal, Estimate< double > &S_sys)
Compute the fluxes of the reference source and system.
Definition FluxCalibratorVariableGain.C:66
VariableGain()
Default constructor.
Definition FluxCalibratorVariableGain.C:18
std::vector< MeanEstimate< double > > mean_ratio_on
Ratio of cal hi/lo on source in each receptor.
Definition FluxCalibratorPolicy.h:125
void integrate(Signal::Source source, unsigned ireceptor, const Estimate< double > &cal_hi, const Estimate< double > &cal_lo)
Integrate an observation of the reference source.
Definition FluxCalibratorVariableGain.C:30
VariableGain * clone() const
Return a new default constructed copy of self.
Definition FluxCalibratorVariableGain.C:25
void add_ratio_off(unsigned receptor, Estimate< double > &ratio_on)
Add to the mean hi/lo ratio off source for the specified receptor.
Definition FluxCalibratorVariableGain.C:57
void add_ratio_on(unsigned receptor, Estimate< double > &ratio_on)
Add to the mean hi/lo ratio on source for the specified receptor.
Definition FluxCalibratorVariableGain.C:46
std::vector< MeanEstimate< double > > mean_ratio_off
Ratio of cal hi/lo off source in each receptor.
Definition FluxCalibratorPolicy.h:128
Defines the PSRCHIVE library.
Definition CalSource.h:17

Generated using doxygen 1.14.0