casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SynthesisUtilMethods.h
Go to the documentation of this file.
1 //# SynthesisUtilMethods.h: Imager functionality sits here;
2 //# Copyright (C) 1996,1997,1998,1999,2000,2001,2002,2003
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 //#
25 //# $Id$
26 
27 #ifndef SYNTHESIS_SYNTHESISUTILS_H
28 #define SYNTHESIS_SYNTHESISUTILS_H
29 
30 #include <casa/aips.h>
31 #include <casa/OS/Timer.h>
32 #include <casa/Containers/Record.h>
34 #include <casa/Arrays/IPosition.h>
35 #include <casa/Quanta/Quantum.h>
38 #include <casa/Quanta/MVAngle.h>
47 
50 //#include <synthesis/ImagerObjects/TmpSwitch.h>
51 
52 namespace casa { //# NAMESPACE CASA - BEGIN
53 
54  class SynthesisParams;
55  class SynthesisParamsImage;
56  class SynthesisParamsSelect;
57 
59  {
60  public:
61  enum VBSTATES {NOVALIDROWS=-1};
62  // Default constructor
63 
66 
67  // All functions here are stand-alone, self-contained methods.
68 
69 
70  // Partitioning syntax for Selection parameters
71  //
72  // casacore::Input casacore::Record (example) :
73  // { 'ms0' : { 'msname':xxx1, 'spw':yyy } ,
74  // 'ms1' : { 'msname':xxx2, 'spw':yyy } }
75  //
76  // Output casacore::Record (example for partitioning on spw) :
77  // { '0' : { 'ms0' : { 'msname':xxx1, 'spw':yyy1 } ,
78  // 'ms1' : { 'msname':xxx2, 'spw':yyy1 } }
79  // '1' : { 'ms0' : { 'msname':xxx1, 'spw':yyy2 } ,
80  // 'ms1' : { 'msname':xxx2, 'spw':yyy2 } } }
81 
82  // casacore::Data partitioning rules for CONTINUUM imaging
84 
85  // casacore::Data partitioning rules for CUBE imaging
86  //uniform contiguous partition in frequency step
87  // Note that the spw selection will have a "-1"
88  //if there is no overlap in the data selection provided and
89  // frequency range provided
91 
92  // freqBeg and freqEnd are frequency range of the sub image cubes defined in frame set here
93  // number of partions is obviously the length of freqBeg and freqEnd
94  // Use this for non uniform width of imge frequencies
96 
97  //casacore::CoordinateSystem and number of channels of original cube is passed in
98  //Output record is the ms's and data selection for each part.
99  // also the casacore::Vector of outCsys and outnChan are the coordinatesystems
100  // and nchannel of the sub cube for each part.
101  // The image is divided in n part along spectral channel
102  //now if one of the sub cube has no match the the spw selection will have a "-1"
103  //for that part. The caller will have to deal with that for load balancing etc..
104  // Output casacore::Record (example for partitioning on spw) :
105  // { '0' : { 'ms0' : { 'msname':xxx1, 'spw': '0:5~10' } ,
106  // 'ms1' : { 'msname':xxx2, 'spw':'0:20~25' },
107  // 'nchan': 6,
108  // 'coordsys': { A record of the coordinatesystem of subcube 0}}
109  // '1' : { 'ms0' : { 'msname':xxx1, 'spw':'0:9~14' } ,
110  // 'ms1' : { 'msname':xxx2, 'spw':'0:24~29' },
111  // 'nchan':6,
112  // 'coordsys': { A record of the coordinatesystem of subcube 1} }
113  // }
114  // the coordsys keyed record can be use in casacore::CoordinateSystem:;restore to reconstrucr
115  // it is the same as the parameter outCsys
117  incsys, const casacore::Int npart, const casacore::Int nchannel,
120 
121  // Image cube partitioning rules for CUBE imaging
123 
124  // Validate the supplied VB. This currently only checks for the
125  // existence of at least one non-flagged row and returns the index
126  // of the first non-flagged row found. Otherwise returns
127  // SynthesisUtilMethods::NOVALIDROWS. This static method is called
128  // in the vis-iter loops to block invalid VBs from flowing down
129  // the pipes.
130  static casacore::Int validate(const VisBuffer& vb);
131  static casacore::Int validate(const vi::VisBuffer2& vb);
132 
133 
134  static casacore::Int getOptimumSize(const casacore::Int npix);
135 
136  static void getResource(casacore::String label="", casacore::String fname="");
137 
138  // return comprehensible direction string from given MDirection object
140 
141  protected:
143 
145 
146  private:
147  static casacore::String makeResourceFilename(int pid);
148 
152 
153  static casacore::Int parseProcStatusLine(const std::string &str);
154  };
155 
157 {
158 public:
160  virtual ~SynthesisParams(){};
162  virtual SynthesisParams& operator= (const SynthesisParams& /*other*/){ return *this;};
163  virtual void fromRecord(const casacore::Record &inrec)=0;
164  virtual void setDefaults()=0;
165  virtual casacore::String verify()const =0 ;
166  virtual casacore::Record toRecord() const =0;
167 protected:
168  // All return strings are error messages. Null if valid.
180  // Others..
184 };
185 
187 {
188 public:
189 
193 
194  //copy semantics
196  void fromRecord(const casacore::Record &inrec);
197  void setDefaults();
198  casacore::String verify() const;
199  casacore::Record toRecord() const;
200 
205 
207 
208 };
209 
210 
211 
213 {
214 public:
215 
218 
219  void fromRecord(const casacore::Record &inrec);
220  void setDefaults();
221  casacore::String verify() const;
222  casacore::Record toRecord()const ;
223 
224  // Generate casacore::Coordinate System
226 
228 
229 
232  casacore::Double freqmin, casacore::Double freqmax,
233  casacore::Double datafstart, casacore::Double datafend);
234 
236  casacore::IPosition shp() const;
238  casacore::Double& refPix, casacore::String& specmode,
239  const casacore::MEpoch& obsEpoch, const casacore::MPosition& obsPosition,
240  const casacore::Vector<casacore::Double>& dataChanFreqs, const casacore::Vector<casacore::Double>& dataFreqRes,
241  const casacore::MFrequency::Types& dataFrame, const casacore::Quantity& qrestfreq,
242  const casacore::Double& freqmin, const casacore::Double& freqmax,
244 
247  casacore::Record getcsys() const;
248  // check consistency of image parameters when csys record exists and update
249  // accordingly based on csys record
251  //get the moving source direction in frame requested
253 
254  // Sky coordinates
264 
265  // Stokes info
267 
268  // Spectral coordinates ( TT : Add other params here )
277 
278  // private variable to store ref frame defined in casacore::Quantity or casacore::Measure
279  // in start or step parameters and veltype from measure (e.g. casacore::MDoppler)
282  // for holding quantity or measure records
284  // optional coordsys record
287 
288  //freqframe coversion?
290 
292 
294  //moving source
295  // Moving phase center ?
300 
301 
302 };
303 
304 
306 {
307 public:
308 
311 
312  void fromRecord(const casacore::Record &inrec);
313  void setDefaults();
314  casacore::String verify() const;
315  casacore::Record toRecord() const;
316 
318 
319  // FTMachine setup
324 
325  // Facets for gridding.
327 
328  // casacore::Cube chunks for gridding
330 
331  // Spectral axis interpolation
333 
334  // Moving phase center ?
339 
340  // For wb-aprojection ftm.
344 
345  // For single-dish imaging
354 
355  // Mapper Type.
357 
358 };
359 
360 
362 {
363 public:
364 
367 
368  void fromRecord(const casacore::Record &inrec);
369  void setDefaults();
370  casacore::String verify() const;
371  casacore::Record toRecord() const;
372 
375  casacore::Int deconvolverId; // maybe remove ? It's only to tag summary info.
401  int nMask;
403 
404 
405 
407 
410 
411  };
412 
413 
414 } //# NAMESPACE CASA - END
415 
416 #endif
A Vector of integers, for indexing into Array&lt;T&gt; objects.
Definition: IPosition.h:119
A Measure: astronomical direction.
Definition: MDirection.h:174
casacore::CoordinateSystem buildCoordinateSystem(ROVisibilityIterator *rvi)
Generate casacore::Coordinate System.
static casacore::String makeResourceFilename(int pid)
casacore::Vector< casacore::String > startModel
void fromRecord(const casacore::Record &inrec)
casacore::MFrequency mFreqStart
A Measure: position on Earth.
Definition: MPosition.h:79
int Int
Definition: aipstype.h:50
virtual casacore::Record toRecord() const =0
casacore::String verify() const
casacore::Record getcsys() const
casacore::Int facets
Facets for gridding.
casacore::Record toRecord() const
casacore::IPosition shp() const
casacore::Quantity distance
moving source Moving phase center ?
static const casacore::String g_enableOptMemProfile
casacore::String stringToQuantity(casacore::String instr, casacore::Quantity &qa) const
casacore::MDirection phaseCenter
VisibilityIterator2 iterates through one or more readonly MeasurementSets.
Geometric parameters needed for a sky projection to a plane.
Definition: Projection.h:95
casacore::Record cubeImagePartition(casacore::Record &impars, casacore::Int npart)
Image cube partitioning rules for CUBE imaging.
casacore::Int nchan
Spectral coordinates (TT : Add other params here)
casacore::Bool pseudoi
Stokes info.
casacore::Record continuumDataPartition(casacore::Record &selpars, const casacore::Int npart)
All functions here are stand-alone, self-contained methods.
casacore::MDirection getMovingSourceDir(const casacore::MeasurementSet &ms, const casacore::MEpoch &refEp, const casacore::MPosition &refpos, const casacore::MDirection::Types outframe)
get the moving source direction in frame requested
void fromRecord(const casacore::Record &inrec)
casacore::MFrequency mFreqStep
virtual void setDefaults()=0
casacore::String MDopToVelString(casacore::Record &rec)
casacore::String readVal(const casacore::Record &rec, casacore::String id, casacore::String &val) const
All return strings are error messages.
casacore::MDirection trackDir
casacore::MFrequency::Types freqframe
A Measure: radial velocity.
casacore::Record toRecord() const
casacore::GaussianBeam restoringbeam
casacore::String pointingDirCol
For single-dish imaging.
casacore::Record updateParams(const casacore::Record &impar)
check consistency of image parameters when csys record exists and update accordingly based on csys re...
casacore::Bool aTermOn
For wb-aprojection ftm.
virtual SynthesisParamsSelect & operator=(const SynthesisParamsSelect &other)
copy semantics
static casacore::Int validate(const VisBuffer &vb)
Validate the supplied VB.
A Measure: instant in time.
Definition: MEpoch.h:104
casacore::String QuantityToString(casacore::Quantity val) const
Represents a Gaussian restoring beam associated with an image.
Definition: GaussianBeam.h:68
casacore::Int chanchunks
casacore::Cube chunks for gridding
casacore::String interpolation
Spectral axis interpolation.
Types
Types of known MDirections Warning: The order defines the order in the translation matrix FromTo in ...
Definition: MDirection.h:188
casacore::MRadialVelocity mVelStart
A Measure: wave characteristics.
Definition: MFrequency.h:161
casacore::Quantity distance
Moving phase center ?
casacore::String gridder
FTMachine setup.
casacore::String qmframe
private variable to store ref frame defined in casacore::Quantity or casacore::Measure in start or st...
casacore::String MDirectionToString(casacore::MDirection val) const
Others.
casacore::Record startRecord
for holding quantity or measure records
casacore::Record toRecord() const
casacore::String mType
Mapper Type.
double Double
Definition: aipstype.h:55
casacore::String verify() const
casacore::String stringToMDirection(casacore::String instr, casacore::MDirection &md) const
static void getResource(casacore::String label="", casacore::String fname="")
static casacore::String mergeSpwSel(const casacore::Vector< casacore::Int > &fspw, const casacore::Vector< casacore::Int > &fstart, const casacore::Vector< casacore::Int > &fnchan, const casacore::Matrix< casacore::Int > &spwsel)
casacore::Vector< casacore::Quantity > cellsize
casacore::MFrequency::Types freqFrame
casacore::String verify() const
static casacore::String g_hostname
A hierarchical collection of named fields of various types.
Definition: Record.h:180
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
void fromRecord(const casacore::Record &inrec)
casacore::Vector< casacore::Quantity > restFreq
casacore::Vector< casacore::Float > scales
float Float
Definition: aipstype.h:54
void fromRecord(const casacore::Record &inrec)
casacore::Record toRecord() const
virtual void fromRecord(const casacore::Record &inrec)=0
A Table intended to hold astronomical data (a set of Measurements).
simple 1-D array
casacore::MRadialVelocity mVelStep
casacore::Vector< casacore::Int > decideNPolPlanes(const casacore::String &stokes) const
casacore::Vector< casacore::Int > imshape
static casacore::String asComprehensibleDirectionString(casacore::MDirection const &direction)
return comprehensible direction string from given MDirection object
casacore::Bool getImFreq(casacore::Vector< casacore::Double > &ChanFreq, casacore::Vector< casacore::Double > &ChanWidth, casacore::Double &refPix, casacore::String &specmode, const casacore::MEpoch &obsEpoch, const casacore::MPosition &obsPosition, const casacore::Vector< casacore::Double > &dataChanFreqs, const casacore::Vector< casacore::Double > &dataFreqRes, const casacore::MFrequency::Types &dataFrame, const casacore::Quantity &qrestfreq, const casacore::Double &freqmin, const casacore::Double &freqmax, const casacore::MDirection &phaseCenter)
static casacore::Vector< casacore::uInt > primeFactors(casacore::uInt n, casacore::Bool douniq=true)
VisBuffer2s encapsulate one chunk of visibility data for processing.
Definition: VisBuffer2.h:141
casacore::Projection projection
casacore::Vector< casacore::Int > imsize
static casacore::String g_startTimestamp
String: the storage and methods of handling collections of characters.
Definition: String.h:223
static casacore::Record cubeDataImagePartition(const casacore::Record &selpars, const casacore::CoordinateSystem &incsys, const casacore::Int npart, const casacore::Int nchannel, casacore::Vector< casacore::CoordinateSystem > &outCsys, casacore::Vector< casacore::Int > &outnChan)
casacore::CoordinateSystem and number of channels of original cube is passed in Output record is the ...
VisBuffers encapsulate one chunk of visibility data for processing.
Definition: VisBuffer.h:153
casacore::String recordQMToString(const casacore::Record &rec) const
static casacore::Int getOptimumSize(const casacore::Int npix)
casacore::CoordinateSystem buildCoordinateSystemCore(casacore::MeasurementSet &msobj, casacore::Vector< casacore::Int > spwids, casacore::Int fld, casacore::Double freqmin, casacore::Double freqmax, casacore::Double datafstart, casacore::Double datafend)
casacore::String findSpecMode(const casacore::String &mode) const
static casacore::Record cubeDataPartition(const casacore::Record &selpars, const casacore::Int npart, const casacore::Double freqBeg, const casacore::Double freqEnd, const casacore::MFrequency::Types eltype=casacore::MFrequency::LSRK)
casacore::Data partitioning rules for CUBE imaging uniform contiguous partition in frequency step No...
Types
Types of known MFrequencies Warning: The order defines the order in the translation matrix FromTo in...
Definition: MFrequency.h:176
casacore::String imageName
Sky coordinates.
ROVisibilityIterator iterates through one or more readonly MeasurementSets.
casacore::String verify() const
casacore::Vector< casacore::String > startModel
casacore::Bool freqFrameValid
freqframe coversion?
SynthesisUtilMethods()
Default constructor.
static casacore::Int parseProcStatusLine(const std::string &str)
Interconvert pixel and world coordinates.
virtual SynthesisParams & operator=(const SynthesisParams &)
As there is no state to copy.
unsigned int uInt
Definition: aipstype.h:51
casacore::Record csysRecord
optional coordsys record
casacore::Vector< casacore::String > maskList
virtual casacore::String verify() const =0