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
00029 #ifndef SYNTHESIS_SIMULATOR_H
00030 #define SYNTHESIS_SIMULATOR_H
00031
00032 #include <casa/aips.h>
00033 #include <casa/Quanta/Quantum.h>
00034 #include <measures/Measures/MPosition.h>
00035 #include <synthesis/TransformMachines/BeamSquint.h>
00036 #include <synthesis/TransformMachines/VPSkyJones.h>
00037 #include <synthesis/MeasurementEquations/VisEquation.h>
00038
00039
00040 #include <casa/namespace.h>
00041 namespace casa {
00042 class MeasurementSet;
00043 class VisSet;
00044 class VisCal;
00045 class ACoh;
00046 class SkyEquation;
00047 class ComponentList;
00048 class CleanImageSkyModel;
00049 class FTMachine;
00050 class ComponentFTMachine;
00051 class MEpoch;
00052 class NewMSSimulator;
00053
00054
00055 template<class T> class PagedImage;
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
00090
00091
00092
00093
00094
00095 class Simulator
00096 {
00097
00098 public:
00099
00100 Simulator();
00101
00102 Simulator(String& msname);
00103
00104
00105 Simulator(MeasurementSet &thems);
00106
00107
00108 String name() const;
00109
00110 Simulator(const Simulator &other);
00111
00112 Simulator &operator=(const Simulator &other);
00113
00114 ~Simulator();
00115
00116 Bool close();
00117
00118
00119
00120 Bool setdata(const Vector<Int>& spectralwindowids,
00121 const Vector<Int>& fieldids,
00122 const String& msSelect);
00123
00124 Bool settimes(const Quantity& integrationTime,
00125 const Bool useHourAngle,
00126 const MEpoch& refTime);
00127
00128
00129
00130
00131 Bool setconfig(const String& telname,
00132 const Vector<Double>& x,
00133 const Vector<Double>& y,
00134 const Vector<Double>& z,
00135 const Vector<Double>& dishDiameter,
00136 const Vector<Double>& offset,
00137 const Vector<String>& mount,
00138 const Vector<String>& antName,
00139 const Vector<String>& padName,
00140 const String& coordsystem,
00141 const MPosition& referenceLocation);
00142
00143 Bool getconfig();
00144
00145
00146 Bool setfield(const String& sourceName,
00147 const MDirection& sourceDirection,
00148 const String& calCode,
00149 const Quantity& distance);
00150
00151
00152
00153 Bool setmosaicfield(const String& sourcename, const String& calcode,
00154 const MDirection& fieldcenter,
00155 const Int xmosp, const Int ymosp,
00156 const Quantity& mosspacing, const Quantity& distance);
00157
00158
00159
00160 Bool setspwindow(const String& spwName,
00161 const Quantity& freq,
00162 const Quantity& deltafreq,
00163 const Quantity& freqresolution,
00164 const MFrequency::Types& freqType,
00165 const Int nchannels,
00166 const String& stokes);
00167
00168
00169 Bool setfeed(const String& mode,
00170 const Vector<Double>& x,
00171 const Vector<Double>& y,
00172 const Vector<String>& pol);
00173
00174
00175 Bool setvp(const Bool dovp,
00176 const Bool defaultVP,
00177 const String& vpTable,
00178 const Bool doSquint,
00179 const Quantity &parAngleInc,
00180 const Quantity &skyPosThreshold,
00181 const Float &pbLimit);
00182
00183
00184 Bool setseed(const Int seed);
00185
00186
00187
00188 Bool setapply (const String& type,
00189 const Double& t,
00190 const String& table,
00191 const String& spw,
00192 const String& field,
00193 const String& interp,
00194 const Bool& calwt,
00195 const Vector<Int>& spwmap,
00196 const Float& opacity);
00197
00198
00199 Bool setgain(const String& mode,
00200 const String& table,
00201 const Quantity& interval,
00202 const Vector<Double>& amplitude);
00203
00204 Bool settrop(const String& mode,
00205 const String& table,
00206 const Float pwv,
00207 const Float deltapwv,
00208 const Float beta,
00209 const Float windspeed);
00210
00211
00212 Bool setpointingerror(const String& epJTableName,
00213 const Bool applyPointingOffsets,
00214 const Bool doPBCorrection);
00215
00216
00217 Bool setleakage(const String& mode, const String& table,
00218
00219 const Vector<Double>& amplitude,
00220 const Vector<Double>& offset);
00221
00222
00223 Bool setbandpass(const String& mode, const String& table,
00224 const Quantity& interval, const Vector<Double>& amplitude);
00225
00226
00227 Bool setpa(const String& mode, const String& table,
00228 const Quantity& interval);
00229
00230
00231
00232 Bool oldsetnoise(const String& mode,
00233 const String& table,
00234 const Quantity& simplenoise,
00235 const Float antefficiency,
00236 const Float correfficiency,
00237 const Float spillefficiency,
00238 const Float tau,
00239 const Float trx,
00240 const Float tatmos,
00241 const Float tcmb);
00242
00243 Bool setnoise(const String& mode,
00244 const String& caltable,
00245 const Quantity& simplenoise,
00246
00247
00248 const Quantity& pground,
00249 const Float relhum,
00250 const Quantity& altitude,
00251 const Quantity& waterheight,
00252 const Quantity& pwv,
00253
00254 const Float tatmos,
00255 const Float tau,
00256
00257 const Float antefficiency,
00258 const Float spillefficiency,
00259 const Float correfficiency,
00260 const Float trx,
00261 const Float tground,
00262 const Float tcmb,
00263 const Bool OTF,
00264 const Float senscoeff,
00265 const Int rxtype);
00266
00267
00268
00269 Bool corrupt();
00270
00271
00272 Bool setlimits(const Double shadowFraction,
00273 const Quantity& elevationLimit);
00274
00275
00276 Bool setauto(const Double autocorrwt);
00277
00278
00279
00280
00281 Bool observe(const String& sourcename, const String& spwname,
00282 const Quantity& startTime,
00283 const Quantity& stopTime,
00284 const Bool add_observationn=True,
00285 const Bool state_sig=True,
00286 const Bool state_ref=True,
00287 const double& state_cal=0.,
00288 const double& state_load=0.,
00289 const unsigned int state_sub_scan=1,
00290 const String& state_obs_mode="OBSERVE_TARGET#ON_SOURCE",
00291 const String& observername="CASA simulator",
00292 const String& projectname="CASA simulation");
00293
00294
00295 Bool observemany(const Vector<String>& sourcenames, const String& spwname,
00296 const Vector<Quantity>& startTimes,
00297 const Vector<Quantity>& stopTimes,
00298 const Vector<MDirection>& directions,
00299 const Bool add_observation,
00300 const Bool state_sig,
00301 const Bool state_ref,
00302 const double& state_cal,
00303 const double& state_load,
00304 const unsigned int state_sub_scan,
00305 const String& state_obs_mode,
00306 const String& observername,
00307 const String& projectname);
00308
00309
00310
00311
00312 Bool predict(const Vector<String>& modelImage,
00313 const String& compList,
00314 const Bool incremental);
00315
00316 String state();
00317
00318 Bool summary();
00319
00320 Bool resetviscal();
00321 Bool resetimcal();
00322 Bool reset();
00323
00324
00325 Bool setoptions(const String& ftmachine, const Int cache, const Int tile,
00326 const String& gridfunction, const MPosition& mLocation,
00327 const Float padding, const Int facets,
00328 const Double maxData,const Int wprojPlanes);
00329
00330
00331
00332 inline void setPrtlev(const Int& prtlev) { prtlev_=prtlev; };
00333
00334 inline Int& prtlev() { return prtlev_; };
00335
00336
00337 private:
00338
00339
00340
00341
00342 Bool create_corrupt(Record& simpar);
00343
00344
00345 Bool detached() const;
00346
00347
00348 void defaults();
00349
00350
00351 void makeVisSet();
00352
00353
00354
00355 String formatDirection(const MDirection& direction);
00356
00357
00358 String formatTime(const Double time);
00359
00360
00361
00362 Bool createSummary(LogIO& os);
00363 Bool configSummary(LogIO& os);
00364 Bool fieldSummary(LogIO& os);
00365 Bool spWindowSummary(LogIO& os);
00366 Bool feedSummary(LogIO& os);
00367 Bool timeSummary(LogIO& os);
00368
00369 Bool predictSummary(LogIO& os);
00370 Bool vpSummary(LogIO& os);
00371 Bool optionsSummary(LogIO& os);
00372
00373 Bool corruptSummary(LogIO& os);
00374 Bool noiseSummary(LogIO& os);
00375
00376
00377
00378
00379
00380 Bool createSkyEquation( const Vector<String>& image, const String complist);
00381 void destroySkyEquation();
00382
00383
00384 String msname_p;
00385 MeasurementSet* ms_p;
00386 MeasurementSet* mssel_p;
00387 VisSet* vs_p;
00388
00389 Int seed_p;
00390
00391 ACoh *ac_p;
00392
00393 SkyEquation* se_p;
00394 CleanImageSkyModel* sm_p;
00395 FTMachine *ft_p;
00396 ComponentFTMachine *cft_p;
00397
00398 Int nmodels_p;
00399 PtrBlock<PagedImage<Float>* > images_p;
00400 ComponentList *componentList_p;
00401
00402 String ftmachine_p, gridfunction_p;
00403 Int cache_p, tile_p;
00404 MPosition mLocation_p;
00405 Float padding_p;
00406 Bool MSMayBeOK;
00407 Int facets_p;
00408 Int wprojPlanes_p;
00409 Long maxData_p;
00410
00411
00412
00413
00414 Bool areStationCoordsSet_p;
00415 String telescope_p;
00416 Vector<Double> x_p;
00417 Vector<Double> y_p;
00418 Vector<Double> z_p;
00419 Vector<Double> diam_p;
00420 Vector<Double> offset_p;
00421 Vector<String> mount_p;
00422 Vector<String> antName_p;
00423 Vector<String> padName_p;
00424 String coordsystem_p;
00425 MPosition mRefLocation_p;
00426
00427
00428
00429
00430
00431 Int nField;
00432 Vector<String> sourceName_p;
00433 Vector<String> calCode_p;
00434 Vector<MDirection> sourceDirection_p;
00435 Vector<Quantity> distance_p;
00436
00437
00438
00439 VisEquation ve_p;
00440
00441 PtrBlock<VisCal*> vc_p;
00442
00443
00444
00445
00446
00447
00448
00449
00450
00451
00452 Int nSpw;
00453 Vector<String> spWindowName_p;
00454 Vector<Int> nChan_p;
00455 Vector<Quantity> startFreq_p;
00456 Vector<Quantity> freqInc_p;
00457 Vector<Quantity> freqRes_p;
00458 Vector<String> stokesString_p;
00459
00460
00461
00462
00463
00464
00465 String feedMode_p;
00466 Int nFeeds_p;
00467 Bool feedsHaveBeenSet;
00468 Bool feedsInitialized;
00469
00470
00471
00472 Quantity integrationTime_p;
00473 Bool useHourAngle_p;
00474 MEpoch refTime_p;
00475 Bool timesHaveBeenSet_p;
00476
00477
00478
00479
00480 Bool doVP_p;
00481 Bool doDefaultVP_p;
00482 String vpTableStr_p;
00483 Quantity parAngleInc_p;
00484 Quantity skyPosThreshold_p;
00485 Float pbLimit_p;
00486 BeamSquint::SquintType squintType_p;
00487 VPSkyJones* vp_p;
00488 VPSkyJones* gvp_p;
00489
00490
00491
00492
00493 String noisemode_p;
00494
00495
00496
00497 NewMSSimulator* sim_p;
00498
00499
00500
00501
00502
00503
00504
00505
00506 String epJTableName_p;
00507 Bool applyPointingOffsets_p;
00508 Bool doPBCorrection_p;
00509
00510
00511 Int prtlev_;
00512
00513 };
00514
00515 }
00516
00517 #endif