ConverterIntensity.h

Go to the documentation of this file.
00001 //# Copyright (C) 2005
00002 //# Associated Universities, Inc. Washington DC, USA.
00003 //#
00004 //# This library is free software; you can redistribute it and/or modify it
00005 //# under the terms of the GNU Library General Public License as published by
00006 //# the Free Software Foundation; either version 2 of the License, or (at your
00007 //# option) any later version.
00008 //#
00009 //# This library is distributed in the hope that it will be useful, but WITHOUT
00010 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00011 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00012 //# License for more details.
00013 //#
00014 //# You should have received a copy of the GNU Library General Public License
00015 //# along with this library; if not, write to the Free Software Foundation,
00016 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00017 //#
00018 //# Correspondence concerning AIPS++ should be addressed as follows:
00019 //#        Internet email: aips2-request@nrao.edu.
00020 //#        Postal address: AIPS++ Project Office
00021 //#                        National Radio Astronomy Observatory
00022 //#                        520 Edgemont Road
00023 //#                        Charlottesville, VA 22903-2475 USA
00024 //#
00025 
00026 #ifndef CONVERTERINTENSITY_H_
00027 #define CONVERTERINTENSITY_H_
00028 
00029 #include <QString>
00030 #include <QList>
00031 #include <casa/Arrays/Vector.h>
00032 #include <coordinates/Coordinates/SpectralCoordinate.h>
00033 
00034 namespace casa {
00035 
00040         class ConverterIntensity {
00041         public:
00042                 static const QString FRACTION_OF_PEAK;
00043                 static const QString KELVIN;
00044                 static const QString JY_SR;
00045                 static const QString JY_ARCSEC;
00046                 static const QString JY_BEAM;
00047                 static const QString JY;
00048                 static const QString ADU;
00049                 static const QString TIMES_PIXELS;
00050                 static bool isSupportedUnits( const QString& yUnit );
00051                 //Hertz values are needed corresponding to the values for Jy/Beam Kelvin conversions
00052                 //only.  Both oldUnits and newUnits refer to the old and new units of the values
00053                 //array.  In order to do FRACTION_OF_PEAK conversions, a maximum value with
00054                 //corresponding maximum units must be passed in.
00055                 static void convert( Vector<float>& values, const Vector<float> hertzValues,
00056                                      const QString& oldUnits, const QString& newUnits,
00057                                      double maxValue, const QString& maxUnits,
00058                                      double beamAngle, double beamArea, SpectralCoordinate coord );
00059 
00060                 //Converts between Jy/Beam units.  For example, MJy/Beam <-> Jy/Beam
00061                 static double convertJyBeams( const QString& sourceUnits, const QString& destUnits,
00062                                 double value, SpectralCoordinate& coord );
00063                 static double convertJY( const QString& oldUnits, const QString& newUnits,
00064                                 double value, SpectralCoordinate& coord );
00065                 static double convertJYSR( const QString& oldUnits,const QString& newUnits,
00066                                 double value, SpectralCoordinate& coord );
00067                 static double convertKelvin( const QString& oldUnits,const QString& newUnits,
00068                                 double value, SpectralCoordinate& coord );
00069                 virtual ~ConverterIntensity();
00070 
00071         private:
00072                 ConverterIntensity();
00073                 static double percentToValue( double yValue, double maxValue );
00074                 static double valueToPercent( double yValue, double maxValue );
00075                 static double convertQuantity( double yValue, double frequencyValue,
00076                                                const QString& oldUnits, const QString& newUnits,
00077                                                double beamSolidAngle, double beamArea );
00078                 static void convertJansky( Vector<float>& values, const QString& oldUnits,
00079                                            const QString& newUnits, SpectralCoordinate& coord );
00080                 static void convertKelvin( Vector<float>& values, const QString& oldUnits,
00081                                            const QString& newUnits, SpectralCoordinate& coord );
00082                 static bool isJansky( const QString& units );
00083                 static bool isKelvin( const QString& units );
00084                 static double convertNonKelvinUnits( double yValue, const QString& oldUnits,
00085                                 const QString& newUnits, double beamArea );
00086                 static QString getJanskyBaseUnits( const QString& units );
00087                 static QString getKelvinBaseUnits( const QString& units );
00088                 static QString stripPixels( const QString& units );
00089                 static double beamToArcseconds( double yValue, double beamArea );
00090                 static double arcsecondsToBeam( double yValue, double beamArea );
00091                 static double srToArcseconds( double yValue );
00092                 static double arcsecondsToSr( double yValue );
00093                 static const QList<QString> BEAM_UNITS;
00094                 static const QList<QString> JY_UNITS;
00095                 static const QList<QString> JY_SR_UNITS;
00096                 static const QList<QString> KELVIN_UNITS;
00097                 static const double SPEED_LIGHT_FACTOR;
00098                 static const double FREQUENCY_FACTOR;
00099                 static const double ARCSECONDS_PER_STERADIAN;
00100         };
00101 
00102 } /* namespace casa */
00103 #endif /* CONVERTERINTENSITY_H_ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1