FluxCalibratorExtension.h
1 //-*-C++-*-
2 /***************************************************************************
3  *
4  * Copyright (C) 2004 - 2019 by Willem van Straten
5  * Licensed under the Academic Free License version 2.1
6  *
7  ***************************************************************************/
8 
9 // psrchive/Base/Extensions/Pulsar/FluxCalibratorExtension.h
10 
11 #ifndef __FluxCalibratorExtension_h
12 #define __FluxCalibratorExtension_h
13 
14 #include "Pulsar/CalibratorExtension.h"
15 
16 namespace Pulsar
17 {
18 
19  class FluxCalibrator;
21 
23  class FluxCalibratorExtension : public CalibratorExtension
24  {
25  friend class FluxCalibrator;
26 
27  public:
28 
31 
34 
37 
40 
43  { return new FluxCalibratorExtension( *this ); }
44 
47 
48  // Text interface to a FluxCalibratorExtension
49  class Interface : public TextInterface::To<FluxCalibratorExtension>
50  {
51  public:
52  Interface( FluxCalibratorExtension *s_instance = NULL );
53  };
54 
57 
59  std::string get_short_name () const { return "fcal"; }
60 
62  void set_nchan (unsigned nchan);
63 
65  unsigned int get_nchan( void ) const;
66 
68  void remove_chan (unsigned first, unsigned last);
69 
70  class Solution;
71 
73  Solution* get_solution (unsigned c);
75  const Solution* get_solution (unsigned c) const;
76 
78  void set_nreceptor (unsigned nreceptor);
79 
81  unsigned get_nreceptor () const;
82 
84  bool has_scale () const { return scale_available; }
85  void has_scale (bool flag) { scale_available = flag; }
86 
88  unsigned get_nparam () const;
89 
91  Estimate<float> get_Estimate ( unsigned iparam, unsigned ichan ) const;
92  void set_Estimate ( unsigned iparam, unsigned ichan, const Estimate<float>& );
93 
94  bool get_valid (unsigned ichan) const;
95  void set_valid (unsigned ichan, bool valid);
96 
98  void frequency_append (Archive* to, const Archive* from);
99 
100  protected:
101 
103  unsigned nreceptor;
104 
106  bool scale_available;
107 
109  std::vector<Solution> solution;
110  };
111 
114  {
115  public:
116 
117  friend class FluxCalibrator;
119 
121  unsigned get_nreceptor () const;
122 
124  void resize (unsigned nreceptor);
125 
127  void set_S_sys (unsigned receptor, const Estimate<double>&);
129  Estimate<double> get_S_sys (unsigned receptor) const;
131 
133  void set_S_cal (unsigned receptor, const Estimate<double>&);
135  Estimate<double> get_S_cal (unsigned receptor) const;
136 
138  void set_scale (unsigned receptor, const Estimate<double>&);
140  Estimate<double> get_scale (unsigned receptor) const;
141 
143  void set_gain_ratio (unsigned r, const Estimate<double>&);
145  Estimate<double> get_gain_ratio (unsigned receptor) const;
146 
147  // Text interface to a FluxCalibratorExtension::Solution instance
148  class Interface : public TextInterface::To<Solution>
149  {
150  public:
151  Interface();
152  };
153 
154  protected:
155 
157 
158  std::vector< Estimate<double> > S_sys;
159 
161 
162  std::vector< Estimate<double> > S_cal;
163 
165 
166  std::vector< Estimate<double> > scale;
167 
169 
170  std::vector< Estimate<double> > ratio;
171 
172  };
173 
174 
175 }
176 
177 #endif
FluxCalibratorExtension()
Default constructor.
Definition: FluxCalibratorExtension.C:19
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
TextInterface::Parser * get_interface()
Return a text interfaces that can be used to access this instance.
Definition: FluxCalibratorExtension.C:188
std::string get_short_name() const
Return a short name.
Definition: FluxCalibratorExtension.h:64
std::vector< Solution > solution
The flux calibrator solutions as a function of frequency.
Definition: FluxCalibratorExtension.h:114
void range_check(unsigned ichan, const char *method) const
Ensure that ichan < get_nchan.
Definition: CalibratorExtension.C:113
void set_nreceptor(unsigned)
Set the number of receptors.
Definition: FluxCalibratorConstantGain.C:56
unsigned get_nreceptor() const
Get the number of receptors.
Definition: FluxCalibratorExtension.C:111
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
const FluxCalibratorExtension & operator=(const FluxCalibratorExtension &)
Operator =.
Definition: FluxCalibratorExtension.C:38
unsigned get_nparam() const
Get the number of parameters that describe each solution.
Definition: FluxCalibratorExtension.C:193
unsigned int get_nchan(void) const
Get the number of frequency channels.
Definition: FluxCalibratorExtension.C:65
virtual void set_nchan(unsigned nchan)
Set the number of frequency channels.
Definition: CalibratorExtension.C:70
virtual void set_nreceptor(unsigned)
Set the number of receptors.
Definition: FluxCalibratorPolicy.C:47
The primary interface to pulsar observational data.
Definition: Archive.h:45
U get_error() const
ConstantGain * clone() const
Return a new default constructed copy of self.
Definition: FluxCalibratorConstantGain.C:23
const ScalarMath sqrt(const ScalarMath &x)
const ExtensionType * get() const
Template method searches for an Extension of the specified type.
void set_scale(unsigned receptor, const Estimate< double > &)
Set the flux scale of the specified channel.
Definition: FluxCalibratorExtension.C:164
std::vector< Estimate< double > > ratio
Gain ratio in each receptor and frequency channel.
Definition: FluxCalibratorExtension.h:175
virtual void set_weight(unsigned ichan, float weight)
Set the weight of the specified channel.
Definition: CalibratorExtension.C:94
std::vector< Estimate< double > > S_sys
System equivalent flux density in each receptor and frequency channel.
Definition: FluxCalibratorExtension.h:163
unsigned nreceptor
The number of receptors.
Definition: FluxCalibratorExtension.h:108
Estimate< double > get_S_sys(unsigned receptor) const
Get the system equivalent flux density of the specified channel.
Definition: FluxCalibratorExtension.C:131
void set_S_cal(unsigned receptor, const Estimate< double > &)
Get the system equivalent flux densities of the fluxcal.
Definition: FluxCalibratorExtension.C:144
unsigned get_nreceptor() const
Get the number of receptors in the calibrator.
Definition: FluxCalibrator.C:765
virtual void remove_chan(unsigned first, unsigned last)
Remove the inclusive range of channels.
Definition: CalibratorExtension.C:76
static Type * factory(const std::string &name)
Construct a new instance of Calibrator::Type, based on name.
Definition: CalibratorType.C:12
void set_scale(unsigned ireceptor, const Estimate< double > &)
Set the scale for the specified receptor.
void set_nreceptor(unsigned nreceptor)
Set the number of receptors.
Definition: FluxCalibratorExtension.C:78
Reference::To< const Calibrator::Type > type
Type of the calibrator.
Definition: CalibratorExtension.h:97
Intermediate storage of MEAL::Complex parameters.
Definition: FluxCalibratorExtension.h:118
Solution * get_solution(unsigned c)
Get the solution for the specified frequency channel.
Definition: FluxCalibratorExtension.C:98
Estimate< double > get_S_cal(unsigned receptor) const
Get the calibrator flux density of the specified channel.
Definition: FluxCalibratorExtension.C:151
void resize(unsigned nreceptor)
Set the number of receptors.
Definition: FluxCalibratorExtension.C:116
void set_gain_ratio(unsigned r, const Estimate< double > &)
Set the gain ratio of the specified channel.
Definition: FluxCalibratorExtension.C:176
Flux Calibrator Extension.
Definition: FluxCalibratorExtension.h:28
Estimate< double > get_gain_ratio(unsigned receptor) const
Get the gain ratio of the specified channel.
Definition: FluxCalibratorExtension.C:183
void set_gain_ratio(unsigned ireceptor, const Estimate< double > &)
Set the gain ratio for the specified receptor.
void frequency_append(Archive *to, const Archive *from)
Append Calibrator Extension data from another Archive.
Definition: CalibratorExtension.C:121
Stores Calibrator parameters in an Archive.
Definition: CalibratorExtension.h:27
bool scale_available
Flag set if scale and ratio data are available.
Definition: FluxCalibratorExtension.h:111
void set_nchan(unsigned nchan)
Set the number of frequency channels.
Definition: FluxCalibratorExtension.C:58
std::vector< Estimate< double > > S_cal
Calibrator flux density in each receptor and frequency channel.
Definition: FluxCalibratorExtension.h:167
const CalibratorExtension & operator=(const CalibratorExtension &)
Operator =.
Definition: CalibratorExtension.C:30
void remove_chan(unsigned first, unsigned last)
Remove the inclusive range of channels.
Definition: FluxCalibratorExtension.C:70
bool in_frequency_order(const Archive *A, const Archive *B)
Return true if A precedes B in frequency order of channels.
Definition: Archive.C:364
bool has_scale() const
Returns true if scale and gain_ratio data are available.
Definition: FluxCalibratorExtension.h:89
Calibrates flux using standard candles and artificial sources.
Definition: FluxCalibrator.h:29
Estimate< double > get_scale(unsigned ireceptor) const
Get the scale for the specified receptor.
Definition: FluxCalibratorConstantGain.C:158
const std::string get_message() const
Defines the PSRCHIVE library.
Definition: CalSource.h:17
virtual float get_weight(unsigned ichan) const
Get the weight of the specified channel.
Definition: CalibratorExtension.C:88
Estimate< double > get_scale(unsigned receptor) const
Get the flux scale of the specified channel.
Definition: FluxCalibratorExtension.C:171
Used when gain remains constant between FluxCal-On and Off observations.
Definition: FluxCalibratorPolicy.h:161
Flux calibration data for each receptor.
Definition: FluxCalibratorPolicy.h:28
~FluxCalibratorExtension()
Destructor.
Definition: FluxCalibratorExtension.C:53
std::vector< Estimate< double > > scale
Flux scale in each receptor and frequency channel.
Definition: FluxCalibratorExtension.h:171
void set_S_sys(unsigned receptor, const Estimate< double > &)
Set the system equivalent flux density of the specified channel.
Definition: FluxCalibratorExtension.C:124
Estimate< double > get_gain_ratio(unsigned ireceptor) const
Get the gain ratio for the specified receptor.
FluxCalibratorExtension * clone() const
Clone method.
Definition: FluxCalibratorExtension.h:47
Estimate< float > get_Estimate(unsigned iparam, unsigned ichan) const
Get the specified parameter for the specified channel.
Definition: FluxCalibratorExtension.C:205
void frequency_append(Archive *to, const Archive *from)
Append FluxCalibrator Extension data from another Archive.
Definition: FluxCalibratorExtension.C:260
unsigned get_nreceptor() const
Get the number of receptors.
Definition: FluxCalibratorExtension.C:90

Generated using doxygen 1.8.17