00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef MS_NEWMSSIMULATOR_H
00029 #define MS_NEWMSSIMULATOR_H
00030
00031
00032
00033 #include <casacore/casa/aips.h>
00034 #include <casacore/casa/BasicSL/String.h>
00035 #include <casacore/casa/Arrays/Vector.h>
00036 #include <casacore/casa/Arrays/Matrix.h>
00037 #include <casacore/casa/Arrays/Cube.h>
00038 #include <casacore/casa/BasicSL/Complex.h>
00039 #include <casacore/casa/Quanta/Quantum.h>
00040 #include <casacore/measures/Measures/MPosition.h>
00041 #include <casacore/measures/Measures/MEpoch.h>
00042 #include <casacore/measures/Measures/MFrequency.h>
00043 #include <casacore/measures/Measures/MDirection.h>
00044
00045 #include <casacore/tables/DataMan/TiledDataStManAccessor.h>
00046
00047 namespace casacore {
00048
00049
00050 class MeasurementSet;
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089 class NewMSSimulator
00090 {
00091 public:
00092
00093
00094 NewMSSimulator(const String&);
00095
00096
00097 NewMSSimulator(MeasurementSet&);
00098
00099
00100 NewMSSimulator(const NewMSSimulator & mss);
00101
00102
00103 ~NewMSSimulator();
00104
00105
00106
00107 NewMSSimulator & operator=(const NewMSSimulator &);
00108
00109
00110
00111 void setMaxData(const Double maxData=2e9) {maxData_p=maxData;}
00112
00113
00114
00115 void initAnt(const String& telname,
00116 const Vector<Double>& x,
00117 const Vector<Double>& y,
00118 const Vector<Double>& z,
00119 const Vector<Double>& dishDiameter,
00120 const Vector<Double>& offset,
00121 const Vector<String>& mount,
00122 const Vector<String>& name,
00123 const Vector<String>& padname,
00124 const String& coordsystem,
00125 const MPosition& mRefLocation);
00126
00127 bool getAnt(String& telescope, Int& nAnt, Matrix<Double>* antXYZ,
00128 Vector<Double>& antDiam, Vector<Double>& offset,
00129 Vector<String>& mount, Vector<String>& name, Vector<String>& padname,
00130 String& coordsystem, MPosition& mRefLocation );
00131
00132
00133 void initFields(const String& sourceName,
00134 const MDirection& sourceDirection,
00135 const String& calCode);
00136
00137 bool getFields(Int& nField,
00138 Vector<String>& sourceName,
00139 Vector<MDirection>& sourceDirection,
00140 Vector<String>& calCode);
00141
00142
00143 void initFeeds(const String& mode);
00144
00145 bool getFeedMode(String& mode);
00146
00147
00148 void initFeeds(const String& mode,
00149 const Vector<Double>& x,
00150 const Vector<Double>& y,
00151 const Vector<String>& pol);
00152
00153
00154 void initSpWindows(const String& spWindowName,
00155 const Int& nChan,
00156 const Quantity& startFreq,
00157 const Quantity& freqInc,
00158 const Quantity& freqRes,
00159 const MFrequency::Types& freqType,
00160 const String& stokesString);
00161
00162 bool getSpWindows(Int& nSpw,
00163 Vector<String>& spWindowName,
00164 Vector<Int>& nChan,
00165 Vector<Quantity>& startFreq,
00166 Vector<Quantity>& freqInc,
00167 Vector<String>& stokesString);
00168
00169 void setFractionBlockageLimit(const Double fraclimit)
00170 { fractionBlockageLimit_p = fraclimit; }
00171
00172 void setElevationLimit(const Quantity& ellimit)
00173 { elevationLimit_p = ellimit; }
00174
00175 void setAutoCorrelationWt(const Float autocorrwt)
00176 { autoCorrelationWt_p = autocorrwt; }
00177
00178 void settimes(const Quantity& qIntegrationTime,
00179 const Bool useHourAngles,
00180 const MEpoch& mRefTime);
00181
00182 void observe(const String& sourceName,
00183 const String& spWindowName,
00184 const Quantity& qStartTime,
00185 const Quantity& qStopTime,
00186 const Bool add_observation=True,
00187
00188
00189 const Bool state_sig=True,
00190 const Bool state_ref=True,
00191 const double& state_cal=0.,
00192 const double& state_load=0.,
00193 const unsigned int state_sub_scan=1,
00194 const String& state_obs_mode="OBSERVE_TARGET.ON_SOURCE",
00195 const String& observername="CASA simulator",
00196 const String& projectname="CASA simulation");
00197
00198
00199 void observe(const Vector<String>& sourceNames,
00200 const String& spWindowName,
00201 const Vector<Quantity>& qStartTimes,
00202 const Vector<Quantity>& qStopTimes,
00203 const Vector<MDirection>& directions,
00204 const Bool add_observation=True,
00205
00206
00207 const Bool state_sig=True,
00208 const Bool state_ref=True,
00209 const double& state_cal=0.,
00210 const double& state_load=0.,
00211 const unsigned int state_sub_scan=1,
00212 const String& state_obs_mode="OBSERVE_TARGET.ON_SOURCE",
00213 const String& observername="CASA simulator",
00214 const String& projectname="CASA simulation");
00215
00216 MeasurementSet * getMs () const;
00217
00218
00219 private:
00220
00221
00222 NewMSSimulator() {}
00223
00224
00225 Double fractionBlockageLimit_p;
00226 Quantity elevationLimit_p;
00227 Float autoCorrelationWt_p;
00228 String telescope_p;
00229 Quantity qIntegrationTime_p;
00230 Bool useHourAngle_p;
00231 Bool hourAngleDefined_p;
00232 MEpoch mRefTime_p;
00233 Double t_offset_p;
00234 Double dataWritten_p;
00235 Int hyperCubeID_p;
00236 Bool hasHyperCubes_p;
00237 Int lastSpWID_p;
00238 Int lastNchan_p;
00239
00240 MeasurementSet* ms_p;
00241
00242 TiledDataStManAccessor dataAcc_p, scratchDataAcc_p, sigmaAcc_p, flagAcc_p;
00243
00244 Double maxData_p;
00245
00246 void local2global(Vector<Double>& xReturned,
00247 Vector<Double>& yReturned,
00248 Vector<Double>& zReturned,
00249 const MPosition& mRefLocation,
00250 const Vector<Double>& xIn,
00251 const Vector<Double>& yIn,
00252 const Vector<Double>& zIn);
00253
00254 void longlat2global(Vector<Double>& xReturned,
00255 Vector<Double>& yReturned,
00256 Vector<Double>& zReturned,
00257 const MPosition& mRefLocation,
00258 const Vector<Double>& xIn,
00259 const Vector<Double>& yIn,
00260 const Vector<Double>& zIn);
00261
00262
00263
00264
00265
00266
00267
00268 void blockage(Double &fraction1, Double &fraction2,
00269 const Vector<Double>& uvw,
00270 const Double diam1, const Double diam2);
00271
00272 String formatDirection(const MDirection&);
00273 String formatTime(const Double);
00274
00275 void addHyperCubes(const Int id, const Int nBase, const Int nChan, const Int nCorr);
00276
00277 void defaults();
00278
00279 Bool calcAntUVW(MEpoch& epoch, MDirection& refdir,
00280 Matrix<Double>& uvwAnt);
00281
00282
00283 };
00284
00285
00286 }
00287
00288 #endif
00289
00290
00291
00292