casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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: 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 #ifndef MS_NEWMSSIMULATOR_H
29 #define MS_NEWMSSIMULATOR_H
30 
31 
32 //# Includes
33 #include <memory>
34 #include <casacore/casa/aips.h>
45 
47 
48 namespace casacore { //# NAMESPACE CASACORE - BEGIN
49 
50 //# Forward Declarations
51 class MeasurementSet;
52 
53 // <category lib=aips module="ModuleName">
54 // <summary> Create an empty MeasurementSet from observation and telescope descriptions. </summary>
55 // <reviewed reviewer="" date="" tests="">
56 //
57 // <prerequisite>
58 //# Classes you should understand before using this one.
59 // <li> MeasurementSet
60 // </prerequisite>
61 //
62 // <etymology>
63 // MS is from MeasurementSet, Simulator refers to the generation of
64 // 'fake' data from a set of parameters for instrument and sources.
65 // </etymology>
66 //
67 // <synopsis>
68 // This class creates a MeasurementSet from a set of parameters for instrument
69 // and sources. It does not simulate the data, only the coordinates of a
70 // measurement. The application "simulator" uses this class to create a true
71 // simulated MS with perfect or corrupted data.
72 // </synopsis>
73 //
74 // <motivation>
75 // To test calibration and imaging programs it is necessary to have flawless
76 // data and data with errors that are known exactly. This class generates
77 // empty MeasurementSets (only coordinates filled in) that can be filled
78 // with predicted data.
79 // </motivation>
80 //
81 // <todo asof="$DATE:$">
82 //# A List of bugs, limitations, extensions or planned refinements.
83 // <li> The amount of information to be specified by the user
84 // could be much larger. For the moment it has been restricted to
85 // what is needed for testing the synthesis imaging code. Already
86 // it is possible to create MeasurementSets that cannot be processed
87 // yet.
88 // </todo>
89 
91 {
92 public:
93 
94  // Constructor from name only
95  NewMSSimulator(const String&);
96 
97  // Constructor from existing MS
99 
100  // Copy constructor - for completeness only
101  NewMSSimulator(const NewMSSimulator & mss);
102 
103  //# Destructor
104  ~NewMSSimulator();
105 
106 //# Operators
107  // Assignment
109 
110  // Set maximum amount of data (bytes) to be written into any one
111  // scratch column hypercube
112  void setMaxData(const Double maxData=2e9) {maxData_p=maxData;}
113 
114  // set the antenna and array data. These are written immediately to the
115  // existing MS. The same model is used for the other init infor.
116  void initAnt(const String& telname,
117  const Vector<Double>& x,
118  const Vector<Double>& y,
119  const Vector<Double>& z,
120  const Vector<Double>& dishDiameter,
121  const Vector<Double>& offset,
122  const Vector<String>& mount,
123  const Vector<String>& name,
124  const Vector<String>& padname,
125  const String& coordsystem,
126  const MPosition& mRefLocation);
127  // get the info back
128  bool getAnt(String& telescope, Int& nAnt, Matrix<Double>* antXYZ,
129  Vector<Double>& antDiam, Vector<Double>& offset,
131  String& coordsystem, MPosition& mRefLocation );
132 
133  // set the observed fields
134  void initFields(const String& sourceName,
135  const MDirection& sourceDirection,
136  const String& calCode);
137 
138  bool getFields(Int& nField,
139  Vector<String>& sourceName,
140  Vector<MDirection>& sourceDirection,
141  Vector<String>& calCode);
142 
143  // set the Feeds; brain dead version
144  void initFeeds(const String& mode);
145 
146  bool getFeedMode(String& mode);
147 
148  // set the Feeds; Smart version
149  void initFeeds(const String& mode,
150  const Vector<Double>& x,
151  const Vector<Double>& y,
152  const Vector<String>& pol);
153 
154  // set the spectral windows information
155  void initSpWindows(const String& spWindowName,
156  const Int& nChan,
157  const Quantity& startFreq,
158  const Quantity& freqInc,
159  const Quantity& freqRes,
160  const MFrequency::Types& freqType,
161  const String& stokesString);
162 
163  bool getSpWindows(Int& nSpw,
164  Vector<String>& spWindowName,
165  Vector<Int>& nChan,
166  Vector<Quantity>& startFreq,
167  Vector<Quantity>& freqInc,
168  Vector<String>& stokesString);
169 
170  void setFractionBlockageLimit(const Double fraclimit)
171  { fractionBlockageLimit_p = fraclimit; }
172 
173  void setElevationLimit(const Quantity& ellimit)
174  { elevationLimit_p = ellimit; }
175 
176  void setAutoCorrelationWt(const Float autocorrwt)
177  { autoCorrelationWt_p = autocorrwt; }
178 
179  void settimes(const Quantity& qIntegrationTime,
180  const Bool useHourAngles,
181  const MEpoch& mRefTime);
182 
183  void observe(const String& sourceName,
184  const String& spWindowName,
185  const Quantity& qStartTime,
186  const Quantity& qStopTime,
187  const Bool add_observation=True,
188 //# from int ASDM2MSFiller::addUniqueState(
189 //# defaults for ALMA as known on 20100831
190  const Bool state_sig=True,
191  const Bool state_ref=True,
192  const double& state_cal=0.,
193  const double& state_load=0.,
194  const unsigned int state_sub_scan=1,
195  const String& state_obs_mode="OBSERVE_TARGET.ON_SOURCE",
196  const String& observername="CASA simulator",
197  const String& projectname="CASA simulation");
198 
199 
200  void observe(const Vector<String>& sourceNames,
201  const String& spWindowName,
202  const Vector<Quantity>& qStartTimes,
203  const Vector<Quantity>& qStopTimes,
204  const Vector<MDirection>& directions,
205  const Bool add_observation=True,
206 //# from int ASDM2MSFiller::addUniqueState(
207 //# defaults for ALMA as known on 20100831
208  const Bool state_sig=True,
209  const Bool state_ref=True,
210  const double& state_cal=0.,
211  const double& state_load=0.,
212  const unsigned int state_sub_scan=1,
213  const String& state_obs_mode="OBSERVE_TARGET.ON_SOURCE",
214  const String& observername="CASA simulator",
215  const String& projectname="CASA simulation");
216 
218 
219 
220 private:
221 
222  // Prevent use of default constructor
224 
225 //# Data Members
240 
242 
244 
246 
247  void local2global(Vector<Double>& xReturned,
248  Vector<Double>& yReturned,
249  Vector<Double>& zReturned,
250  const MPosition& mRefLocation,
251  const Vector<Double>& xIn,
252  const Vector<Double>& yIn,
253  const Vector<Double>& zIn);
254 
255  void longlat2global(Vector<Double>& xReturned,
256  Vector<Double>& yReturned,
257  Vector<Double>& zReturned,
258  const MPosition& mRefLocation,
259  const Vector<Double>& xIn,
260  const Vector<Double>& yIn,
261  const Vector<Double>& zIn);
262 
263  // Returns the fractional blockage of one antenna by another
264  // We will want to put this somewhere else eventually, but I don't yet know where!
265  // Till then.
266  // fraction1: fraction of antenna 1 that is blocked by 2
267  // fraction2: fraction of antenna 2 that is blocked by 1
268  // hint: at least one of the two will be 0.0
269  void blockage(Double &fraction1, Double &fraction2,
270  const Vector<Double>& uvw, // uvw in same units as diam!
271  const Double diam1, const Double diam2);
272 
274  String formatTime(const Double);
275 
276  void addHyperCubes(const Int id, const Int nBase, const Int nChan, const Int nCorr);
277 
278  void defaults();
279 
280  Bool calcAntUVW(MEpoch& epoch, MDirection& refdir,
281  Matrix<Double>& uvwAnt);
282 
283 
284 };
285 
286 
287 } //# NAMESPACE CASACORE - END
288 
289 #endif
290 
291 
292 
293 
A Measure: astronomical direction.
Definition: MDirection.h:174
void setFractionBlockageLimit(const Double fraclimit)
String formatTime(const Double)
A Measure: position on Earth.
Definition: MPosition.h:79
int Int
Definition: aipstype.h:50
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 setAutoCorrelationWt(const Float autocorrwt)
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 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")
bool getSpWindows(Int &nSpw, Vector< String > &spWindowName, Vector< Int > &nChan, Vector< Quantity > &startFreq, Vector< Quantity > &freqInc, Vector< String > &stokesString)
ABSTRACT CLASSES Abstract class for colors Any implementation of color should be able to provide a hexadecimal form of the if a human readable name(i.e."black").In many places throughout the plotter
void setElevationLimit(const Quantity &ellimit)
A Measure: instant in time.
Definition: MEpoch.h:104
TiledDataStManAccessor sigmaAcc_p
void initFeeds(const String &mode)
set the Feeds; brain dead version
NewMSSimulator & operator=(const NewMSSimulator &)
Assignment.
Referenced counted pointer for constant data.
Definition: VisModelData.h:42
TiledDataStManAccessor scratchDataAcc_p
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.
Create an empty MeasurementSet from observation and telescope descriptions.
double Double
Definition: aipstype.h:55
casacore::CountedPtr< MeasurementSet > getMs() const
casacore::CountedPtr< MeasurementSet > ms_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)
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
float Float
Definition: aipstype.h:54
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)
Give access to some TiledDataStMan functions.
void initFields(const String &sourceName, const MDirection &sourceDirection, const String &calCode)
set the observed fields
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
A Table intended to hold astronomical data (a set of Measurements).
Bool calcAntUVW(MEpoch &epoch, MDirection &refdir, Matrix< Double > &uvwAnt)
void settimes(const Quantity &qIntegrationTime, const Bool useHourAngles, const MEpoch &mRefTime)
NewMSSimulator()
Prevent use of default constructor.
bool getFields(Int &nField, Vector< String > &sourceName, Vector< MDirection > &sourceDirection, Vector< String > &calCode)
String formatDirection(const MDirection &)
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
Types
Types of known MFrequencies Warning: The order defines the order in the translation matrix FromTo in...
Definition: MFrequency.h:176
const Bool True
Definition: aipstype.h:43
TiledDataStManAccessor dataAcc_p
TiledDataStManAccessor flagAcc_p
void addHyperCubes(const Int id, const Int nBase, const Int nChan, const Int nCorr)
bool getFeedMode(String &mode)
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42