casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FluxCalcLogFreqPolynomial.h
Go to the documentation of this file.
1 //# FluxCalcLogFreqPolynomial.h: Implementation base classes for flux standards
2 //# which are (possibly broken) polynomials of log10(frequency).
3 //# Copyright (C) 2010 Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be adressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //#
27 #ifndef COMPONENTS_FLUXCALCLOGFREQPOLYNOMIAL_H
28 #define COMPONENTS_FLUXCALCLOGFREQPOLYNOMIAL_H
29 
31 //#include <components/ComponentModels/FluxCalcQS.h>
33 #include <casa/BasicSL/String.h>
35 
36 //# Handy for passing anonymous arrays to functions.
38 
39 namespace casa { //# NAMESPACE CASA - BEGIN
40 
41 // <summary>
42 // FluxCalcLogFreqPolynomial: Implementation base class for flux standards
43 // which are polynomials of log10(frequency).
44 // </summary>
45 
46 // <use visibility=export>
47 
48 // <reviewed reviewer="" date="" tests="" demos="">
49 
50 // <prerequisite>
51 // <li><linkto class="FluxStandard">FluxStandard</linkto> module
52 // <li><linkto class="FluxCalcQS">FluxCalcQS</linkto> module
53 // </prerequisite>
54 //
55 // <etymology>
56 // From "flux density", "calculator", "log10(frequency)", and "polynomial".
57 // </etymology>
58 //
59 // <synopsis>
60 // The FluxCalcLogFreqPolynomial class provides machinery to compute total flux
61 // densities for specified (variable or non-variable) sources where the flux density is well
62 // described by a low order polynomial of log(frequency).
63 // </synopsis>
64 //
65 // <example>
66 // <srcblock>
67 // </srcblock>
68 // </example>
69 //
70 // <motivation>
71 // Encapsulate the machinery for most of the flux density standards in one class.
72 //
73 // The flux standards for cm astronomy are deliberately chosen to be distant,
74 // non-varying, and bright around 1 GHz. Since such objects tend to be
75 // dominated by synchrotron radiation their flux density is usually described
76 // by a polynomial of log(frequency).
77 // </motivation>
78 //
79 
80 class FluxCalcLogFreqPolynomial : public virtual FluxCalcVQS {
81 public:
82  // Some abbreviations, since the classes derived from this have to
83  // define many polynomial coefficients.
88 
89  // Set the log10(frequency) polynomial coefficients for calculating the flux
90  // density and its uncertainty, and the unit (typically "MHz" or "GHz") that
91  // the coefficients assume. Note that errcoeffs does not have to have the
92  // same number of terms as lfcoeffs, or any terms at all, and that each term
93  // in its polynomial is (errcoeff[order] * pow(log10(freq), order))**2.
94  //FluxCalcLogFreqPolynomial(const casacore::String& freqUnit, const casacore::Vector<casacore::Double>& lfcoeffs,
95  // const casacore::Vector<casacore::Double>& errcoeffs);
96 
97  // Set value and error with the expected flux density and its uncertainty
98  // (0.0 if unknown) at mfreq. Set updatecoeffs = true if the source considered to be
99  // time variable.
101  const casacore::MFrequency& mfreq, const casacore::Bool updatecoeffs=false);
102 
103  virtual casacore::Bool setSource(const casacore::String& sourceName, const casacore::MDirection& sourceDir);
104  void setFreqUnit(const casacore::String& freqUnit);
105 
106  // Functions for setting up coeffs_p by taking a bunch of numbers
107  // (packaged in RigidVectors) and formatting them into coeffs_p.
108 
109  // Takes a casacore::RigidVector for the flux density coefficients and
110  // second one for the uncertainty coefficients, and fills coeffs_p with them.
111  template<casacore::Int lford, casacore::Int errord>
114 
115  // Like fill_coeffs(lfrv, errrv), but it only takes the flux density
116  // coefficients, and substitutes an empty casacore::Vector for the error coefficients.
117  template<casacore::Int lford>
119 
121 
122 private:
123  virtual casacore::Bool setSourceCoeffs() = 0;
124 
125  // The first element of this pair of Vectors is a casacore::Vector of coefficients for
126  // the flux density polynomial (of log10(frequency)). The second element is
127  // for estimating the flux density's uncertainty with a similar polynomial,
128  // but each term is (coeff * log10(freq))**2. It does not need to have the
129  // same number of coefficients as the first element, or even any
130  // coefficients. Both Vectors start with the 0th order term.
132  //casacore::RigidVector<casacore::Double, 2> validfrange_p;
134 
135  // The frequency unit (e.g. "MHz" or "GHz") assumed by coeffs_p.
137 
138 };
139 
140 // <summary>
141 // FluxCalcLogFreqBrokenPolynomial: Implementation base class for flux standards
142 // which are broken polynomials of log10(frequency).
143 // </summary>
144 
145 // <use visibility=export>
146 
147 // <reviewed reviewer="" date="" tests="" demos="">
148 
149 // <prerequisite>
150 // <li><linkto class="FluxCalcLogFreqPolynomial">FluxCalcLogFreqPolynomial</linkto> module
151 // </prerequisite>
152 //
153 // <etymology>
154 // From FluxCalcLogFreqPolynomial and "broken".
155 // </etymology>
156 //
157 // <synopsis>
158 // The FluxCalcLogFreqBrokenPolynomial class extends FluxCalcLogFreqPolynomial
159 // to allow one set of coefficients to be used below a certain frequency (the
160 // break frequency) and another above it. Ideally the sets should mesh well
161 // enough to make the resulting function at least roughly continuous.
162 // </synopsis>
163 //
164 // <example>
165 // <srcblock>
166 // </srcblock>
167 // </example>
168 //
169 // <motivation>
170 // Some of the flux classes use a broken polynomial for 1934-638, and some do not.
171 // </motivation>
172 //
173 // <todo asof="2010/07/26">
174 // <li> Handle an arbitrary number of breaks.
175 // </todo>
177 public:
179 
180  template <casacore::Int lford1, casacore::Int lford2>
182  const casacore::MFrequency& break_freq,
184 
186  const casacore::MFrequency& mfreq, const casacore::Bool updatecoeffs);
187 private:
192 };
193 
194 // <summary>
195 // FluxCalcLogFreqPolynomialSH: Implementation base class for flux standards
196 // which are polynomials of log10(frequency) following Scaife & Heald (2012).
197 // </summary>
198 
199 // <use visibility=export>
200 
201 // <reviewed reviewer="" date="" tests="" demos="">
202 
203 // <prerequisite>
204 // <li><linkto class="FluxCalcLogFreqPolynomial">FluxCalcLogFreqPolynomial</linkto> module
205 // </prerequisite>
206 //
207 // <etymology>
208 // From FluxCalcLogFreqPolynomial and Scaife-Heald (SH).
209 // </etymology>
210 //
211 // <synopsis>
212 // The FluxCalcLogFreqPolynomial class extends FluxCalcLogFreqPolynomial
213 // to enable the use of polynomial coefficients a la Scaife & Heald (2012).
214 // </synopsis>
215 //
216 // <example>
217 // <srcblock>
218 // </srcblock>
219 // </example>
220 //
221 // <motivation>
222 // The Scaife & Heald (2012) models can used to calibrate broadband
223 // low-frequency radio observations (<~500 MHz).
224 // </motivation>
225 class FluxCalcLogFreqPolynomialSH : public virtual FluxCalcVQS {
226 public:
231 
232  //virtual casacore::Bool operator()(Flux<casacore::Double>& value, Flux<casacore::Double>& error,
233  // const casacore::MFrequency& mfreq);
234 
236  const casacore::MFrequency& mfreq, const casacore::Bool /* updatecoeffs */);
237 
238  virtual casacore::Bool setSource(const casacore::String& sourceName, const casacore::MDirection& sourceDir);
239 
240  void setFreqUnit(const casacore::String& freqUnit);
241 
242  template<casacore::Int lford, casacore::Int errord>
245 
246 private:
247  virtual casacore::Bool setSourceCoeffs() = 0;
250 };
251 
252 
253 } //# NAMESPACE CASA - END
254 
255 #ifndef AIPS_NO_TEMPLATE_SRC
256 #include <components/ComponentModels/FluxCalcLogFreqPolynomial.tcc>
257 #endif //# AIPS_NO_TEMPLATE_SRC
258 
259 #endif
A Measure: astronomical direction.
Definition: MDirection.h:174
virtual casacore::Bool setSourceCoeffs()=0
void fill_coeffs(const casacore::RigidVector< casacore::Float, lford > &lfrv, const casacore::RigidVector< casacore::Float, errord > &errrv)
casacore::RigidVector< casacore::Float, 5 > RVF5
casacore::RigidVector< casacore::Float, 4 > RVF4
casacore::RigidVector< casacore::Vector< casacore::Float >, 2 > coeffs_p
The first element of this pair of Vectors is a casacore::Vector of coefficients for the flux density ...
casacore::Vector< casacore::MFrequency > validfrange_p
casacore::RigidVector&lt;casacore::Double, 2&gt; validfrange_p;
void fill_lohi_coeffs(const casacore::RigidVector< casacore::Float, lford1 > &lorv, const casacore::MFrequency &break_freq, const casacore::RigidVector< casacore::Float, lford2 > &hirv)
void setFreqUnit(const casacore::String &freqUnit)
casacore::String freqUnit_p
The frequency unit (e.g.
class Flux;
Definition: FluxCalcVQS.h:92
virtual casacore::Bool operator()(Flux< casacore::Double > &value, Flux< casacore::Double > &error, const casacore::MFrequency &mfreq, const casacore::Bool)
virtual casacore::Bool operator()(Flux&lt;casacore::Double&gt;&amp; value, Flux&lt;casacore::Double&gt;&amp; error...
FluxCalcLogFreqPolynomial: Implementation base class for flux standards which are polynomials of log1...
A Measure: wave characteristics.
Definition: MFrequency.h:161
Fast Vector classes with fixed (templated) length.
virtual casacore::Bool setSource(const casacore::String &sourceName, const casacore::MDirection &sourceDir)
FluxCalcLogFreqPolynomialSH: Implementation base class for flux standards which are polynomials of lo...
virtual casacore::Bool operator()(Flux< casacore::Double > &value, Flux< casacore::Double > &error, const casacore::MFrequency &mfreq, const casacore::Bool updatecoeffs=false)
Set the log10(frequency) polynomial coefficients for calculating the flux density and its uncertainty...
virtual casacore::Bool setSourceCoeffs()=0
virtual casacore::Bool operator()(Flux< casacore::Double > &value, Flux< casacore::Double > &error, const casacore::MFrequency &mfreq, const casacore::Bool updatecoeffs)
Set the log10(frequency) polynomial coefficients for calculating the flux density and its uncertainty...
casacore::Vector< casacore::Float > high_coeffs_p
casacore::RigidVector< casacore::Float, 5 > RVF5
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
FluxCalcLogFreqBrokenPolynomial: Implementation base class for flux standards which are broken polyno...
casacore::RigidVector< casacore::Float, 2 > RVF2
Some abbreviations, since the classes derived from this have to define many polynomial coefficients...
casacore::RigidVector< casacore::Vector< casacore::Float >, 2 > coeffs_p
virtual casacore::Bool setSource(const casacore::String &sourceName, const casacore::MDirection &sourceDir)
void setFreqUnit(const casacore::String &freqUnit)
String: the storage and methods of handling collections of characters.
Definition: String.h:223
casacore::RigidVector< casacore::Float, 3 > RVF3
casacore::RigidVector< casacore::Float, 2 > RVF2
void fill_coeffs(const casacore::RigidVector< casacore::Float, lford > &lfrv, const casacore::RigidVector< casacore::Float, errord > &errrv)
Functions for setting up coeffs_p by taking a bunch of numbers (packaged in RigidVectors) and formatt...
casacore::RigidVector< casacore::Float, 4 > RVF4
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.
casacore::RigidVector< casacore::Float, 3 > RVF3
casacore::Vector< casacore::Float > low_coeffs_p