casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
FluxStandard.h
Go to the documentation of this file.
00001 //# FluxStandard.h: Compute flux densities for standard reference sources
00002 //# Copyright (C) 1996,1997,1999,2001
00003 //# Associated Universities, Inc. Washington DC, USA.
00004 //#
00005 //# This library is free software; you can redistribute it and/or modify it
00006 //# under the terms of the GNU Library General Public License as published by
00007 //# the Free Software Foundation; either version 2 of the License, or (at your
00008 //# option) any later version.
00009 //#
00010 //# This library is distributed in the hope that it will be useful, but WITHOUT
00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00013 //# License for more details.
00014 //#
00015 //# You should have received a copy of the GNU Library General Public License
00016 //# along with this library; if not, write to the Free Software Foundation,
00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00018 //#
00019 //# Correspondence concerning AIPS++ should be adressed as follows:
00020 //#        Internet email: aips2-request@nrao.edu.
00021 //#        Postal address: AIPS++ Project Office
00022 //#                        National Radio Astronomy Observatory
00023 //#                        520 Edgemont Road
00024 //#                        Charlottesville, VA 22903-2475 USA
00025 //#
00026 //#
00027 //# $Id: FluxStandard.h 21292 2012-11-28 14:58:19Z gervandiepen $
00028 
00029 #ifndef COMPONENTS_FLUXSTANDARD_H
00030 #define COMPONENTS_FLUXSTANDARD_H
00031 
00032 #include <casa/aips.h>
00033 #include <components/ComponentModels/Flux.h>
00034 #include <measures/Measures/MDirection.h>
00035 
00036 namespace casa { //# NAMESPACE CASA - BEGIN
00037 
00038 // Forward declarations
00039 class String;        //#include <casa/BasicSL/String.h>
00040 class MEpoch;        //#include <measures/Measures/MEpoch.h>
00041 class MFrequency;    //#include <measures/Measures/MFrequency.h>
00042 class SpectralModel; //#include <components/ComponentModels/SpectralModel.h>
00043 
00044 // <summary> 
00045 // FluxStandard: Compute flux densities for standard reference sources
00046 // </summary>
00047 
00048 // <use visibility=export>
00049 
00050 // <reviewed reviewer="" date="" tests="" demos="">
00051 
00052 // <prerequisite>
00053 // <li><linkto class="Flux">Flux</linkto> module
00054 // </prerequisite>
00055 //
00056 // <etymology>
00057 // From "flux density" and "standard".
00058 // </etymology>
00059 //
00060 // <synopsis>
00061 // The FluxStandard class provides a means to compute total flux
00062 // densities for specified non-variable sources on a standard
00063 // flux density scale, such as that established by Baars or
00064 // Perley and Taylor.
00065 // </synopsis>
00066 //
00067 // <example>
00068 // <srcblock>
00069 // </srcblock>
00070 // </example>
00071 //
00072 // <motivation>
00073 // Encapsulate information on standard flux density computation in one class.
00074 // </motivation>
00075 //
00076 // <todo asof="99/06/01">
00077 // <li> closer integration into component models.
00078 // </todo>
00079 
00080 class FluxStandard
00081 {
00082  public:
00083   // Flux scale types.
00084   // Standards which do not include resolution info must come before
00085   // HAS_RESOLUTION_INFO, and those with it must come after.
00086   enum FluxScale {
00087     // Perley (1990); plus Reynolds (1934-638; 7/94); Baars (3C138)
00088     PERLEY_90 = 0,
00089 
00090     // Perley and Taylor (1995.2); plus Reynolds (1934-638; 7/94)
00091     PERLEY_TAYLOR_95,
00092 
00093     // Perley and Taylor (1999.2); plus Reynolds (1934-638; 7/94)
00094     PERLEY_TAYLOR_99,
00095 
00096     // Baars scale
00097     // Baars J. W. M., Genzel R., Pauliny-Toth I. I. K., et al., 1977,
00098     // A&A, 61, 99
00099     // http://cdsads.u-strasbg.fr/abs/1977A%26A....61...99B
00100     BAARS,
00101 
00102     // Perley-Butler 2010 Scale (using VLA [not EVLA!] data)
00103     PERLEY_BUTLER_2010,
00104 
00105     // Perley-Butler 2013 
00106     PERLEY_BUTLER_2013,
00107 
00108     HAS_RESOLUTION_INFO,
00109 
00110     // Estimate the flux density for a Solar System object using a JPL Horizons
00111     // ephemeris/data page and model provided by Bryan Butler.
00112     SS_JPL_BUTLER = HAS_RESOLUTION_INFO,
00113 
00114     // The number of standards in this enumerator.
00115     NUMBER_STANDARDS
00116   };
00117 
00118   // Default constructor, and destructor
00119   FluxStandard(const FluxStandard::FluxScale scale =
00120                FluxStandard::PERLEY_TAYLOR_99);
00121   ~FluxStandard();
00122 
00123   // Compute the flux density for a specified source at a specified frequency
00124   Bool compute (const String& sourceName, const MFrequency& mfreq,
00125                 Flux<Double>& value, Flux<Double>& error);
00126 
00127   // Compute the flux densities and their uncertainties for a specified source
00128   // at a set of specified frequencies.
00129   Bool compute(const String& sourceName, const Vector<MFrequency>& mfreqs,
00130                Vector<Flux<Double> >& values,
00131                Vector<Flux<Double> >& errors,
00132                const Bool verbose=True);
00133 
00134   // Compute the flux densities and their uncertainties for a specified source
00135   // for a set of sets of specified frequencies, i.e. mfreqs[spw] is a set of
00136   // frequencies for channels in spectral window spw, and values and errors are
00137   // arranged the same way.
00138   Bool compute(const String& sourceName,
00139                const Vector<Vector<MFrequency> >& mfreqs,
00140                Vector<Vector<Flux<Double> > >& values,
00141                Vector<Vector<Flux<Double> > >& errors);
00142 
00143   // Like compute, but it also saves a set of ComponentLists for the source to
00144   // disk and puts the paths (sourceName_mfreq_mtime.cl) in clnames, making it
00145   // suitable for resolved sources.
00146   // mtime is ignored for nonvariable objects.
00147   // Solar System objects are typically resolved and variable!
00148   // The ComponentList names are formed from prefix, sourceName, the
00149   // frequencies, and times.
00150   Bool computeCL(const String& sourceName, const Vector<Vector<MFrequency> >& mfreqs,
00151                  const MEpoch& mtime, const MDirection& position,
00152                  Vector<Vector<Flux<Double> > >& values,
00153                  Vector<Vector<Flux<Double> > >& errors,
00154                  Vector<String>& clnames, const String& prefix="");
00155 
00156   // Take a component cmp and save it to a ComponentList on disk, returning the
00157   // pathname.  ("" if unsuccessful, sourceName_mfreqGHzDateTime.cl otherwise)
00158   //
00159   // This is also used outside of FluxStandard, but it is declared here instead
00160   // of in ComponentList because it is somewhat specialized, mainly in setting
00161   // up the pathname.  The ComponentList name is formed from prefix, sourceName,
00162   // mfreq, and mtime.
00163   //
00164   static String makeComponentList(const String& sourceName, const MFrequency& mfreq,
00165                                   const MEpoch& mtime, const Flux<Double>& fluxval,
00166                                   const ComponentShape& cmp,
00167                                   const SpectralModel& spectrum,
00168                                   const String& prefix="");
00169 
00170   // Variation of the above that will fill a TabularSpectrum with mfreqs and
00171   // values if appropriate.
00172   static String makeComponentList(const String& sourceName,
00173                                   const Vector<MFrequency>& mfreqs,
00174                                   const MEpoch& mtime,
00175                                   const Vector<Flux<Double> >& values,
00176                                   const ComponentShape& cmp,
00177                                   const String& prefix="");
00178 
00179   // Decode a string representation of the standard or catalog name
00180   static Bool matchStandard(const String& name, 
00181                             FluxStandard::FluxScale& stdEnum,
00182                             String& stdName);
00183 
00184   // Return a standard string description for each scale or catalog
00185   static String standardName(const FluxStandard::FluxScale& stdEnum);
00186 
00187  private:
00188   // Flux scale in use
00189   FluxStandard::FluxScale itsFluxScale;
00190 
00191   Bool has_direction_p;
00192 
00193   MDirection direction_p;
00194 };
00195 
00196 } //# NAMESPACE CASA - END
00197 
00198 #endif