00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef MSTransformRegridder_H_
00024 #define MSTransformRegridder_H_
00025
00026
00027 #include <casa/Logging/LogIO.h>
00028
00029
00030 #include <measures/Measures/MeasTable.h>
00031
00032
00033 #include <ms/MeasurementSets.h>
00034
00035
00036 #include <iomanip>
00037
00038
00039 #include <casa/Quanta/QuantumHolder.h>
00040
00041
00042 namespace casa {
00043
00044
00045 class MSTransformRegridder
00046 {
00047
00048 public:
00049
00050 MSTransformRegridder();
00051 ~MSTransformRegridder();
00052
00053
00054 static Bool combineSpws( LogIO& os,
00055 String msName,
00056 const Vector<Int>& spwids,
00057 Vector<Double>& newCHAN_FREQ,
00058 Vector<Double>& newCHAN_WIDTH,
00059 std::vector<std::vector<Int> >& averageWhichChan,
00060 std::vector<std::vector<Int> >& averageWhichSPW,
00061 std::vector<std::vector<Double> >& averageChanFrac,
00062 Bool verbose = False);
00063
00064
00065 static Bool combineSpwsCore( LogIO& os,
00066 MeasurementSet& ms_p,
00067 const Vector<Int>& spwids,
00068 Vector<Double>& newCHAN_FREQ,
00069 Vector<Double>& newCHAN_WIDTH,
00070 std::vector<std::vector<Int> >& averageWhichChan,
00071 std::vector<std::vector<Int> >& averageWhichSPW,
00072 std::vector<std::vector<Double> >& averageChanFrac,
00073 Bool verbose = False);
00074
00075
00076
00077 static Bool calcChanFreqs( LogIO& os,
00078
00079 Vector<Double>& newCHAN_FREQ,
00080 Vector<Double>& newCHAN_WIDTH,
00081 Double& weightScale,
00082
00083 const Vector<Double>& oldCHAN_FREQ,
00084 const Vector<Double>& oldCHAN_WIDTH,
00085
00086 const MDirection phaseCenter,
00087 const MFrequency::Types theOldRefFrame,
00088 const MEpoch theObsTime,
00089 const MPosition mObsPos,
00090 const String& mode,
00091 const int nchan,
00092 const String& start,
00093 const String& width,
00094 const String& restfreq,
00095 const String& outframe,
00096 const String& veltype,
00097 const Bool verbose=False,
00098
00099 const MRadialVelocity mRV=MRadialVelocity() );
00100
00101
00102 static Bool convertGridPars(LogIO& os,
00103 const String& mode,
00104 const int nchan,
00105 const String& start,
00106 const String& width,
00107 const String& interp,
00108 const String& restfreq,
00109 const String& outframe,
00110 const String& veltype,
00111 String& t_mode,
00112 String& t_outframe,
00113 String& t_regridQuantity,
00114 Double& t_restfreq,
00115 String& t_regridInterpMeth,
00116 Double& t_cstart,
00117 Double& t_bandwidth,
00118 Double& t_cwidth,
00119 Bool& t_centerIsStart,
00120 Bool& t_startIsEnd,
00121 Int& t_nchan,
00122 Int& t_width,
00123 Int& t_start);
00124
00125
00126
00127
00128 static Bool regridChanBounds(Vector<Double>& newChanLoBound,
00129 Vector<Double>& newChanHiBound,
00130 const Double regridCenter,
00131 const Double regridBandwidth,
00132 const Double regridChanWidth,
00133 const Double regridVeloRestfrq,
00134 const String regridQuant,
00135 const Vector<Double>& transNewXin,
00136 const Vector<Double>& transCHAN_WIDTH,
00137 String& message,
00138 const Bool centerIsStart=False,
00139 const Bool startIsEnd=False,
00140 const Int nchan=0,
00141 const Int width=0,
00142 const Int start=-1);
00143
00144
00145
00146 static lDouble vrad(const lDouble freq, const lDouble rest){ return (C::c * (1. - freq/rest)); };
00147 static lDouble vopt(const lDouble freq, const lDouble rest){ return (C::c *(rest/freq - 1.)); };
00148 static lDouble lambda(const lDouble freq){ return (C::c/freq); };
00149 static lDouble freq_from_vrad(const lDouble vrad, const lDouble rest){ return (rest * (1. - vrad/C::c)); };
00150 static lDouble freq_from_vopt(const lDouble vopt, const lDouble rest){ return (rest / (1. + vopt/C::c)); };
00151 static lDouble freq_from_lambda(const lDouble lambda){ return (C::c/lambda); };
00152 };
00153
00154 }
00155
00156 #endif