casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ConverterIntensity.h
Go to the documentation of this file.
1 //# Copyright (C) 2005
2 //# Associated Universities, Inc. Washington DC, USA.
3 //#
4 //# This library is free software; you can redistribute it and/or modify it
5 //# under the terms of the GNU Library General Public License as published by
6 //# the Free Software Foundation; either version 2 of the License, or (at your
7 //# option) any later version.
8 //#
9 //# This library is distributed in the hope that it will be useful, but WITHOUT
10 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12 //# License for more details.
13 //#
14 //# You should have received a copy of the GNU Library General Public License
15 //# along with this library; if not, write to the Free Software Foundation,
16 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
17 //#
18 //# Correspondence concerning AIPS++ should be addressed as follows:
19 //# Internet email: aips2-request@nrao.edu.
20 //# Postal address: AIPS++ Project Office
21 //# National Radio Astronomy Observatory
22 //# 520 Edgemont Road
23 //# Charlottesville, VA 22903-2475 USA
24 //#
25 
26 #ifndef CONVERTERINTENSITY_H_
27 #define CONVERTERINTENSITY_H_
28 
29 #include <QString>
30 #include <QList>
31 #include <casa/Arrays/Vector.h>
33 
34 namespace casa {
35 
41  public:
42  static const QString FRACTION_OF_PEAK;
43  static const QString KELVIN;
44  static const QString JY_SR;
45  static const QString JY_ARCSEC;
46  static const QString JY_BEAM;
47  static const QString JY;
48  static const QString ADU;
49  static const QString TIMES_PIXELS;
50  static bool isSupportedUnits( const QString& yUnit );
51  //Hertz values are needed corresponding to the values for Jy/Beam Kelvin conversions
52  //only. Both oldUnits and newUnits refer to the old and new units of the values
53  //array. In order to do FRACTION_OF_PEAK conversions, a maximum value with
54  //corresponding maximum units must be passed in.
55  static void convert( casacore::Vector<float>& values, const casacore::Vector<float> hertzValues,
56  const QString& oldUnits, const QString& newUnits,
57  double maxValue, const QString& maxUnits,
58  double beamAngle, double beamArea, casacore::SpectralCoordinate coord );
59 
60  //Converts between Jy/Beam units. For example, MJy/Beam <-> Jy/Beam
61  static double convertJyBeams( const QString& sourceUnits, const QString& destUnits,
62  double value, casacore::SpectralCoordinate& coord );
63  static double convertJY( const QString& oldUnits, const QString& newUnits,
64  double value, casacore::SpectralCoordinate& coord );
65  static double convertJYSR( const QString& oldUnits,const QString& newUnits,
66  double value, casacore::SpectralCoordinate& coord );
67  static double convertKelvin( const QString& oldUnits,const QString& newUnits,
68  double value, casacore::SpectralCoordinate& coord );
69  virtual ~ConverterIntensity();
70 
71  private:
73  static double percentToValue( double yValue, double maxValue );
74  static double valueToPercent( double yValue, double maxValue );
75  static double convertQuantity( double yValue, double frequencyValue,
76  const QString& oldUnits, const QString& newUnits,
77  double beamSolidAngle, double beamArea );
78  static void convertJansky( casacore::Vector<float>& values, const QString& oldUnits,
79  const QString& newUnits, casacore::SpectralCoordinate& coord );
80  static void convertKelvin( casacore::Vector<float>& values, const QString& oldUnits,
81  const QString& newUnits, casacore::SpectralCoordinate& coord );
82  static bool isJansky( const QString& units );
83  static bool isKelvin( const QString& units );
84  static double convertNonKelvinUnits( double yValue, const QString& oldUnits,
85  const QString& newUnits, double beamArea );
86  static QString getJanskyBaseUnits( const QString& units );
87  static QString getKelvinBaseUnits( const QString& units );
88  static QString stripPixels( const QString& units );
89  static double beamToArcseconds( double yValue, double beamArea );
90  static double arcsecondsToBeam( double yValue, double beamArea );
91  static double srToArcseconds( double yValue );
92  static double arcsecondsToSr( double yValue );
93  static const QList<QString> BEAM_UNITS;
94  static const QList<QString> JY_UNITS;
95  static const QList<QString> JY_SR_UNITS;
96  static const QList<QString> KELVIN_UNITS;
97  static const double SPEED_LIGHT_FACTOR;
98  static const double FREQUENCY_FACTOR;
99  static const double ARCSECONDS_PER_STERADIAN;
100  };
101 
102 } /* namespace casa */
103 #endif /* CONVERTERINTENSITY_H_ */
static const QList< QString > BEAM_UNITS
static QString stripPixels(const QString &units)
static const double ARCSECONDS_PER_STERADIAN
static double arcsecondsToSr(double yValue)
static void convert(casacore::Vector< float > &values, const casacore::Vector< float > hertzValues, const QString &oldUnits, const QString &newUnits, double maxValue, const QString &maxUnits, double beamAngle, double beamArea, casacore::SpectralCoordinate coord)
Hertz values are needed corresponding to the values for Jy/Beam Kelvin conversions only...
static double convertKelvin(const QString &oldUnits, const QString &newUnits, double value, casacore::SpectralCoordinate &coord)
static QString getKelvinBaseUnits(const QString &units)
static double srToArcseconds(double yValue)
static const QList< QString > JY_UNITS
static bool isKelvin(const QString &units)
static const double FREQUENCY_FACTOR
static double percentToValue(double yValue, double maxValue)
static const QString JY
static const QList< QString > KELVIN_UNITS
static const QString TIMES_PIXELS
static const QString KELVIN
static void convertJansky(casacore::Vector< float > &values, const QString &oldUnits, const QString &newUnits, casacore::SpectralCoordinate &coord)
static double convertNonKelvinUnits(double yValue, const QString &oldUnits, const QString &newUnits, double beamArea)
static double valueToPercent(double yValue, double maxValue)
static const QString FRACTION_OF_PEAK
static QString getJanskyBaseUnits(const QString &units)
static double beamToArcseconds(double yValue, double beamArea)
static double convertJyBeams(const QString &sourceUnits, const QString &destUnits, double value, casacore::SpectralCoordinate &coord)
Converts between Jy/Beam units.
static bool isJansky(const QString &units)
static const double SPEED_LIGHT_FACTOR
static const QString JY_SR
static const QString JY_ARCSEC
static double convertJY(const QString &oldUnits, const QString &newUnits, double value, casacore::SpectralCoordinate &coord)
Interconvert pixel and frequency values.
static double convertJYSR(const QString &oldUnits, const QString &newUnits, double value, casacore::SpectralCoordinate &coord)
static double arcsecondsToBeam(double yValue, double beamArea)
static bool isSupportedUnits(const QString &yUnit)
Converts intensity units: Jy/Beam, Kelvin, Fraction of Peak, etc.
static const QString ADU
static const QList< QString > JY_SR_UNITS
static const QString JY_BEAM
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.
static double convertQuantity(double yValue, double frequencyValue, const QString &oldUnits, const QString &newUnits, double beamSolidAngle, double beamArea)