casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
VisBuffer.h
Go to the documentation of this file.
1 //# VisBuffer.h: buffer for iterating through casacore::MS in large blocks
2 //# Copyright (C) 1996-2014
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: VisBuffer.h,v 19.14 2006/02/28 04:48:58 mvoronko Exp $
27 
28 #ifndef MSVIS_VISBUFFER_H
29 #define MSVIS_VISBUFFER_H
30 
31 #include <casa/aips.h>
32 #include <casa/Arrays/Cube.h>
33 #include <casa/Arrays/Vector.h>
34 #include <casa/Arrays/Matrix.h>
35 #include <casa/BasicSL/Complex.h>
42 #include <msvis/MSVis/MSCalEnums.h>
43 #include <set>
44 
45 namespace casa { //# NAMESPACE CASA - BEGIN
46 
47 
48 //#forward
49  class SIMapperCollection;
50 
51 // <summary>
52 // VbDirtyComponents allows marking portions of a VisBuffer as
53 // modified (aka dirty). This feature is needed for the Visibility
54 // Processing Framework (VPF) which allows a sequence of data processing
55 // nodes to work as a bucket brigade operating sequentially on a
56 // VisBuffer. A downstream output node needs to know what data,
57 // if any, needs to be written out.
58 //
59 // <prerequisite>
60 // #<li><linkto class="VisBuffer">VisBuffer</linkto>
61 // </prerequisite>
62 //
63 // </summary>
64 //
65 // <synopsis>
66 //
67 // </synopsis>
68 // <example>
69 //
70 // <code>
71 //
72 // </code>
73 // </example>
74 //
76 
77 public:
78 
79  typedef std::set<VisBufferComponents::EnumType> Set;
81 
82  VbDirtyComponents operator+ (const VbDirtyComponents & other) const;
83 
84  const_iterator begin () const;
86  const_iterator end () const;
87 
88  static VbDirtyComponents all ();
90  static VbDirtyComponents none ();
93 
94 protected:
95 
96 private:
97 
99 
100  static const VbDirtyComponents all_p;
101 
103 
104 };
105 
106 namespace asyncio {
107  class VLAT;
108 } // end namespace asyncio
109 
110 //<summary>VisBuffers encapsulate one chunk of visibility data for processing.</summary>
111 //
112 // <use visibility=export>
113 //
114 // <reviewed reviewer="" date="" tests="" demos="">
115 
116 // <prerequisite>
117 // <li> <linkto class="VisSet">VisSet</linkto>
118 // <li> <linkto class="VisibilityIterator">VisibilityIterator</linkto>
119 // <li> <linkto class="VisBufferAutoPtr">VisBufferAutoPtr</linkto>
120 // <li> <linkto class="VbDirtyComponents">VbDirtyComponents</linkto>
121 // </prerequisite>
122 //
123 // <etymology>
124 // VisBuffer is a buffer for visibility data
125 // </etymology>
126 //
127 //<synopsis>
128 // This class contains 'one iteration' of the
129 // <linkto class="VisibilityIterator">VisibilityIterator</linkto>
130 // It is a modifiable
131 // buffer of values to which calibration and averaging can be applied.
132 // This allows processing of the data in larger blocks, avoiding some
133 // overheads for processing per visibility point or spectrum.
134 //
135 // See <linkto module="MeasurementEquations">MeasurementEquations</linkto>
136 // for more details on how the VisBuffer is to be used.
137 //
138 // When the user intends to allow asynchronous I/O they will need to use
139 // the VisBufferAsync and VisBufferAsyncWrapper classes; these are
140 // publicly derived from VisBuffer. Normally, the user should not
141 // explicitly use these classes but should use the helper class
142 // VisBufferAutoPtr which will ensure that the appropriate class is
143 // used.
144 //</synopsis>
145 
146 //<todo>
147 // <li> reconcile vis/visCube usage: visCube, flagCube and weightMatrix
148 // are currently only correct when this VisBuffer got them from a
149 // VisIter, operations like -=, freqAverage() are only done for
150 // visibility() and flag().
151 //</todo>
152 
153 class VisBuffer {
154 
155  friend class asyncio::VLAT; // for async i/o
156  friend class VisBufferAsync; // for async i/o
157  friend class VisBufferAsyncWrapper; // for async i/o
158  friend class ViReadImplAsync; // for async I/O
159  friend class SIMapperCollection; //for SIimager as we need access to casacore::MS object
160  friend class VisModelData; // need access to ms to recover the model rec
161 
162 public:
163  // Create empty VisBuffer you can assign to or attach.
164  VisBuffer();
165  // Construct VisBuffer for a particular VisibilityIterator
166  // The buffer will remain synchronized with the iterator.
168 
169  // Copy construct, looses synchronization with iterator: only use buffer for
170  // current iteration (or reattach).
171  VisBuffer(const VisBuffer & vb);
172 
173  // Destructor (detaches from VisIter)
174  virtual ~VisBuffer();
175 
176  // Assignment, loses synchronization with iterator: only use buffer for
177  // current iteration (or reattach)
178 
179  virtual VisBuffer & operator=(const VisBuffer & vb);
180 
181  // Assignment, optionally without copying the data across; with copy=true
182  // this is identical to normal assignment operator
183 
184  virtual VisBuffer & assign(const VisBuffer & vb, casacore::Bool copy = true);
185 
186  virtual VisBuffer * clone () const;
187 
188  // subtraction: return the difference of the visibilities, flags of
189  // this and other are or-ed. An exception is thrown if the number of
190  // rows or channels differs, but no further checks are done.
191  VisBuffer & operator-=(const VisBuffer & vb);
192 
193  // Attach to a VisIter. Detaches itself first if already attached
194  // to a VisIter. Will remain synchronized with iterator.
195  virtual void attachToVisIter(ROVisibilityIterator & iter);
196  virtual void detachFromVisIter ();
197 
198  // Invalidate the cache
199  virtual void invalidate();
200 
201  // <group>
202  // Access functions
203  //
204  virtual casacore::Int & nCorr() {
205  return nCorrOK_p ? nCorr_p : fillnCorr();
206  }
207  virtual casacore::Int nCorr() const {
208  return This->nCorr();
209  }
210 
211  virtual casacore::Int & nChannel() {
212  return nChannelOK_p ? nChannel_p : fillnChannel();
213  }
214  virtual casacore::Int nChannel() const {
215  return This->nChannel();
216  }
217 
219  return channelOK_p ? channel_p : fillChannel();
220  }
221  virtual const casacore::Vector<casacore::Int>& channel() const {
222  return This->channel();
223  }
224 
225  // virtual casacore::Int & nCat() {
226  // return nCatOK_p ? nCat_p : fillnCat();
227  // }
228  // virtual casacore::Int nCat() const {
229  // return This->nCat();
230  // }
231 
236  // Decide what is the right value (depending on where the vb is coming from)
237  // for you for the size of the buffer. i.e (nCorr(), nChannel(), nRow()) or vb.visCube().shape()
238  // The latter comes from the VisIter state ...the former be careful...
240  //without updating fillnrow
245  virtual casacore::Int & nRow() {
246  return nRowOK_p ? nRow_p : fillnRow();
247  }
248  virtual casacore::Int nRow() const {
249  return This->nRow();
250  }
251 
252  virtual casacore::Int nRowChunk() const;
253 
255  return antenna1OK_p ? antenna1_p : fillAnt1();
256  }
257  virtual const casacore::Vector<casacore::Int>& antenna1() const {
258  return This->antenna1();
259  }
260 
262  return antenna2OK_p ? antenna2_p : fillAnt2();
263  }
264  virtual const casacore::Vector<casacore::Int>& antenna2() const {
265  return This->antenna2();
266  }
267 
269  return feed1OK_p ? feed1_p : fillFeed1();
270  }
271  virtual const casacore::Vector<casacore::Int>& feed1() const {
272  return This->feed1();
273  }
274 
276  return feed2OK_p ? feed2_p : fillFeed2();
277  }
278  virtual const casacore::Vector<casacore::Int>& feed2() const {
279  return This->feed2();
280  }
281 
282  virtual void dirtyComponentsAdd (const VbDirtyComponents & additionalDirtyComponents);
283  virtual void dirtyComponentsAdd (VisBufferComponents::EnumType component);
284  virtual void dirtyComponentsClear ();
285  virtual VbDirtyComponents dirtyComponentsGet () const;
286  virtual void dirtyComponentsSet (const VbDirtyComponents & dirtyComponents);
287  virtual void dirtyComponentsSet (VisBufferComponents::EnumType component);
288 
289  virtual casacore::Bool fetch(const asyncio::PrefetchColumns *pfc);
290 
291  // feed1_pa() and feed2_pa() return an array of parallactic angles
292  // (each corresponds to the first receptor of the feed) one for each
293  // row in the current buffer. In contrast, feed_pa() calculates
294  // the angles for each antenna. These methods are implemented for
295  // VisBuffer only to benefit from caching of the feed and antenna IDs.
297  return feed1_paOK_p ? feed1_pa_p : fillFeed1_pa();
298  }
300  return This->feed1_pa();
301  }
302 
304  return feed2_paOK_p ? feed2_pa_p : fillFeed2_pa();
305  }
307  return This->feed2_pa();
308  }
309 
311  return cjonesOK_p ? cjones_p : fillCjones();
312  }
314  return This->CJones();
315  }
316 
317  // Note that feed_pa is a function instead of a cached value
319 
320  // direction1() and direction2() return arrays of directions where
321  // the first and the second antenna/feed are pointed to. One value for
322  // each row in the current buffer.
324  return direction1OK_p ? direction1_p
325  : fillDirection1();
326  }
328  return This->direction1();
329  }
330 
332  return direction2OK_p ? direction2_p :
333  fillDirection2();
334  }
336  return This->direction2();
337  }
339  return firstDirection1OK_p ? firstDirection1_p
341  }
342  virtual const casacore::MDirection& firstDirection1() const {
343  return This->firstDirection1();
344  }
345  // NOMINAL parallactic angle (feed p.a. offset NOT included)
348 
349  // Note that azel is a function instead of a cached value
354 
355  // Hour angle for specified time
357 
358  virtual casacore::Int fieldId() const {
359  return fieldIdOK_p ? fieldId_p : This->fillFieldId();
360  }
361 
363  return fieldIdOK_p ? fieldId_p : This->fillFieldId();
364  }
365 
367  return arrayIdOK_p ? arrayId_p : This->fillArrayId();
368  }
369 
370  virtual casacore::Int arrayId() const {
371  return arrayIdOK_p ? arrayId_p : This->fillArrayId();
372  }
373 
374  // Return flag for each channel & row
376  return flagOK_p ? flag_p : fillFlag();
377  }
378  virtual const casacore::Matrix<casacore::Bool>& flag() const {
379  return This->flag();
380  }
381 
382  // Return flag for each polarization, channel and row
384  return flagCubeOK_p ? flagCube_p : fillFlagCube();
385  }
386  virtual const casacore::Cube<casacore::Bool>& flagCube() const {
387  return This->flagCube();
388  }
389 
391  return flagRowOK_p ? flagRow_p : fillFlagRow();
392  }
393  virtual const casacore::Vector<casacore::Bool>& flagRow() const {
394  return This->flagRow();
395  }
396 
397  // Return flags for each polarization, channel, category, and row.
399  return flagCategoryOK_p ? flagCategory_p : fillFlagCategory();
400  }
402  return This->flagCategory();
403  }
404 
406  return scanOK_p ? scan_p : fillScan();
407  }
408  virtual const casacore::Vector<casacore::Int>& scan() const {
409  return This->scan();
410  }
411 
412  // scalar version for convenience, when scan known constant for
413  // entire iteration/buffer.
414  virtual casacore::Int scan0() {
415  return scan()(0);
416  }
417 
419  return processorIdOK_p ? processorId_p : fillProcessorId();
420  }
422  return This->processorId();
423  }
424 
426  return observationIdOK_p ? observationId_p : fillObservationId();
427  }
429  return This->observationId();
430  }
431 
433  return stateIdOK_p ? stateId_p : fillStateId();
434  }
435  virtual const casacore::Vector<casacore::Int>& stateId() const {
436  return This->stateId();
437  }
438 
439  // Gets SPECTRAL_WINDOW/CHAN_FREQ (in Hz, acc. to the casacore::MS def'n v.2).
441  return frequencyOK_p ? frequency_p : fillFreq();
442  }
444  return This->frequency();
445  }
446 
447 // virtual casacore::Vector<casacore::Double>& lsrFrequency() {
448 // return lsrFrequencyOK_p ? lsrFrequency_p : fillLSRFreq();
449 // }
450 // virtual const casacore::Vector<casacore::Double>& lsrFrequency() const {
451 // return This->lsrFrequency();
452 // }
453 
454 
455  //the following method is to convert the observed frequencies
456  // This conversion may not be accurate for some frame
457  // conversion like topo to lsr except if the spw is in the actual buffer
458 
459  //if ignoreconv=true..frequency is served as is in the data frame
460  virtual void lsrFrequency(const casacore::Int & spw, casacore::Vector<casacore::Double>& freq, casacore::Bool & convert, const casacore::Bool ignoreconv=false) const;
461 
462  virtual casacore::Int numberCoh () const;
463 
465  return phaseCenterOK_p ? phaseCenter_p : fillPhaseCenter();
466  }
468  return This->phaseCenter();
469  }
470  virtual const casacore::MDirection phaseCenter(const casacore::Int fieldId, const casacore::Double time=-1.0) const;
471  virtual const casacore::MDirection phaseCenter(const casacore::Double time) const;
472  virtual casacore::Int polFrame() const {
473  return polFrameOK_p ? polFrame_p : This->fillPolFrame();
474  }
475 
477  return corrTypeOK_p ? corrType_p : fillCorrType();
478  }
479  virtual const casacore::Vector<casacore::Int>& corrType() const {
480  return This->corrType();
481  }
482 
484  return sigmaOK_p ? sigma_p : fillSigma();
485  }
486  virtual const casacore::Vector<casacore::Float>& sigma() const {
487  return This->sigma();
488  }
489 
491  return sigmaMatOK_p ? sigmaMat_p : fillSigmaMat();
492  }
494  return This->sigmaMat();
495  }
496 
498  return spectralWindowOK_p ? spectralWindow_p : This->fillSpW();
499  }
500  virtual casacore::Int spectralWindow() const {
501  return spectralWindowOK_p ? spectralWindow_p : This->fillSpW();
502  }
503  virtual casacore::Int polarizationId() const {
504  return visIter_p->polarizationId();
505  }
507  return dataDescriptionIdOK_p ? dataDescriptionId_p : This->fillDataDescriptionId ();
508  }
510  return dataDescriptionIdOK_p ? dataDescriptionId_p : This->fillDataDescriptionId ();
511  }
513  return timeOK_p ? time_p : fillTime();
514  }
515  virtual const casacore::Vector<casacore::Double>& time() const {
516  return This->time();
517  }
518 
520  return timeCentroidOK_p ? timeCentroid_p : fillTimeCentroid();
521  }
523  return This->timeCentroid();
524  }
525 
527  return timeIntervalOK_p ? timeInterval_p : fillTimeInterval();
528  }
530  return This->timeInterval();
531  }
532 
534  return exposureOK_p ? exposure_p : fillExposure();
535  }
537  return This->exposure();
538  }
539 
541  return uvwOK_p ? uvw_p : filluvw();
542  }
544  return This->uvw();
545  }
546 
548  return uvwMatOK_p ? uvwMat_p : filluvwMat();
549  }
551  return This->uvwMat();
552  }
553 
555  return visibilityOK_p ? visibility_p : fillVis(VisibilityIterator::Observed);
556  }
558  return This->visibility();
559  }
560 
562  return modelVisibilityOK_p ? modelVisibility_p :
564  }
566  return This->modelVisibility();
567  }
568 
570  return correctedVisibilityOK_p ? correctedVisibility_p :
572  }
574  return This->correctedVisibility();
575  }
576 
578  return visCubeOK_p ? visCube_p : fillVisCube(VisibilityIterator::Observed);
579  }
581  return This->visCube();
582  }
583 
585  return modelVisCubeOK_p ? modelVisCube_p :
587  }
588 
589  virtual casacore::Cube<casacore::Complex>& modelVisCube(const casacore::Bool & matchVisCubeShape) {
590  // Avoids call to fillVisCube(VisIter::Model)
591  modelVisCubeOK_p = true;
592  if (matchVisCubeShape) {
593  // shape it in memory like data
596  }
597  // ... and return it in the usual way
598  return modelVisCube();
599  }
600 
602  return This->modelVisCube();
603  }
604 
606  return correctedVisCubeOK_p ? correctedVisCube_p :
608  }
610  return This->correctedVisCube();
611  }
612 
613  // Return visCube(), modelVisCube(), or correctedVisCube(),
614  // according to whichcol. They throw an exception if whichcol is
615  // unsupported, but note the encouraged default.
616  // TODO: Optionally return DATA if whichcol is unavailable.
619  whichcol=casacore::MS::DATA) const;
620 
622  return floatDataCubeOK_p ? floatDataCube_p : fillFloatDataCube();
623  }
625  return This->floatDataCube();
626  }
627 
628  // Returns the weights for each row averaged over the parallel hand correlations.
630  return weightOK_p ? weight_p : fillWeight();
631  }
632  virtual const casacore::Vector<casacore::Float>& weight() const {
633  return This->weight();
634  }
635 
636  // Returns the nPol_p x curNumRow_p weight matrix.
638  return weightMatOK_p ? weightMat_p : fillWeightMat();
639  }
641  return This->weightMat();
642  }
643 
644  // Is a valid WEIGHT_SPECTRUM available?
646  return visIter_p ? visIter_p->existsWeightSpectrum() : false;
647  }
648 
650  return weightSpectrumOK_p ? weightSpectrum_p : fillWeightSpectrum();
651  }
653  return This->weightSpectrum();
654  }
655 
657  virtual const casacore::Matrix<casacore::Float>& imagingWeight() const;
658 
659 
660 // virtual casacore::Matrix<casacore::Float>& imagingWeight() {
661 // return imagingWeightOK_p ? imagingWeight_p : fillImagingWeight();
662 // }
663 // virtual const casacore::Matrix<casacore::Float>& imagingWeight() const {
664 // return This->imagingWeight();
665 // }
666 
668  return weightCube_p;
669  }
670  //</group>
671 
672  //<group>
673  // Utility functions to provide coordinate or column ranges of the
674  // data in the VisBuffer. Flagging is applied before computing the ranges.
675  //
676  // Generic accessor to column ranges of integer type, as specified by
677  // enumerations defined in class MSCalEnums. Throws an exception
678  // if the enum is not for a recognized integer column.
679  virtual casacore::Vector<casacore::Int> vecIntRange(const MSCalEnums::colDef & calEnum) const;
680 
681  // Antenna id. range (includes both ANTENNA1 and ANTENNA2 columns)
683 
684  // casacore::Time range
685  virtual casacore::Bool timeRange(casacore::MEpoch & rTime, casacore::MVEpoch & rTimeEP, casacore::MVEpoch & rInterval) const;
686 
687  // Return the row Ids from the original ms. If the ms used is a subset of
688  // another ms then rowIds() return the row ids of the original ms.
690 
691  virtual const casacore::Vector<casacore::uInt>& rowIds() const {
692  return This->rowIds();
693  };
694 
695  //</group>
696 
697  // Frequency average the buffer (visibility() column only)
698  virtual void freqAverage();
699 
700  // Frequency average the buffer (visCube and [if present] modelVisCube)
701  void freqAveCubes();
702 
703  // Average channel axis according to chanavebounds, for whichever of DATA,
704  // MODEL_DATA, CORRECTED_DATA, FLOAT_DATA, FLAG, and WEIGHT_SPECTRUM are
705  // present. It will only treat the first 5 as present if they have already
706  // been loaded into the buffer!
707  void channelAve(const casacore::Matrix<casacore::Int>& chanavebounds,casacore::Bool calmode=true);
708 
709  // Average channel axis by factor.
710  template<class T> void chanAveVisCube(casacore::Cube<T>& data, casacore::Int nChanOut);
711 
712  // Accumulate channel axis by factor, without applying WEIGHT_SPECTRUM even
713  // if it is present.
714  // It is primarily intended for averaging WEIGHT_SPECTRUM itself.
715  template<class T> void chanAccCube(casacore::Cube<T>& data, casacore::Int nChanOut);
716 
717  // This defaults to no conceptual side effects, but usually it is more
718  // efficient to let it leave weightSpectrum() in a channel averaged state.
719  // restoreWeightSpectrum has no effect if !existsWeightSpectrum().
720  virtual void chanAveFlagCube(casacore::Cube<casacore::Bool>& flagcube, const casacore::Int nChanOut,
721  const casacore::Bool restoreWeightSpectrum = true);
722 
723  // Doesn't do anything if flagcat is degenerate.
725 
726  // Form casacore::Stokes parameters from correlations
727  // (these are preliminary versions)
728  virtual void formStokes();
729  virtual void formStokesWeightandFlag();
731  virtual void formStokes(casacore::Cube<casacore::Float>& fcube); // Will throw up if asked to do all 4.
732 
733  // casacore::Sort/unsort the correlations, if necessary
734  // (Rudimentary handling of non-canonically sorted correlations--use with care!)
735  virtual void sortCorr();
736  virtual void unSortCorr();
737 
738  // Normalize the visCube by the modelVisCube
739  // (and optionally also divide visCube_p by its normalized amp)
740  virtual void normalize(const casacore::Bool & phaseOnly = false);
741 
742  // Fill weightMat according to sigma column
743  virtual void resetWeightMat();
744 
745  // Rotate visibility phase for given vector (dim = nrow of vb) of phases (metres)
747  // Rotate visibility phase for phase center offsets (arcsecs)
749 
750  // Update coordinate info - useful for copied VisBuffers that need
751  // to retain some state for later reference.
752  // Presently this fills antenna, array, field and spectralWindow ids, time,
753  // frequency and number of rows.
754  // if dirDependent is set to false the expensive direction dependent calculation of parallactic or direction of
755  // antenna from pointing table is avoided
756  //Add more as needed.
757  virtual void updateCoordInfo(const VisBuffer * vb = NULL, const casacore::Bool dirDependent=true);
758  void copyCoordInfo(const VisBuffer& other, casacore::Bool force=false);
759 
760  // Set the visibility to a constant, note that this only changes the buffer,
761  // no values are written back to tables from here.
762  virtual void setVisCube(casacore::Complex c);
763  virtual void setModelVisCube(casacore::Complex c);
765 
766  // Set the visibility, note that this only changes the buffer,
767  // no values are written back to tables from here.
768  virtual void setVisCube(const casacore::Cube<casacore::Complex>& vis);
769  virtual void setModelVisCube(const casacore::Cube<casacore::Complex>& vis);
771 
772  // Like the above, but for FLOAT_DATA, keeping it as real floats.
773  virtual void setFloatDataCube(const casacore::Cube<casacore::Float>& fcube);
774 
775  // Set model according to a casacore::Stokes vector
776  virtual void setModelVisCube(const casacore::Vector<casacore::Float>& stokes);
777 
778  // Reference external model visibilities
779  virtual void refModelVis(const casacore::Matrix<CStokesVector>& mvis);
780 
781  // Remove scratch cols data from vb
782  virtual void removeScratchCols();
783 
784  // Access the current casacore::ROMSColumns object via VisIter
785  virtual const casacore::ROMSColumns & msColumns() const {
786  return visIter_p->msColumns();
787  }
788 
789  virtual casacore::Int numberAnt () const;
790 
791 
792 
793  // Get all selected spectral windows not just the one in the actual buffer
795  visIter_p->allSelectedSpectralWindows(spws, nvischan);
796  }
797 
803  visIter_p->getChannelSelection(blockNGroup, blockStart, blockWidth, blockIncr, blockSpw);
804  };
806  This->allSelectedSpectralWindows(spws, nvischan);
807  }
808 
809  // Return the actual msid, useful if using multiple ms to monitor which
810  // ms in the list is being dealt with
811  virtual casacore::Int msId() const {
812  This->checkMSId();
813  return oldMSId_p;
814  }
815 
816  //checked if the ms has changed since the last chunk processed
817  virtual casacore::Bool newMS() const {
818  This->checkMSId();
819  return newMS_p;
820  }
821  //get the name of the ms the buffer is at empty string if no visiter is attached
822  virtual casacore::String msName(casacore::Bool stripPath=false) const;
823 
824  virtual casacore::Bool newArrayId () const;
825  virtual casacore::Bool newFieldId () const;
826  virtual casacore::Bool newSpectralWindow () const;
827 
828  //
829 
830 protected:
831 
832  virtual casacore::Bool checkMSId();
833  virtual void checkVisIter (const char * func, const char * file, int line, const char * extra = "") const;
834  virtual void copyCache (const VisBuffer & other, casacore::Bool force);
835  virtual void copyMsInfo (casacore::Int & msID, casacore::Bool & MsOk_p, casacore::Bool & newMs) const;
836  virtual const casacore::Matrix<casacore::Float>& imagingWeight(const VisImagingWeight & weightGenerator) const;
837  virtual casacore::Int getOldMsId () const;
838  virtual ROVisibilityIterator * getVisibilityIterator () const;
839 
840  template <typename Coord>
841  void updateCoord (const VisBuffer * other,
842  casacore::Bool otherOk,
843  const Coord & (VisBuffer::* getCoord) () const,
844  Coord & coord,
845  casacore::Bool & coordOk)
846  {
847  if (otherOk){
848  coord.assign ((other ->* getCoord) ());
849  coordOk = true;
850  }
851  else {
852  ((this ->* getCoord) ());
853  }
854  }
855 
856  template <typename Scalar>
857  void updateCoordS (const VisBuffer * other,
858  casacore::Bool otherOk,
859  Scalar (VisBuffer::* getCoord) () const,
860  Scalar & coord,
861  casacore::Bool & coordOk)
862  {
863  if (otherOk){
864  coord = (other ->* getCoord) ();
865  coordOk = true;
866  }
867  else {
868  ((this ->* getCoord) ());
869  }
870  }
871 
872 
873 private:
874 
875 
876  // validate the cache
877  virtual void validate();
878 
879  void checkVisIterBase (const char * func, const char * file, int line, const char * extra = "") const;
880 
881  template<typename T>
882  static void cacheCopyArray (casacore::Bool & newStatus,
883  casacore::Bool oldStatus,
884  T & newCache,
885  const VisBuffer & other,
886  const T & (VisBuffer::* oldCache) () const,
887  casacore::Bool force) {
888 
889  // Leave things unchanged if the old status is false. This will often
890  // leave the value with an empty data structure and an OK status which
891  // is needed in many cases.
892  //
893  // For copying casacore::Array<T> derived objects since the assign operator
894  // doesn't work for these.
895 
896  newStatus = force || oldStatus;
897 
898  if (newStatus) {
899  newCache.assign (((& other) ->* oldCache) ());
900  }
901  }
902 
903  template<typename T>
904  static void cacheCopyNormal (casacore::Bool & newStatus,
905  casacore::Bool oldStatus,
906  T & newCache,
907  const VisBuffer & other,
908  T (VisBuffer::* oldCache) () const,
909  casacore::Bool force) {
910 
911  // Leave things unchanged if the old status is false. This will often
912  // leave the value with an empty data structure and an OK status which
913  // is needed in many cases.
914  //
915  // For copying "normal" cache status and values. casacore::Normal means
916  // the assign operator works (which it doesn't for classes based on casacore::Array<T>)
917 
918  newStatus = force || oldStatus;
919 
920  if (newStatus) {
921 
922  newCache = ((& other) ->* oldCache) ();
923  }
924  }
925 
926  virtual void setAllCacheStatuses (bool status);
927 
928  virtual casacore::Bool nonCanonCorr(); // Are correlations in non-canonical order?
929 
930  // Filter index arrays for unique elements
932 
933  casacore::Bool corrSorted_p; // Have correlations been sorted by sortCorr?
941 
942  // +-------------------------------------------------+
943  // | Cache Declarations (fillers, statuses and data) |
944  // +-------------------------------------------------+
945  //
946  // Preferred naming convention:
947  //
948  // T thing () --- returns the value of thing (public method)
949  // T fillThing () --- fills thing cache variable and sets thingOK_p to true (private)
950  // casacore::Bool thingOK_p --- true if the value of thing is currently cached (private)
951  // T thing_p --- holds cached value of thing (if thingOK_p is true) (private)
952  //
953  // Example: casacore::Vector<casacore::Int>& feed1(); casacore::Vector<casacore::Int>& fillFeed1();
954  // casacore::Bool feed1OK_P; casacore::Vector<casacore::Int> feed1_p;
955 
956  // Cache filling routines in alphabetical order
957  //
958  // The first line in a fill routine should be the macro CheckVisIter. This
959  // will cause an casacore::AipsError to be throw when there is no visibilty iterator
960  // associated with the VisBuffer. This is especially important because the
961  // fillers may be called on a VisBufferAsync in two contexts: filling
962  // where there will be a VI attached and in normal use where there is no VI
963  // attached. The filler must also set the cache status variable to true during
964  // its execution.
965 
968  virtual casacore::Int & fillArrayId();
969  //virtual casacore::Matrix<casacore::Int>& fillChanAveBounds();
982  virtual casacore::Int & fillFieldId();
988  virtual casacore::Vector<casacore::Double>& fillFreq(); // Puts SPECTRAL_WINDOW/CHAN_FREQ in frequency_p.
989  //virtual casacore::Matrix<casacore::Float>& fillImagingWeight();
990  //virtual casacore::Vector<casacore::Double>& fillLSRFreq();
991  virtual casacore::Int & fillnChannel();
992  virtual casacore::Int & fillnCorr();
993  // virtual casacore::Int & fillnCat();
994  virtual casacore::Int & fillnRow();
997  virtual casacore::Int & fillPolFrame();
1002  virtual casacore::Int & fillSpW();
1014 
1016 
1017  // Variables to track validity of cache (alphabetical order)
1018 
1019 #define CacheStatus(item) \
1020 virtual bool item ## OK () const\
1021 {\
1022  return item ## OK_p;\
1023 }\
1024 bool item ## OK_p;
1025 
1026  // Define the cache statuses
1027  //
1028  // For example, CacheStatus (antenna1) defines:
1029  //
1030  // virtual casacore::Bool antenna1OK () const { return antenna1OK_p;}
1031  //
1032  // and
1033  //
1034  // casacore::Bool antenna1OK_p;
1035 
1038  CacheStatus (arrayId);
1039  CacheStatus (channel);
1040  CacheStatus (cjones);
1050  CacheStatus (feed1);
1052  CacheStatus (feed2);
1053  CacheStatus (fieldId);
1056  CacheStatus (flag);
1057  CacheStatus (flagRow);
1063  CacheStatus (ms);
1065  CacheStatus (nCorr);
1066  CacheStatus (nRow);
1071  CacheStatus (rowIds);
1072  CacheStatus (scan);
1074  CacheStatus (sigma);
1076  CacheStatus (stateId);
1079  CacheStatus (time);
1080  CacheStatus (uvwMat);
1081  CacheStatus (uvw);
1082  CacheStatus (visCube);
1085  CacheStatus (weight);
1087 
1088  // Cached values (alphabetical order)
1089 
1100  casacore::Vector<casacore::MDirection> direction1_p; //where the first antenna/feed is pointed to
1101  casacore::Vector<casacore::MDirection> direction2_p; //where the second antenna/feed is pointed to
1116  //casacore::Vector<casacore::Double> lsrFrequency_p;
1121  // casacore::Int nCat_p;
1144 
1145 };
1146 
1147 // <summary>
1148 // A convenience class to assist in migrating code to potentially use
1149 // asynchronous I/O.
1150 //
1151 // <prerequisite>
1152 // <li> <linkto class="VisBuffer">VisBuffer</linkto>
1153 // <li> <linkto class="VisBufferAsync">VisBufferAsync</linkto>
1154 // <li> <linkto class="ROVisibilityIterator">ROVisibilityIterator</linkto>
1155 // </prerequisite>
1156 //
1157 // </summary>
1158 //
1159 // <synopsis>
1160 //
1161 // When existing code is modified to potentially use asynchronous I/O the current
1162 // VisBuffer usage is probably using automatic (stack) storage which will have to
1163 // be replaced to allow VisBufferAsync objects (which derive from VisBuffer) to be
1164 // used with asynchronous I/O. The goal of this class is to make that transition
1165 // easier. The user will replace their existing declaration of a VisBuffer object
1166 // with a declaration of a VisBufferAutoPtr object. Depending on the attributes
1167 // of the VisBuffer reference/pointer or the ROVisibilityIterator provided in the
1168 // VisBufferAutoPtr constructor, the appropriate type of VisBuffer will be created
1169 // dynamically. The VisBufferAutoPtr will also function somewhat like an auto_ptr
1170 // and delete the underlying object when the VisBufferAutoPtr object is destroyed.
1171 //
1172 // Once the straight VisBuffer declaration is replaced, then the code in its scope
1173 // will need to be modified to dereference the VisBufferAutoPtr or to delete use
1174 // of the address-of operator, "&", applied to the previous VisBuffer variable.
1175 // See the example below.
1176 //
1177 // </synopsis>
1178 // <example>
1179 //
1180 // <code>
1181 // // Before adding asynchronous I/O support
1182 //
1183 // VisBuffer vb (vi);
1184 //
1185 // doSomething (vb); // void doSomething (VisBuffer &);
1186 // doSomethingElse (& vb); // void doSomethingElse (VisBuffer *);
1187 //
1188 // // After adding asynchronous I/O support
1189 //
1190 // VisBufferAutoPtr vb (vi);
1191 //
1192 // doSomething (* vb);
1193 // doSomethingElse (vb.get());
1194 //
1195 // </code>
1196 // </example>
1197 //
1199 
1200 public:
1201 
1202  VisBufferAutoPtr ();
1204  explicit VisBufferAutoPtr (VisBuffer &);
1205  explicit VisBufferAutoPtr (VisBuffer *);
1206  explicit VisBufferAutoPtr (ROVisibilityIterator * rovi);
1207  explicit VisBufferAutoPtr (ROVisibilityIterator & rovi);
1208  ~VisBufferAutoPtr ();
1209 
1211  VisBuffer & operator* () const;
1212  VisBuffer * operator-> () const;
1213 
1214  VisBuffer * get () const;
1215  VisBuffer * release ();
1216  void set (VisBuffer &);
1217  void set (VisBuffer *);
1218  void set (ROVisibilityIterator * rovi, casacore::Bool attachIt = false);
1219  void set (ROVisibilityIterator & rovi, casacore::Bool attachIt = false);
1220 
1221 protected:
1222 
1223  void construct (ROVisibilityIterator * rovi, casacore::Bool attachVi);
1224  void constructVb (VisBuffer * rovi);
1225 
1226 private:
1227 
1229 
1230 };
1231 
1232 } //# NAMESPACE CASA - END
1233 
1234 #ifndef AIPS_NO_TEMPLATE_SRC
1235 #include <msvis/MSVis/VisBuffer.tcc>
1236 #endif //# AIPS_NO_TEMPLATE_SRC
1237 
1238 #endif
1239 
virtual casacore::Int & fieldIdRef()
Definition: VisBuffer.h:362
casacore::Vector< casacore::Int > stateId_p
Definition: VisBuffer.h:1132
virtual casacore::Int & fillnRow()
virtual casacore::Int &amp; fillnCat();
casacore::Matrix< casacore::Float > sigmaMat_p
Definition: VisBuffer.h:1130
virtual casacore::Vector< casacore::Double > & fillTimeCentroid()
virtual const casacore::Cube< casacore::Complex > & visCube() const
Definition: VisBuffer.h:580
A Measure: astronomical direction.
Definition: MDirection.h:174
virtual casacore::Matrix< casacore::Float > & fillSigmaMat()
virtual casacore::Vector< casacore::Int > & fillFeed2()
virtual void normalize(const casacore::Bool &phaseOnly=false)
Normalize the visCube by the modelVisCube (and optionally also divide visCube_p by its normalized amp...
virtual casacore::Vector< casacore::Int > & fillScan()
virtual const casacore::Matrix< CStokesVector > & visibility() const
Definition: VisBuffer.h:557
virtual casacore::Array< casacore::Bool > & fillFlagCategory()
int Int
Definition: aipstype.h:50
virtual casacore::Int & nCorr()
Access functions.
Definition: VisBuffer.h:204
casacore::Matrix< CStokesVector > correctedVisibility_p
Definition: VisBuffer.h:1097
VisBufferAutoPtr & operator=(VisBufferAutoPtr &other)
casacore::Vector< casacore::Int > corrType_p
Definition: VisBuffer.h:1098
virtual casacore::Cube< casacore::Float > & weightSpectrum()
Definition: VisBuffer.h:649
virtual casacore::MDirection azel0(casacore::Double time) const
Note that azel is a function instead of a cached value.
casacore::Vector< casacore::MDirection > direction2_p
Definition: VisBuffer.h:1101
virtual void dirtyComponentsClear()
virtual casacore::Bool newFieldId() const
virtual casacore::Matrix< casacore::Double > & uvwMat()
Definition: VisBuffer.h:547
VisBuffer & operator*() const
casacore::Vector< casacore::Float > feed2_pa_p
Definition: VisBuffer.h:1107
Elements::const_iterator const_iterator
casacore::Cube< casacore::Float > floatDataCube_p
Definition: VisBuffer.h:1113
virtual const casacore::Vector< casacore::Int > & antenna1() const
Definition: VisBuffer.h:257
virtual casacore::Vector< casacore::RigidVector< casacore::Double, 3 > > & filluvw()
virtual casacore::Vector< casacore::RigidVector< casacore::Double, 3 > > & uvw()
Definition: VisBuffer.h:540
virtual casacore::Vector< casacore::Int > & fillFeed1()
StatsData< AccumType > copy(const StatsData< AccumType > &stats)
virtual const casacore::Cube< casacore::Float > & floatDataCube() const
Definition: VisBuffer.h:624
virtual casacore::Float parang0(casacore::Double time) const
NOMINAL parallactic angle (feed p.a.
casacore::Vector< casacore::RigidVector< casacore::Double, 3 > > uvw_p
Definition: VisBuffer.h:1136
Object to hold type of imaging weight scheme to be used on the fly and to provide facilities to do th...
casacore::Array< casacore::Bool > flagCategory_p
Definition: VisBuffer.h:1110
casacore::Vector< casacore::Double > timeInterval_p
Definition: VisBuffer.h:1135
virtual void setFloatDataCube(const casacore::Cube< casacore::Float > &fcube)
Like the above, but for FLOAT_DATA, keeping it as real floats.
virtual casacore::Vector< casacore::Double > & fillTimeInterval()
casacore::MDirection phaseCenter_p
Definition: VisBuffer.h:1124
virtual casacore::Bool newArrayId() const
virtual const casacore::Cube< casacore::Complex > & correctedVisCube() const
Definition: VisBuffer.h:609
virtual ~VisBuffer()
Destructor (detaches from VisIter)
virtual const casacore::Matrix< casacore::Bool > & flag() const
Definition: VisBuffer.h:378
Object to provide MODEL_DATA visibilities on demand.
Definition: VisModelData.h:147
virtual const casacore::Vector< casacore::Float > & feed1_pa() const
Definition: VisBuffer.h:299
virtual void setCorrectedVisCube(casacore::Complex c)
VisBuffer * visBuffer_p
Definition: VisBuffer.h:1228
casacore::Vector< casacore::Int > antenna2_p
Definition: VisBuffer.h:1091
virtual void setModelVisCube(casacore::Complex c)
virtual casacore::Int & arrayIdRef()
Definition: VisBuffer.h:366
virtual casacore::Vector< casacore::Float > & feed2_pa()
Definition: VisBuffer.h:303
virtual casacore::Int nCorr() const
Definition: VisBuffer.h:207
casacore::Vector< casacore::Bool > flagRow_p
Definition: VisBuffer.h:1112
virtual casacore::Vector< casacore::Double > & timeCentroid()
Definition: VisBuffer.h:519
virtual casacore::Int dataDescriptionId() const
Definition: VisBuffer.h:509
virtual casacore::Int nChannel() const
Definition: VisBuffer.h:214
VLAT is the Visibility LookAhead Thread. This thread advances a visibility iterator and fills the dat...
Definition: VLAT.h:219
virtual void allSelectedSpectralWindows(casacore::Vector< casacore::Int > &spws, casacore::Vector< casacore::Int > &nvischan)
Get all selected spectral windows not just the one in the actual buffer.
Definition: VisBuffer.h:794
casacore::Cube< casacore::Float > weightSpectrum_p
Definition: VisBuffer.h:1143
virtual void validate()
validate the cache
virtual const casacore::Cube< casacore::Float > & weightSpectrum() const
Definition: VisBuffer.h:652
virtual casacore::Bool newSpectralWindow() const
virtual const casacore::ROMSColumns & msColumns() const
Access the current casacore::ROMSColumns object via VisIter.
Definition: VisBuffer.h:785
TableExprNode phase(const TableExprNode &node)
The phase (i.e.
Definition: ExprNode.h:1405
void set(VisBuffer &)
virtual VisBuffer & operator=(const VisBuffer &vb)
Assignment, loses synchronization with iterator: only use buffer for current iteration (or reattach) ...
virtual casacore::Cube< casacore::Float > & fillFloatDataCube()
virtual casacore::Int & fillnCorr()
virtual casacore::Cube< casacore::Bool > & flagCube()
Return flag for each polarization, channel and row.
Definition: VisBuffer.h:383
virtual casacore::Vector< casacore::Int > vecIntRange(const MSCalEnums::colDef &calEnum) const
Utility functions to provide coordinate or column ranges of the data in the VisBuffer.
virtual casacore::Vector< casacore::Float > & fillSigma()
virtual casacore::Double hourang(casacore::Double time) const
Hour angle for specified time.
virtual const casacore::Vector< casacore::Float > & weight() const
Definition: VisBuffer.h:632
virtual casacore::MDirection & fillPhaseCenter()
virtual casacore::Vector< casacore::Int > & antenna2()
Definition: VisBuffer.h:261
casacore::Matrix< CStokesVector > visibility_p
Definition: VisBuffer.h:1139
virtual const casacore::Cube< casacore::Complex > & modelVisCube() const
Definition: VisBuffer.h:601
casacore::Vector< casacore::Int > processorId_p
Definition: VisBuffer.h:1126
virtual casacore::Int arrayId() const
Definition: VisBuffer.h:370
virtual casacore::Cube< casacore::Float > & fillWeightSpectrum()
virtual casacore::Int & nRow()
virtual casacore::Int &amp; nCat() { return nCatOK_p ? nCat_p : fillnCat(); } virtual casacore::Int nCat(...
Definition: VisBuffer.h:245
virtual casacore::Vector< casacore::uInt > & rowIds()
Return the row Ids from the original ms.
virtual casacore::Vector< casacore::MDirection > & direction2()
Definition: VisBuffer.h:331
VisBuffer * This
Definition: VisBuffer.h:937
virtual casacore::Vector< casacore::Int > & fillAnt1()
+----------------------------------------------—+ | Cache Declarations (fillers, statuses and data) |...
virtual casacore::Vector< casacore::Float > & fillFeed1_pa()
virtual casacore::Matrix< casacore::Float > & fillWeightMat()
virtual const casacore::Vector< casacore::Int > & processorId() const
Definition: VisBuffer.h:421
virtual casacore::Int polarizationId() const
Definition: VisBuffer.h:503
virtual casacore::Int & fillSpW()
casacore::Vector< casacore::Int > observationId_p
Definition: VisBuffer.h:1123
casacore::Int nCorr_p
Definition: VisBuffer.h:1120
virtual casacore::Matrix< CStokesVector > & modelVisibility()
Definition: VisBuffer.h:561
virtual void invalidate()
Invalidate the cache.
casacore::Int nRow_p
casacore::Int nCat_p;
Definition: VisBuffer.h:1122
virtual VbDirtyComponents dirtyComponentsGet() const
static VbDirtyComponents these(VisBufferComponents::EnumType component,...)
virtual casacore::Bool checkMSId()
casacore::Vector< casacore::Double > frequency_p
Definition: VisBuffer.h:1114
virtual casacore::Vector< casacore::Double > & frequency()
Gets SPECTRAL_WINDOW/CHAN_FREQ (in Hz, acc.
Definition: VisBuffer.h:440
casacore::Vector< casacore::Int > scan_p
Definition: VisBuffer.h:1128
casacore::Cube< casacore::Complex > correctedVisCube_p
Definition: VisBuffer.h:1096
CacheStatus(antenna1)
Define the cache statuses.
const_iterator begin() const
virtual casacore::Vector< casacore::Int > & fillChannel()
virtual casacore::Matrix&lt;casacore::Int&gt;&amp; fillChanAveBounds();
virtual casacore::Int & dataDescriptionIdRef()
Definition: VisBuffer.h:506
virtual casacore::Matrix< casacore::Float > & sigmaMat()
Definition: VisBuffer.h:490
virtual casacore::Vector< casacore::Int > & antenna1()
Definition: VisBuffer.h:254
virtual casacore::Cube< casacore::Complex > & modelVisCube()
Definition: VisBuffer.h:584
PredefinedColumns
The Main table colums with predefined meaning.
Definition: MSMainEnums.h:65
virtual casacore::Matrix< CStokesVector > & fillVis(VisibilityIterator::DataColumn whichOne)
virtual const casacore::Matrix< CStokesVector > & correctedVisibility() const
Definition: VisBuffer.h:573
virtual casacore::Int & fillDataDescriptionId()
casacore::Cube< casacore::Float > weightCube_p
Definition: VisBuffer.h:1141
casacore::Bool newMS_p
Definition: VisBuffer.h:1015
virtual casacore::Int spectralWindow() const
Definition: VisBuffer.h:500
virtual casacore::Cube< casacore::Complex > & visCube()
Definition: VisBuffer.h:577
A Measure: instant in time.
Definition: MEpoch.h:104
virtual const casacore::Vector< casacore::Int > & feed1() const
Definition: VisBuffer.h:271
virtual casacore::Int nRowChunk() const
void chanAveFlagCategory(casacore::Array< casacore::Bool > &flagcat, const casacore::Int nChanOut)
Doesn&#39;t do anything if flagcat is degenerate.
virtual void phaseCenterShift(const casacore::Vector< casacore::Double > &phase)
Rotate visibility phase for given vector (dim = nrow of vb) of phases (metres)
static VbDirtyComponents all()
virtual casacore::Int & fillPolFrame()
virtual const casacore::Vector< casacore::Int > & observationId() const
Definition: VisBuffer.h:428
void checkVisIterBase(const char *func, const char *file, int line, const char *extra="") const
virtual const casacore::Vector< casacore::MDirection > & direction1() const
Definition: VisBuffer.h:327
casacore::Int nChannel_p
Definition: VisBuffer.h:1119
casacore::Bool contains(VisBufferComponents::EnumType component) const
virtual casacore::Int fieldId() const
Definition: VisBuffer.h:358
ABSTRACT CLASSES Deliberately vague to be general enough to allow for many different types of data
Definition: PlotData.h:48
casacore::Cube< casacore::Complex > modelVisCube_p
casacore::Vector&lt;casacore::Double&gt; lsrFrequency_p;
Definition: VisBuffer.h:1117
VbDirtyComponents operator+(const VbDirtyComponents &other) const
virtual casacore::Vector< casacore::Bool > & fillFlagRow()
virtual void refModelVis(const casacore::Matrix< CStokesVector > &mvis)
Reference external model visibilities.
virtual casacore::Int getOldMsId() const
casacore::Vector< casacore::Double > time_p
Definition: VisBuffer.h:1133
void construct(ROVisibilityIterator *rovi, casacore::Bool attachVi)
const casacore::ROMSColumns & msColumns() const
Access the current casacore::ROMSColumns object in MSIter.
virtual casacore::Vector< casacore::Int > & observationId()
Definition: VisBuffer.h:425
virtual casacore::Vector< casacore::Float > & sigma()
Definition: VisBuffer.h:483
virtual casacore::Matrix< CStokesVector > & correctedVisibility()
Definition: VisBuffer.h:569
void allSelectedSpectralWindows(casacore::Vector< casacore::Int > &spws, casacore::Vector< casacore::Int > &nvischan)
get back the selected spectral windows and spectral channels for current ms
casacore::Int dataDescriptionId_p
Definition: VisBuffer.h:1099
casacore::Vector< casacore::Int > feed1_p
Definition: VisBuffer.h:1104
casacore::Cube< casacore::Bool > flagCube_p
Definition: VisBuffer.h:1111
virtual ROVisibilityIterator * getVisibilityIterator() const
Referenced counted pointer for constant data.
Definition: VisModelData.h:42
virtual casacore::Vector< casacore::Float > feed_pa(casacore::Double time) const
Note that feed_pa is a function instead of a cached value.
virtual casacore::Vector< casacore::Int > & fillObservationId()
virtual casacore::Vector< casacore::Int > unique(const casacore::Vector< casacore::Int > &indices) const
Filter index arrays for unique elements.
virtual void sortCorr()
casacore::Sort/unsort the correlations, if necessary (Rudimentary handling of non-canonically sorted ...
The PrefetchColumns class is used to specify a set of columns that can be prefetched when the (RO)Vis...
virtual void detachFromVisIter()
casacore::Matrix< casacore::Float > imagingWeight_p
Definition: VisBuffer.h:1115
virtual casacore::Vector< casacore::Int > & feed1()
Definition: VisBuffer.h:268
static void cacheCopyNormal(casacore::Bool &newStatus, casacore::Bool oldStatus, T &newCache, const VisBuffer &other, T(VisBuffer::*oldCache)() const, casacore::Bool force)
Definition: VisBuffer.h:904
casacore::Bool corrSorted_p
Definition: VisBuffer.h:933
virtual casacore::Vector< casacore::Int > & fillCorrType()
virtual void checkVisIter(const char *func, const char *file, int line, const char *extra="") const
static const VbDirtyComponents all_p
Definition: VisBuffer.h:100
virtual casacore::Vector< casacore::Float > & feed1_pa()
feed1_pa() and feed2_pa() return an array of parallactic angles (each corresponds to the first recept...
Definition: VisBuffer.h:296
casacore::Bool existsWeightSpectrum() const
Determine whether WEIGHT_SPECTRUM exists.
virtual void dirtyComponentsAdd(const VbDirtyComponents &additionalDirtyComponents)
virtual void unSortCorr()
virtual casacore::MDirection & phaseCenter()
Definition: VisBuffer.h:464
virtual const casacore::Array< casacore::Bool > & flagCategory() const
Definition: VisBuffer.h:401
virtual casacore::Vector< casacore::Double > & fillFreq()
virtual casacore::Int msId() const
Return the actual msid, useful if using multiple ms to monitor which ms in the list is being dealt wi...
Definition: VisBuffer.h:811
virtual void resetWeightMat()
Fill weightMat according to sigma column.
Set::const_iterator const_iterator
Definition: VisBuffer.h:80
virtual casacore::MDirection phaseCenter() const
Definition: VisBuffer.h:467
virtual casacore::Vector< casacore::Int > & scan()
Definition: VisBuffer.h:405
double Double
Definition: aipstype.h:55
virtual casacore::Vector< casacore::MDirection > azel(casacore::Double time) const
virtual casacore::Bool fetch(const asyncio::PrefetchColumns *pfc)
A class to provide easy read-only access to MeasurementSet columns.
Definition: MSColumns.h:111
virtual const casacore::Vector< casacore::Float > & sigma() const
Definition: VisBuffer.h:486
void resize(size_t nx, size_t ny, size_t nz, Bool copyValues=False)
Definition: Cube.h:138
virtual casacore::Vector< casacore::SquareMatrix< casacore::Complex, 2 > > & CJones()
Definition: VisBuffer.h:310
virtual casacore::MDirection & firstDirection1()
Definition: VisBuffer.h:338
void allSelectedSpectralWindows(casacore::Vector< casacore::Int > &spws, casacore::Vector< casacore::Int > &nvischan) const
Definition: VisBuffer.h:805
virtual void formStokes()
Form casacore::Stokes parameters from correlations (these are preliminary versions) ...
virtual const casacore::Matrix< casacore::Float > & sigmaMat() const
Definition: VisBuffer.h:493
virtual void formStokesWeightandFlag()
void freqAveCubes()
Frequency average the buffer (visCube and [if present] modelVisCube)
casacore::Vector< casacore::Double > timeCentroid_p
Definition: VisBuffer.h:1134
virtual casacore::Vector< casacore::Int > & feed2()
Definition: VisBuffer.h:275
virtual const casacore::Vector< casacore::Double > & timeCentroid() const
Definition: VisBuffer.h:522
void constructVb(VisBuffer *rovi)
virtual const casacore::Vector< casacore::Double > & exposure() const
Definition: VisBuffer.h:536
virtual casacore::Matrix< casacore::Float > & weightMat()
Returns the nPol_p x curNumRow_p weight matrix.
Definition: VisBuffer.h:637
A convenience class to assist in migrating code to potentially use asynchronous I/O.
Definition: VisBuffer.h:1198
casacore::CountedPtr< VisModelDataI > visModelData_p
Definition: VisBuffer.h:940
virtual casacore::Matrix< casacore::Double > & azelMat(casacore::Double time, casacore::Matrix< casacore::Double > &azelMat) const
virtual casacore::Array< casacore::Bool > & flagCategory()
Return flags for each polarization, channel, category, and row.
Definition: VisBuffer.h:398
virtual const casacore::Vector< casacore::uInt > & rowIds() const
Definition: VisBuffer.h:691
virtual casacore::Matrix< casacore::Float > & imagingWeight()
virtual casacore::Int polFrame() const
Definition: VisBuffer.h:472
virtual casacore::Vector< casacore::Double > & azel0Vec(casacore::Double time, casacore::Vector< casacore::Double > &azelVec) const
virtual casacore::Vector< casacore::Int > & fillStateId()
casacore::Int lastPointTableRow_p
Definition: VisBuffer.h:935
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
virtual const casacore::Matrix< CStokesVector > & modelVisibility() const
Definition: VisBuffer.h:565
casacore::Vector< casacore::uInt > rowIds_p
Definition: VisBuffer.h:1127
virtual casacore::Cube< casacore::Complex > & modelVisCube(const casacore::Bool &matchVisCubeShape)
Definition: VisBuffer.h:589
casacore::Vector< casacore::MDirection > direction1_p
Definition: VisBuffer.h:1100
virtual casacore::Vector< casacore::Int > & fillAnt2()
casacore::Int oldMSId_p
Definition: VisBuffer.h:936
void updateCoordS(const VisBuffer *other, casacore::Bool otherOk, Scalar(VisBuffer::*getCoord)() const, Scalar &coord, casacore::Bool &coordOk)
Definition: VisBuffer.h:857
virtual void removeScratchCols()
Remove scratch cols data from vb.
static void cacheCopyArray(casacore::Bool &newStatus, casacore::Bool oldStatus, T &newCache, const VisBuffer &other, const T &(VisBuffer::*oldCache)() const, casacore::Bool force)
Definition: VisBuffer.h:882
virtual const casacore::Vector< casacore::Int > & stateId() const
Definition: VisBuffer.h:435
casacore::Vector< casacore::Int > channel_p
Definition: VisBuffer.h:1094
virtual void chanAveFlagCube(casacore::Cube< casacore::Bool > &flagcube, const casacore::Int nChanOut, const casacore::Bool restoreWeightSpectrum=true)
This defaults to no conceptual side effects, but usually it is more efficient to let it leave weightS...
virtual void setAllCacheStatuses(bool status)
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) const
Definition: VisBuffer.h:798
virtual casacore::Int & spectralWindow()
Definition: VisBuffer.h:497
virtual const casacore::Vector< casacore::Double > & time() const
Definition: VisBuffer.h:515
casacore::Cube< casacore::Complex > visCube_p
Definition: VisBuffer.h:1138
float Float
Definition: aipstype.h:54
casacore::Matrix< casacore::Int > chanAveBounds_p
Definition: VisBuffer.h:1093
virtual void copyMsInfo(casacore::Int &msID, casacore::Bool &MsOk_p, casacore::Bool &newMs) const
virtual casacore::Vector< casacore::Float > & weight()
Returns the weights for each row averaged over the parallel hand correlations.
Definition: VisBuffer.h:629
VisBuffers encapulsate one chunk of visibility data for processing.
virtual casacore::Vector< casacore::Double > & fillExposure()
casacore::Int spectralWindow_p
Definition: VisBuffer.h:1131
virtual void copyCache(const VisBuffer &other, casacore::Bool force)
virtual const casacore::Matrix< casacore::Double > & uvwMat() const
Definition: VisBuffer.h:550
TableExprNode shape(const TableExprNode &array)
Function operating on any scalar or array resulting in a Double array containing the shape...
Definition: ExprNode.h:1944
virtual void freqAverage()
Frequency average the buffer (visibility() column only)
VisBuffer & operator-=(const VisBuffer &vb)
subtraction: return the difference of the visibilities, flags of this and other are or-ed...
virtual casacore::Vector< casacore::Int > & fillProcessorId()
virtual const casacore::Vector< casacore::Int > & channel() const
Definition: VisBuffer.h:221
virtual casacore::Vector< casacore::MDirection > & fillDirection2()
virtual const casacore::Vector< casacore::Double > & timeInterval() const
Definition: VisBuffer.h:529
void channelAve(const casacore::Matrix< casacore::Int > &chanavebounds, casacore::Bool calmode=true)
Average channel axis according to chanavebounds, for whichever of DATA, MODEL_DATA, CORRECTED_DATA, FLOAT_DATA, FLAG, and WEIGHT_SPECTRUM are present.
virtual casacore::Cube< casacore::Float > & floatDataCube()
Definition: VisBuffer.h:621
virtual casacore::Vector< casacore::Int > & corrType()
Definition: VisBuffer.h:476
virtual VisBuffer * clone() const
simple 1-D array
void chanAccCube(casacore::Cube< T > &data, casacore::Int nChanOut)
Accumulate channel axis by factor, without applying WEIGHT_SPECTRUM even if it is present...
virtual const casacore::Vector< casacore::RigidVector< casacore::Double, 3 > > & uvw() const
Definition: VisBuffer.h:543
std::set< VisBufferComponents::EnumType > Set
Definition: VisBuffer.h:79
casacore::Vector< casacore::Float > feed1_pa_p
Definition: VisBuffer.h:1105
casacore::Int polFrame_p
Definition: VisBuffer.h:1125
virtual casacore::Int & fillArrayId()
virtual casacore::Vector< casacore::Bool > & flagRow()
Definition: VisBuffer.h:390
casacore::Vector< casacore::Float > sigma_p
Definition: VisBuffer.h:1129
virtual casacore::Vector< casacore::Float > & fillWeight()
virtual casacore::Int numberCoh() const
virtual casacore::Vector< casacore::Double > & timeInterval()
Definition: VisBuffer.h:526
static VbDirtyComponents singleton(VisBufferComponents::EnumType component)
void updateCoord(const VisBuffer *other, casacore::Bool otherOk, const Coord &(VisBuffer::*getCoord)() const, Coord &coord, casacore::Bool &coordOk)
Definition: VisBuffer.h:841
virtual const casacore::Cube< casacore::Bool > & flagCube() const
Definition: VisBuffer.h:386
virtual void updateCoordInfo(const VisBuffer *vb=NULL, const casacore::Bool dirDependent=true)
Update coordinate info - useful for copied VisBuffers that need to retain some state for later refere...
virtual void attachToVisIter(ROVisibilityIterator &iter)
Attach to a VisIter.
colDef
Enumerate all relevant data fields (columns and keywords)
Definition: MSCalEnums.h:92
virtual casacore::Int numberAnt() const
A class for high precision time.
Definition: MVEpoch.h:90
virtual casacore::Vector< casacore::Int > antIdRange() const
Antenna id.
casacore::Bool twoWayConnection_p
Definition: VisBuffer.h:938
virtual casacore::Bool newMS() const
checked if the ms has changed since the last chunk processed
Definition: VisBuffer.h:817
casacore::Matrix< CStokesVector > modelVisibility_p
Definition: VisBuffer.h:1118
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 ...
virtual void setVisCube(casacore::Complex c)
Set the visibility to a constant, note that this only changes the buffer, no values are written back ...
virtual const casacore::MDirection & firstDirection1() const
Definition: VisBuffer.h:342
casacore::Int arrayId_p
Definition: VisBuffer.h:1092
casacore::Cube< casacore::Complex > & dataCube(const casacore::MS::PredefinedColumns whichcol=casacore::MS::DATA)
Return visCube(), modelVisCube(), or correctedVisCube(), according to whichcol.
casacore::Matrix< casacore::Double > uvwMat_p
Definition: VisBuffer.h:1137
VbDirtyComponents allows marking portions of a VisBuffer as modified (aka dirty). This feature is nee...
Definition: VisBuffer.h:75
virtual casacore::Vector< casacore::Int > & channel()
Definition: VisBuffer.h:218
virtual const casacore::Matrix< casacore::Float > & weightMat() const
Definition: VisBuffer.h:640
virtual const casacore::Vector< casacore::Float > & feed2_pa() const
Definition: VisBuffer.h:306
VisBuffer()
Create empty VisBuffer you can assign to or attach.
virtual casacore::Vector< casacore::Float > parang(casacore::Double time) const
const Double c
Fundamental physical constants (SI units):
casacore::MDirection firstDirection1_p
Definition: VisBuffer.h:1102
static VbDirtyComponents initializeAll()
casacore::Vector< casacore::Double > exposure_p
Definition: VisBuffer.h:1103
void copyCoordInfo(const VisBuffer &other, casacore::Bool force=false)
virtual casacore::Int nRow() const
Definition: VisBuffer.h:248
virtual VisBuffer & assign(const VisBuffer &vb, casacore::Bool copy=true)
Assignment, optionally without copying the data across; with copy=true this is identical to normal as...
virtual casacore::Int & nChannel()
Definition: VisBuffer.h:211
virtual casacore::Bool nonCanonCorr()
String: the storage and methods of handling collections of characters.
Definition: String.h:223
virtual casacore::Cube< casacore::Complex > & correctedVisCube()
Definition: VisBuffer.h:605
virtual casacore::Vector< casacore::Double > & fillTime()
virtual casacore::MDirection & fillFirstDirection1()
virtual void dirtyComponentsSet(const VbDirtyComponents &dirtyComponents)
casacore::Vector< casacore::SquareMatrix< casacore::Complex, 2 > > cjones_p
Definition: VisBuffer.h:1095
virtual casacore::Cube< casacore::Complex > & fillVisCube(VisibilityIterator::DataColumn whichOne)
virtual const casacore::Vector< casacore::Bool > & flagRow() const
Definition: VisBuffer.h:393
casacore::Matrix< casacore::Bool > flag_p
Definition: VisBuffer.h:1109
virtual casacore::Int & fillnChannel()
virtual casacore::Matrix&lt;casacore::Float&gt;&amp; fillImagingWeight(); virtual casacore::Vector&lt;casacore::Do...
VisBuffers encapsulate one chunk of visibility data for processing.
Definition: VisBuffer.h:153
virtual casacore::Vector< casacore::Double > & time()
Definition: VisBuffer.h:512
virtual casacore::Cube< casacore::Float > & weightCube()
virtual casacore::Matrix&lt;casacore::Float&gt;&amp; imagingWeight() { return imagingWeightOK_p ...
Definition: VisBuffer.h:667
static VbDirtyComponents exceptThese(VisBufferComponents::EnumType component,...)
virtual casacore::Int & fillFieldId()
casacore::Vector< casacore::Int > antenna1_p
Cached values (alphabetical order)
Definition: VisBuffer.h:1090
virtual casacore::Vector< casacore::Int > & processorId()
Definition: VisBuffer.h:418
casacore::Matrix< casacore::Float > weightMat_p
Definition: VisBuffer.h:1142
VisBuffer * operator->() const
casacore::Int polarizationId() const
Return current Polarization Id.
virtual casacore::Matrix< CStokesVector > & visibility()
Definition: VisBuffer.h:554
void chanAveVisCube(casacore::Cube< T > &data, casacore::Int nChanOut)
Average channel axis by factor.
ROVisibilityIterator iterates through one or more readonly MeasurementSets.
virtual casacore::String msName(casacore::Bool stripPath=false) const
get the name of the ms the buffer is at empty string if no visiter is attached
virtual const casacore::Vector< casacore::Int > & scan() const
Definition: VisBuffer.h:408
virtual casacore::Vector< casacore::MDirection > & direction1()
direction1() and direction2() return arrays of directions where the first and the second antenna/feed...
Definition: VisBuffer.h:323
virtual casacore::Vector< casacore::SquareMatrix< casacore::Complex, 2 > > & fillCjones()
virtual casacore::Bool timeRange(casacore::MEpoch &rTime, casacore::MVEpoch &rTimeEP, casacore::MVEpoch &rInterval) const
casacore::Time range
virtual const casacore::Vector< casacore::MDirection > & direction2() const
Definition: VisBuffer.h:335
VisBuffer * release()
casacore::Int fieldId_p
Definition: VisBuffer.h:1108
virtual const casacore::Vector< casacore::SquareMatrix< casacore::Complex, 2 > > & CJones() const
Definition: VisBuffer.h:313
virtual casacore::Matrix< casacore::Double > & filluvwMat()
Complex visibility matrix.
Definition: MSMainEnums.h:183
casacore::Vector< casacore::Int > feed2_p
Definition: VisBuffer.h:1106
const_iterator end() const
virtual const casacore::Vector< casacore::Int > & corrType() const
Definition: VisBuffer.h:479
casacore::Vector< casacore::Float > weight_p
Definition: VisBuffer.h:1140
VbDirtyComponents dirtyComponents_p
Definition: VisBuffer.h:934
virtual const casacore::Vector< casacore::Int > & antenna2() const
Definition: VisBuffer.h:264
virtual casacore::Matrix< casacore::Bool > & flag()
Return flag for each channel &amp; row.
Definition: VisBuffer.h:375
static VbDirtyComponents none()
virtual const casacore::Vector< casacore::Double > & frequency() const
Definition: VisBuffer.h:443
virtual casacore::Vector< casacore::Float > & fillFeed2_pa()
virtual void lsrFrequency(const casacore::Int &spw, casacore::Vector< casacore::Double > &freq, casacore::Bool &convert, const casacore::Bool ignoreconv=false) const
virtual casacore::Vector&lt;casacore::Double&gt;&amp; lsrFrequency() { return lsrFrequencyOK_p ...
virtual casacore::Bool existsWeightSpectrum() const
Is a valid WEIGHT_SPECTRUM available?
Definition: VisBuffer.h:645
virtual casacore::Vector< casacore::Double > & exposure()
Definition: VisBuffer.h:533
ROVisibilityIterator * visIter_p
Definition: VisBuffer.h:939
virtual casacore::Matrix< casacore::Bool > & fillFlag()
virtual casacore::Cube< casacore::Bool > & fillFlagCube()
virtual casacore::Vector< casacore::MDirection > & fillDirection1()
virtual casacore::Int scan0()
scalar version for convenience, when scan known constant for entire iteration/buffer.
Definition: VisBuffer.h:414
virtual casacore::Vector< casacore::Int > & stateId()
Definition: VisBuffer.h:432
Defines nreal time structures used by the VLA table filler.
Definition: nreal.h:100
virtual const casacore::Vector< casacore::Int > & feed2() const
Definition: VisBuffer.h:278