casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
VisibilityIteratorImplAsync2.h
Go to the documentation of this file.
00001 //# VisibilityIterator.h: Step through the MeasurementEquation by visibility
00002 //# Copyright (C) 1996,1997,1998,1999,2000,2001,2002,2003
00003 //# Associated Universities, Inc. Washington DC, USA.
00004 //#
00005 //# This library is free software; you can redistribute it and/or modify it
00006 //# under the terms of the GNU Library General Public License as published by
00007 //# the Free Software Foundation; either version 2 of the License, or (at your
00008 //# option) any later version.
00009 //#
00010 //# This library is distributed in the hope that it will be useful, but WITHOUT
00011 //# ANY WARRANTY; without even the Implied warranty of MERCHANTABILITY or
00012 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00013 //# License for more details.
00014 //#
00015 //# You should have received a copy of the GNU Library General Public License
00016 //# along with this library; if not, write to the Free Software Foundation,
00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00018 //#
00019 //# Correspondence concerning AIPS++ should be addressed as follows:
00020 //#        Internet email: aips2-request@nrao.edu.
00021 //#        Postal address: AIPS++ Project Office
00022 //#                        National Radio Astronomy Observatory
00023 //#                        520 Edgemont Road
00024 //#                        Charlottesville, VA 22903-2475 USA
00025 //#
00026 //# $Id: VisibilityIterator2.h,v 19.14 2006/02/28 04:48:58 mvoronko Exp $
00027 
00028 #ifndef MSVIS_VISIBILITYITERATORIMPLASYNC2_H
00029 #define MSVIS_VISIBILITYITERATORIMPLASYNC2_H
00030 
00031 #include <casa/Arrays/Cube.h>
00032 #include <casa/Arrays/Matrix.h>
00033 #include <casa/Arrays/Slicer.h>
00034 #include <casa/BasicSL/String.h>
00035 #include <casa/Containers/Stack.h>
00036 #include <casa/Quanta/MVDoppler.h>
00037 #include <casa/aips.h>
00038 #include <measures/Measures/MCDoppler.h>
00039 #include <measures/Measures/MDoppler.h>
00040 #include <measures/Measures/MeasConvert.h>
00041 #include <measures/Measures/Stokes.h>
00042 #include <ms/MeasurementSets/MSDerivedValues.h>
00043 #include <ms/MeasurementSets/MSIter.h>
00044 #include <ms/MeasurementSets/MSColumns.h>
00045 #include <ms/MeasurementSets/MeasurementSet.h>
00046 #include <scimath/Mathematics/RigidVector.h>
00047 #include <scimath/Mathematics/SquareMatrix.h>
00048 #include <synthesis/MSVis/StokesVector.h>
00049 #include <synthesis/MSVis/VisBufferComponents2.h>
00050 #include <synthesis/MSVis/VisBufferImplAsync2.h>
00051 #include <synthesis/MSVis/VisImagingWeight.h>
00052 #include <synthesis/MSVis/VisibilityIterator2.h>
00053 #include <tables/Tables/ArrayColumn.h>
00054 #include <tables/Tables/ScalarColumn.h>
00055 
00056 #include <boost/noncopyable.hpp>
00057 #include <map>
00058 #include <vector>
00059 
00060 namespace casa { //# NAMESPACE CASA - BEGIN
00061 
00062 namespace vi {
00063 
00064 //# forward decl
00065 
00066 class AsynchronousInterface;
00067 class VisBuffer2;
00068 class VisBufferAsyncWrapper2;
00069 class VlaData;
00070 
00071 // <summary>
00072 // VisibilityIterator2 iterates through one or more readonly MeasurementSets
00073 // </summary>
00074 
00075 // <use visibility=export>
00076 
00077 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
00078 // </reviewed>
00079 
00080 // <prerequisite>
00081 //   <li> <linkto class="MSIter">MSIter</linkto>
00082 //   <li> <linkto class="MeasurementSet">MeasurementSet</linkto>
00083 //   <li> <linkto class="VisSet">VisSet</linkto>
00084 // </prerequisite>
00085 //
00086 // <etymology>
00087 // The VisibilityIterator2 is a readonly iterator returning visibilities
00088 // </etymology>
00089 //
00090 // <synopsis>
00091 // VisibilityIterator2 provides iteration with various sort orders
00092 // for one or more MSs. It has member functions to retrieve the fields
00093 // commonly needed in synthesis calibration and imaging.
00094 //
00095 // One should use <linkto class="VisBuffer">VisBuffer</linkto>
00096 // to access chunks of data.
00097 // </synopsis>
00098 //
00099 // <example>
00100 // <code>
00101 // //
00102 // </code>
00103 // </example>
00104 //
00105 // <motivation>
00106 // For imaging and calibration you need to access an MS in some consistent
00107 // order (by field, spectralwindow, time interval etc.). This class provides
00108 // that access.
00109 // </motivation>
00110 //
00111 // <thrown>
00112 //    <li>
00113 //    <li>
00114 // </thrown>
00115 //
00116 // <todo asof="1997/05/30">
00117 //   <li> cleanup the currently dual interface for visibilities and flags
00118 //   <li> sort out what to do with weights when interpolating
00119 // </todo>
00120 
00121 class VisibilityIteratorImplAsync2 : public VisibilityIteratorImpl2 {
00122 
00123     friend class AsyncEnabler;
00124     friend class ViImplAsync2;
00125     friend class VisibilityIterator2;
00126     friend class VLAT; // allow VI lookahead thread class to access protected functions
00127     // VLAT should not access private parts, especially variables
00128 
00129 public:
00130 
00131     //# the following is a copy of the enum in MSIter
00132     //# can't think of a way to get one that known to the outside world from here
00133     //  enum PolFrame {
00134     //    // Circular polarization
00135     //    Circular=0,
00136     //    // Linear polarization
00137     //    Linear=1
00138     //  };
00139     //
00140     //  enum DataColumn {
00141     //    // Observed data
00142     //    Observed=0,
00143     //    // Model data
00144     //    Model,
00145     //    // Corrected data
00146     //    Corrected
00147     //  };
00148 
00149     //    class AsyncEnabler {
00150     //    public:
00151     //        AsyncEnabler (VisibilityIterator2 &);
00152     //        AsyncEnabler (VisibilityIterator2 *);
00153     //        ~AsyncEnabler ();
00154     //
00155     //        void release ();
00156     //
00157     //    private:
00158     //
00159     //        Bool oldEnabledState_p;
00160     //        VisibilityIterator2 * roVisibilityIterator2_p;
00161     //    };
00162 
00163     // Default constructor - useful only to assign another iterator later
00165 
00166     // Construct from an MS and a Block of MS column enums specifying the
00167     // iteration order.  If no order is specified, it uses the default sort
00168     // order of MSIter, which is not necessarily the raw order of ms!
00169     // The default ordering is ARRAY_ID, FIELD_ID, DATA_DESC_ID,
00170     // and TIME, but check MSIter.h to be sure.
00171     // These columns will be added first if they are not specified.
00172     //
00173     // An optional timeInterval (in seconds) can be given to iterate through
00174     // chunks of time.  The default interval of 0 groups all times together.
00175     // Every 'chunk' of data contains all data within a certain time interval and
00176     // with identical values of the other iteration columns (e.g.  DATA_DESC_ID
00177     // and FIELD_ID).  Using selectChannel (), a number of groups of channels can
00178     // be requested.  At present the channel group iteration will always occur
00179     // before the interval iteration.
00180 //    VisibilityIteratorImplAsync (const MeasurementSet & ms,
00181 //                                const Block<Int> & sortColumns,
00182 //                                Double timeInterval = 0);
00183 
00184     // Same as above, but with the option of using the raw order of ms
00185     // (addDefaultSortCols=false).
00186 //    VisibilityIteratorImplAsync (const MeasurementSet & ms,
00187 //                                const Block<Int> & sortColumns, const Bool addDefaultSortCols,
00188 //                                Double timeInterval = 0);
00189 
00190     // Same as previous constructors, but with multiple MSs to iterate over.
00191 //    VisibilityIteratorImplAsync (const Block<MeasurementSet> & mss,
00192 //                                const Block<Int> & sortColumns,
00193 //                                Double timeInterval = 0);
00194 
00195     VisibilityIteratorImplAsync2 (VisibilityIterator2 * rovi,
00196                                   const Block<MeasurementSet> & mss,
00197                                   const Block<Int> & sortColumns,
00198                                   Bool addDefaultSortCols,
00199                                   Double timeInterval,
00200                                   Bool createVb,
00201                                   Bool isWritable);
00202 
00203     // Copy construct. This calls the assigment operator.
00204     VisibilityIteratorImplAsync2 (const VisibilityIteratorImplAsync2 & other,
00205                                   VisibilityIterator2 * rovi);
00206 
00207     // Destructor
00208     virtual ~VisibilityIteratorImplAsync2 ();
00209 
00210         // Members
00211 
00212     // Reset iterator to origin/start of data (of current chunk)
00213     virtual void origin ();
00214     // Reset iterator to true start of data (first chunk)
00215     virtual void originChunks ();
00216 
00217     // Return the time interval (in seconds) used for iteration.
00218     // This is not the same as the INTERVAL column.
00219 
00220     // Set or reset the time interval (in seconds) to use for iteration.
00221     // You should call originChunks () to reset the iteration after
00222     // calling this.
00223 
00224     virtual void setInterval (Double timeInterval);
00225 
00226     // Set the 'blocking' size for returning data.
00227     // With the default (0) only a single integration is returned at a time, this
00228     // is what is currently required for the calibration software. With blocking
00229     // set, up to nRows can be returned in one go. The chunk
00230     // size determines the actual maximum.
00231 
00232     virtual void setRowBlocking (Int nRows = 0);
00233 
00234     virtual Bool existsColumn (VisBufferComponent2 id) const;
00235 
00236     // Return False if no more data (in current chunk)
00237 
00238     virtual Bool more () const;
00239 
00240     virtual Subchunk getSubchunkId () const;
00241 
00242     virtual void setFrequencySelections (const FrequencySelections & selection);
00243 
00244     // Return False if no more 'Chunks' of data left
00245 
00246     virtual Bool moreChunks () const;
00247 
00248     // Check if ms has change since last iteration
00249 
00250     virtual Bool isNewArrayId () const;
00251     virtual Bool isNewFieldId () const;
00252     virtual Bool isNewMs () const;
00253     virtual Bool isNewSpectralWindow () const;
00254 
00255     virtual Int msId () const;
00256 
00257     //reference to actual ms in interator
00258     virtual const MeasurementSet & ms () const;
00259 
00260     // Advance to the next Chunk of data
00261     virtual void nextChunk ();
00262 
00263     // Return antenna1
00264     virtual void antenna1 (Vector<Int> & ant1) const;
00265 
00266     // Return antenna2
00267     virtual void antenna2 (Vector<Int> & ant2) const;
00268 
00269     // Return feed1
00270     virtual void feed1 (Vector<Int> & fd1) const;
00271 
00272     // Return feed2
00273     virtual void feed2 (Vector<Int> & fd2) const;
00274 
00275 
00276     // Return feed configuration matrix for specified antenna
00277     void jonesC (Vector<SquareMatrix<Complex, 2> > & cjones) const;
00278 
00279     // Return receptor angles for all antennae and feeds
00280     // First axis of the cube is a receptor number,
00281     // 2nd is antennaId, 3rd is feedId
00282     // Note: the method is intended to provide an access to MSIter::receptorAngles
00283     // for VisBuffer in the multi-feed case. It may be worth to change the
00284     // interface of feed_pa to return the information for all feeds.
00285     virtual const Cube<Double> & receptorAngles () const;
00286 
00287     // return a string mount identifier for each antenna
00288     virtual const Vector<String> & antennaMounts () const;
00289 
00290     // Return a cube containing pairs of coordinate offsets for each
00291     // receptor of each feed (values are in radians, coordinate system is fixed
00292     // with antenna and is the same one as used to define the BEAM_OFFSET
00293     // parameter in the feed table). The cube axes are receptor, antenna, feed.
00294     virtual const Cube<RigidVector<Double, 2> > & getBeamOffsets () const;
00295 
00296     // Return the current FieldId
00297 
00298     virtual Int fieldId () const;
00299 
00300     // Return the current ArrayId
00301     virtual Int arrayId () const;
00302 
00303     // Return flag for each polarization, channel and row
00304     virtual void flag (Cube<Bool> & flags) const;
00305 
00306     // Return flag for each channel & row
00307     virtual void flag (Matrix<Bool> & flags) const;
00308 
00309     // Determine whether FLAG_CATEGORY is valid.
00310     Bool existsFlagCategory() const;
00311 
00312     // Return flags for each polarization, channel, category, and row.
00313     virtual void flagCategory (Array<Bool> & flagCategories) const;
00314 
00315     // Return row flag
00316     virtual void flagRow (Vector<Bool> & rowflags) const;
00317 
00318     // Return scan number
00319     virtual void scan (Vector<Int> & scans) const;
00320 
00321     // Return the OBSERVATION_IDs
00322     virtual void observationId (Vector<Int> & obsids) const;
00323 
00324     // Return the PROCESSOR_IDs
00325     virtual void processorId (Vector<Int> & procids) const;
00326 
00327     // Return the STATE_IDs
00328     virtual void stateId (Vector<Int> & stateids) const;
00329 
00330     // Return the current phase center as an MDirection
00331     virtual const MDirection & phaseCenter () const;
00332 
00333     // Return frame for polarization (returns PolFrame enum)
00334     virtual Int polFrame () const;
00335 
00336     // Return the correlation type (returns Stokes enums)
00337     virtual void corrType (Vector<Int> & corrTypes) const;
00338 
00339     // Return sigma
00340     virtual void sigma (Vector<Float> & sig) const;
00341 
00342     // Return sigma matrix (pol-dep)
00343     virtual void sigmaMat (Matrix<Float> & sigmat) const;
00344 
00345     // Return current SpectralWindow
00346     virtual Int spectralWindow () const;
00347 
00348     // Return current Polarization Id
00349     virtual Int polarizationId () const;
00350 
00351     // Return current DataDescription Id
00352     virtual Int dataDescriptionId () const;
00353 
00354     // Return MJD midpoint of interval.
00355     virtual void time (Vector<Double> & t) const;
00356 
00357     // Return MJD centroid of interval.
00358     virtual void timeCentroid (Vector<Double> & t) const;
00359 
00360     // Return nominal time interval
00361     virtual void timeInterval (Vector<Double> & ti) const;
00362 
00363     // Return actual time interval
00364     virtual void  exposure (Vector<Double> & expo) const;
00365 
00366     // Return the visibilities as found in the MS, Cube (npol,nchan,nrow).
00367     virtual void visibilityCorrected (Cube<Complex> & vis) const;
00368     virtual void visibilityModel (Cube<Complex> & vis) const;
00369     virtual void visibilityObserved (Cube<Complex> & vis) const;
00370 
00371     // Return FLOAT_DATA as a Cube (npol, nchan, nrow) if found in the MS.
00372     virtual void floatData (Cube<Float> & fcube) const;
00373 
00374     // Return the visibility 4-vector of polarizations for each channel.
00375     // If the MS doesn't contain all polarizations, it is assumed it
00376     // contains one or two parallel hand polarizations.
00377     virtual void visibilityCorrected (Matrix<CStokesVector> & vis) const;
00378     virtual void visibilityModel (Matrix<CStokesVector> & vis) const;
00379     virtual void visibilityObserved (Matrix<CStokesVector> & vis) const;
00380 
00381     // Return the shape of the visibility Cube
00382     virtual IPosition visibilityShape () const;
00383 
00384     // Return u,v and w (in meters)
00385 
00386     virtual void uvw (Matrix<Double> & uvwmat) const;
00387 
00388     // Return weight
00389     virtual void weight (Vector<Float> & wt) const;
00390 
00391     // Returns the nPol_p x curNumRow_p weight matrix
00392     virtual void weightMat (Matrix<Float> & wtmat) const;
00393 
00394     // Determine whether WEIGHT_SPECTRUM exists.
00395     Bool existsWeightSpectrum () const;
00396 
00397     // Return weightspectrum (a weight for each channel)
00398     virtual void weightSpectrum (Cube<Float> & wtsp) const;
00399 
00400     // Return imaging weight (a weight for each channel)
00401     //virtual Matrix<Float> & imagingWeight (Matrix<Float> & wt) const;
00402     const VisImagingWeight & getImagingWeightGenerator () const;
00403 
00404     // Return True if FieldId/Source has changed since last iteration
00405     virtual Bool newFieldId () const;
00406 
00407     // Return True if arrayID has changed since last iteration
00408     virtual Bool newArrayId () const;
00409 
00410     // Return True if SpectralWindow has changed since last iteration
00411     virtual Bool newSpectralWindow () const;
00412 
00413     // Return the number of correlations in the current iteration
00414 
00415     virtual Int nPolarizations () const;
00416 
00417     // Return the number of rows in the current iteration
00418     virtual Int nRows () const;
00419 
00420     // Return the row ids as from the original root table. This is useful
00421     // to find correspondance between a given row in this iteration to the
00422     // original ms row
00423     virtual void getRowIds (Vector<uInt> & rowids) const;
00424 
00425     // Return the numbers of rows in the current chunk
00426 
00427     virtual Int nRowsInChunk () const;
00428 
00429     // Return the number of sub-intervals in the current chunk
00430 
00431     //virtual Int nSubInterval () const;
00432 
00433     // Call to use the slurp i/o method for all scalar columns. This
00434     // will set the BucketCache cache size to the full column length
00435     // and cause the full column to be cached in memory, if
00436     // any value of the column is used. In case of out-of-memory,
00437     // it will automatically fall-back on the smaller cache size.
00438     // Slurping the column is to be considered as a work-around for the
00439     // Table i/o code, which uses BucketCache and performs extremely bad
00440     // for random access. Slurping is useful when iterating non-sequentially
00441     // an MS or parts of an MS, it is not tested with multiple MSs.
00442     virtual void slurp () const;
00443 
00444     // Get the spw, start  and nchan for all the ms's is this Visiter that
00445     // match the frequecy "freqstart-freqStep" and "freqEnd+freqStep" range
00446     // Can help in doing channel selection above..
00447     // freqFrame is the frame the caller frequency values are in (freqStart and freqEnd)
00448     // These will be converted to the frame of the selected spw to match
00449 
00450 //    virtual void getSpwInFreqRange (Block<Vector<Int> > & spw,
00451 //                                    Block<Vector<Int> > & start,
00452 //                                    Block<Vector<Int> > & nchan,
00453 //                                    Double freqStart, Double freqEnd,
00454 //                                    Double freqStep, MFrequency::Types freqFrame = MFrequency::LSRK) const;
00455 
00456     // Get the range of frequency convered by the selected data in the frame requested
00457 
00458 //    virtual void getFreqInSpwRange(Double& freqStart, Double& freqEnd, MFrequency::Types freqframe = MFrequency::LSRK) const;
00459 
00460     // Access the current ROMSColumns object in MSIter
00461     virtual const vi::SubtableColumns & subtableColumns () const;
00462 
00463     // get back the selected spectral windows and spectral channels for
00464     // current ms
00465 
00466     virtual const SpectralWindowChannels & getSpectralWindowChannels (Int msId, Int spectralWindowId) const;
00467 
00468     //assign a VisImagingWeight object to this iterator
00469     virtual void useImagingWeight (const VisImagingWeight & imWgt);
00470     //return number  of Ant
00471     virtual Int numberAnt ();
00472     //Return number of rows in all selected ms's
00473     virtual Int numberCoh ();
00474 
00475     // Return number of spws, polids, ddids
00476     virtual Int numberSpw ();
00477     virtual Int numberPol ();
00478     virtual Int numberDDId ();
00479 
00480     Int getDataDescriptionId () const;
00481     const MeasurementSet & getMeasurementSet () const;;
00482     Int getMeasurementSetId () const;
00483     Int getNAntennas () const;
00484     virtual MEpoch getEpoch () const;
00485     MFrequency::Types getObservatoryFrequencyType () const; //???
00486     MPosition getObservatoryPosition () const;
00487     Vector<Float> getReceptor0Angle ();
00488 
00489     // Write/modify the flags in the data.
00490     // This will flag all channels in the original data that contributed to
00491     // the output channel in the case of channel averaging.
00492     // All polarizations have the same flag value.
00493     virtual void writeFlag (const Matrix<Bool> & flag);
00494 
00495     // Write/modify the flags in the data.
00496     // This writes the flags as found in the MS, Cube (npol,nchan,nrow),
00497     // where nrow is the number of rows in the current iteration (given by
00498     // nRow ()).
00499     virtual void writeFlag (const Cube<Bool> & flag);
00500 
00501     // Write/modify the flag row column; dimension Vector (nrow)
00502     virtual void writeFlagRow (const Vector<Bool> & rowflags);
00503 
00504     void writeFlagCategory(const Array<Bool>& fc);
00505 
00506     // Write/modify the visibilities.
00507     // This is possibly only for a 'reference' MS which has a new DATA column.
00508     // The first axis of the matrix should equal the selected number of channels
00509     // in the original MS.
00510     // If the MS does not contain all polarizations, only the parallel
00511     // hand polarizations are used.
00512     void writeVisCorrected (const Matrix<CStokesVector> & visibilityStokes);
00513     void writeVisModel (const Matrix<CStokesVector> & visibilityStokes);
00514     void writeVisObserved (const Matrix<CStokesVector> & visibilityStokes);
00515 
00516     // Write/modify the visibilities
00517     // This writes the data as found in the MS, Cube (npol,nchan,nrow).
00518     virtual void writeVisCorrected (const Cube<Complex> & vis);
00519     virtual void writeVisModel (const Cube<Complex> & vis);
00520     virtual void writeVisObserved (const Cube<Complex> & vis);
00521 
00522     // Write/modify the weights
00523     virtual void writeWeight (const Vector<Float> & wt);
00524 
00525     // Write/modify the weightMat
00526     virtual void writeWeightMat (const Matrix<Float> & wtmat);
00527 
00528     // Write/modify the weightSpectrum
00529     virtual void writeWeightSpectrum (const Cube<Float> & wtsp);
00530 
00531     // Write/modify the Sigma
00532     virtual void writeSigma (const Vector<Float> & sig);
00533 
00534     // Write/modify the ncorr x nrow SigmaMat.
00535     virtual void writeSigmaMat (const Matrix<Float> & sigmat);
00536 
00537     virtual void writeBackChanges (VisBuffer2 *);
00538 
00539 protected:
00540 
00541     void attachColumnsSafe (const Table & t);
00542 
00543     // attach the column objects to the currently selected table
00544 
00545     virtual void attachColumns (const Table & t);
00546 
00547     // returns the table, to which columns are attached,
00548     // can be overridden in derived classes
00549 
00550     virtual const Table attachTable () const;
00551 
00552     // advance the iteration
00553 
00554     virtual void advance ();
00555 
00556     virtual void applyPendingChanges ();
00557 
00558     // set the iteration state
00559 
00560     virtual void configureNewChunk ();
00561 
00562     // set the currently selected table
00563 
00564     virtual void configureNewSubchunk ();
00565 
00566     const ChannelSelector *
00567     createDefaultChannelSelector (Double time, Int msId, Int spectralWindowId);
00568 
00569     virtual const ChannelSelector * determineChannelSelection (Double time);
00570 
00571     Slice findChannelsInRange (Double lowerFrequency, Double upperFrequency,
00572                                const SpectralWindowChannels & spectralWindowChannels);
00573 
00574     void fillVisBuffer ();
00575 
00576     // Methods to get the data out of a table column according to whatever selection
00577     // criteria (e.g., slicing) is in effect.
00578 
00579     template <typename T>
00580     void getColumnRows (const ROArrayColumn<T> & column, Array<T> & array) const;
00581 
00582     template <typename T>
00583     void
00584     getColumnRowsMatrix (const ROArrayColumn<T> & column, Matrix<T> & array) const;
00585 
00586     template <typename T>
00587     void getColumnRows (const ROScalarColumn<T> & column, Vector<T> & array) const;
00588 
00589     Vector<Double> getFrequencies (Double time, Int frameOfReference) const;
00590     Vector<Int> getChannels (Double time, Int frameOfReference) const;
00591 
00592     Int getReportingFrameOfReference () const;
00593 
00594     // Returns the MS objects that this VI is iterating over.
00595 
00596     std::vector<MeasurementSet> getMeasurementSets () const;
00597 
00598     // Provides access to the MS-derived values object
00599 
00600     const MSDerivedValues & getMsd () const; // for use by Async I/O *ONLY*
00601 
00602     const MsIterInfo & getMsIterInfo () const;
00603 
00604     // Get privileged (non-const) access to the containing ROVI
00605 
00606     VisBufferImplAsync2 * getVisBufferAsync () const;
00607     VisBufferAsyncWrapper2 * getVisBufferWrapper () const;
00608 
00609     VisibilityIterator2 * getViP () const;
00610 
00611     void getVisibilityAsStokes (Matrix<CStokesVector> & visibilityStokes,
00612                                 const ROArrayColumn<Complex> & column) const;
00613 
00614     // Ctor auxiliary method
00615 
00616     virtual void initialize (const Block<MeasurementSet> & mss);
00617 
00618     // Returns true if MS Iterator is currently pointing to a selected
00619     // spectral window
00620 
00621     Bool isInASelectedSpectralWindow () const;
00622 
00623     // Creates a channel selection for the current subchunk based on the channel
00624     // or frequency selection made by the user.
00625 
00626     ChannelSelector *
00627     makeChannelSelectorC (const FrequencySelection & selection,
00628                           Double time, Int msId, Int spectralWindowId);
00629 
00630     ChannelSelector *
00631     makeChannelSelectorF (const FrequencySelection & selection,
00632                           Double time, Int msId, Int spectralWindowId);
00633 
00634     MFrequency::Convert makeFrequencyConverter (Double time, Int otherFrameOfReference,
00635                                                 Bool toObservedFrame) const;
00636 
00637 
00638     // Method to reset the VI back to the start.  Unlike the public version
00639     // there is a parameter to allow forcing the rewind even if the
00640     // MS Iter is already at the origin.
00641 
00642     virtual void originChunks (Bool forceRewind);
00643 
00644     // Advances the MS Iterator until it points at a spectral window
00645     // that is part of the frequency selection.
00646 
00647     void positionMsIterToASelectedSpectralWindow ();
00648 
00649     void readComplete ();
00650 
00651     // Sets the default frequency reporting frame of reference.  This
00652     // affects the default frame for obtaining the frequencies in a
00653     // VisBuffer.
00654 
00655     void setReportingFrameOfReference (Int);
00656 
00657     // Adjusts the tile cache for some columns so that the cache size is
00658     // optimized for the current input state (e.g., a new data description).
00659 
00660     virtual void setTileCache ();
00661 
00662     // Throws exception if there is a pending (i.e., unapplied) change to
00663     // the VI's properties.  Called when the VI is advanced since the user
00664     // probably forgot to apply the changes.
00665 
00666     virtual void throwIfPendingChanges ();
00667 
00668 
00669     // Returns true if the named column uses a tiled data manager in the specified MS
00670 
00671     Bool usesTiledDataManager (const String & columnName, const MeasurementSet & ms) const;
00672 
00673 private:
00674 
00675     AsynchronousInterface * interface_p;
00676     VlaData * vlaData_p;
00677 
00678 };
00679 
00680 } // end namespace vi
00681 
00682 } //# NAMESPACE CASA - END
00683 
00684 #endif
00685