Line data Source code
1 : //# MakeMS: Tests
2 : //# Copyright (C) 2016
3 : //# Associated Universities, Inc. Washington DC, USA.
4 : //#
5 : //# This program is free software; you can redistribute it and/or modify it
6 : //# under the terms of the GNU General Public License as published by the Free
7 : //# Software Foundation; either version 2 of the License, or (at your option)
8 : //# any later version.
9 : //#
10 : //# This program is distributed in the hope that it will be useful, but WITHOUT
11 : //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 : //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 : //# more details.
14 : //#
15 : //# You should have received a copy of the GNU General Public License along
16 : //# with this program; if not, write to the Free Software Foundation, Inc.,
17 : //# 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 : //#
19 : //# Correspondence concerning AIPS++ should be addressed as follows:
20 : //# Internet email: aips2-request@nrao.edu.
21 : //# Postal address: AIPS++ Project Office
22 : //# National Radio Astronomy Observatory
23 : //# 520 Edgemont Road
24 : //# Charlottesville, VA 22903-2475 USA
25 : //#
26 : //# $Id$
27 :
28 : #include <casacore/casa/aips.h>
29 : #include <casacore/casa/BasicSL/String.h>
30 : #include <synthesis/MeasurementEquations/Simulator.h>
31 : #include <casacore/measures/Measures/MDirection.h>
32 : #include <casacore/measures/Measures/MeasTable.h>
33 :
34 : namespace casa {
35 :
36 : namespace test {
37 :
38 : class MakeMS {
39 :
40 : public:
41 :
42 1 : static inline void makems( casacore::String msname, casacore::MDirection thedir, casacore::Double freq=1.5e9,
43 : casacore::Double chanwidth=1e6, casacore::Int nchan=100, casacore::Int nInteg=200 ) {
44 :
45 : std::vector<Double> stnx={ 41.1100006, 134.110001, 268.309998, 439.410004,
46 : 644.210022, 880.309998, 1147.10999, 1442.41003, 1765.41003,
47 : -36.7900009, -121.690002, -244.789993, -401.190002, -588.48999,
48 : -804.690002, -1048.48999, -1318.48999, -1613.98999,
49 : -4.38999987,-11.29, -22.7900009, -37.6899986, -55.3899994,
50 1 : -75.8899994, -99.0899963, -124.690002, -152.690002 };
51 : std::vector<Double> stny={ 3.51999998, -39.8300018, -102.480003, -182.149994, -277.589996,
52 : -387.839996, -512.119995, -649.76001, -800.450012,
53 : -2.58999991, -59.9099998, -142.889999, -248.410004, -374.690002,
54 : -520.599976, -685, -867.099976, -1066.42004,
55 : 77.1500015, 156.910004, 287.980011, 457.429993, 660.409973,
56 1 : 894.700012, 1158.82996, 1451.43005, 1771.48999 };
57 : std::vector<Double> stnz={ 0.25, -0.439999998, -1.46000004, -3.77999997, -5.9000001,
58 : -7.28999996, -8.48999977, -10.5, -9.56000042,
59 : 0.25, -0.699999988, -1.79999995, -3.28999996, -4.78999996,
60 : -6.48999977, -9.17000008, -12.5299997, -15.3699999,
61 : 1.25999999, 2.42000008, 4.23000002, 6.65999985, 9.5,
62 1 : 12.7700005, 16.6800003, 21.2299995, 26.3299999 };
63 1 : Vector<Double> xpos(stnx);
64 1 : Vector<Double> ypos(stny);
65 1 : Vector<Double> zpos(stnz);
66 1 : xpos *=5.0; ypos *=5.0;
67 1 : xpos-=mean(xpos); ypos-=mean(ypos); zpos-=mean(zpos);
68 1 : Vector<Double> diam(27, 25.0);
69 1 : Vector<String> antnames(27, "EVLA");
70 1 : Vector<String> padnames(27, "KotZot");
71 28 : for ( Int k=0; k <27; ++k ) {
72 27 : antnames[k] =antnames[k]+ String::toString(k);
73 27 : padnames[k]=padnames[k]+String::toString(k);
74 : }
75 1 : MPosition obsPos;
76 1 : casacore::MeasTable::Observatory(obsPos, "EVLA");
77 1 : Simulator sm(msname);
78 2 : sm.setconfig( "EVLA", xpos, ypos, zpos, diam, Vector<Double>(27,0.0),
79 2 : Vector<String>(27, "ALT-AZ"), antnames, padnames, "local", obsPos );
80 :
81 2 : sm.setspwindow( "Bandobast", Quantity(freq, "Hz"), Quantity(chanwidth, "Hz"),
82 2 : Quantity(chanwidth, "Hz"), MFrequency::LSRK, nchan, "RR RL LR LL" );
83 2 : MEpoch refdate( Quantity(57388.0, "d"), MEpoch::UTC );
84 1 : MeasFrame mframe(thedir, refdate, obsPos);
85 2 : MDirection thedir_hadec=MDirection::Convert(thedir, MDirection::Ref(MDirection::HADEC, mframe))();
86 2 : MEpoch lst=MEpoch::Convert(refdate, MEpoch::Ref(MEpoch::LAST, mframe))();
87 2 : MEpoch refepo(lst.get("d")-thedir_hadec.getValue().getLong("d"), MEpoch::UTC);
88 1 : sm.setfeed("perfect R L", Vector<Double>(), Vector<Double>(), Vector<String>(1, ""));
89 1 : sm.setlimits(0.01, Quantity(10.0, "deg"));
90 1 : sm.setauto(0.0);
91 1 : sm.setfield("2C666", thedir, "T", Quantity(0.0, "m"));
92 1 : sm.settimes(Quantity(1.0,"s"), true, refepo);
93 1 : sm.observe("2C666", "Bandobast", Quantity(-Double(nInteg)/2.0, "s"), Quantity(Double(nInteg)/2.0,"s"));
94 1 : }
95 :
96 :
97 : };
98 :
99 : } // namespace test
100 : } // namespace casa
|