casacore
Loading...
Searching...
No Matches
NewMSSimulator.h
Go to the documentation of this file.
1//# NewMSSimulator.h: this defines the MeasurementSet Simulator
2//# Copyright (C) 1995-2009
3//# Associated Universities, Inc. Washington DC, USA.
4//#
5//# This library is free software; you can redistribute it and/or modify it
6//# under the terms of the GNU Library General Public License as published by
7//# the Free Software Foundation; either version 2 of the License, or (at your
8//# option) any later version.
9//#
10//# This library 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 Library General Public
13//# License for more details.
14//#
15//# You should have received a copy of the GNU Library General Public License
16//# along with this library; if not, write to the Free Software Foundation,
17//# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18//#
19//# Correspondence concerning AIPS++ should be addressed as follows:
20//# Internet email: casa-feedback@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#ifndef MS_NEWMSSIMULATOR_H
27#define MS_NEWMSSIMULATOR_H
28
29
30//# Includes
31#include <memory>
32#include <casacore/casa/aips.h>
33#include <casacore/casa/BasicSL/String.h>
34#include <casacore/casa/Arrays/Vector.h>
35#include <casacore/casa/Arrays/Matrix.h>
36#include <casacore/casa/Arrays/Cube.h>
37#include <casacore/casa/BasicSL/Complex.h>
38#include <casacore/casa/Quanta/Quantum.h>
39#include <casacore/measures/Measures/MPosition.h>
40#include <casacore/measures/Measures/MEpoch.h>
41#include <casacore/measures/Measures/MFrequency.h>
42#include <casacore/measures/Measures/MDirection.h>
43
44#include <casacore/tables/DataMan/TiledDataStManAccessor.h>
45
46namespace casacore { //# NAMESPACE CASACORE - BEGIN
47
48//# Forward Declarations
49class MeasurementSet;
50
51// <category lib=aips module="ModuleName">
52// <summary> Create an empty MeasurementSet from observation and telescope descriptions. </summary>
53// <reviewed reviewer="" date="" tests="">
54//
55// <prerequisite>
56//# Classes you should understand before using this one.
57// <li> MeasurementSet
58// </prerequisite>
59//
60// <etymology>
61// MS is from MeasurementSet, Simulator refers to the generation of
62// 'fake' data from a set of parameters for instrument and sources.
63// </etymology>
64//
65// <synopsis>
66// This class creates a MeasurementSet from a set of parameters for instrument
67// and sources. It does not simulate the data, only the coordinates of a
68// measurement. The application "simulator" uses this class to create a true
69// simulated MS with perfect or corrupted data.
70// </synopsis>
71//
72// <motivation>
73// To test calibration and imaging programs it is necessary to have flawless
74// data and data with errors that are known exactly. This class generates
75// empty MeasurementSets (only coordinates filled in) that can be filled
76// with predicted data.
77// </motivation>
78//
79// <todo asof="$DATE:$">
80//# A List of bugs, limitations, extensions or planned refinements.
81// <li> The amount of information to be specified by the user
82// could be much larger. For the moment it has been restricted to
83// what is needed for testing the synthesis imaging code. Already
84// it is possible to create MeasurementSets that cannot be processed
85// yet.
86// </todo>
87
89{
90public:
91
92 // Constructor from name only
94
95 // Constructor from existing MS
97
98 // Copy constructor - for completeness only
100
101 //# Destructor
103
104//# Operators
105 // Assignment
107
108 // Set maximum amount of data (bytes) to be written into any one
109 // scratch column hypercube
110 void setMaxData(const Double maxData=2e9) {maxData_p=maxData;}
111
112 // set the antenna and array data. These are written immediately to the
113 // existing MS. The same model is used for the other init infor.
114 void initAnt(const String& telname,
115 const Vector<Double>& x,
116 const Vector<Double>& y,
117 const Vector<Double>& z,
118 const Vector<Double>& dishDiameter,
119 const Vector<Double>& offset,
120 const Vector<String>& mount,
121 const Vector<String>& name,
122 const Vector<String>& padname,
123 const String& coordsystem,
124 const MPosition& mRefLocation);
125 // get the info back
126 bool getAnt(String& telescope, Int& nAnt, Matrix<Double>* antXYZ,
127 Vector<Double>& antDiam, Vector<Double>& offset,
128 Vector<String>& mount, Vector<String>& name, Vector<String>& padname,
129 String& coordsystem, MPosition& mRefLocation );
130
131 // set the observed fields
132 void initFields(const String& sourceName,
133 const MDirection& sourceDirection,
134 const String& calCode);
135
136 bool getFields(Int& nField,
137 Vector<String>& sourceName,
138 Vector<MDirection>& sourceDirection,
139 Vector<String>& calCode);
140
141 // set the Feeds; brain dead version
142 void initFeeds(const String& mode);
143
144 bool getFeedMode(String& mode);
145
146 // set the Feeds; Smart version
147 void initFeeds(const String& mode,
148 const Vector<Double>& x,
149 const Vector<Double>& y,
150 const Vector<String>& pol);
151
152 // set the spectral windows information
153 void initSpWindows(const String& spWindowName,
154 const Int& nChan,
155 const Quantity& startFreq,
156 const Quantity& freqInc,
157 const Quantity& freqRes,
158 const MFrequency::Types& freqType,
159 const String& stokesString);
160
161 bool getSpWindows(Int& nSpw,
162 Vector<String>& spWindowName,
163 Vector<Int>& nChan,
164 Vector<Quantity>& startFreq,
165 Vector<Quantity>& freqInc,
166 Vector<String>& stokesString);
167
168 void setFractionBlockageLimit(const Double fraclimit)
169 { fractionBlockageLimit_p = fraclimit; }
170
171 void setElevationLimit(const Quantity& ellimit)
172 { elevationLimit_p = ellimit; }
173
174 void setAutoCorrelationWt(const Float autocorrwt)
175 { autoCorrelationWt_p = autocorrwt; }
176
177 void settimes(const Quantity& qIntegrationTime,
178 const Bool useHourAngles,
179 const MEpoch& mRefTime);
180
181 void observe(const String& sourceName,
182 const String& spWindowName,
183 const Quantity& qStartTime,
184 const Quantity& qStopTime,
185 const Bool add_observation=True,
186//# from int ASDM2MSFiller::addUniqueState(
187//# defaults for ALMA as known on 20100831
188 const Bool state_sig=True,
189 const Bool state_ref=True,
190 const double& state_cal=0.,
191 const double& state_load=0.,
192 const unsigned int state_sub_scan=1,
193 const String& state_obs_mode="OBSERVE_TARGET.ON_SOURCE",
194 const String& observername="CASA simulator",
195 const String& projectname="CASA simulation");
196
197
198 void observe(const Vector<String>& sourceNames,
199 const String& spWindowName,
200 const Vector<Quantity>& qStartTimes,
201 const Vector<Quantity>& qStopTimes,
202 const Vector<MDirection>& directions,
203 const Bool add_observation=True,
204//# from int ASDM2MSFiller::addUniqueState(
205//# defaults for ALMA as known on 20100831
206 const Bool state_sig=True,
207 const Bool state_ref=True,
208 const double& state_cal=0.,
209 const double& state_load=0.,
210 const unsigned int state_sub_scan=1,
211 const String& state_obs_mode="OBSERVE_TARGET.ON_SOURCE",
212 const String& observername="CASA simulator",
213 const String& projectname="CASA simulation");
214
215 std::shared_ptr<MeasurementSet> getMs () const;
216
217
218private:
219
220 // Prevent use of default constructor
222
223//# Data Members
238
239 std::shared_ptr<MeasurementSet> ms_p;
240
242
244
246 Vector<Double>& yReturned,
247 Vector<Double>& zReturned,
248 const MPosition& mRefLocation,
249 const Vector<Double>& xIn,
250 const Vector<Double>& yIn,
251 const Vector<Double>& zIn);
252
254 Vector<Double>& yReturned,
255 Vector<Double>& zReturned,
256 const MPosition& mRefLocation,
257 const Vector<Double>& xIn,
258 const Vector<Double>& yIn,
259 const Vector<Double>& zIn);
260
261 // Returns the fractional blockage of one antenna by another
262 // We will want to put this somewhere else eventually, but I don't yet know where!
263 // Till then.
264 // fraction1: fraction of antenna 1 that is blocked by 2
265 // fraction2: fraction of antenna 2 that is blocked by 1
266 // hint: at least one of the two will be 0.0
267 void blockage(Double &fraction1, Double &fraction2,
268 const Vector<Double>& uvw, // uvw in same units as diam!
269 const Double diam1, const Double diam2);
270
273
274 void addHyperCubes(const Int id, const Int nBase, const Int nChan, const Int nCorr);
275
276 void defaults();
277
279 Matrix<Double>& uvwAnt);
280
281
282};
283
284
285} //# NAMESPACE CASACORE - END
286
287#endif
288
289
290
291
Types
Types of known MFrequencies Warning: The order defines the order in the translation matrix FromTo in...
Definition MFrequency.h:173
void longlat2global(Vector< Double > &xReturned, Vector< Double > &yReturned, Vector< Double > &zReturned, const MPosition &mRefLocation, const Vector< Double > &xIn, const Vector< Double > &yIn, const Vector< Double > &zIn)
void blockage(Double &fraction1, Double &fraction2, const Vector< Double > &uvw, const Double diam1, const Double diam2)
Returns the fractional blockage of one antenna by another We will want to put this somewhere else eve...
void observe(const String &sourceName, const String &spWindowName, const Quantity &qStartTime, const Quantity &qStopTime, const Bool add_observation=True, const Bool state_sig=True, const Bool state_ref=True, const double &state_cal=0., const double &state_load=0., const unsigned int state_sub_scan=1, const String &state_obs_mode="OBSERVE_TARGET.ON_SOURCE", const String &observername="CASA simulator", const String &projectname="CASA simulation")
void initFields(const String &sourceName, const MDirection &sourceDirection, const String &calCode)
set the observed fields
TiledDataStManAccessor flagAcc_p
void initFeeds(const String &mode)
set the Feeds; brain dead version
void setFractionBlockageLimit(const Double fraclimit)
TiledDataStManAccessor sigmaAcc_p
void local2global(Vector< Double > &xReturned, Vector< Double > &yReturned, Vector< Double > &zReturned, const MPosition &mRefLocation, const Vector< Double > &xIn, const Vector< Double > &yIn, const Vector< Double > &zIn)
void setElevationLimit(const Quantity &ellimit)
NewMSSimulator(MeasurementSet &)
Constructor from existing MS.
NewMSSimulator & operator=(const NewMSSimulator &)
Assignment.
NewMSSimulator(const String &)
Constructor from name only.
Bool calcAntUVW(MEpoch &epoch, MDirection &refdir, Matrix< Double > &uvwAnt)
NewMSSimulator(const NewMSSimulator &mss)
Copy constructor - for completeness only.
TiledDataStManAccessor scratchDataAcc_p
bool getSpWindows(Int &nSpw, Vector< String > &spWindowName, Vector< Int > &nChan, Vector< Quantity > &startFreq, Vector< Quantity > &freqInc, Vector< String > &stokesString)
void setAutoCorrelationWt(const Float autocorrwt)
std::shared_ptr< MeasurementSet > ms_p
bool getFeedMode(String &mode)
bool getFields(Int &nField, Vector< String > &sourceName, Vector< MDirection > &sourceDirection, Vector< String > &calCode)
std::shared_ptr< MeasurementSet > getMs() const
void observe(const Vector< String > &sourceNames, const String &spWindowName, const Vector< Quantity > &qStartTimes, const Vector< Quantity > &qStopTimes, const Vector< MDirection > &directions, const Bool add_observation=True, const Bool state_sig=True, const Bool state_ref=True, const double &state_cal=0., const double &state_load=0., const unsigned int state_sub_scan=1, const String &state_obs_mode="OBSERVE_TARGET.ON_SOURCE", const String &observername="CASA simulator", const String &projectname="CASA simulation")
String formatTime(const Double)
void initAnt(const String &telname, const Vector< Double > &x, const Vector< Double > &y, const Vector< Double > &z, const Vector< Double > &dishDiameter, const Vector< Double > &offset, const Vector< String > &mount, const Vector< String > &name, const Vector< String > &padname, const String &coordsystem, const MPosition &mRefLocation)
set the antenna and array data.
TiledDataStManAccessor dataAcc_p
void initFeeds(const String &mode, const Vector< Double > &x, const Vector< Double > &y, const Vector< String > &pol)
set the Feeds; Smart version
String formatDirection(const MDirection &)
void initSpWindows(const String &spWindowName, const Int &nChan, const Quantity &startFreq, const Quantity &freqInc, const Quantity &freqRes, const MFrequency::Types &freqType, const String &stokesString)
set the spectral windows information
void addHyperCubes(const Int id, const Int nBase, const Int nChan, const Int nCorr)
bool getAnt(String &telescope, Int &nAnt, Matrix< Double > *antXYZ, Vector< Double > &antDiam, Vector< Double > &offset, Vector< String > &mount, Vector< String > &name, Vector< String > &padname, String &coordsystem, MPosition &mRefLocation)
get the info back
void settimes(const Quantity &qIntegrationTime, const Bool useHourAngles, const MEpoch &mRefTime)
NewMSSimulator()
Prevent use of default constructor.
void setMaxData(const Double maxData=2e9)
Set maximum amount of data (bytes) to be written into any one scratch column hypercube.
String: the storage and methods of handling collections of characters.
Definition String.h:223
this file contains all the compiler specific defines
Definition mainpage.dox:28
float Float
Definition aipstype.h:52
int Int
Definition aipstype.h:48
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
const Bool True
Definition aipstype.h:41
double Double
Definition aipstype.h:53