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// # Includes
30#include <memory>
31#include <casacore/casa/aips.h>
32#include <casacore/casa/BasicSL/String.h>
33#include <casacore/casa/Arrays/Vector.h>
34#include <casacore/casa/Arrays/Matrix.h>
35#include <casacore/casa/Arrays/Cube.h>
36#include <casacore/casa/BasicSL/Complex.h>
37#include <casacore/casa/Quanta/Quantum.h>
38#include <casacore/measures/Measures/MPosition.h>
39#include <casacore/measures/Measures/MEpoch.h>
40#include <casacore/measures/Measures/MFrequency.h>
41#include <casacore/measures/Measures/MDirection.h>
42
43#include <casacore/tables/DataMan/TiledDataStManAccessor.h>
44
45namespace casacore { // # NAMESPACE CASACORE - BEGIN
46
47// # Forward Declarations
48class MeasurementSet;
49
50// <category lib=aips module="ModuleName">
51// <summary> Create an empty MeasurementSet from observation and telescope descriptions. </summary>
52// <reviewed reviewer="" date="" tests="">
53//
54// <prerequisite>
55// # Classes you should understand before using this one.
56// <li> MeasurementSet
57// </prerequisite>
58//
59// <etymology>
60// MS is from MeasurementSet, Simulator refers to the generation of
61// 'fake' data from a set of parameters for instrument and sources.
62// </etymology>
63//
64// <synopsis>
65// This class creates a MeasurementSet from a set of parameters for instrument
66// and sources. It does not simulate the data, only the coordinates of a
67// measurement. The application "simulator" uses this class to create a true
68// simulated MS with perfect or corrupted data.
69// </synopsis>
70//
71// <motivation>
72// To test calibration and imaging programs it is necessary to have flawless
73// data and data with errors that are known exactly. This class generates
74// empty MeasurementSets (only coordinates filled in) that can be filled
75// with predicted data.
76// </motivation>
77//
78// <todo asof="$DATE:$">
79// # A List of bugs, limitations, extensions or planned refinements.
80// <li> The amount of information to be specified by the user
81// could be much larger. For the moment it has been restricted to
82// what is needed for testing the synthesis imaging code. Already
83// it is possible to create MeasurementSets that cannot be processed
84// yet.
85// </todo>
86
88 public:
89 // Constructor from name only
91
92 // Constructor from existing MS
94
95 // Copy constructor - for completeness only
97
98 // # Destructor
100
101 // # Operators
102 // Assignment
104
105 // Set maximum amount of data (bytes) to be written into any one
106 // scratch column hypercube
107 void setMaxData(const Double maxData = 2e9) { maxData_p = maxData; }
108
109 // set the antenna and array data. These are written immediately to the
110 // existing MS. The same model is used for the other init infor.
111 void initAnt(const String& telname, const Vector<Double>& x, const Vector<Double>& y,
112 const Vector<Double>& z, const Vector<Double>& dishDiameter,
113 const Vector<Double>& offset, const Vector<String>& mount,
114 const Vector<String>& name, const Vector<String>& padname, const String& coordsystem,
115 const MPosition& mRefLocation);
116 // get the info back
117 bool getAnt(String& telescope, Int& nAnt, Matrix<Double>* antXYZ, Vector<Double>& antDiam,
119 Vector<String>& padname, String& coordsystem, MPosition& mRefLocation);
120
121 // set the observed fields
122 void initFields(const String& sourceName, const MDirection& sourceDirection,
123 const String& calCode);
124
125 bool getFields(Int& nField, Vector<String>& sourceName, Vector<MDirection>& sourceDirection,
126 Vector<String>& calCode);
127
128 // set the Feeds; brain dead version
129 void initFeeds(const String& mode);
130
131 bool getFeedMode(String& mode);
132
133 // set the Feeds; Smart version
134 void initFeeds(const String& mode, const Vector<Double>& x, const Vector<Double>& y,
135 const Vector<String>& pol);
136
137 // set the spectral windows information
138 void initSpWindows(const String& spWindowName, const Int& nChan, const Quantity& startFreq,
139 const Quantity& freqInc, const Quantity& freqRes,
140 const MFrequency::Types& freqType, const String& stokesString);
141
142 bool getSpWindows(Int& nSpw, Vector<String>& spWindowName, Vector<Int>& nChan,
143 Vector<Quantity>& startFreq, Vector<Quantity>& freqInc,
144 Vector<String>& stokesString);
145
146 void setFractionBlockageLimit(const Double fraclimit) { fractionBlockageLimit_p = fraclimit; }
147
148 void setElevationLimit(const Quantity& ellimit) { elevationLimit_p = ellimit; }
149
150 void setAutoCorrelationWt(const Float autocorrwt) { autoCorrelationWt_p = autocorrwt; }
151
152 void settimes(const Quantity& qIntegrationTime, const Bool useHourAngles, const MEpoch& mRefTime);
153
154 void observe(const String& sourceName, const String& spWindowName, const Quantity& qStartTime,
155 const Quantity& qStopTime, const Bool add_observation = True,
156 // # from int ASDM2MSFiller::addUniqueState(
157 // # defaults for ALMA as known on 20100831
158 const Bool state_sig = True, const Bool state_ref = True,
159 const double& state_cal = 0., const double& state_load = 0.,
160 const unsigned int state_sub_scan = 1,
161 const String& state_obs_mode = "OBSERVE_TARGET.ON_SOURCE",
162 const String& observername = "CASA simulator",
163 const String& projectname = "CASA simulation");
164
165 void observe(const Vector<String>& sourceNames, const String& spWindowName,
166 const Vector<Quantity>& qStartTimes, const Vector<Quantity>& qStopTimes,
167 const Vector<MDirection>& directions, const Bool add_observation = True,
168 // # from int ASDM2MSFiller::addUniqueState(
169 // # defaults for ALMA as known on 20100831
170 const Bool state_sig = True, const Bool state_ref = True,
171 const double& state_cal = 0., const double& state_load = 0.,
172 const unsigned int state_sub_scan = 1,
173 const String& state_obs_mode = "OBSERVE_TARGET.ON_SOURCE",
174 const String& observername = "CASA simulator",
175 const String& projectname = "CASA simulation");
176
177 std::shared_ptr<MeasurementSet> getMs() const;
178
179 private:
180 // Prevent use of default constructor
182
183 // # Data Members
198
199 std::shared_ptr<MeasurementSet> ms_p;
200
202
204
205 void local2global(Vector<Double>& xReturned, Vector<Double>& yReturned, Vector<Double>& zReturned,
206 const MPosition& mRefLocation, const Vector<Double>& xIn,
207 const Vector<Double>& yIn, const Vector<Double>& zIn);
208
209 void longlat2global(Vector<Double>& xReturned, Vector<Double>& yReturned,
210 Vector<Double>& zReturned, const MPosition& mRefLocation,
211 const Vector<Double>& xIn, const Vector<Double>& yIn,
212 const Vector<Double>& zIn);
213
214 // Returns the fractional blockage of one antenna by another
215 // We will want to put this somewhere else eventually, but I don't yet know where!
216 // Till then.
217 // fraction1: fraction of antenna 1 that is blocked by 2
218 // fraction2: fraction of antenna 2 that is blocked by 1
219 // hint: at least one of the two will be 0.0
220 void blockage(Double& fraction1, Double& fraction2,
221 const Vector<Double>& uvw, // uvw in same units as diam!
222 const Double diam1, const Double diam2);
223
226
227 void addHyperCubes(const Int id, const Int nBase, const Int nChan, const Int nCorr);
228
229 void defaults();
230
231 Bool calcAntUVW(MEpoch& epoch, MDirection& refdir, Matrix<Double>& uvwAnt);
232};
233
234} // namespace casacore
235
236#endif
Types
Types of known MFrequencies Warning: The order defines the order in the translation matrix FromTo in...
Definition MFrequency.h:175
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:355
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
int offset(int, int) const
compute a linear offset from array indicies
float Float
Definition aipstype.h:52
String name() const
Return the name of the field.
int Int
Definition aipstype.h:48
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
Quantum< Double > Quantity
Definition Quantum.h:40
const Bool True
Definition aipstype.h:41
double Double
Definition aipstype.h:53