casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SubMS.h
Go to the documentation of this file.
1 //# SubMS.h: this defines SubMS which creates a subset of an casacore::MS with some
2 //# transformation
3 //# Copyright (C) 1997,1998,1999,2000,2001,2003
4 //# Associated Universities, Inc. Washington DC, USA.
5 //#
6 //# This library is free software; you can redistribute it and/or modify it
7 //# under the terms of the GNU Library General Public License as published by
8 //# the Free Software Foundation; either version 2 of the License, or (at your
9 //# option) any later version.
10 //#
11 //# This library is distributed in the hope that it will be useful, but WITHOUT
12 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
14 //# License for more details.
15 //#
16 //# You should have received a copy of the GNU Library General Public License
17 //# along with this library; if not, write to the Free Software Foundation,
18 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
19 //#
20 //# Correspondence concerning AIPS++ should be addressed as follows:
21 //# Internet email: aips2-request@nrao.edu.
22 //# Postal address: AIPS++ Project Office
23 //# National Radio Astronomy Observatory
24 //# 520 Edgemont Road
25 //# Charlottesville, VA 22903-2475 USA
26 //#
27 //#
28 //# $Id$
32 //#include <msvis/MSVis/VisIterator.h>
34 #include <casa/aips.h>
35 #include <casa/Arrays/Array.h>
36 #include <casa/Arrays/Vector.h>
37 #include <tables/Tables/Table.h>
38 //#include <casa/Utilities/CountedPtr.h>
39 #include <map>
40 #include <set>
41 #include <vector>
43 
45 
46 
47 #ifndef MSVIS_SUBMS_H
48 
49 namespace casacore{
50 
51 class MSSelection; // #include <ms/MSSel/MSSelection.h>
52 template<class T> class ArrayColumn;
53 class Table;
54 }
55 
56 namespace casa { //# NAMESPACE CASA - BEGIN
57 
58 #define MSVIS_SUBMS_H
59 
60 namespace subms {
61 // Returns wt**-0.5 or -1, depending on whether wt is positive.
62 // NOT a member function, so it can be easily passed to other functions
63 // (i.e. arrayTransformInPlace).
64 double wtToSigma(casacore::Double wt);
65 double sigToWeight(casacore::Double sig);
66 }
67 
68 // <summary>
69 // SubMS provides functionalities to make a subset of an existing MS
70 // </summary>
71 
72 // <visibility=export>
73 
74 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
75 // </reviewed>
76 
77 // <prerequisite>
78 // <li> MeasurementSet
79 // </prerequisite>
80 //
81 // <etymology>
82 // SubMS ...from the SUBset of an MS
83 // </etymology>
84 //
85 // <synopsis>
86 // The order of operations (as in ms::split()) is:
87 // ctor
88 // setmsselect
89 // selectTime
90 // makeSubMS
91 // </synopsis>
92 
93 // These forward declarations are so the corresponding .h files don't have to
94 // be included in this .h file, but it's only worth it if a lot of other files
95 // include this file.
96 class VBRemapper;
97 
98  // // These typedefs are necessary because a<b::c> doesn't work.
99  // typedef std::vector<casacore::uInt> uivector;
100  // struct uIntCmp
101  // {
102  // bool operator()(const casacore::uInt i1, const casacore::uInt i2) const
103  // {
104  // return i1 < i2;
105  // }
106  // };
107  // typedef std::map<const casacore::uInt, uivector, uIntCmp> ui2vmap;
108 
110 
111 class SubMS
112 {
113 
114  // jagonzal: Allow TransformVisDataHandler to access protected methods and members of this class
115  friend class MSTransformManager;
116 
117  public:
118 
120  useFFTShift = -100, // needs input and output grid to have the same number of channels and be equidistant in freq.
121  useLinIntThenFFTShift // for the case the input grid is not equidistant in frequency but the output grid is
122  };
123 
128  };
129 
131 
132  // construct from an MS
134 
135  virtual ~SubMS();
136 
137  // Change or Set the casacore::MS this casacore::MSSelector refers to.
139 
140  // Returns the set (possibly empty) of spectral windows that are in spwv but
141  // not listed in ms's DATA_DESCRIPTION subtable. (This happens with certain
142  // calibration/hardware setups.)
143  static std::set<casacore::Int> findBadSpws(casacore::MeasurementSet& ms, casacore::Vector<casacore::Int> spwv);
144 
145  // Select spw and channels for each spw.
146  // This is the version used by split. It returns true on success and false
147  // on failure.
149 
150  // This older version is used by the older version of setmsselect().
153 
154  // Setup polarization selection (for now, only from available correlations -
155  // no casacore::Stokes transformations.)
157 
158  //select casacore::Time and time averaging or regridding
159  //void selectTime();
160 
161  //select stuff using msselection syntax ...time is left out
162  // call it separately with timebin
163  // This version returns a success value, and does not need nchan, start, and
164  // step. It is used by split.
165  casacore::Bool setmsselect(const casacore::String& spw="", const casacore::String& field="",
166  const casacore::String& baseline="", const casacore::String& scan="",
167  const casacore::String& uvrange="", const casacore::String& taql="",
169  const casacore::String& subarray="", const casacore::String& correlation="",
170  const casacore::String& intent="", const casacore::String& obs="");
171 
172  // This older version does not return a success value, and does need nchan,
173  // start, and step. It is used elsewhere (i.e. ImagerMultiMS).
174  void setmsselect(const casacore::String& spw, const casacore::String& field,
175  const casacore::String& baseline, const casacore::String& scan,
176  const casacore::String& obs, const casacore::String& uvrange,
177  const casacore::String& taql, const casacore::Vector<casacore::Int>& nchan,
179  const casacore::String& subarray, const casacore::String& intent="");
180 
181  // Select source or field
183 
184  // Select Antennas to split out
186  const casacore::Vector<casacore::String>& antennaSel)
187  {
189  antennaids, antennaSel);
190  }
191  static casacore::Bool pickAntennas(casacore::Vector<casacore::Int>& selected_antennaids,
192  casacore::Vector<casacore::String>& selected_antenna_strs,
193  const casacore::Vector<casacore::Int>& antennaids,
194  const casacore::Vector<casacore::String>& antennaSel);
195 
196  // Select array IDs to use.
197  void selectArray(const casacore::String& subarray) {arrayExpr_p = subarray;}
198 
199  //select time parameters
200  void selectTime(casacore::Double timeBin=-1.0, casacore::String timerng="");
201 
202  //void selectSource(casacore::Vector<casacore::String> sourceid);
203 
204  //Method to set if a phase Center rotation is needed
205  //void setPhaseCenter(casacore::Int fieldid, casacore::MDirection& newPhaseCenter);
206 
207  // Sets the polynomial order for continuum fitting to fitorder.
208  // If < 0, continuum subtraction is not done.
209  void setFitOrder(casacore::Int fitorder, casacore::Bool advise=true);
210  // Set the selection string for line-free channels.
211  void setFitSpw(const casacore::String& fitspw) {fitspw_p = fitspw;}
212  // Selection string for output channels if doing continuum subtraction.
213  void setFitOutSpw(const casacore::String& fitoutspw) {fitoutspw_p = fitoutspw;}
214 
215  //Method to make the subMS
216  //
217  //TileShape of size 1 can have 2 values [0], and [1] ...these are used in to
218  //determine the tileshape by using MSTileLayout. Otherwise it has to be a
219  //vector size 3 e.g [4, 15, 351] => a tile shape of 4 stokes, 15 channels 351
220  //rows.
221  //
222  // combine sets combine_p. (Columns to ignore while time averaging.)
223  //
224  casacore::Bool makeSubMS(casacore::String& submsname, casacore::String& whichDataCol,
226  const casacore::String& combine="");
227 
228  //Method to make a scratch subMS and even in memory if posssible
229  //Useful if temporary subselection/averaging is necessary
230  // It'll be in memory if the basic output ms is less than half of
231  // memory reported by casacore::HostInfo unless forced to by user...
233  const casacore::Bool forceInMemory=false);
234  // In this form whichDataCol gets passed to parseColumnNames().
235  virtual casacore::MeasurementSet* makeScratchSubMS(const casacore::String& whichDataCol,
236  const casacore::Bool forceInMemory=false);
237 
238  // This sets up a default new ms
239  // Declared static as it can be (and is) called directly outside of SubMS.
240  // Therefore it is not dependent on any member variable.
241  static casacore::MeasurementSet* setupMS(const casacore::String& msname, const casacore::Int nchan,
242  const casacore::Int npol, const casacore::String& telescop,
244  const casacore::Int obstype=0,
245  const casacore::Bool compress=false,
246  const asdmStManUseAlternatives asdmStManUse=DONT);
247 
248  // Same as above except allowing manual tileshapes
249  static casacore::MeasurementSet* setupMS(const casacore::String& msname, const casacore::Int nchan,
250  const casacore::Int npol,
253  const casacore::Bool compress=false,
254  const asdmStManUseAlternatives asdmStManUse=DONT);
255 
256 
257  // Add optional columns to outTab if present in inTab and possColNames.
258  // beLazy should only be true if outTab is in its default state.
259  // Returns the number of added columns.
261  const casacore::Bool beLazy=false);
262 
263  // Like casacore::TableCopy::copyRows, but by column.
264  static casacore::Bool copyCols(casacore::Table& out, const casacore::Table& in, const casacore::Bool flush=true);
265 
266  // A customized version of casacore::MS::createDefaultSubtables().
268 
269  // Declared static because it's used in setupMS(). Therefore it can't use
270  // any member variables. It is also used in MSFixvis.cc.
271  // colNameList is internally upcased, so it is not const or passed by reference.
273  // This version uses the casacore::MeasurementSet to check what columns are present,
274  // i.e. it makes col=="all" smarter, and it is not necessary to call
275  // verifyColumns() after calling this. Unlike the other version, it knows
276  // about FLOAT_DATA and LAG_DATA. It throws an exception if a
277  // _specifically_ requested column is absent.
279  const casacore::MeasurementSet& ms);
280 
282 
283  // The output casacore::MS must have (at least?) 1 of DATA, FLOAT_DATA, or LAG_DATA.
284  // MODEL_DATA or CORRECTED_DATA will be converted to DATA if necessary.
287  {
288  return (nTok == 1) && (datacols[0] != casacore::MS::FLOAT_DATA) &&
289  (datacols[0] != casacore::MS::LAG_DATA);
290  }
291 
294 
295  // Fills outToIn[pol] with a map from output correlation index to input
296  // correlation index, for each input polID pol.
297  // It does not yet check the appropriateness of the correlation selection
298  // string, so ignore the return value for now. outToIn[pol] defaults to
299  // an empty casacore::Vector if no correlations are selected for pol.
300  // That is not the same as the default "select everything in ms".
303  const casacore::Bool areSelecting=false);
304 
305  // Replaces col[i] with mapper[col[i]] for each element of col.
306  // Does NOT check whether mapper[col[i]] is defined, but it does return
307  // right away (i.e. a no-op) if mapper is empty.
309  static void remap(casacore::Vector<casacore::Int>& col, const std::map<casacore::Int, casacore::Int>& mapper);
310 
311  // Transform spectral data to different reference frame,
312  // optionally regrid the frequency channels
313  // return values: -1 = casacore::MS not modified, 1 = casacore::MS modified and OK,
314  // 0 = casacore::MS modified but not OK (i.e. casacore::MS is probably damaged)
315  casacore::Int regridSpw(casacore::String& message, // returns the casacore::MS history entry
316  const casacore::String& outframe="", // default = "keep the same"
317  const casacore::String& regridQuant="chan",
318  const casacore::Double regridVeloRestfrq=-3E30, // default = "not set"
319  const casacore::String& regridInterpMeth="LINEAR",
320  const casacore::Double regridCenter=-3E30, // default = "not set"
321  const casacore::Double regridBandwidth=-1., // default = "not set"
322  const casacore::Double regridChanWidth=-1., // default = "not set"
323  const casacore::Bool doHanningSmooth=false,
324  const casacore::Int phaseCenterFieldId=-2, // -2 = use pahse center from field table
325  casacore::MDirection phaseCenter=casacore::MDirection(), // this direction is used if phaseCenterFieldId==-1
326  const casacore::Bool centerIsStart=false, // if true, the parameter regridCenter specifies the start
327  const casacore::Bool startIsEnd=false, // if true, and centerIsStart is true, regridCenter specifies the upper end in frequency
328  const casacore::Int nchan=0, // if >0: used instead of regridBandwidth, ==
329  const casacore::Int width=0, // if >0 and regridQuant=="freq": used instead of regridChanWidth
330  const casacore::Int start=-1 // if >=0 and regridQuant=="freq": used instead of regridCenter
331  );
332 
333  // the following inline convenience methods for regridSpw bypass the whole CASA measure system
334  // because when they are used, they can assume that the frame stays the same and the units are OK
335  static casacore::lDouble vrad(const casacore::lDouble freq, const casacore::lDouble rest){ return (casacore::C::c * (1. - freq/rest)); };
336  static casacore::lDouble vopt(const casacore::lDouble freq, const casacore::lDouble rest){ return (casacore::C::c *(rest/freq - 1.)); };
337  static casacore::lDouble lambda(const casacore::lDouble freq){ return (casacore::C::c/freq); };
338  static casacore::lDouble freq_from_vrad(const casacore::lDouble vrad, const casacore::lDouble rest){ return (rest * (1. - vrad/casacore::C::c)); };
339  static casacore::lDouble freq_from_vopt(const casacore::lDouble vopt, const casacore::lDouble rest){ return (rest / (1. + vopt/casacore::C::c)); };
341 
342  // Support method for regridSpw():
343  // results in the column oldName being renamed to newName, and a new column
344  // which is an empty copy of oldName being created together with a
345  // TileShapeStMan data manager and hypercolumn (name copied from the old
346  // hypercolumn) with given dimension, the old hypercolumn of name
347  // hypercolumnName is renamed to name+"B"
349  const casacore::String& newName, const casacore::Int& hypercolumnDim,
350  const casacore::IPosition& tileShape);
351 
352  // Support method for regridSpw():
353  // calculate the final new channel boundaries from the regridding parameters
354  // and the old channel boundaries (already transformed to the desired
355  // reference frame); returns false if input paramters were invalid and no
356  // useful boundaries could be created
358  casacore::Vector<casacore::Double>& newChanHiBound,
359  const casacore::Double regridCenter,
360  const casacore::Double regridBandwidth,
361  const casacore::Double regridChanWidth,
362  const casacore::Double regridVeloRestfrq,
363  const casacore::String regridQuant,
364  const casacore::Vector<casacore::Double>& transNewXin,
365  const casacore::Vector<casacore::Double>& transCHAN_WIDTH,
366  casacore::String& message, // message to the user, epsecially in case of error
367  const casacore::Bool centerIsStart=false, // if true, the parameter regridCenter specifies the start
368  const casacore::Bool startIsEnd=false, // if true, and centerIsStart is true, regridCenter specifies the upper end in frequency
369  const casacore::Int nchan=0, // if != 0 : used instead of regridBandwidth, -1 means use all channels
370  const casacore::Int width=0, // if >0 and regridQuant=="freq": used instead of regridChanWidth
371  const casacore::Int start=-1 // if >=0 and regridQuant=="freq": used instead of regridCenter
372  );
373 
374  // a helper function for handling the gridding parameter user input
376  const casacore::String& mode,
377  const int nchan,
378  const casacore::String& start,
379  const casacore::String& width,
380  const casacore::String& interp,
381  const casacore::String& restfreq,
382  const casacore::String& outframe,
383  const casacore::String& veltype,
384  casacore::String& t_mode,
385  casacore::String& t_outframe,
386  casacore::String& t_regridQuantity,
387  casacore::Double& t_restfreq,
388  casacore::String& t_regridInterpMeth,
389  casacore::Double& t_cstart,
390  casacore::Double& t_bandwidth,
391  casacore::Double& t_cwidth,
392  casacore::Bool& t_centerIsStart,
393  casacore::Bool& t_startIsEnd,
394  casacore::Int& t_nchan,
395  casacore::Int& t_width,
396  casacore::Int& t_start);
397 
398  // A wrapper for SubMS::regridChanBounds() which takes the user interface type gridding parameters
399  // The ready-made grid is returned in newCHAN_FREQ and newCHAN_WIDTH
401  // output
403  casacore::Vector<casacore::Double>& newCHAN_WIDTH,
404  // input
405  const casacore::Vector<casacore::Double>& oldCHAN_FREQ, // the original grid
406  const casacore::Vector<casacore::Double>& oldCHAN_WIDTH,
407  // the gridding parameters
408  const casacore::MDirection phaseCenter,
409  const casacore::MFrequency::Types theOldRefFrame,
410  const casacore::MEpoch theObsTime,
411  const casacore::MPosition mObsPos,
412  const casacore::String& mode,
413  const int nchan,
414  const casacore::String& start,
415  const casacore::String& width,
416  const casacore::String& restfreq,
417  const casacore::String& outframe,
418  const casacore::String& veltype,
419  const casacore::Bool verbose=false,
420  const casacore::MRadialVelocity mRV=casacore::MRadialVelocity() // additional radial velo shift to apply,
421  // used e.g. when outframe=="SOURCE"
422  );
423 
424  // Overloaded version of the above method returning the additional value weightScale
425  // which is the factor by which WEIGHT needs to be scaled when transforming from
426  // the old grid to the new grid.
428  // output
430  casacore::Vector<casacore::Double>& newCHAN_WIDTH,
431  casacore::Double& weightScale,
432  // input
433  const casacore::Vector<casacore::Double>& oldCHAN_FREQ, // the original grid
434  const casacore::Vector<casacore::Double>& oldCHAN_WIDTH,
435  // the gridding parameters
436  const casacore::MDirection phaseCenter,
437  const casacore::MFrequency::Types theOldRefFrame,
438  const casacore::MEpoch theObsTime,
439  const casacore::MPosition mObsPos,
440  const casacore::String& mode,
441  const int nchan,
442  const casacore::String& start,
443  const casacore::String& width,
444  const casacore::String& restfreq,
445  const casacore::String& outframe,
446  const casacore::String& veltype,
447  const casacore::Bool verbose=false,
448  const casacore::MRadialVelocity mRV=casacore::MRadialVelocity() // additional radial velo shift to apply,
449  // used e.g. when outframe=="SOURCE"
450  );
451 
452  // Support method for regridSpw():
453  // if writeTables is false, the (const) input parameters are only verified, nothing is written;
454  // return value is true if the parameters are OK.
455  // if writeTables is true, the vectors are filled and the SPW, DD, and SOURCE tables are modified;
456  // the return value in this case is true only if a successful modification (or none) took place
457  casacore::Bool setRegridParameters(std::vector<casacore::Int>& oldSpwId,
458  std::vector<casacore::Int>& oldFieldId,
459  std::vector<casacore::Int>& newDataDescId,
460  std::vector<casacore::Bool>& regrid,
461  std::vector<casacore::Bool>& transform,
462  std::vector<casacore::MDirection>& theFieldDirV,
463  std::vector<casacore::MPosition>& mObsPosV,
464  std::vector<casacore::MFrequency::Types>& fromFrameTypeV,
465  std::vector<casacore::MFrequency::Ref>& outFrameV,
466  std::vector<casacore::MRadialVelocity>& outRadVelV,
467  std::vector<casacore::Double>& weightScaleV,
468  std::vector< casacore::Vector<casacore::Double> >& xold,
469  std::vector< casacore::Vector<casacore::Double> >& xout,
470  std::vector< casacore::Vector<casacore::Double> >& xin,
471  vector< casacore::Int >& method, // interpolation method cast to Int
472  casacore::Bool& msMod,
473  const casacore::String& outframe,
474  const casacore::String& regridQuant,
475  const casacore::Double regridVeloRestfrq,
476  const casacore::String& regridInterpMeth,
477  const casacore::Double regridCenter,
478  const casacore::Double regridBandwidth,
479  const casacore::Double regridChanWidth,
480  const casacore::Int regridPhaseCenterFieldId, // -2 = take from field table, -1 = use
481  const casacore::MDirection regridPhaseCenter, // <- this value, >-1 = take from this field
482  const casacore::Bool writeTables,
483  casacore::LogIO& os,
484  casacore::String& regridMessage,
485  const casacore::Bool centerIsStart=false, // if true, the parameter regridCenter specifies the start
486  const casacore::Bool startIsEnd=false, // if true, and centerIsStart is true, regridCenter specifies the upper end in frequency
487  const casacore::Int nchan=0, // if >0: used instead of regridBandwidth
488  const casacore::Int width=0, // if >0 and regridQuant=="freq": used instead of regridChanWidth
489  const casacore::Int start=-1 // if >=0 and regridQuant=="freq": used instead of regridCenter
490  );
491 
492  // combineSpws():
493  // make one spectral window from all spws given by the spwids vector
494  casacore::Bool combineSpws(const casacore::Vector<casacore::Int>& spwids, // casacore::Vector<casacore::Int>(1,-1) means: use all SPWs
495  const casacore::Bool noModify, // if true, the casacore::MS will not be modified
496  casacore::Vector<casacore::Double>& newCHAN_FREQ, // will return the grid of the resulting SPW
497  casacore::Vector<casacore::Double>& newCHAN_WIDTH,
498  casacore::Bool verbose=false
499  );
500 
501  casacore::Bool combineSpws(const casacore::Vector<casacore::Int>& spwids = casacore::Vector<casacore::Int>(1,-1)){ // casacore::Vector<casacore::Int>(1,-1) means: use all SPWs
504  return combineSpws(spwids, false, temp1, temp2, true);
505  }
506 
507  // Fills mapper[ntok] with a map from dataColumn indices to ArrayColumns in
508  // the output. mapper must have ntok slots!
510  casacore::uInt ntok,
512 
514  void setWantCont(bool want_cont) {want_cont_p = want_cont;}
515 
516 
517  protected:
518 
519  //method that returns the selected ms (?! - but it's Boolean - RR)
521 
522  // (Sub)table fillers.
524  casacore::Bool fillDDTables(); // Includes spw and pol.
526 
527  // Used to be fillMainTable(colnames), but what distinguishes it from
528  // writeSomeMainRows(colnames) is that it is for cases where there is
529  // a 1-1 match between rows in mssel_p and msOut_p (including order).
531 
532  // Used to be fillAverMainTable(colnames), but what distinguishes it from
533  // writeAllMainRows(colnames) is that it is for cases where there is not
534  // necessarily a 1-1 match between rows in mssel_p and msOut_p.
536 
550 
551  // This falls between copyGenericSubtables() and the copiers for standard
552  // subtables like copyFeed(). It is for optional subtables like CALDEVICE
553  // and SYSPOWER which can be watched for by name and may need their
554  // ANTENNA_ID and SPECTRAL_WINDOW_ID columns remapped. (Technically FEED_ID,
555  // too, if split ever starts remapping feeds.)
556  //
557  // It must be called BEFORE copyGenericSubtables()!
558  //
560 
561  // casacore::Bool writeDiffSpwShape(const casacore::Vector<casacore::MS::PredefinedColumns>& colNames);
563 
564  // *** Private member functions ***
565 
566  // Adds and copies inTab to msOut_p without any filtering.
567  // tabName is the table "type", i.e. POINTING or SYSPOWER without the
568  // preceding path.
569  //
570  // If noRows is true, the structure will be setup but no rows will be
571  // copied. (Useful for filtering)
572  void copySubtable(const casacore::String& tabName, const casacore::Table& inTab,
573  const casacore::Bool noRows=false);
574 
576  const casacore::MS::PredefinedColumns colName);
578  const casacore::MS::PredefinedColumns colName);
580  const casacore::MS::PredefinedColumns datacol,
581  const casacore::Bool writeToDataCol=false);
583  const casacore::MS::PredefinedColumns datacol,
584  const casacore::Bool writeToDataCol=false);
585 
586  // This method uses VisIter for efficient copy mode data transfer
588  const casacore::Bool writeToDataCol);
589 
590  // Like doTimeAver(), but it subtracts the continuum instead of time
591  // averaging. Unlike doTimeAver(), it infers writeToDataCol from
592  // colNames.nelements() (subtractContinuum is intentionally not as general as
593  // copyDataFlagsWtSp), and writes according to fitoutspw_p instead of spw_p.
595  const VBRemapper& remapper);
596 
597  // Helper function for parseColumnNames(). Converts col to a list of
598  // casacore::MS::PredefinedColumnss, and returns the # of recognized data columns.
599  // static because parseColumnNames() is static.
602 
604 
606  std::map<casacore::Int, casacore::Int> >& vbmaps);
607 
608  // return the number of unique antennas selected
609  //casacore::Int numOfBaselines(casacore::Vector<casacore::Int>& ant1, casacore::Vector<casacore::Int>& ant2,
610  // casacore::Bool includeAutoCorr=false);
611 
612  // Used in a couple of places to estimate how much memory to grab.
614  sizeof(casacore::Complex);}
615 
616  // Picks a reference to DATA, MODEL_DATA, CORRECTED_DATA, or LAG_DATA out
617  // of ms_p. FLOAT_DATA is not included because it is not natively complex.
619  const casacore::MS::PredefinedColumns datacol);
620 
621  // The writable version of the above.
624  const casacore::Bool writeToDataCol);
625 
626  // Figures out the number, maximum, and index of the selected antennas.
627  casacore::uInt fillAntIndexer(std::map<casacore::Int, casacore::Int>& antIndexer, const casacore::ROMSColumns *msc);
628 
629  // Read the input, time average it to timeBin_p, and write the output.
630  // The first version uses VisibilityIterator (much faster), but the second
631  // supports correlation selection using VisIterator. VisIterator should be
632  // sped up soon!
634  const VBRemapper& remapper);
636  const VBRemapper& remapper);
637 
640  {
641  getDataColMap(msc_p, mapper, ntok, colEnums);
642  }
643 
644  // Returns whether or not the numbers of correlations and channels
645  // are independent of DATA_DESCRIPTION_ID, for both the input and output
646  // MSes.
648 
649  // Returns whether or not the input casacore::MS has a valid FLAG_CATEGORY, and its
650  // first row has the right number of correlations and channels.
652 
653  // Sets up sourceRelabel_p for mapping input SourceIDs (if any) to output
654  // ones. Must be called after fieldid_p is set and before calling
655  // fillFieldTable() or copySource().
656  void relabelSources();
657 
658  void relabelIDs();
659 
660  // Sets outcol to the indices of selvals that correspond to incol, i.e.
661  // outcol(i) = j s.t. selvals[j] == incol(i).
662  //
663  // Ideally selvals is set up so that outcol's values will be row numbers in
664  // the corresponding subtable of its ms.
665  //
666  // Throws an exception if incol and outcol do not have the same # of rows, or
667  // incol has a value that is not in selvals.
669  const casacore::Vector<casacore::Int>& selvals);
670 
671  // Equivalent to but slightly more efficient than
672  // remapColumn(outcol, incol, incol.getColumn()).
674 
675  //static void make_map(const casacore::Vector<casacore::Int>& mscol, casacore::Vector<casacore::Int>& mapper);
676 
677  // Sets mapper to to a map from the distinct values of inv, in increasing
678  // order, to 0, 1, 2, ..., mapper.size() - 1.
679  static void make_map(std::map<casacore::Int, casacore::Int>& mapper, const casacore::Vector<casacore::Int>& inv);
680  // Sets mapper to form a map from inv whose elements are mapped values. It skips
681  // to store in mapper if the value is -1
682  static void make_map2(std::map<casacore::Int, casacore::Int>& mapper, const casacore::Vector<casacore::Int>& inv);
683 
685 
686  // Sets up the stub of a POINTING, enough to create an MSColumns.
687  void setupNewPointing();
688 
689  // Sets sort to a casacore::Block of columns that a VisibilityIterator should sort by,
690  // according to combine_p. Columns that should never be combined in the
691  // calling function, i.e. spw for time averaging, should be listed in
692  // uncombinable.
693  //
694  // verbose: log a message on error.
695  //
696  // Returns whether or not there were any conflicts between combine_p and
697  // uncombinable.
699  const casacore::Bool verbose=true) const;
700 
701  // Returns whether col is (not in combine_p) || in uncombinable.
702  // Columns that should never be combined in the
703  // calling function, i.e. spw for time averaging, should be listed in
704  // uncombinable.
705  //
706  // verbose: log a message on error.
707  //
708  // conflict is set to true if there is a conflict between combine_p and
709  // uncombinable.
711  const casacore::String& uncombinable="",
712  const casacore::Bool verbose=true) const;
713 
714  // *** Member variables ***
715 
716  // Initialized* by ctors. (Maintain order both here and in ctors.)
717  // * not necessarily to anything useful.
719  casacore::MSColumns * msc_p; // columns of msOut_p
721  casacore::Bool keepShape_p, // Iff true, each output array has the
722  // same shape as the corresponding input one.
723  // sameShape_p, // Iff true, the shapes of the arrays do not
724  // // vary with row number.
725  antennaSel_p; // Selecting by antenna?
727  casacore::String scanString_p, // Selects scans by #number#. Historically named.
728  intentString_p, // Selects scans by string. scanString_p was taken.
729  obsString_p, // casacore::String for observationID selection.
731  taqlString_p;
733  casacore::String combine_p; // Should time averaging not split bins by
734  // scan #, observation, and/or state ID?
735  // Must be lowercase at all times.
736  casacore::Int fitorder_p; // The polynomial order for continuum fitting.
737  // If < 0 (default), continuum subtraction is
738  // not done.
739  casacore::String fitspw_p; // Selection string for line-free channels.
740  casacore::String fitoutspw_p; // Selection string for output channels if doing
741  // continuum subtraction.
742 
743  // jagonzal: Allow main table to be left empty, so that it can be filled by another layer.
745 
746  // Uninitialized by ctors.
748  casacore::Vector<casacore::Int> spw_p, // The input spw corresponding to each output spw.
749  spw_uniq_p, // Uniquified version of spw_p.
751  nchan_p, // The # of output channels for each range.
752  totnchan_p, // The # of output channels for each output spw.
753  chanStart_p, // 1st input channel index in a selection.
754  chanEnd_p, // last input channel index in a selection.
755  chanStep_p, // Increment between input chans, i.e. if 3, only every third
756  // input channel will be used.
757  widths_p, // # of input chans per output chan for each range.
758  ncorr_p, // The # of output correlations for each DDID.
759  inNumChan_p, // The # of input channels for each spw.
760  inNumCorr_p; // The # of input correlations for each DDID.
768 
769  casacore::Vector<casacore::Int> selObsId_p; // casacore::List of selected OBSERVATION_IDs.
770  casacore::Vector<casacore::Int> polID_p; // casacore::Map from input DDID to input polID, filled in fillDDTables().
772 
773  // inCorrInd = outPolCorrToInCorrMap_p[polID_p[ddID]][outCorrInd]
775 
776  std::map<casacore::Int, casacore::Int> stateRemapper_p;
777 
778  casacore::Vector<casacore::Vector<casacore::Slice> > chanSlices_p; // Used by VisIterator::selectChannel()
780  casacore::Vector<casacore::Vector<casacore::Slice> > corrSlices_p; // Used by VisIterator::selectCorrelation()
782 
783  bool tvi_debug;
785 };
786 
787 } //# NAMESPACE CASA - END
788 
789 #endif
790 
static casacore::lDouble freq_from_vopt(const casacore::lDouble vopt, const casacore::lDouble rest)
Definition: SubMS.h:339
A Vector of integers, for indexing into Array&lt;T&gt; objects.
Definition: IPosition.h:119
casacore::ROMSColumns * mscIn_p
Definition: SubMS.h:720
A Measure: astronomical direction.
Definition: MDirection.h:174
casacore::String combine_p
Definition: SubMS.h:733
casacore::Vector< casacore::Int > fieldid_p
Definition: SubMS.h:761
casacore::Vector< casacore::Int > widths_p
input channel will be used.
Definition: SubMS.h:748
A 1-D Specialization of the Array class.
void fill_vbmaps(std::map< VisBufferComponents::EnumType, std::map< casacore::Int, casacore::Int > > &vbmaps)
A Measure: position on Earth.
Definition: MPosition.h:79
void copySubtable(const casacore::String &tabName, const casacore::Table &inTab, const casacore::Bool noRows=false)
*** Private member functions ***
static casacore::lDouble vrad(const casacore::lDouble freq, const casacore::lDouble rest)
the following inline convenience methods for regridSpw bypass the whole CASA measure system because w...
Definition: SubMS.h:335
int Int
Definition: aipstype.h:50
casacore::Bool fillAllTables(const casacore::Vector< casacore::MS::PredefinedColumns > &colNames)
(Sub)table fillers.
casacore::Vector< casacore::Int > polID_p
Definition: SubMS.h:770
casacore::Bool selectSource(const casacore::Vector< casacore::Int > &fieldid)
Select source or field.
void relabelIDs()
casacore::Vector< casacore::Int > chanEnd_p
Definition: SubMS.h:748
casacore::MSColumns * msc_p
Definition: SubMS.h:719
static casacore::Bool getCorrMaps(casacore::MSSelection &mssel, const casacore::MeasurementSet &ms, casacore::Vector< casacore::Vector< casacore::Int > > &outToIn, const casacore::Bool areSelecting=false)
Fills outToIn[pol] with a map from output correlation index to input correlation index, for each input polID pol.
casacore::Bool areDataShapesConstant()
Returns whether or not the numbers of correlations and channels are independent of DATA_DESCRIPTION_I...
static void getDataColMap(casacore::MSColumns *msc, casacore::ArrayColumn< casacore::Complex > *mapper, casacore::uInt ntok, const casacore::Vector< casacore::MS::PredefinedColumns > &colEnums)
Fills mapper[ntok] with a map from dataColumn indices to ArrayColumns in the output.
casacore::Bool combineSpws(const casacore::Vector< casacore::Int > &spwids=casacore::Vector< casacore::Int >(1,-1))
Definition: SubMS.h:501
bool want_cont_p
Definition: SubMS.h:784
Main interface class to a read/write table.
Definition: Table.h:153
static casacore::Bool pickAntennas(casacore::Vector< casacore::Int > &selected_antennaids, casacore::Vector< casacore::String > &selected_antenna_strs, const casacore::Vector< casacore::Int > &antennaids, const casacore::Vector< casacore::String > &antennaSel)
casacore::Bool copyWeather()
VBRemappers remap VisBuffers.
Definition: VBRemapper.h:67
casacore::Vector< casacore::Int > antennaId_p
Definition: SubMS.h:765
double sigToWeight(casacore::Double sig)
static std::set< casacore::Int > findBadSpws(casacore::MeasurementSet &ms, casacore::Vector< casacore::Int > spwv)
Returns the set (possibly empty) of spectral windows that are in spwv but not listed in ms&#39;s DATA_DES...
static casacore::lDouble lambda(const casacore::lDouble freq)
Definition: SubMS.h:337
asdmStManUseAlternatives
Definition: SubMS.h:124
casacore::String scanString_p
Definition: SubMS.h:727
casacore::Bool copySyscal()
void selectArray(const casacore::String &subarray)
Select array IDs to use.
Definition: SubMS.h:197
casacore::Vector< casacore::Int > spwRelabel_p
Definition: SubMS.h:762
static casacore::uInt addOptionalColumns(const casacore::Table &inTab, casacore::Table &outTab, const casacore::Bool beLazy=false)
Add optional columns to outTab if present in inTab and possColNames.
const casacore::ArrayColumn< casacore::Complex > & right_column(const casacore::ROMSColumns *ms_p, const casacore::MS::PredefinedColumns datacol)
Picks a reference to DATA, MODEL_DATA, CORRECTED_DATA, or LAG_DATA out of ms_p.
static casacore::lDouble freq_from_vrad(const casacore::lDouble vrad, const casacore::lDouble rest)
Definition: SubMS.h:338
static casacore::Bool copyCols(casacore::Table &out, const casacore::Table &in, const casacore::Bool flush=true)
Like casacore::TableCopy::copyRows, but by column.
casacore::Int regridSpw(casacore::String &message, const casacore::String &outframe="", const casacore::String &regridQuant="chan", const casacore::Double regridVeloRestfrq=-3E30, const casacore::String &regridInterpMeth="LINEAR", const casacore::Double regridCenter=-3E30, const casacore::Double regridBandwidth=-1., const casacore::Double regridChanWidth=-1., const casacore::Bool doHanningSmooth=false, const casacore::Int phaseCenterFieldId=-2, casacore::MDirection phaseCenter=casacore::MDirection(), const casacore::Bool centerIsStart=false, const casacore::Bool startIsEnd=false, const casacore::Int nchan=0, const casacore::Int width=0, const casacore::Int start=-1)
Transform spectral data to different reference frame, optionally regrid the frequency channels return...
casacore::Bool subtractContinuum(const casacore::Vector< casacore::MS::PredefinedColumns > &colNames, const VBRemapper &remapper)
Like doTimeAver(), but it subtracts the continuum instead of time averaging.
casacore::Vector< casacore::Vector< casacore::Int > > inPolOutCorrToInCorrMap_p
inCorrInd = outPolCorrToInCorrMap_p[polID_p[ddID]][outCorrInd]
Definition: SubMS.h:774
casacore::Bool shouldWatch(casacore::Bool &conflict, const casacore::String &col, const casacore::String &uncombinable="", const casacore::Bool verbose=true) const
Returns whether col is (not in combine_p) || in uncombinable.
virtual ~SubMS()
casacore::Bool doTimeAverVisIterator(const casacore::Vector< casacore::MS::PredefinedColumns > &dataColNames, const VBRemapper &remapper)
casacore::uInt remapped(const casacore::Int ov, const casacore::Vector< casacore::Int > &mapper, casacore::uInt i)
casacore::Bool makeSubMS(casacore::String &submsname, casacore::String &whichDataCol, const casacore::Vector< casacore::Int > &tileShape=casacore::Vector< casacore::Int >(1, 0), const casacore::String &combine="")
Method to make the subMS.
ostream-like interface to creating log messages.
Definition: LogIO.h:167
A Measure: radial velocity.
void setFitSpw(const casacore::String &fitspw)
Set the selection string for line-free channels.
Definition: SubMS.h:211
casacore::Bool makeSelection()
method that returns the selected ms (?! - but it&#39;s Boolean - RR)
casacore::String taqlString_p
Definition: SubMS.h:727
PredefinedColumns
The Main table colums with predefined meaning.
Definition: MSMainEnums.h:65
casacore::Bool keepShape_p
Definition: SubMS.h:721
static void make_map2(std::map< casacore::Int, casacore::Int > &mapper, const casacore::Vector< casacore::Int > &inv)
Sets mapper to form a map from inv whose elements are mapped values.
A Measure: instant in time.
Definition: MEpoch.h:104
casacore::Vector< casacore::Int > selObsId_p
Definition: SubMS.h:769
casacore::Bool getDataColumn(casacore::ArrayColumn< casacore::Complex > &data, const casacore::MS::PredefinedColumns colName)
casacore::Bool fillMainTable_p
continuum subtraction.
Definition: SubMS.h:744
casacore::Bool copyAntenna()
Complex correlation function or lag spectrum for each correlation product Complex(Nc, Nl)
Definition: MSMainEnums.h:201
casacore::Vector< casacore::Slice > corrSlice_p
Definition: SubMS.h:779
ABSTRACT CLASSES Deliberately vague to be general enough to allow for many different types of data
Definition: PlotData.h:48
casacore::Bool copyPointing()
casacore::String timeRange_p
Definition: SubMS.h:732
casacore::MeasurementSet ms_p
*** Member variables ***
Definition: SubMS.h:718
casacore::Bool writeAllMainRows(const casacore::Vector< casacore::MS::PredefinedColumns > &colNames)
Used to be fillMainTable(colnames), but what distinguishes it from writeSomeMainRows(colnames) is tha...
double wtToSigma(casacore::Double wt)
Returns wt**-0.5 or -1, depending on whether wt is positive.
casacore::Bool copyGenericSubtables()
casacore::Bool combineSpws(const casacore::Vector< casacore::Int > &spwids, const casacore::Bool noModify, casacore::Vector< casacore::Double > &newCHAN_FREQ, casacore::Vector< casacore::Double > &newCHAN_WIDTH, casacore::Bool verbose=false)
combineSpws(): make one spectral window from all spws given by the spwids vector
void selectTime(casacore::Double timeBin=-1.0, casacore::String timerng="")
select time parameters
casacore::Bool doTimeAver(const casacore::Vector< casacore::MS::PredefinedColumns > &dataColNames, const VBRemapper &remapper)
Read the input, time average it to timeBin_p, and write the output.
casacore::Bool fillFieldTable()
casacore::MeasurementSet msOut_p
Uninitialized by ctors.
Definition: SubMS.h:747
casacore::Bool setSortOrder(casacore::Block< casacore::Int > &sort, const casacore::String &uncombinable="", const casacore::Bool verbose=true) const
Sets sort to a casacore::Block of columns that a VisibilityIterator should sort by, according to combine_p.
void setTVIDebug(bool debug)
Definition: SubMS.h:513
casacore::Bool writeSomeMainRows(const casacore::Vector< casacore::MS::PredefinedColumns > &colNames)
Used to be fillAverMainTable(colnames), but what distinguishes it from writeAllMainRows(colnames) is ...
casacore::Vector< casacore::Int > chanStep_p
Definition: SubMS.h:748
existing table
Definition: Table.h:170
casacore::Bool copyProcessor()
double Double
Definition: aipstype.h:55
Floating point data column.
Definition: MSMainEnums.h:192
casacore::String fitoutspw_p
Definition: SubMS.h:740
A class to provide easy read-only access to MeasurementSet columns.
Definition: MSColumns.h:111
casacore::Vector< casacore::Int > nchan_p
Definition: SubMS.h:748
casacore::String intentString_p
Definition: SubMS.h:727
casacore::Vector< casacore::Int > inNumChan_p
Definition: SubMS.h:748
casacore::String arrayExpr_p
Definition: SubMS.h:732
casacore::Vector< casacore::Int > chanStart_p
Definition: SubMS.h:748
void setWantCont(bool want_cont)
Definition: SubMS.h:514
casacore::Vector< casacore::Int > fieldRelabel_p
Definition: SubMS.h:762
casacore::Bool createPartnerColumn(casacore::TableDesc &modMSTD, const casacore::String &oldName, const casacore::String &newName, const casacore::Int &hypercolumnDim, const casacore::IPosition &tileShape)
Support method for regridSpw(): results in the column oldName being renamed to newName, and a new column which is an empty copy of oldName being created together with a TileShapeStMan data manager and hypercolumn (name copied from the old hypercolumn) with given dimension, the old hypercolumn of name hypercolumnName is renamed to name+&quot;B&quot;.
bool tvi_debug
Definition: SubMS.h:783
casacore::Vector< casacore::Int > spwind_to_min_spwind_p
Definition: SubMS.h:748
casacore::Vector< casacore::uInt > spw2ddid_p
Definition: SubMS.h:771
MSSelection: Class to represent a selection on an MS.
Definition: MSSelection.h:118
casacore::Bool putDataColumn(casacore::MSColumns &msc, casacore::ArrayColumn< casacore::Complex > &data, const casacore::MS::PredefinedColumns datacol, const casacore::Bool writeToDataCol=false)
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
static const casacore::Vector< casacore::MS::PredefinedColumns > & parseColumnNames(casacore::String colNameList)
Declared static because it&#39;s used in setupMS().
Read and write access to an array table column with arbitrary data type.
Definition: Reweighter.h:48
casacore::Vector< casacore::Int > oldDDSpwMatch_p
Definition: SubMS.h:763
RegriddingAlternatives
Definition: SubMS.h:119
casacore::Bool copyDataFlagsWtSp(const casacore::Vector< casacore::MS::PredefinedColumns > &colNames, const casacore::Bool writeToDataCol)
This method uses VisIter for efficient copy mode data transfer.
static casacore::Bool convertGridPars(casacore::LogIO &os, const casacore::String &mode, const int nchan, const casacore::String &start, const casacore::String &width, const casacore::String &interp, const casacore::String &restfreq, const casacore::String &outframe, const casacore::String &veltype, casacore::String &t_mode, casacore::String &t_outframe, casacore::String &t_regridQuantity, casacore::Double &t_restfreq, casacore::String &t_regridInterpMeth, casacore::Double &t_cstart, casacore::Double &t_bandwidth, casacore::Double &t_cwidth, casacore::Bool &t_centerIsStart, casacore::Bool &t_startIsEnd, casacore::Int &t_nchan, casacore::Int &t_width, casacore::Int &t_start)
a helper function for handling the gridding parameter user input
static casacore::uInt dataColStrToEnums(const casacore::String &col, casacore::Vector< casacore::MS::PredefinedColumns > &colvec)
Helper function for parseColumnNames().
casacore::Bool fillDDTables()
static casacore::MeasurementSet * setupMS(const casacore::String &msname, const casacore::Int nchan, const casacore::Int npol, const casacore::String &telescop, const casacore::Vector< casacore::MS::PredefinedColumns > &colNamesTok, const casacore::Int obstype=0, const casacore::Bool compress=false, const asdmStManUseAlternatives asdmStManUse=DONT)
This sets up a default new ms Declared static as it can be (and is) called directly outside of SubMS...
uInt nrow() const
Get the number of rows.
Definition: Table.h:1201
static casacore::Bool mustConvertToData(const casacore::uInt nTok, const casacore::Vector< casacore::MS::PredefinedColumns > &datacols)
The output casacore::MS must have (at least?) 1 of DATA, FLOAT_DATA, or LAG_DATA. ...
Definition: SubMS.h:285
casacore::Double n_bytes()
return the number of unique antennas selected casacore::Int numOfBaselines(casacore::Vector&lt;casacore...
Definition: SubMS.h:613
casacore::Matrix< casacore::Double > selTimeRanges_p
Definition: SubMS.h:781
void verifyColumns(const casacore::MeasurementSet &ms, const casacore::Vector< casacore::MS::PredefinedColumns > &colNames)
static casacore::Bool regridChanBounds(casacore::Vector< casacore::Double > &newChanLoBound, casacore::Vector< casacore::Double > &newChanHiBound, const casacore::Double regridCenter, const casacore::Double regridBandwidth, const casacore::Double regridChanWidth, const casacore::Double regridVeloRestfrq, const casacore::String regridQuant, const casacore::Vector< casacore::Double > &transNewXin, const casacore::Vector< casacore::Double > &transCHAN_WIDTH, casacore::String &message, const casacore::Bool centerIsStart=false, const casacore::Bool startIsEnd=false, const casacore::Int nchan=0, const casacore::Int width=0, const casacore::Int start=-1)
Support method for regridSpw(): calculate the final new channel boundaries from the regridding parame...
void setFitOutSpw(const casacore::String &fitoutspw)
Selection string for output channels if doing continuum subtraction.
Definition: SubMS.h:213
A hierarchical collection of named fields of various types.
Definition: TableRecord.h:182
casacore::Bool copyObservation()
std::map< casacore::Int, casacore::Int > stateRemapper_p
Definition: SubMS.h:776
A Table intended to hold astronomical data (a set of Measurements).
casacore::Bool filterOptSubtable(const casacore::String &subtabname)
This falls between copyGenericSubtables() and the copiers for standard subtables like copyFeed()...
long double lDouble
Definition: aipstype.h:56
static casacore::lDouble freq_from_lambda(const casacore::lDouble lambda)
Definition: SubMS.h:340
casacore::Bool antennaSel_p
same shape as the corresponding input one.
Definition: SubMS.h:721
bool debug
SubMS(casacore::String &theMS, casacore::Table::TableOption option=casacore::Table::Old)
void remapColumn(casacore::ScalarColumn< casacore::Int > &outcol, const casacore::ScalarColumn< casacore::Int > &incol, const casacore::Vector< casacore::Int > &selvals)
Sets outcol to the indices of selvals that correspond to incol, i.e.
casacore::String uvrangeString_p
Definition: SubMS.h:727
casacore::Vector< casacore::Int > totnchan_p
Definition: SubMS.h:748
casacore::MeasurementSet mssel_p
Definition: SubMS.h:718
casacore::Bool copyFlag_Cmd()
static casacore::lDouble vopt(const casacore::lDouble freq, const casacore::lDouble rest)
Definition: SubMS.h:336
casacore::Bool isAllColumns(const casacore::Vector< casacore::MS::PredefinedColumns > &colNames)
// These typedefs are necessary because a&lt;b::c&gt; doesn&#39;t work.
casacore::Bool copyFeed()
void copyMainTableKeywords(casacore::TableRecord &outKeys, const casacore::TableRecord &inKeys)
casacore::Bool existsFlagCategory() const
Returns whether or not the input casacore::MS has a valid FLAG_CATEGORY, and its first row has the ri...
static void createSubtables(casacore::MeasurementSet &ms, casacore::Table::TableOption option)
A customized version of casacore::MS::createDefaultSubtables().
casacore::Int fitorder_p
scan #, observation, and/or state ID? Must be lowercase at all times.
Definition: SubMS.h:736
const Double c
Fundamental physical constants (SI units):
casacore::Bool selectSpw(const casacore::String &spwstr, const casacore::Vector< casacore::Int > &steps)
Select spw and channels for each spw.
A class to provide easy read-write access to MeasurementSet columns.
Definition: MSColumns.h:221
casacore::uInt fillAntIndexer(std::map< casacore::Int, casacore::Int > &antIndexer, const casacore::ROMSColumns *msc)
Figures out the number, maximum, and index of the selected antennas.
casacore::Bool fillAccessoryMainCols()
casacore::Bool writeDiffSpwShape(const casacore::Vector&lt;casacore::MS::PredefinedColumns&gt;&amp; colNames); ...
String: the storage and methods of handling collections of characters.
Definition: String.h:223
casacore::Vector< casacore::Int > inNumCorr_p
Definition: SubMS.h:748
static void make_map(std::map< casacore::Int, casacore::Int > &mapper, const casacore::Vector< casacore::Int > &inv)
static void make_map(const casacore::Vector&lt;casacore::Int&gt;&amp; mscol, casacore::Vector&lt;casacore::Int&gt;&amp; m...
casacore::Bool doChannelMods(const casacore::Vector< casacore::MS::PredefinedColumns > &colNames)
casacore::Vector< casacore::Vector< casacore::Slice > > corrSlices_p
Definition: SubMS.h:780
void relabelSources()
Sets up sourceRelabel_p for mapping input SourceIDs (if any) to output ones.
casacore::Bool copyHistory()
casacore::String fitspw_p
If &lt; 0 (default), continuum subtraction is not done.
Definition: SubMS.h:739
Define the structure of a Casacore table.
Definition: TableDesc.h:187
casacore::Bool copySource()
casacore::Double timeBin_p
Definition: SubMS.h:726
casacore::Bool setRegridParameters(std::vector< casacore::Int > &oldSpwId, std::vector< casacore::Int > &oldFieldId, std::vector< casacore::Int > &newDataDescId, std::vector< casacore::Bool > &regrid, std::vector< casacore::Bool > &transform, std::vector< casacore::MDirection > &theFieldDirV, std::vector< casacore::MPosition > &mObsPosV, std::vector< casacore::MFrequency::Types > &fromFrameTypeV, std::vector< casacore::MFrequency::Ref > &outFrameV, std::vector< casacore::MRadialVelocity > &outRadVelV, std::vector< casacore::Double > &weightScaleV, std::vector< casacore::Vector< casacore::Double > > &xold, std::vector< casacore::Vector< casacore::Double > > &xout, std::vector< casacore::Vector< casacore::Double > > &xin, vector< casacore::Int > &method, casacore::Bool &msMod, const casacore::String &outframe, const casacore::String &regridQuant, const casacore::Double regridVeloRestfrq, const casacore::String &regridInterpMeth, const casacore::Double regridCenter, const casacore::Double regridBandwidth, const casacore::Double regridChanWidth, const casacore::Int regridPhaseCenterFieldId, const casacore::MDirection regridPhaseCenter, const casacore::Bool writeTables, casacore::LogIO &os, casacore::String &regridMessage, const casacore::Bool centerIsStart=false, const casacore::Bool startIsEnd=false, const casacore::Int nchan=0, const casacore::Int width=0, const casacore::Int start=-1)
Support method for regridSpw(): if writeTables is false, the (const) input parameters are only verifi...
static casacore::Bool calcChanFreqs(casacore::LogIO &os, casacore::Vector< casacore::Double > &newCHAN_FREQ, casacore::Vector< casacore::Double > &newCHAN_WIDTH, const casacore::Vector< casacore::Double > &oldCHAN_FREQ, const casacore::Vector< casacore::Double > &oldCHAN_WIDTH, const casacore::MDirection phaseCenter, const casacore::MFrequency::Types theOldRefFrame, const casacore::MEpoch theObsTime, const casacore::MPosition mObsPos, const casacore::String &mode, const int nchan, const casacore::String &start, const casacore::String &width, const casacore::String &restfreq, const casacore::String &outframe, const casacore::String &veltype, const casacore::Bool verbose=false, const casacore::MRadialVelocity mRV=casacore::MRadialVelocity())
A wrapper for SubMS::regridChanBounds() which takes the user interface type gridding parameters The r...
Types
Types of known MFrequencies Warning: The order defines the order in the translation matrix FromTo in...
Definition: MFrequency.h:176
casacore::Vector< casacore::Int > spw_uniq_p
Definition: SubMS.h:748
casacore::Vector< casacore::Int > spw_p
Definition: SubMS.h:748
casacore::Vector< casacore::Int > antNewIndex_p
Definition: SubMS.h:767
casacore::Vector< casacore::String > antennaSelStr_p
Definition: SubMS.h:764
static void remap(casacore::Vector< casacore::Int > &col, const casacore::Vector< casacore::Int > &mapper)
Replaces col[i] with mapper[col[i]] for each element of col.
casacore::Bool setmsselect(const casacore::String &spw="", const casacore::String &field="", const casacore::String &baseline="", const casacore::String &scan="", const casacore::String &uvrange="", const casacore::String &taql="", const casacore::Vector< casacore::Int > &step=casacore::Vector< casacore::Int >(1, 1), const casacore::String &subarray="", const casacore::String &correlation="", const casacore::String &intent="", const casacore::String &obs="")
select casacore::Time and time averaging or regridding void selectTime();
virtual casacore::MeasurementSet * makeScratchSubMS(const casacore::Vector< casacore::MS::PredefinedColumns > &whichDataCols, const casacore::Bool forceInMemory=false)
Method to make a scratch subMS and even in memory if posssible Useful if temporary subselection/avera...
void setMS(casacore::MeasurementSet &ms)
Change or Set the casacore::MS this casacore::MSSelector refers to.
casacore::String corrString_p
Definition: SubMS.h:732
casacore::Bool copyState()
MSTransformManager definition.
void setupNewPointing()
Sets up the stub of a POINTING, enough to create an MSColumns.
casacore::Vector< casacore::Int > sourceRelabel_p
Definition: SubMS.h:762
void setFitOrder(casacore::Int fitorder, casacore::Bool advise=true)
void selectSource(casacore::Vector&lt;casacore::String&gt; sourceid);
unsigned int uInt
Definition: aipstype.h:51
void selectAntenna(const casacore::Vector< casacore::Int > &antennaids, const casacore::Vector< casacore::String > &antennaSel)
Select Antennas to split out.
Definition: SubMS.h:185
casacore::Vector< casacore::Int > ncorr_p
Definition: SubMS.h:748
TableOption
Define the possible options how a table can be opened.
Definition: Table.h:168
casacore::String obsString_p
Definition: SubMS.h:727
casacore::Bool selectCorrelations(const casacore::String &corrstr)
Setup polarization selection (for now, only from available correlations - no casacore::Stokes transfo...
void getDataColMap(casacore::ArrayColumn< casacore::Complex > *mapper, casacore::uInt ntok, const casacore::Vector< casacore::MS::PredefinedColumns > &colEnums)
Definition: SubMS.h:638
transform(a.begin(), a.end(), std::ostream_iterator< int >(cout,"\n"), compose(unary(h), compose(unary(f), unary(f))))
Global Functions.
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42
static casacore::Bool sepFloat(const casacore::Vector< casacore::MS::PredefinedColumns > &anyDataCols, casacore::Vector< casacore::MS::PredefinedColumns > &complexDataCols)
casacore::Vector< casacore::Vector< casacore::Slice > > chanSlices_p
Definition: SubMS.h:778
casacore::Vector< casacore::Int > antIndexer_p
Definition: SubMS.h:766