casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
VisibilityIteratorImpl.h
Go to the documentation of this file.
1 //# VisibilityIterator.h: Step through the MeasurementEquation by visibility
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 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //# $Id: VisibilityIterator.h,v 19.14 2006/02/28 04:48:58 mvoronko Exp $
27 
28 #ifndef MSVIS_VISIBILITYITERATORIMPL_H
29 #define MSVIS_VISIBILITYITERATORIMPL_H
30 
31 #include <stack>
32 #include <casa/aips.h>
33 #include <casa/Arrays/Matrix.h>
34 #include <casa/Arrays/Cube.h>
35 #include <casa/Arrays/Slicer.h>
39 #include <casa/Quanta/MVDoppler.h>
44 #include <casa/BasicSL/String.h>
47 
54 
55 #include <map>
56 #include <vector>
57 
58 namespace casa { //# NAMESPACE CASA - BEGIN
59 
60 //# forward decl
61 class VisBuffer;
62 
63 
64 
65 // <summary>
66 // ROVisibilityIterator iterates through one or more readonly MeasurementSets
67 // </summary>
68 
69 // <use visibility=export>
70 
71 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
72 // </reviewed>
73 
74 // <prerequisite>
75 // <li> <linkto class="MSIter">MSIter</linkto>
76 // <li> <linkto class="casacore::MeasurementSet">casacore::MeasurementSet</linkto>
77 // <li> <linkto class="VisSet">VisSet</linkto>
78 // </prerequisite>
79 //
80 // <etymology>
81 // The ROVisibilityIterator is a readonly iterator returning visibilities
82 // </etymology>
83 //
84 // <synopsis>
85 // ROVisibilityIterator provides iteration with various sort orders
86 // for one or more MSs. It has member functions to retrieve the fields
87 // commonly needed in synthesis calibration and imaging.
88 //
89 // One should use <linkto class="VisBuffer">VisBuffer</linkto>
90 // to access chunks of data.
91 // </synopsis>
92 //
93 // <example>
94 // <code>
95 // //
96 // </code>
97 // </example>
98 //
99 // <motivation>
100 // For imaging and calibration you need to access an casacore::MS in some consistent
101 // order (by field, spectralwindow, time interval etc.). This class provides
102 // that access.
103 // </motivation>
104 //
105 // <thrown>
106 // <li>
107 // <li>
108 // </thrown>
109 //
110 // <todo asof="1997/05/30">
111 // <li> cleanup the currently dual interface for visibilities and flags
112 // <li> sort out what to do with weights when interpolating
113 // </todo>
114 
116 
117  friend class AsyncEnabler;
118  friend class ViReadImplAsync;
120  friend class ROVisibilityIterator;
121  friend class ROVisIterator;
122  friend class VisIterator;
123  friend class VLAT; // allow VI lookahead thread class to access protected functions
124  // VLAT should not access private parts, especially variables
125 
126 public:
127 
128  //# the following is a copy of the enum in MSIter
129  //# can't think of a way to get one that known to the outside world from here
130  // enum PolFrame {
131  // // Circular polarization
132  // Circular=0,
133  // // Linear polarization
134  // Linear=1
135  // };
136  //
137  // enum DataColumn {
138  // // Observed data
139  // Observed=0,
140  // // Model data
141  // Model,
142  // // Corrected data
143  // Corrected
144  // };
145 
147 
148  // class AsyncEnabler {
149  // public:
150  // AsyncEnabler (ROVisibilityIterator &);
151  // AsyncEnabler (ROVisibilityIterator *);
152  // ~AsyncEnabler ();
153  //
154  // void release ();
155  //
156  // private:
157  //
158  // casacore::Bool oldEnabledState_p;
159  // ROVisibilityIterator * roVisibilityIterator_p;
160  // };
161 
162  // Default constructor - useful only to assign another iterator later
164 
165  // Construct from an casacore::MS and a casacore::Block of casacore::MS column enums specifying the
166  // iteration order. If no order is specified, it uses the default sort
167  // order of MSIter, which is not necessarily the raw order of ms!
168  // The default ordering is ARRAY_ID, FIELD_ID, DATA_DESC_ID,
169  // and TIME, but check MSIter.h to be sure.
170  // These columns will be added first if they are not specified.
171  //
172  // An optional timeInterval (in seconds) can be given to iterate through
173  // chunks of time. The default interval of 0 groups all times together.
174  // Every 'chunk' of data contains all data within a certain time interval and
175  // with identical values of the other iteration columns (e.g. DATA_DESC_ID
176  // and FIELD_ID). Using selectChannel (), a number of groups of channels can
177  // be requested. At present the channel group iteration will always occur
178  // before the interval iteration.
179 // VisibilityIteratorReadImpl (const casacore::MeasurementSet & ms,
180 // const casacore::Block<casacore::Int> & sortColumns,
181 // casacore::Double timeInterval = 0);
182 
183  // Same as above, but with the option of using the raw order of ms
184  // (addDefaultSortCols=false).
185 // VisibilityIteratorReadImpl (const casacore::MeasurementSet & ms,
186 // const casacore::Block<casacore::Int> & sortColumns, const casacore::Bool addDefaultSortCols,
187 // casacore::Double timeInterval = 0);
188 
189  // Same as previous constructors, but with multiple MSs to iterate over.
190 // VisibilityIteratorReadImpl (const casacore::Block<casacore::MeasurementSet> & mss,
191 // const casacore::Block<casacore::Int> & sortColumns,
192 // casacore::Double timeInterval = 0);
193 
196  const casacore::Block<casacore::Int> & sortColumns,
197  const casacore::Bool addDefaultSortCols,
199 
200  // Copy construct. This calls the assigment operator.
202  ROVisibilityIterator * rovi);
203 
204  // Assigment. Any attached VisBuffers are lost in the assign.
206 
207  // Destructor
208  virtual ~VisibilityIteratorReadImpl ();
209 
210  virtual VisibilityIteratorReadImpl * clone (ROVisibilityIterator * rovi) const;
211 
212  // Members
213 
215 
216  virtual casacore::Bool isWritable () const {
217  return false;
218  }
219 
220  // Reset iterator to origin/start of data (of current chunk)
221  virtual void origin ();
222  // Reset iterator to true start of data (first chunk)
223  virtual void originChunks ();
224 
225  // Return the time interval (in seconds) used for iteration.
226  // This is not the same as the INTERVAL column.
227  virtual casacore::Double getInterval() const { return timeInterval_p; }
228 
229  // Set or reset the time interval (in seconds) to use for iteration.
230  // You should call originChunks () to reset the iteration after
231  // calling this.
233  msIter_p.setInterval (timeInterval);
235  }
236 
237  // Set the 'blocking' size for returning data.
238  // With the default (0) only a single integration is returned at a time, this
239  // is what is currently required for the calibration software. With blocking
240  // set, up to nRows can be returned in one go. The chunk
241  // size determines the actual maximum.
242  virtual void setRowBlocking (casacore::Int nRows = 0);
243 
245 
246  // Return false if no more data (in current chunk)
247  virtual casacore::Bool more () const;
248 
249  virtual SubChunkPair getSubchunkId () const;
250 
251  virtual const casacore::Block<casacore::Int>& getSortColumns() const;
252 
253  // Return false if no more 'Chunks' of data left
254  virtual casacore::Bool moreChunks () const {
255  return msIter_p.more ();
256  }
257 
258  // Check if ms has change since last iteration
259  virtual casacore::Bool newMS () const {
260  return msIter_p.newMS ();
261  }
262 
263  virtual casacore::Int msId () const {
264  return msIter_p.msId ();
265  }
266 
267  virtual VisBuffer * getVisBuffer ();
268 
269  //reference to actual ms in interator
270  virtual const casacore::MeasurementSet & ms () const {
271  return msIter_p.ms ();
272  }
273  // Advance to the next Chunk of data
275 
276  // Return antenna1
278 
279  // Return antenna2
281 
282  // Return feed1
284 
285  // Return feed2
287 
288  // Return channel numbers in selected VisSet spectrum
289  // (i.e. disregarding possible selection on the iterator, but
290  // including the selection set when creating the VisSet)
292 
293  // Return feed configuration matrix for specified antenna
296 
297  // Return receptor angles for all antennae and feeds
298  // First axis of the cube is a receptor number,
299  // 2nd is antennaId, 3rd is feedId
300  // Note: the method is intended to provide an access to MSIter::receptorAngles
301  // for VisBuffer in the multi-feed case. It may be worth to change the
302  // interface of feed_pa to return the information for all feeds.
303  virtual const casacore::Cube<casacore::Double> & receptorAngles () const;
304 
305  // return a string mount identifier for each antenna
306  virtual const casacore::Vector<casacore::String> & antennaMounts () const;
307 
308  // Return a cube containing pairs of coordinate offsets for each
309  // receptor of each feed (values are in radians, coordinate system is fixed
310  // with antenna and is the same one as used to define the BEAM_OFFSET
311  // parameter in the feed table). The cube axes are receptor, antenna, feed.
313 
314  // true if all elements of the cube returned by getBeamOffsets are zero
315  virtual casacore::Bool allBeamOffsetsZero () const;
316 
317  // Return feed parallactic angles casacore::Vector (nant) (1 feed/ant)
320  casacore::Int nAntennas, const casacore::MEpoch & mEpoch0,
321  const casacore::Vector<casacore::Float> & receptor0Angle);
322 
323  // Return nominal parallactic angle at specified time
324  // (does not include feed position angle offset--see feed_pa)
325  // A global value for all antennas (e.g., small array)
326  virtual const casacore::Float & parang0 (casacore::Double time) const;
328 
329  // Per antenna:
332  int nAntennas, const casacore::MEpoch mEpoch0);
333 
334  // Return the antenna AZ/EL casacore::Vector (nant)
337  casacore::MDirection & azel0, const casacore::MEpoch & mEpoch0);
338 
341  casacore::Int nAnt, const casacore::MEpoch & mEpoch0);
342 
343 
344  // Return the hour angle for the specified time
347 
348  // Return the current FieldId
349  virtual casacore::Int fieldId () const {
350  return msIter_p.fieldId ();
351  }
352 
353  // Return the current ArrayId
354  virtual casacore::Int arrayId () const {
355  return msIter_p.arrayId ();
356  }
357 
358  // Return the current Field Name
359  virtual casacore::String fieldName () const {
360  return msIter_p.fieldName ();
361  }
362 
363  // Return the current Source Name
364  virtual casacore::String sourceName () const {
365  return msIter_p.sourceName ();
366  }
367 
368  // Return flag for each polarization, channel and row
370 
371  // Return flag for each channel & row
373 
374  // Determine whether FLAG_CATEGORY is valid.
376 
377  // Return flags for each polarization, channel, category, and row.
379 
380  // Return row flag
382 
383  // Return scan number
385 
386  // Return the OBSERVATION_IDs
388 
389  // Return the PROCESSOR_IDs
391 
392  // Return the STATE_IDs
394 
395  // Return current frequencies (in Hz, acc. to the casacore::MS def'n v.2)
397 
398  // Return frequencies (in Hz, acc. to the casacore::MS def'n v.2) in selected velocity frame,
399  // returns the same as frequency () if there is no vel selection active.
401 
402  // Return the current phase center as an MDirection
403  virtual const casacore::MDirection & phaseCenter () const {
404  return msIter_p.phaseCenter ();
405  }
406 
407  virtual const casacore::MDirection phaseCenter (const casacore::Int fieldId, const casacore::Double time=-1.0) const {
408  return time >0.0 ? msIter_p.phaseCenter (fieldId, time) : msIter_p.phaseCenter () ;
409  }
410  // Return frame for polarization (returns PolFrame enum)
411  virtual casacore::Int polFrame () const {
412  return msIter_p.polFrame ();
413  }
414 
415  // Return the correlation type (returns casacore::Stokes enums)
417 
418  // Return sigma
420 
421  // Return sigma matrix (pol-dep)
423 
424  // Return current SpectralWindow
425  virtual casacore::Int spectralWindow () const {
426  return msIter_p.spectralWindowId ();
427  }
428 
429  // Return current Polarization Id
430  virtual casacore::Int polarizationId () const {
431  return msIter_p.polarizationId ();
432  }
433 
434  // Return current DataDescription Id
435  virtual casacore::Int dataDescriptionId () const {
436  return msIter_p.dataDescriptionId ();
437  }
438 
439  // Return MJD midpoint of interval.
441 
442  // Return MJD centroid of interval.
444 
445  // Return nominal time interval
447 
448  // Return actual time interval
450 
451  // Return the visibilities as found in the casacore::MS, casacore::Cube (npol,nchan,nrow).
453  DataColumn whichOne) const;
454 
455  // Return FLOAT_DATA as a casacore::Cube (npol, nchan, nrow) if found in the MS.
457 
458  // Return the visibility 4-vector of polarizations for each channel.
459  // If the casacore::MS doesn't contain all polarizations, it is assumed it
460  // contains one or two parallel hand polarizations.
462  DataColumn whichOne) const;
463 
464  // Return the shape of the visibility Cube
465  virtual casacore::IPosition visibilityShape () const;
466 
467  // Return u,v and w (in meters)
470 
471  // Return weight
473 
474  // Returns the nPol_p x curNumRow_p weight matrix
476 
477  // Determine whether WEIGHT_SPECTRUM exists.
479 
480  // Return weightspectrum (a weight for each channel)
482 
483  // Return imaging weight (a weight for each channel)
484  //virtual casacore::Matrix<casacore::Float> & imagingWeight (casacore::Matrix<casacore::Float> & wt) const;
486 
487  // Return true if FieldId/Source has changed since last iteration
488  virtual casacore::Bool newFieldId () const {
489  return (curStartRow_p == 0 && msIter_p.newField ());
490  }
491 
492  // Return true if arrayID has changed since last iteration
493  virtual casacore::Bool newArrayId () const {
494  return (curStartRow_p == 0 && msIter_p.newArray ());
495  }
496 
497  // Return true if SpectralWindow has changed since last iteration
499  return (curStartRow_p == 0 && msIter_p.newSpectralWindow ());
500  }
501 
502  // Return the index of the first channel of the current channel group
503  // in the total (selected) spectrum.
504  virtual casacore::Int channelIndex () const;
505 
506  // Return the width of the current group of channels, i.e.,
507  // the number of channels returned by visibility () and frequency ().
508  virtual casacore::Int channelGroupSize () const;
509 
510  // Return the number of correlations in the current iteration
511  virtual casacore::Int nCorr () const {
512  return nPol_p;
513  };
514 
515  // Return the number of rows in the current iteration
516  virtual casacore::Int nRow () const;
517 
518  // Return the row ids as from the original root table. This is useful
519  // to find correspondance between a given row in this iteration to the
520  // original ms row
522 
523  // Return the numbers of rows in the current chunk
524  virtual casacore::Int nRowChunk () const;
525 
526  // Return the number of sub-intervals in the current chunk
527  virtual casacore::Int nSubInterval () const;
528 
529  // Call to use the slurp i/o method for all scalar columns. This
530  // will set the casacore::BucketCache cache size to the full column length
531  // and cause the full column to be cached in memory, if
532  // any value of the column is used. In case of out-of-memory,
533  // it will automatically fall-back on the smaller cache size.
534  // Slurping the column is to be considered as a work-around for the
535  // casacore::Table i/o code, which uses casacore::BucketCache and performs extremely bad
536  // for random access. Slurping is useful when iterating non-sequentially
537  // an casacore::MS or parts of an casacore::MS, it is not tested with multiple MSs.
538  virtual void slurp () const;
539 
540  // Velocity selection - specify the output channels in velocity:
541  // nChan - number of output channels, vStart - start velocity,
542  // vInc - velocity increment. So channel i will have velocity
543  // vStart + i*vInc (i=0,nChan-1).
544  // Specify velocities as in e.g., casacore::MVRadialVelocity (casacore::Quantity (2001.,"km/s")).
545  // The reference type and velocity definition are specified separately.
546  // Note that no averaging is performed, the visibilities will be interpolated
547  // and sampled at the specified velocities, it's up to you to choose a vInc
548  // appropriate to the channel width.
549  // The REST_FREQUENCY column in the SPECTRAL_WINDOW subtable is used to
550  // determine the velocity-frequency conversion.
551  // By default calculations are done for a single velocity with offsets
552  // applied for the others (ok for non-rel velocities with RADIO defn),
553  // set precise to true to do a full conversion for each output channel. (NYI)
556  const casacore::MVRadialVelocity & vStart, const casacore::MVRadialVelocity & vInc,
559 
560  // Select the velocity interpolation scheme.
561  // At present the choice is limited to : nearest and linear, linear
562  // is the default.
563  // TODO: add cubic, spline and possibly FFT
564  virtual VisibilityIteratorReadImpl & velInterpolation (const casacore::String & /*type*/) {return * this; }
565 
566  // Channel selection - only the selected channels will be returned by the
567  // access functions. The default spectralWindow is the current one (or 0)
568  // This allows selection of the input channels, producing
569  // nGroup groups of width output channels. Default is to return all channels
570  // in a single group.
571  virtual VisibilityIteratorReadImpl & selectChannel (casacore::Int nGroup = 1, casacore::Int start = 0, casacore::Int width = 0,
572  casacore::Int increment = 1, casacore::Int spectralWindow = -1);
573 
574  //Same as above except when multiple ms's are to be accessed
575 
577  const casacore::Block< casacore::Vector<casacore::Int> > & blockStart,
578  const casacore::Block< casacore::Vector<casacore::Int> > & blockWidth,
581 
582 
583  //get the channel selection ...the block over the number of ms's associated
584  // with this iterator
590 
591  // Translate slicesv from the form returned by casacore::MSSelection::getChanSlices ()
592  // to matv as used by setChanAveBounds (). widthsv is the channel averaging
593  // width for each _selected_ spw.
596  const casacore::Vector<casacore::Int> & widthsv) const;
597 
598  // Get the spw, start and nchan for all the ms's is this Visiter that
599  // match the frequecy "freqstart-freqStep" and "freqEnd+freqStep" range
600  // Can help in doing channel selection above..
601  // freqFrame is the frame the caller frequency values are in (freqStart and freqEnd)
602  // These will be converted to the frame of the selected spw to match
603 
607  casacore::Double freqStart, casacore::Double freqEnd,
609 
610  // Get the range of frequency convered by the selected data in the frame requested
611 
613 
614  // Attach a VisBuffer object.
615  // Note that while more than one VisBuffer may be attached, only the
616  // last one is actively updated. A casacore::Stack is kept internally, so after
617  // a detach, the previous VisBuffer becomes active again.
618  virtual void attachVisBuffer (VisBuffer & vb);
619 
620  // Detach a VisBuffer object.
621  // If the object detached is not the last one attached an exception
622  // is thrown.
623  virtual void detachVisBuffer (VisBuffer & vb);
624 
625  // Access the current casacore::ROMSColumns object in MSIter
626  virtual const casacore::ROMSColumns & msColumns () const {
627  return msIter_p.msColumns ();
628  }
629 
630  // get back the selected spectral windows and spectral channels for
631  // current ms
632 
634 
635  // Convert the frequency from the observe frame to lsr frame.
636  // Returns true in convert if given spw was not observed
637  // in the LSRK frame
638  // if ignoreconv=true then conversion from frame in data
639  //is ignored by request
640  virtual void lsrFrequency (const casacore::Int & spw, casacore::Vector<casacore::Double> & freq, casacore::Bool & convert, const casacore::Bool ignoreconv=false);
641  //assign a VisImagingWeight object to this iterator
642  virtual void useImagingWeight (const VisImagingWeight & imWgt);
643  //return number of Ant
644  virtual casacore::Int numberAnt ();
645  //Return number of rows in all selected ms's
646  virtual casacore::Int numberCoh ();
647 
648  // Return number of spws, polids, ddids
649  virtual casacore::Int numberSpw ();
650  virtual casacore::Int numberPol ();
651  virtual casacore::Int numberDDId ();
652 
661  casacore::Int getNAntennas () const;
662  virtual casacore::MEpoch getEpoch () const;
668 
669  static void lsrFrequency (const casacore::Int & spw,
671  casacore::Bool & convert,
672  const casacore::Block<casacore::Int> & chanStart,
673  const casacore::Block<casacore::Int> & chanWidth,
674  const casacore::Block<casacore::Int> & chanInc,
675  const casacore::Block<casacore::Int> & numChanGroup,
677  const casacore::ScalarColumn<casacore::Int> & obsMFreqTypes,
678  const casacore::MEpoch & ep,
679  const casacore::MPosition & obsPos,
680  const casacore::MDirection & dir,
681  const casacore::Bool ignoreconv=false);
682 
683 protected:
684 
685  void attachColumnsSafe (const casacore::Table & t);
686 
687  // advance the iteration
688  virtual void advance ();
689  // set the currently selected table
690  virtual void setSelTable ();
691  // set the iteration state
692  virtual void setState ();
693  // get the TOPO frequencies from the selected velocities and the obs. vel.
694  virtual void getTopoFreqs ();
695  virtual void getTopoFreqs (casacore::Vector<casacore::Double> & lsrFreq, casacore::Vector<casacore::Double> & selFreq); // for async i/o
696 
697  virtual void getLsrInfo (casacore::Block<casacore::Int> & channelGroupNumber,
698  casacore::Block<casacore::Int> & channelIncrement,
699  casacore::Block<casacore::Int> & channelStart,
700  casacore::Block<casacore::Int> & channelWidth,
701  casacore::MPosition & observatoryPositon,
703  casacore::Bool & velocitySelection) const;
704 
705  std::vector<casacore::MeasurementSet> getMeasurementSets () const;
706 
707  const casacore::MSDerivedValues & getMSD () const; // for use by Async I/O *ONLY*
708 
709  // update the DATA slicer
710  virtual void updateSlicer ();
711  // attach the column objects to the currently selected table
712  virtual void attachColumns (const casacore::Table & t);
713  // returns the table, to which columns are attached,
714  // can be overridden in derived classes
715  virtual const casacore::Table attachTable () const;
716 
717  // get the (velocity selected) interpolated visibilities, flags and weights.
718  // It is not really const at all (it seems to use This-> trickery so callers
719  // like flag () can be declared const).
720 
721 // virtual void getInterpolatedVisFlagWeight (DataColumn whichOne) const;
722 
723  // get the (velocity selected) interpolated FLOAT_DATA (as real Floats),
724  // flags and weights.
725 
726 // void getInterpolatedFloatDataFlagWeight () const;
727 
729 
730  // get the visibility data (observed, corrected or model);
731  // deals with casacore::Float and casacore::Complex observed data (DATA or FLOAT_DATA)
732  virtual void getDataColumn (ROVisibilityIterator::DataColumn whichOne, const casacore::Slicer & slicer,
734  virtual void getDataColumn (DataColumn whichOne, casacore::Cube<casacore::Complex> & data) const;
735 
736  // get FLOAT_DATA as real Floats.
737  virtual void getFloatDataColumn (const casacore::Slicer & slicer, casacore::Cube<casacore::Float> & data) const;
739 
740  //constructor helpers
741  virtual void initialize (const casacore::Block<casacore::MeasurementSet> & mss);
742 
743  virtual void originChunks (casacore::Bool forceRewind);
744 
745  //Re-Do the channel selection in multi ms case
746  virtual void doChannelSelection ();
747  //Set the tile cache size....when using slice access if tile cache size is
748  // not set memory usage can go wild. Specifically, the caching scheme is
749  // ephemeral and lives for that instance of setting the caching scheme.
750  //
751  // If you don't set any then the defaults come into play and caches a few
752  // tiles along every axis at the tile you requested...which is a waste when
753  // say you know you want to proceed along the row axis for example...and in
754  // fact now VisIter just reads one tile (thus the commenting in setTileCache)
755  // and lets the OS do the caching rather than than having the table system
756  // cache extra tiles.
757  virtual void setTileCache ();
758  //Check if spw is in selected SPW for actual ms
759  virtual casacore::Bool isInSelectedSPW (const casacore::Int & spw);
760 
761  // Updates, if necessary, rowIds_p member for the current chunk
762  virtual void update_rowIds () const;
763 
764  void setAsyncEnabled (casacore::Bool enable);
765 
766  template<class T>
767  void getColScalar (const casacore::ScalarColumn<T> & column, casacore::Vector<T> & array, casacore::Bool resize) const;
768 
769  template<class T>
770  void getColArray (const casacore::ArrayColumn<T> & column, casacore::Array<T> & array, casacore::Bool resize) const;
771 
772  // column access functions, can be overridden in derived classes
773  virtual void getCol (const casacore::ScalarColumn<casacore::Bool> & column, casacore::Vector<casacore::Bool> & array, casacore::Bool resize = false) const;
774  virtual void getCol (const casacore::ScalarColumn<casacore::Int> & column, casacore::Vector<casacore::Int> & array, casacore::Bool resize = false) const;
775  virtual void getCol (const casacore::ScalarColumn<casacore::Double> & column, casacore::Vector<casacore::Double> & array, casacore::Bool resize = false) const;
776 
777  virtual void getCol (const casacore::ArrayColumn<casacore::Bool> & column, casacore::Array<casacore::Bool> & array, casacore::Bool resize = false) const;
778  virtual void getCol (const casacore::ArrayColumn<casacore::Float> & column, casacore::Array<casacore::Float> & array, casacore::Bool resize = false) const;
779  virtual void getCol (const casacore::ArrayColumn<casacore::Double> & column, casacore::Array<casacore::Double> & array, casacore::Bool resize = false) const;
780  virtual void getCol (const casacore::ArrayColumn<casacore::Complex> & column, casacore::Array<casacore::Complex> & array, casacore::Bool resize = false) const;
781 
782  virtual void getCol (const casacore::ArrayColumn<casacore::Bool> & column, const casacore::Slicer & slicer, casacore::Array<casacore::Bool> & array, casacore::Bool resize = false) const;
783  virtual void getCol (const casacore::ArrayColumn<casacore::Float> & column, const casacore::Slicer & slicer, casacore::Array<casacore::Float> & array, casacore::Bool resize = false) const;
784  virtual void getCol (const casacore::ArrayColumn<casacore::Complex> & column, const casacore::Slicer & slicer, casacore::Array<casacore::Complex> & array, casacore::Bool resize = false) const;
785 
786  // virtual void getCol (const casacore::String & colName, casacore::Array<casacore::Double> & array,
787  // casacore::Array<casacore::Double> & all, casacore::Bool resize = false) const;
788  // virtual void getCol (const casacore::String & colName, casacore::Vector<casacore::Bool> & array,
789  // casacore::Vector<casacore::Bool> & all, casacore::Bool resize = false) const;
790  // virtual void getCol (const casacore::String & colName, casacore::Vector<casacore::Int> & array,
791  // casacore::Vector<casacore::Int> & all, casacore::Bool resize = false) const;
792  // virtual void getCol (const casacore::String & colName, casacore::Vector<casacore::Double> & array,
793  // casacore::Vector<casacore::Double> & all, casacore::Bool resize = false) const;
794 
795  template<class T>
796  void swapyz (casacore::Cube<T> & out, const casacore::Cube<T> & in) const;
797 
798  class Cache {
799 
800  public:
801 
802  Cache ();
803 
804  Cache & operator= (const Cache & other);
805 
817  casacore::Double lastParang0UT_p; // cache update timestamp
818  casacore::Double lastParangUT_p; // cache update timestamp
819  casacore::Double lastazelUT_p; // cache update timestamp
820  casacore::Double lastazel0UT_p; // cache update timestamp
821  casacore::Double lasthourangUT_p; // cache update timestamp
822  casacore::Double lastfeedpaUT_p; // cache update timestamp
823  casacore::Bool msHasFC_p; // Does the current casacore::MS have a valid FLAG_CATEGORY?
824  casacore::Bool msHasWtSp_p; // Does the current casacore::MS have a valid WEIGHT_SPECTRUM?
833  };
834 
835  class Channels { // channel selection
836 
837  public:
838 
845 
846  };
847 
848  class Columns {
849 
850  public:
851 
852  Columns & operator= (const Columns & other);
853 
877 
878  };
879 
881 
882  public:
883 
889 
890  };
891 
892  class Velocity { // for velocity selection and conversion
893 
894  public:
895 
896  Velocity ();
897  Velocity & operator= (const Velocity & other);
898 
909 
910  };
911 
912 
913  typedef std::vector<casacore::MeasurementSet> MeasurementSets;
914 
916  casacore::Bool asyncEnabled_p; // Allows lower-level code to make an async "copy" of this VI.
918  mutable Cache cache_p;
930  VisImagingWeight imwgt_p; // object to calculate imaging weight
946  casacore::RefRows selRows_p; // currently selected rows from msIter_p.table ()
955  std::stack<VisBuffer *> vbStack_p; // casacore::Stack of VisBuffer objects
958 
959 
960 };
961 
963 {
964  return more_p;
965 }
966 
969 {
970  cjones.resize (msIter_p.CJones ().nelements ());
971  return cjones = msIter_p.CJones ();
972 }
973 
975 {
976  return msIter_p.receptorAngles ();
977 }
978 
980 {
981  return msIter_p.antennaMounts ();
982 }
983 
986 {
987  return msIter_p.getBeamOffsets ();
988 }
989 
991 {
992  return msIter_p.allBeamOffsetsZero ();
993 }
994 
996 {
998 }
1000 {
1002 }
1004 {
1005  return curNumRow_p;
1006 }
1008 {
1009  return msIter_p.table ().nrow ();
1010 }
1011 //inline VisibilityIteratorReadImpl &
1012 //VisibilityIteratorReadImpl::velInterpolation (const casacore::String & type)
1013 //{
1014 // vInterpolation_p = type;
1015 // return *this;
1016 //}
1018 {
1020 }
1021 
1022 // <summary>
1023 // VisibilityIterator iterates through one or more writable MeasurementSets
1024 // </summary>
1025 
1026 // <use visibility=export>
1027 
1028 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
1029 // </reviewed>
1030 
1031 // <prerequisite>
1032 // <li> <linkto class="VisibilityIteratorReadImpl">VisibilityIteratorReadImpl</linkto>
1033 // </prerequisite>
1034 //
1035 // <etymology>
1036 // The VisibilityIterator is a read/write iterator returning visibilities
1037 // </etymology>
1038 //
1039 // <synopsis>
1040 // VisibilityIterator provides iteration with various sort orders
1041 // for one or more MSs. It has member functions to retrieve the fields
1042 // commonly needed in synthesis calibration and imaging. It is
1043 // derived from the read-only iterator
1044 // <linkto class="VisibilityIteratorReadImpl">VisibilityIteratorReadImpl</linkto>.
1045 //
1046 // One should use <linkto class="VisBuffer">VisBuffer</linkto>
1047 // to access chunks of data.
1048 // </synopsis>
1049 //
1050 // <example>
1051 // <code>
1052 // //
1053 // </code>
1054 // </example>
1055 //
1056 // <motivation>
1057 // For imaging and calibration you need to access an casacore::MS in some consistent
1058 // order (by field, spectralwindow, time interval etc.). This class provides
1059 // that access.
1060 // </motivation>
1061 //
1062 // #<thrown>
1063 //
1064 // #</thrown>
1065 //
1066 // <todo asof="1997/05/30">
1067 // <li> cleanup the currently dual interface for visibilities and flags
1068 // <li> sort out what to do with weights when interpolating
1069 // </todo>
1070 
1072 
1073  friend class VisibilityIterator;
1074 
1075 public:
1076 
1078 
1079  // Constructors.
1080  // Note: The VisibilityIterator is not initialized correctly by default, you
1081  // need to call origin () before using it to iterate.
1082 
1084 
1085  //VisibilityIteratorWriteImpl (VisibilityIterator * vi);
1086 
1088 
1089  // Destructor
1090 
1091  virtual ~VisibilityIteratorWriteImpl ();
1092 
1093  // Members
1094 
1095  virtual VisibilityIteratorWriteImpl * clone (VisibilityIterator * vi) const;
1096 
1097  virtual casacore::Bool isWritable () const {
1098  return true;
1099  }
1100 
1101  // Set/modify the flags in the data.
1102  // This will flag all channels in the original data that contributed to
1103  // the output channel in the case of channel averaging.
1104  // All polarizations have the same flag value.
1105  virtual void setFlag (const casacore::Matrix<casacore::Bool> & flag);
1106 
1107  // Set/modify the flags in the data.
1108  // This sets the flags as found in the casacore::MS, casacore::Cube (npol,nchan,nrow),
1109  // where nrow is the number of rows in the current iteration (given by
1110  // nRow ()).
1111  virtual void setFlag (const casacore::Cube<casacore::Bool> & flag);
1112 
1113  // Set/modify the flag row column; dimension casacore::Vector (nrow)
1114  virtual void setFlagRow (const casacore::Vector<casacore::Bool> & rowflags);
1115 
1117 
1118  // Set/modify the visibilities.
1119  // This is possibly only for a 'reference' casacore::MS which has a new DATA column.
1120  // The first axis of the matrix should equal the selected number of channels
1121  // in the original MS.
1122  // If the casacore::MS does not contain all polarizations, only the parallel
1123  // hand polarizations are used.
1124  virtual void setVis (const casacore::Matrix<CStokesVector> & vis, DataColumn whichOne);
1125 
1126  // Set/modify the visibilities
1127  // This sets the data as found in the casacore::MS, casacore::Cube (npol,nchan,nrow).
1128  virtual void setVis (const casacore::Cube<casacore::Complex> & vis, DataColumn whichOne);
1129 
1130  // Set the visibility and flags, and interpolate from velocities if needed
1131  virtual void setVisAndFlag (const casacore::Cube<casacore::Complex> & vis, const casacore::Cube<casacore::Bool> & flag,
1132  DataColumn whichOne);
1133 
1134  // Set/modify the weights
1135  virtual void setWeight (const casacore::Vector<casacore::Float> & wt);
1136 
1137  // Set/modify the weightMat
1138  virtual void setWeightMat (const casacore::Matrix<casacore::Float> & wtmat);
1139 
1140  // Set/modify the weightSpectrum
1141  virtual void setWeightSpectrum (const casacore::Cube<casacore::Float> & wtsp);
1142 
1143  // Set/modify the Sigma
1144  virtual void setSigma (const casacore::Vector<casacore::Float> & sig);
1145 
1146  // Set/modify the ncorr x nrow SigmaMat.
1147  virtual void setSigmaMat (const casacore::Matrix<casacore::Float> & sigmat);
1148 
1149  virtual void writeBack (VisBuffer *);
1150 
1151 protected:
1152 
1153  // A BackWriter is a functor that will extract a piece of information out of its VisBuffer
1154  // argument and write it out using a "set" method on the supplied VisibilityIterator.
1155  class BackWriter {
1156 
1157  public:
1158 
1159  virtual ~BackWriter () {}
1160 
1161  virtual void operator () (VisibilityIteratorWriteImpl * vi, VisBuffer * vb) = 0;
1162 
1163  };
1164 
1165  // A simple BackWriterImpl uses a nullary accessor on a VisBuffer.
1166  template <typename Setter, typename Getter>
1167  class BackWriterImpl : public BackWriter {
1168  public:
1169 
1170  BackWriterImpl (Setter setter, Getter getter) : getter_p (getter), setter_p (setter) {}
1172  (vi ->* setter_p) ((vb ->* getter_p) ());
1173  }
1174 
1175  private:
1176 
1177  Getter getter_p;
1178  Setter setter_p;
1179  };
1180 
1181  // BackWriterImpl2 is slightly more complicated in that it uses a unary accessor. The argument
1182  // to the unary accessor is a member of the ROVisibilityIterator DataColumn enumeration which
1183  // specifies which visibilty or visCube type is wanted (e.g., observed, model or corrected).
1184  template <typename Setter, typename Getter>
1185  class BackWriterImpl2 : public BackWriter {
1186  public:
1187 
1189 
1190  BackWriterImpl2 (Setter setter, Getter getter, DataColumn dc)
1191  : dataColumn_p (dc), getter_p (getter), setter_p (setter)
1192  {}
1194  (vi ->* setter_p) ((vb ->* getter_p) (), dataColumn_p);
1195  }
1196 
1197  private:
1198 
1200  Getter getter_p;
1201  Setter setter_p;
1202  };
1203 
1204  // Backwriter(2) creation methods. These methods make it fairly straightforward to create
1205  // a BackWriter object.
1206 
1207  template <typename Ret>
1208  static
1209  BackWriter *
1210  makeBackWriter (void (VisibilityIteratorWriteImpl::* setter) (Ret), Ret (VisBuffer::* getter) () const) {
1211  return new BackWriterImpl <void (VisibilityIteratorWriteImpl:: *) (Ret),
1212  Ret (VisBuffer:: *) () const >
1213  (setter, getter);
1214  }
1215 
1216  template <typename Ret>
1217  static
1218  BackWriter *
1220  Ret (VisBuffer::* getter) () const,
1222 
1223  // Define the Getter and Setter types
1224 
1226  typedef Ret (VisBuffer::* Getter) () const;
1227 
1228  return new BackWriterImpl2 < Setter, Getter> (setter, getter, dc);
1229  }
1230 
1232 
1233  void initializeBackWriters ();
1234 
1235  virtual void attachColumns (const casacore::Table & t);
1236 
1237 // void setInterpolatedVisFlag (const casacore::Cube<casacore::Complex> & vis,
1238 // const casacore::Cube<casacore::Bool> & flag);
1239 // void setInterpolatedWeight (const casacore::Matrix<casacore::Float> & wt);
1240 
1241  // Write the data column (observed, model or corrected);
1242  // deals with casacore::Float or casacore::Complex observed data (DATA and FLOAT_DATA).
1243 
1244  void putDataColumn (DataColumn whichOne, const casacore::Slicer & slicer,
1247 
1248  // column access functions, can be overridden in derived classes
1253 
1257 
1258  template <class T> void setTileShape(casacore::RefRows &rowRef,casacore::ArrayColumn<T> &outputDataCol,const casacore::IPosition &arrayShape);
1260 
1261  // non-virtual, no reason to template this function because casacore::Bool is the only type needed
1263 
1264  //This puts a model into the descriptor of the actual ms
1265  //Set iscomponentlist to true if the record represent a componentlist
1266  //if false then it is a FTMachine casacore::Record that holds the model image
1267  // a [-1] vector in validfields mean the model applies to all fields of the active ms
1268  virtual void putModel(const casacore::RecordInterface& rec, casacore::Bool iscomponentlist=true, casacore::Bool incremental=false);
1269 
1270 
1271 
1272 
1273 
1274 private:
1275 
1276  class Columns {
1277 
1278  public:
1279 
1280  Columns & operator= (const Columns & other);
1281 
1292 
1293  };
1294 
1295  std::map <VisBufferComponents::EnumType, BackWriter *> backWriters_p;
1299 };
1300 
1301 } //# NAMESPACE CASA - END
1302 
1303 #endif
1304 
static void azelCalculate(casacore::Double time, casacore::MSDerivedValues &msd, casacore::Vector< casacore::MDirection > &azel, casacore::Int nAnt, const casacore::MEpoch &mEpoch0)
casacore::ArrayColumn< casacore::Bool > flagCategory_p
A Vector of integers, for indexing into Array&lt;T&gt; objects.
Definition: IPosition.h:119
casacore::ArrayColumn< casacore::Bool > flag_p
virtual casacore::Bool allBeamOffsetsZero() const
true if all elements of the cube returned by getBeamOffsets are zero
Int msId() const
Return the current MS Id (according to the order in which they appeared in the constructor) ...
Definition: MSIter.h:515
A Measure: astronomical direction.
Definition: MDirection.h:174
virtual casacore::Bool isInSelectedSPW(const casacore::Int &spw)
Check if spw is in selected SPW for actual ms.
A Measure: position on Earth.
Definition: MPosition.h:79
virtual void originChunks()
Reset iterator to true start of data (first chunk)
Int arrayId() const
Return the current ArrayId.
Definition: MSIter.h:517
int Int
Definition: aipstype.h:50
MSDerivedValues calculates values derived from a MS.
virtual void setSigma(const casacore::Vector< casacore::Float > &sig)
Set/modify the Sigma.
virtual void putModel(const casacore::RecordInterface &rec, casacore::Bool iscomponentlist=true, casacore::Bool incremental=false)
This puts a model into the descriptor of the actual ms Set iscomponentlist to true if the record repr...
virtual casacore::String fieldName() const
Return the current Field Name.
Int fieldId() const
Return the current FieldId.
Definition: MSIter.h:518
virtual casacore::Cube< casacore::Float > & weightSpectrum(casacore::Cube< casacore::Float > &wtsp) const
Return weightspectrum (a weight for each channel)
casacore::MDirection getPhaseCenter() const
virtual casacore::Vector< casacore::Float > & sigma(casacore::Vector< casacore::Float > &sig) const
Return sigma.
virtual casacore::Int nRow() const
Return the number of rows in the current iteration.
casacore::Vector< casacore::uInt > getRowIds() const
casacore::ScalarColumn< casacore::Int > feed1_p
virtual casacore::Vector< casacore::Bool > & flagRow(casacore::Vector< casacore::Bool > &rowflags) const
Return row flag.
ROVisibilityIterator::DataColumn DataColumn
casacore::MFrequency::Types getObservatoryFrequencyType() const
Object to hold type of imaging weight scheme to be used on the fly and to provide facilities to do th...
casacore::Matrix< casacore::Double > uvwMat_p
virtual SubChunkPair getSubchunkId() const
virtual casacore::Int nRowChunk() const
Return the numbers of rows in the current chunk.
Main interface class to a read/write table.
Definition: Table.h:153
virtual casacore::Matrix< casacore::Float > & sigmaMat(casacore::Matrix< casacore::Float > &sigmat) const
Return sigma matrix (pol-dep)
Bool newField() const
Return True if FieldId/Source has changed since last iteration.
Definition: MSIter.h:512
virtual casacore::Bool newSpectralWindow() const
Return true if SpectralWindow has changed since last iteration.
virtual casacore::Vector< casacore::Double > & frequency(casacore::Vector< casacore::Double > &freq) const
Return current frequencies (in Hz, acc.
virtual void setWeight(const casacore::Vector< casacore::Float > &wt)
Set/modify the weights.
virtual const casacore::MDirection phaseCenter(const casacore::Int fieldId, const casacore::Double time=-1.0) const
casacore::Cube< casacore::Float > wtSp_p
VisibilityIterator iterates through one or more writable MeasurementSets.
virtual casacore::Vector< casacore::Float > & weight(casacore::Vector< casacore::Float > &wt) const
Return weight.
TableExprNode array(const TableExprNode &values, const TableExprNodeSet &shape)
Create an array of the given shape and fill it with the values.
Definition: ExprNode.h:1886
static BackWriter * makeBackWriter2(void(VisibilityIteratorWriteImpl::*setter)(Ret, VisibilityIteratorReadImpl::DataColumn), Ret(VisBuffer::*getter)() const, ROVisibilityIterator::DataColumn dc)
virtual void writeBack(VisBuffer *)
virtual const casacore::Block< casacore::Int > & getSortColumns() const
casacore::ScalarColumn< casacore::Int > processor_p
casacore::Vector< casacore::MDirection > azel_p
virtual casacore::Bool existsColumn(VisBufferComponents::EnumType id) const
casacore::Int getNAntennas() const
virtual casacore::Vector< casacore::MDirection > azel(casacore::Double time) const
virtual casacore::MDirection azel0(casacore::Double time) const
Return the antenna AZ/EL casacore::Vector (nant)
casacore::ArrayColumn< casacore::Bool > flag_p
virtual ~VisibilityIteratorWriteImpl()
Destructor.
casacore::ArrayColumn< casacore::Bool > flagCategory_p
void setTileShape(casacore::RefRows &rowRef, casacore::ArrayColumn< T > &outputDataCol, const casacore::IPosition &arrayShape)
casacore::Block< casacore::Int > sortColumns_p
virtual casacore::Vector< casacore::RigidVector< casacore::Double, 3 > > & uvw(casacore::Vector< casacore::RigidVector< casacore::Double, 3 > > &uvwvec) const
Return u,v and w (in meters)
Int polFrame() const
Return frame for polarization (returns PolFrame enum)
Definition: MSIter.h:525
casacore::ScalarColumn< casacore::Double > timeCentroid_p
virtual casacore::Matrix< casacore::Float > & weightMat(casacore::Matrix< casacore::Float > &wtmat) const
Returns the nPol_p x curNumRow_p weight matrix.
casacore::Block< casacore::Vector< casacore::Int > > inc_p
virtual casacore::Vector< casacore::Int > & channel(casacore::Vector< casacore::Int > &chan) const
Return channel numbers in selected VisSet spectrum (i.e.
virtual void setInterval(casacore::Double timeInterval)
Set or reset the time interval (in seconds) to use for iteration.
Int dataDescriptionId() const
Return current DataDescriptionId.
Definition: MSIter.h:522
virtual casacore::Array< casacore::Bool > & flagCategory(casacore::Array< casacore::Bool > &flagCategories) const
Return flags for each polarization, channel, category, and row.
casacore::Vector< casacore::Float > parang_p
virtual VisBuffer * getVisBuffer()
std::vector< casacore::MeasurementSet > getMeasurementSets() const
virtual casacore::Cube< casacore::Float > & floatData(casacore::Cube< casacore::Float > &fcube) const
Return FLOAT_DATA as a casacore::Cube (npol, nchan, nrow) if found in the MS.
static casacore::Vector< casacore::Float > parangCalculate(casacore::Double time, casacore::MSDerivedValues &msd, int nAntennas, const casacore::MEpoch mEpoch0)
const VisImagingWeight & getImagingWeightGenerator() const
Return imaging weight (a weight for each channel) virtual casacore::Matrix&lt;casacore::Float&gt; &amp; imagin...
casacore::ArrayColumn< casacore::Complex > modelVis_p
casacore::ScalarColumn< casacore::Bool > flagRow_p
virtual casacore::Vector< casacore::Int > & antenna1(casacore::Vector< casacore::Int > &ant1) const
Return antenna1.
void putDataColumn(DataColumn whichOne, const casacore::Slicer &slicer, const casacore::Cube< casacore::Complex > &data)
void setInterpolatedVisFlag (const casacore::Cube&lt;casacore::Complex&gt; &amp; vis, const casacore::Cube&lt;casa...
casacore::ArrayColumn< casacore::Float > weightSpectrum_p
const String & sourceName() const
virtual casacore::Vector< casacore::Int > & stateId(casacore::Vector< casacore::Int > &stateids) const
Return the STATE_IDs.
VisibilityIteratorReadImpl & operator=(const VisibilityIteratorReadImpl &other)
Assigment.
virtual void getLsrInfo(casacore::Block< casacore::Int > &channelGroupNumber, casacore::Block< casacore::Int > &channelIncrement, casacore::Block< casacore::Int > &channelStart, casacore::Block< casacore::Int > &channelWidth, casacore::MPosition &observatoryPositon, casacore::MDirection &phaseCenter, casacore::Bool &velocitySelection) const
virtual void setSelTable()
set the currently selected table
virtual void getSpwInFreqRange(casacore::Block< casacore::Vector< casacore::Int > > &spw, casacore::Block< casacore::Vector< casacore::Int > > &start, casacore::Block< casacore::Vector< casacore::Int > > &nchan, casacore::Double freqStart, casacore::Double freqEnd, casacore::Double freqStep, casacore::MFrequency::Types freqFrame=casacore::MFrequency::LSRK) const
Get the spw, start and nchan for all the ms&#39;s is this Visiter that match the frequecy &quot;freqstart-freq...
casacore::ScalarColumn< casacore::Int > state_p
casacore::Int getDataDescriptionId() const
Columns & operator=(const Columns &other)
const String & fieldName() const
return FIELD table associated current fieldname and sourcename respectively
void swapyz(casacore::Cube< T > &out, const casacore::Cube< T > &in) const
virtual void getCol (const casacore::String &amp; colName, casacore::Array&lt;casacore::Double&gt; &amp; array...
virtual void slurp() const
Call to use the slurp i/o method for all scalar columns.
virtual void operator()(VisibilityIteratorWriteImpl *vi, VisBuffer *vb)=0
void setInterval(Double timeInterval)
Set or reset the time interval to use for iteration.
virtual casacore::Double getInterval() const
Return the time interval (in seconds) used for iteration.
Int polarizationId() const
Return current PolarizationId.
Definition: MSIter.h:521
virtual const casacore::MDirection & phaseCenter() const
Return the current phase center as an MDirection.
A Measure: instant in time.
Definition: MEpoch.h:104
virtual casacore::Int numberAnt()
return number of Ant
virtual void getDataColumn(ROVisibilityIterator::DataColumn whichOne, const casacore::Slicer &slicer, casacore::Cube< casacore::Complex > &data) const
get the visibility data (observed, corrected or model); deals with casacore::Float and casacore::Comp...
ROVisibilityIterator::DataColumn DataColumn
VLAT should not access private parts, especially variables.
casacore::ArrayColumn< casacore::Complex > vis_p
virtual VisibilityIteratorReadImpl & selectChannel(casacore::Int nGroup=1, casacore::Int start=0, casacore::Int width=0, casacore::Int increment=1, casacore::Int spectralWindow=-1)
Channel selection - only the selected channels will be returned by the access functions.
virtual casacore::Int numberDDId()
const Vector< SquareMatrix< Complex, 2 > > & CJones() const
Return the feed configuration/leakage matrix for feed 0 on each antenna TODO: CJonesAll can be used i...
Definition: MSIter.h:528
virtual void setTileCache()
Set the tile cache size....when using slice access if tile cache size is not set memory usage can go ...
casacore::ScalarColumn< casacore::Int > antenna1_p
virtual casacore::Vector< casacore::Int > & feed1(casacore::Vector< casacore::Int > &fd1) const
Return feed1.
ABSTRACT CLASSES Deliberately vague to be general enough to allow for many different types of data
Definition: PlotData.h:48
casacore::Cube< casacore::Float > floatDataCube_p
virtual casacore::Vector< casacore::Double > & timeInterval(casacore::Vector< casacore::Double > &ti) const
Return nominal time interval.
virtual casacore::Vector< casacore::Double > & exposure(casacore::Vector< casacore::Double > &expo) const
Return actual time interval.
virtual casacore::Bool newMS() const
Check if ms has change since last iteration.
casacore::Block< casacore::Int > getChannelStart() const
Internal value for MRadialVelocity.
Fast Vector classes with fixed (templated) length.
virtual casacore::Cube< casacore::Bool > & flag(casacore::Cube< casacore::Bool > &flags) const
Return flag for each polarization, channel and row.
casacore::Block< casacore::Vector< casacore::Int > > width_p
casacore::ScalarColumn< casacore::Int > scan_p
casacore::Block< casacore::Vector< casacore::Int > > spw_p
static BackWriter * makeBackWriter(void(VisibilityIteratorWriteImpl::*setter)(Ret), Ret(VisBuffer::*getter)() const)
Backwriter(2) creation methods.
virtual casacore::Bool newFieldId() const
Return true if FieldId/Source has changed since last iteration.
void putColScalar(casacore::ScalarColumn< casacore::Bool > &column, const casacore::Vector< casacore::Bool > &array)
non-virtual, no reason to template this function because casacore::Bool is the only type needed ...
casacore::ScalarColumn< casacore::Int > observation_p
virtual casacore::Vector< casacore::Double > & timeCentroid(casacore::Vector< casacore::Double > &t) const
Return MJD centroid of interval.
casacore::Vector< casacore::Float > getReceptor0Angle()
virtual VisibilityIteratorWriteImpl * clone(VisibilityIterator *vi) const
Members.
void operator()(VisibilityIteratorWriteImpl *vi, VisBuffer *vb)
virtual void setWeightSpectrum(const casacore::Cube< casacore::Float > &wtsp)
Set/modify the weightSpectrum.
virtual casacore::Bool isWritable() const
virtual void advance()
advance the iteration
virtual const casacore::Cube< casacore::RigidVector< casacore::Double, 2 > > & getBeamOffsets() const
Return a cube containing pairs of coordinate offsets for each receptor of each feed (values are in ra...
virtual void getTopoFreqs()
get the TOPO frequencies from the selected velocities and the obs.
virtual void setState()
set the iteration state
Velocity & operator=(const Velocity &other)
Bool newMS() const
Return true if msId has changed since last iteration.
Definition: MSIter.h:510
Fast Square Matrix class with fixed (templated) size.
virtual casacore::Cube< casacore::Complex > & visibility(casacore::Cube< casacore::Complex > &vis, DataColumn whichOne) const
Return the visibilities as found in the casacore::MS, casacore::Cube (npol,nchan,nrow).
virtual void setSigmaMat(const casacore::Matrix< casacore::Float > &sigmat)
Set/modify the ncorr x nrow SigmaMat.
Cache & operator=(const Cache &other)
Int spectralWindowId() const
Return current SpectralWindow.
Definition: MSIter.h:519
virtual casacore::IPosition visibilityShape() const
Return the shape of the visibility Cube.
Bool newArray() const
Return True if ArrayId has changed since last iteration.
Definition: MSIter.h:511
virtual const casacore::Cube< casacore::Double > & receptorAngles() const
Return receptor angles for all antennae and feeds First axis of the cube is a receptor number...
virtual casacore::Vector< casacore::Int > & scan(casacore::Vector< casacore::Int > &scans) const
Return scan number.
double Double
Definition: aipstype.h:55
virtual VisibilityIteratorReadImpl & velInterpolation(const casacore::String &)
Select the velocity interpolation scheme.
A class to provide easy read-only access to MeasurementSet columns.
Definition: MSColumns.h:111
Class holding the row numbers in a RefTable.
Definition: RefRows.h:85
casacore::ScalarColumn< casacore::Int > antenna2_p
virtual void setVis(const casacore::Matrix< CStokesVector > &vis, DataColumn whichOne)
Set/modify the visibilities.
virtual void getFreqInSpwRange(casacore::Double &freqStart, casacore::Double &freqEnd, casacore::MFrequency::Types freqframe=casacore::MFrequency::LSRK) const
Get the range of frequency convered by the selected data in the frame requested.
casacore::Vector< casacore::Float > feedpa_p
ROVisibilityIterator iterates through one or more readonly MeasurementSets.
Columns & operator=(const Columns &other)
virtual casacore::Int dataDescriptionId() const
Return current DataDescription Id.
void getColArray(const casacore::ArrayColumn< T > &column, casacore::Array< T > &array, casacore::Bool resize) const
virtual void getFloatDataColumn(const casacore::Slicer &slicer, casacore::Cube< casacore::Float > &data) const
get FLOAT_DATA as real Floats.
casacore::ScalarColumn< casacore::Int > feed2_p
virtual const casacore::Float & parang0(casacore::Double time) const
Return nominal parallactic angle at specified time (does not include feed position angle offset–see f...
casacore::Block< casacore::Int > nGroups_p
virtual void setWeightMat(const casacore::Matrix< casacore::Float > &wtmat)
Set/modify the weightMat.
virtual const casacore::Table attachTable() const
returns the table, to which columns are attached, can be overridden in derived classes ...
const MS & ms() const
Return reference to the current MS.
Definition: MSIter.h:508
casacore::ArrayColumn< casacore::Complex > corrVis_p
virtual casacore::Int arrayId() const
Return the current ArrayId.
casacore::ArrayColumn< casacore::Complex > corrVis_p
Table table() const
Return the current Table iteration.
Definition: MSIter.h:507
casacore::ArrayColumn< casacore::Float > sigma_p
virtual const casacore::ROMSColumns & msColumns() const
Access the current casacore::ROMSColumns object in MSIter.
Bool allBeamOffsetsZero() const
True if all elements of the cube returned by getBeamOffsets are zero.
Definition: MSIter.h:541
A BackWriter is a functor that will extract a piece of information out of its VisBuffer argument and ...
Types
Types of known MRadialVelocity Warning: The order defines the order in the translation matrix FromTo...
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
virtual void getChannelSelection(casacore::Block< casacore::Vector< casacore::Int > > &blockNGroup, casacore::Block< casacore::Vector< casacore::Int > > &blockStart, casacore::Block< casacore::Vector< casacore::Int > > &blockWidth, casacore::Block< casacore::Vector< casacore::Int > > &blockIncr, casacore::Block< casacore::Vector< casacore::Int > > &blockSpw)
get the channel selection...the block over the number of ms&#39;s associated with this iterator ...
void setFlagCategory(const casacore::Array< casacore::Bool > &fc)
virtual VisibilityIteratorReadImpl & selectVelocity(casacore::Int nChan, const casacore::MVRadialVelocity &vStart, const casacore::MVRadialVelocity &vInc, casacore::MRadialVelocity::Types rvType=casacore::MRadialVelocity::LSR, casacore::MDoppler::Types dType=casacore::MDoppler::RADIO, casacore::Bool precise=false)
Velocity selection - specify the output channels in velocity: nChan - number of output channels...
VisibilityIteratorReadImpl::DataColumn DataColumn
casacore::ArrayColumn< casacore::Float > sigma_p
virtual casacore::Vector< casacore::Int > & feed2(casacore::Vector< casacore::Int > &fd2) const
Return feed2.
A simple BackWriterImpl uses a nullary accessor on a VisBuffer.
const Cube< RigidVector< Double, 2 > > & getBeamOffsets() const
Return a cube containing pairs of coordinate offset for each receptor of each feed (values are in rad...
Definition: MSIter.h:538
casacore::Vector< casacore::Double > frequency_p
BackWriterImpl2 is slightly more complicated in that it uses a unary accessor.
virtual void origin()
Reset iterator to origin/start of data (of current chunk)
virtual casacore::Int msId() const
casacore::ArrayColumn< casacore::Float > weight_p
void attachColumnsSafe(const casacore::Table &t)
uInt nrow() const
Get the number of rows.
Definition: Table.h:1201
virtual casacore::Matrix< casacore::Double > & uvwMat(casacore::Matrix< casacore::Double > &uvwmat) const
Types
Types of known MDopplers Warning: The order defines the order in the translation matrix FromTo in th...
Definition: MDoppler.h:149
virtual void doChannelSelection()
Re-Do the channel selection in multi ms case.
VisibilityIteratorWriteImpl(VisibilityIterator *vi)
Constructors.
const MDirection & phaseCenter() const
Returns the phasecenter for the first time stamp of the iteration The time is important for field tab...
casacore::ArrayColumn< casacore::Double > uvw_p
float Float
Definition: aipstype.h:54
virtual casacore::Vector< casacore::Double > & time(casacore::Vector< casacore::Double > &t) const
Return MJD midpoint of interval.
casacore::Bool existsFlagCategory() const
Determine whether FLAG_CATEGORY is valid.
const casacore::MSDerivedValues & getMSD() const
virtual const casacore::Vector< casacore::String > & antennaMounts() const
return a string mount identifier for each antenna
virtual casacore::Int nCorr() const
Return the number of correlations in the current iteration.
static void azel0Calculate(casacore::Double time, casacore::MSDerivedValues &msd, casacore::MDirection &azel0, const casacore::MEpoch &mEpoch0)
casacore::MPosition getObservatoryPosition() const
virtual casacore::Int numberCoh()
Return number of rows in all selected ms&#39;s.
casacore::ScalarColumn< casacore::Double > timeInterval_p
casacore::Block< casacore::Bool > visOK_p
casacore::Block< casacore::Int > getChannelIncrement() const
virtual void putCol(casacore::ScalarColumn< casacore::Bool > &column, const casacore::Vector< casacore::Bool > &array)
column access functions, can be overridden in derived classes
casacore::ScalarColumn< casacore::Double > time_p
virtual casacore::Vector< casacore::Double > & lsrFrequency(casacore::Vector< casacore::Double > &freq) const
Return frequencies (in Hz, acc.
virtual const casacore::MeasurementSet & ms() const
reference to actual ms in interator
A Table intended to hold astronomical data (a set of Measurements).
virtual casacore::Vector< casacore::Int > & observationId(casacore::Vector< casacore::Int > &obsids) const
Return the OBSERVATION_IDs.
virtual void updateSlicer()
update the DATA slicer
casacore::Block< casacore::Int > getChannelWidth() const
virtual casacore::Bool newArrayId() const
Return true if arrayID has changed since last iteration.
Specify which elements to extract from an n-dimensional array.
Definition: Slicer.h:289
std::map< VisBufferComponents::EnumType, BackWriter * > backWriters_p
virtual void allSelectedSpectralWindows(casacore::Vector< casacore::Int > &spws, casacore::Vector< casacore::Int > &nvischan)
get back the selected spectral windows and spectral channels for current ms
virtual Bool more() const
Return False if there is no more data.
Definition: MSIter.h:506
virtual casacore::Int numberSpw()
Return number of spws, polids, ddids.
virtual casacore::Int polarizationId() const
Return current Polarization Id.
casacore::ArrayColumn< casacore::Complex > modelVis_p
casacore::ScalarColumn< casacore::Double > exposure_p
virtual casacore::Vector< casacore::SquareMatrix< casacore::Complex, 2 > > & CJones(casacore::Vector< casacore::SquareMatrix< casacore::Complex, 2 > > &cjones) const
Return feed configuration matrix for specified antenna.
void operator()(VisibilityIteratorWriteImpl *vi, VisBuffer *vb)
Bool newSpectralWindow() const
Return True if SpectralWindow has changed since last iteration.
Definition: MSIter.h:513
casacore::Bool isAsyncEnabled() const
Members.
virtual void setRowBlocking(casacore::Int nRows=0)
Set the &#39;blocking&#39; size for returning data.
virtual casacore::Int fieldId() const
Return the current FieldId.
casacore::ArrayColumn< casacore::Float > floatVis_p
virtual casacore::Vector< casacore::Float > feed_pa(casacore::Double time) const
Return feed parallactic angles casacore::Vector (nant) (1 feed/ant)
casacore::Cube< casacore::Bool > flagCube_p
casacore::ScalarColumn< casacore::Bool > flagRow_p
virtual void attachColumns(const casacore::Table &t)
const Vector< String > & antennaMounts() const
Return a string mount identifier for each antenna.
Definition: MSIter.h:536
BackWriterImpl2(Setter setter, Getter getter, DataColumn dc)
casacore::ArrayColumn< casacore::Float > floatVis_p
virtual casacore::Vector< casacore::uInt > & rowIds(casacore::Vector< casacore::uInt > &rowids) const
Return the row ids as from the original root table.
virtual ~VisibilityIteratorReadImpl()
Destructor.
virtual casacore::MEpoch getEpoch() const
virtual VisibilityIteratorReadImpl * clone(ROVisibilityIterator *rovi) const
An iterator class for MeasurementSets.
Definition: MSIter.h:163
casacore::Vector< casacore::Bool > tileCacheIsSet_p
static casacore::Vector< casacore::Float > feed_paCalculate(casacore::Double time, casacore::MSDerivedValues &msd, casacore::Int nAntennas, const casacore::MEpoch &mEpoch0, const casacore::Vector< casacore::Float > &receptor0Angle)
virtual casacore::Bool isWritable() const
casacore::Block< casacore::Int > preselectedChanStart_p
virtual casacore::Int polFrame() const
Return frame for polarization (returns PolFrame enum)
virtual void attachColumns(const casacore::Table &t)
attach the column objects to the currently selected table
virtual casacore::Vector< casacore::Int > & corrType(casacore::Vector< casacore::Int > &corrTypes) const
Return the correlation type (returns casacore::Stokes enums)
casacore::Block< casacore::Vector< casacore::Int > > start_p
virtual void getCol(const casacore::ScalarColumn< casacore::Bool > &column, casacore::Vector< casacore::Bool > &array, casacore::Bool resize=false) const
column access functions, can be overridden in derived classes
std::vector< casacore::MeasurementSet > MeasurementSets
casacore::Vector< casacore::Double > time_p
virtual casacore::Int spectralWindow() const
Return current SpectralWindow.
virtual casacore::Bool moreChunks() const
Return false if no more &#39;Chunks&#39; of data left.
String: the storage and methods of handling collections of characters.
Definition: String.h:223
void setAsyncEnabled(casacore::Bool enable)
casacore::Block< casacore::Int > preselectednChan_p
static casacore::Double hourangCalculate(casacore::Double time, casacore::MSDerivedValues &msd, const casacore::MEpoch &mEpoch0)
VisibilityIteratorReadImpl()
class AsyncEnabler { public: AsyncEnabler (ROVisibilityIterator &amp;); AsyncEnabler (ROVisibilityIterato...
void slicesToMatrices(casacore::Vector< casacore::Matrix< casacore::Int > > &matv, const casacore::Vector< casacore::Vector< casacore::Slice > > &slicesv, const casacore::Vector< casacore::Int > &widthsv) const
Translate slicesv from the form returned by casacore::MSSelection::getChanSlices () to matv as used b...
casacore::Bool usesTiledDataManager(const casacore::String &columnName, const casacore::MeasurementSet &ms) const
get the (velocity selected) interpolated visibilities, flags and weights.
casacore::ArrayColumn< casacore::Double > & getChannelFrequency() const
virtual void setFlag(const casacore::Matrix< casacore::Bool > &flag)
Set/modify the flags in the data.
VisBuffers encapsulate one chunk of visibility data for processing.
Definition: VisBuffer.h:153
virtual casacore::Int channelIndex() const
Return the index of the first channel of the current channel group in the total (selected) spectrum...
casacore::ArrayColumn< casacore::Complex > vis_p
VisibilityIterator iterates through one or more writable MeasurementSets.
const casacore::MeasurementSet & getMeasurementSet() const
casacore::Cube< casacore::Complex > visCube_p
casacore::ArrayColumn< casacore::Float > weightSpectrum_p
virtual void useImagingWeight(const VisImagingWeight &imWgt)
assign a VisImagingWeight object to this iterator
casacore::Vector< casacore::uInt > rowIds_p
casacore::Bool existsWeightSpectrum() const
Determine whether WEIGHT_SPECTRUM exists.
VisibilityIteratorReadImpl * getReadImpl()
virtual casacore::Vector< casacore::Int > & antenna2(casacore::Vector< casacore::Int > &ant2) const
Return antenna2.
Abstract base class for Record classes.
Types
Types of known MFrequencies Warning: The order defines the order in the translation matrix FromTo in...
Definition: MFrequency.h:176
virtual void update_rowIds() const
Updates, if necessary, rowIds_p member for the current chunk.
ROVisibilityIterator iterates through one or more readonly MeasurementSets.
virtual VisibilityIteratorReadImpl & nextChunk()
Advance to the next Chunk of data.
virtual casacore::Vector< casacore::Int > & processorId(casacore::Vector< casacore::Int > &procids) const
Return the PROCESSOR_IDs.
static casacore::Float parang0Calculate(casacore::Double time, casacore::MSDerivedValues &msd, const casacore::MEpoch &epoch0)
virtual void initialize(const casacore::Block< casacore::MeasurementSet > &mss)
constructor helpers
virtual void setVisAndFlag(const casacore::Cube< casacore::Complex > &vis, const casacore::Cube< casacore::Bool > &flag, DataColumn whichOne)
Set the visibility and flags, and interpolate from velocities if needed.
void getColScalar(const casacore::ScalarColumn< T > &column, casacore::Vector< T > &array, casacore::Bool resize) const
virtual casacore::Double hourang(casacore::Double time) const
Return the hour angle for the specified time.
casacore::Block< casacore::Vector< casacore::Int > > nGroups_p
virtual void attachVisBuffer(VisBuffer &vb)
Attach a VisBuffer object.
casacore::ArrayColumn< casacore::Float > weight_p
virtual void detachVisBuffer(VisBuffer &vb)
Detach a VisBuffer object.
casacore::Int getMeasurementSetId() const
const ROMSColumns & msColumns() const
Return reference to the current ROMSColumns.
Definition: MSIter.h:509
virtual casacore::Bool more() const
Return false if no more data (in current chunk)
const Cube< Double > & receptorAngles() const
Return the receptor angles for all feeds and antennae First axis is a receptor number, 2nd axis is antennaId, 3rd axis is feedId.
Definition: MSIter.h:534
casacore::Vector< casacore::Double > lsrFreq_p
virtual casacore::Int numberPol()
casacore::Block< casacore::Int > getChannelGroupNumber() const
unsigned int uInt
Definition: aipstype.h:51
virtual void setFlagRow(const casacore::Vector< casacore::Bool > &rowflags)
Set/modify the flag row column; dimension casacore::Vector (nrow)
virtual casacore::Int channelGroupSize() const
Return the width of the current group of channels, i.e., the number of channels returned by visibilit...
virtual casacore::Int nSubInterval() const
Return the number of sub-intervals in the current chunk.
casacore::Vector< casacore::Double > selFreq_p
casacore::Matrix< casacore::Float > imagingWeight_p
virtual casacore::Vector< casacore::Float > parang(casacore::Double time) const
Per antenna:
virtual casacore::String sourceName() const
Return the current Source Name.