Line data Source code
1 : //# VisibilityIterator.h: Step through the MeasurementEquation by visibility
2 : //# Copyright (C) 1996,1997,1998,1999,2000,2001,2002,2003
3 : //# Associated Universities, Inc. Washington DC, USA.
4 : //#
5 : //# This library is free software; you can redistribute it and/or modify it
6 : //# under the terms of the GNU Library General Public License as published by
7 : //# the Free Software Foundation; either version 2 of the License, or (at your
8 : //# option) any later version.
9 : //#
10 : //# This library is distributed in the hope that it will be useful, but WITHOUT
11 : //# ANY WARRANTY; without even the Implied warranty of MERCHANTABILITY or
12 : //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 : //# License for more details.
14 : //#
15 : //# You should have received a copy of the GNU Library General Public License
16 : //# along with this library; if not, write to the Free Software Foundation,
17 : //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 : //#
19 : //# Correspondence concerning AIPS++ should be addressed as follows:
20 : //# Internet email: aips2-request@nrao.edu.
21 : //# Postal address: AIPS++ Project Office
22 : //# National Radio Astronomy Observatory
23 : //# 520 Edgemont Road
24 : //# Charlottesville, VA 22903-2475 USA
25 : //#
26 : //# $Id: VisibilityIterator2.h,v 19.14 2006/02/28 04:48:58 mvoronko Exp $
27 :
28 : #if ! defined (MSVIS_ViImplementation2_H_121115_0950)
29 : #define MSVIS_ViImplementation2_H_121115_0950
30 :
31 : #include <casacore/casa/aips.h>
32 : #include <casacore/casa/BasicSL.h>
33 : #include <msvis/MSVis/VisBufferComponents2.h>
34 : #include <casacore/measures/Measures/MFrequency.h>
35 : #include <casacore/measures/Measures/Stokes.h>
36 : #include <casacore/measures/Measures/Stokes.h>
37 : #include <casacore/casa/Arrays/ArrayFwd.h>
38 : #include <casacore/scimath/Mathematics/RigidVector.h>
39 : #include <casacore/tables/Tables/RowNumbers.h>
40 :
41 : #include <map>
42 : #include <vector>
43 :
44 : //Forward declarations
45 : namespace casacore{
46 :
47 : class MDirection;
48 : class MeasurementSet;
49 : class MEpoch;
50 : class MPosition;
51 : class MSDerivedValues;
52 : class RecordInterface;
53 :
54 : class Slice;
55 : class String;
56 : template <typename T, Int n> class SquareMatrix;
57 :
58 : class MSAntennaColumns;
59 : class MSDataDescColumns;
60 : class MSFeedColumns;
61 : class MSFieldColumns;
62 : class MSFlagCmdColumns;
63 : class MSHistoryColumns;
64 : class MSObservationColumns;
65 : class MSPointingColumns;
66 : class MSPolarizationColumns;
67 : class MSProcessorColumns;
68 : class MSSpWindowColumns;
69 : class MSStateColumns;
70 : class MSDopplerColumns;
71 : class MSFreqOffsetColumns;
72 : class MSSourceColumns;
73 : class MSSysCalColumns;
74 : class MSWeatherColumns;
75 : }
76 :
77 : namespace casa { //# NAMESPACE CASA - BEGIN
78 :
79 : //class CStokesVector;
80 : class VisImagingWeight;
81 :
82 : namespace vi {
83 :
84 :
85 : //# forward decl
86 :
87 : class ChannelSelector;
88 : class ChannelSelectorCache;
89 : class FrequencySelections;
90 : class SortColumns;
91 : class SpectralWindowChannels;
92 : class SpectralWindowChannelsCache;
93 : class Subchunk;
94 : class SubtableColumns;
95 : class VisBuffer2;
96 : class VisibilityIterator2;
97 : class WeightScaling;
98 : enum VisBufferType : int;
99 : enum VisBufferOptions : int;
100 :
101 : typedef enum {UnknownScope = 0, ChunkScope = 1, SubchunkScope = 2, RowScope = 3} MetadataScope;
102 : // <summary>
103 : // VisibilityIterator2 iterates through one or more readonly MeasurementSets
104 : // </summary>
105 :
106 : // <use visibility=export>
107 :
108 : // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
109 : // </reviewed>
110 :
111 : // <prerequisite>
112 : // <li> <linkto class="MSIter">MSIter</linkto>
113 : // <li> <linkto class="casacore::MeasurementSet">casacore::MeasurementSet</linkto>
114 : // <li> <linkto class="VisSet">VisSet</linkto>
115 : // </prerequisite>
116 : //
117 : // <etymology>
118 : // The VisibilityIterator2 is a readonly iterator returning visibilities
119 : // </etymology>
120 : //
121 : // <synopsis>
122 : // VisibilityIterator2 provides iteration with various sort orders
123 : // for one or more MSs. It has member functions to retrieve the fields
124 : // commonly needed in synthesis calibration and imaging.
125 : //
126 : // One should use <linkto class="VisBuffer">VisBuffer</linkto>
127 : // to access chunks of data.
128 : // </synopsis>
129 : //
130 : // <example>
131 : // <code>
132 : // //
133 : // </code>
134 : // </example>
135 : //
136 : // <motivation>
137 : // For imaging and calibration you need to access an casacore::MS in some consistent
138 : // order (by field, spectralwindow, time interval etc.). This class provides
139 : // that access.
140 : // </motivation>
141 : //
142 : // <thrown>
143 : // <li>
144 : // <li>
145 : // </thrown>
146 : //
147 : // <todo asof="1997/05/30">
148 : // <li> cleanup the currently dual interface for visibilities and flags
149 : // <li> sort out what to do with weights when interpolating
150 : // </todo>
151 :
152 : class ViImplementation2 {
153 :
154 : friend class VisibilityIterator2;
155 :
156 : public:
157 :
158 : // make noncopyable...
159 : ViImplementation2( const ViImplementation2& ) = delete;
160 : ViImplementation2& operator=( const ViImplementation2& ) = delete;
161 6309 : ViImplementation2 () {}
162 :
163 : // Destructor
164 :
165 6309 : virtual ~ViImplementation2 () {}
166 :
167 : // Report the the ViImplementation type
168 : virtual casacore::String ViiType() const = 0;
169 :
170 : // +==================================+
171 : // | |
172 : // | Iteration Control and Monitoring |
173 : // | |
174 : // +==================================+
175 :
176 : // Methods to control and monitor subchunk iteration
177 :
178 : virtual void origin () = 0;
179 : virtual casacore::Bool more () const = 0;
180 : virtual void next () = 0;
181 : virtual Subchunk getSubchunkId () const = 0;
182 :
183 : // Methods to control chunk iterator
184 :
185 : virtual void originChunks (casacore::Bool forceRewind = false) = 0;
186 : virtual casacore::Bool moreChunks () const = 0;
187 : virtual void nextChunk () = 0;
188 :
189 : // Get results accumulated throughout iteration
190 : virtual void result(casacore::Record& res) const = 0;
191 :
192 : // Report Name of slowest column that changes at end of current iteration
193 : virtual casacore::String keyChange() const = 0;
194 :
195 : virtual casacore::Bool isWritable () const = 0;
196 :
197 : // Return the time interval (in seconds) used for iteration.
198 : // This is not the same as the INTERVAL column. Setting the
199 : // the interval requires calling origin chunks before performing
200 : // further iterator.
201 :
202 : virtual casacore::Double getInterval() const = 0;
203 : virtual void setInterval (casacore::Double timeInterval) = 0;
204 :
205 : // Select the channels to be returned. Requires calling originChunks before
206 : // performing additional iteration.
207 :
208 : virtual void setFrequencySelections (const FrequencySelections & selection) = 0;
209 :
210 : // Set the 'blocking' size for returning data.
211 : // With the default (0) only a single integration is returned at a time, this
212 : // is what is currently required for the calibration software. With blocking
213 : // set, up to nRows can be returned in one go. The chunk
214 : // size determines the actual maximum.
215 :
216 : virtual casacore::rownr_t getRowBlocking() const = 0;
217 : virtual void setRowBlocking (casacore::rownr_t nRows = 0) = 0;
218 :
219 : virtual casacore::Bool existsColumn (VisBufferComponent2 id) const = 0;
220 :
221 : virtual const SortColumns & getSortColumns() const = 0;
222 :
223 : virtual casacore::Bool isNewArrayId () const = 0;
224 : virtual casacore::Bool isNewFieldId () const = 0;
225 : virtual casacore::Bool isNewMs () const = 0;
226 : virtual casacore::Bool isNewSpectralWindow () const = 0;
227 :
228 : // Return the number of rows in the current iteration
229 : virtual casacore::rownr_t nRows () const = 0;
230 :
231 : // Return the number of distinct array/cube shapes in the current iteration
232 : virtual casacore::rownr_t nShapes () const = 0;
233 :
234 : // Return the number of rows for each distinct array/cube shapes in the current iteration
235 : virtual const casacore::Vector<casacore::rownr_t>& nRowsPerShape () const = 0;
236 :
237 : // Return the number of channels for each distinct array/cube shapes in the current iteration
238 : virtual const casacore::Vector<casacore::Int>& nChannelsPerShape () const = 0;
239 :
240 : // Return the number of correlations for each distinct array/cube shapes in the current iteration
241 : virtual const casacore::Vector<casacore::Int>& nCorrelationsPerShape () const = 0;
242 :
243 : // Return the row ids as from the original root table. This is useful
244 : // to find correspondance between a given row in this iteration to the
245 : // original ms row
246 :
247 : virtual void getRowIds (casacore::Vector<casacore::rownr_t> & rowids) const = 0;
248 :
249 : virtual VisBuffer2 * getVisBuffer () const = 0;
250 :
251 :
252 : // +=========================+
253 : // | |
254 : // | Subchunk Data Accessors |
255 : // | |
256 : // +=========================+
257 :
258 : // Return antenna1
259 :
260 : virtual void antenna1 (casacore::Vector<casacore::Int> & ant1) const = 0;
261 :
262 : // Return antenna2
263 :
264 : virtual void antenna2 (casacore::Vector<casacore::Int> & ant2) const = 0;
265 :
266 : // Return the correlation type (returns casacore::Stokes enums)
267 :
268 : virtual void corrType (casacore::Vector<casacore::Int> & corrTypes) const = 0;
269 :
270 : // Return current DataDescription Id
271 :
272 : virtual casacore::Int dataDescriptionId () const = 0;
273 :
274 : virtual void dataDescriptionIds (casacore::Vector<casacore::Int> & ddis) const = 0;
275 :
276 : // Return actual time interval
277 :
278 : virtual void exposure (casacore::Vector<casacore::Double> & expo) const = 0;
279 :
280 : // Return feed1
281 :
282 : virtual void feed1 (casacore::Vector<casacore::Int> & fd1) const = 0;
283 :
284 : // Return feed2
285 :
286 : virtual void feed2 (casacore::Vector<casacore::Int> & fd2) const = 0;
287 :
288 : // Return the current FieldId
289 :
290 : virtual void fieldIds (casacore::Vector<casacore::Int>&) const = 0;
291 :
292 : // Return the current ArrayId
293 :
294 : virtual void arrayIds (casacore::Vector<casacore::Int>&) const = 0;
295 :
296 : // Return the current Field Name
297 :
298 : virtual casacore::String fieldName () const = 0;
299 :
300 : // Return flag for each polarization, channel and row
301 :
302 : virtual void flag (casacore::Cube<casacore::Bool> & flags) const = 0;
303 : virtual void flag (casacore::Vector<casacore::Cube<casacore::Bool>> & flags) const = 0;
304 :
305 : // Return flag for each channel & row
306 :
307 : virtual void flag (casacore::Matrix<casacore::Bool> & flags) const = 0;
308 :
309 : // Determine whether FLAG_CATEGORY is valid.
310 :
311 : virtual casacore::Bool flagCategoryExists () const = 0;
312 :
313 : // Return flags for each polarization, channel, category, and row.
314 :
315 : virtual void flagCategory (casacore::Array<casacore::Bool> & flagCategories) const = 0;
316 :
317 : // Return row flag
318 :
319 : virtual void flagRow (casacore::Vector<casacore::Bool> & rowflags) const = 0;
320 :
321 : // Return the OBSERVATION_IDs
322 :
323 : virtual void observationId (casacore::Vector<casacore::Int> & obsids) const = 0;
324 :
325 : // Return current Polarization Id
326 :
327 : virtual casacore::Int polarizationId () const = 0;
328 :
329 : // Return the PROCESSOR_IDs
330 :
331 : virtual void processorId (casacore::Vector<casacore::Int> & procids) const = 0;
332 :
333 : // Return scan number
334 :
335 : virtual void scan (casacore::Vector<casacore::Int> & scans) const = 0;
336 :
337 : // Return the current Source Name
338 :
339 : virtual casacore::String sourceName () const = 0;
340 :
341 : // Return the STATE_IDs
342 :
343 : virtual void stateId (casacore::Vector<casacore::Int> & stateids) const = 0;
344 :
345 :
346 : // Return feed configuration matrix for specified antenna
347 :
348 : virtual void jonesC (casacore::Vector<casacore::SquareMatrix<casacore::Complex, 2> > & cjones) const = 0;
349 :
350 : // Return frame for polarization (returns PolFrame enum)
351 :
352 : virtual casacore::Int polFrame () const = 0;
353 :
354 : // Return sigma
355 :
356 : virtual void sigma (casacore::Matrix<casacore::Float> & sigmat) const = 0;
357 : virtual void sigma (casacore::Vector<casacore::Matrix<casacore::Float>> & sigmat) const = 0;
358 :
359 : // Return all the spectral windows ids for each row of the current buffer
360 : virtual void spectralWindows (casacore::Vector<casacore::Int> & spws) const = 0;
361 :
362 : // Return all the polarizations Ids for each row of the current buffer
363 : virtual void polarizationIds (casacore::Vector<casacore::Int> & polIds) const = 0;
364 :
365 : // Return MJD midpoint of interval.
366 :
367 : virtual void time (casacore::Vector<casacore::Double> & t) const = 0;
368 :
369 : // Return MJD centroid of interval.
370 :
371 : virtual void timeCentroid (casacore::Vector<casacore::Double> & t) const = 0;
372 :
373 : // Return nominal time interval
374 :
375 : virtual void timeInterval (casacore::Vector<casacore::Double> & ti) const = 0;
376 :
377 : // Return u,v and w (in meters)
378 :
379 : virtual void uvw (casacore::Matrix<casacore::Double> & uvwmat) const = 0;
380 :
381 : // Return the visibilities as found in the casacore::MS, casacore::Cube (npol,nchan,nrow).
382 :
383 : virtual void visibilityCorrected (casacore::Cube<casacore::Complex> & vis) const = 0;
384 : virtual void visibilityCorrected (casacore::Vector<casacore::Cube<casacore::Complex>> & vis) const = 0;
385 : virtual void visibilityModel (casacore::Cube<casacore::Complex> & vis) const = 0;
386 : virtual void visibilityModel (casacore::Vector<casacore::Cube<casacore::Complex>> & vis) const = 0;
387 : virtual void visibilityObserved (casacore::Cube<casacore::Complex> & vis) const = 0;
388 : virtual void visibilityObserved (casacore::Vector<casacore::Cube<casacore::Complex>> & vis) const = 0;
389 :
390 : // Return FLOAT_DATA as a casacore::Cube (npol, nchan, nrow) if found in the MS.
391 :
392 : virtual void floatData (casacore::Cube<casacore::Float> & fcube) const = 0;
393 : virtual void floatData (casacore::Vector<casacore::Cube<casacore::Float>> & fcube) const = 0;
394 :
395 : // Return the visibility 4-vector of polarizations for each channel.
396 : // If the casacore::MS doesn't contain all polarizations, it is assumed it
397 : // contains one or two parallel hand polarizations.
398 :
399 : // virtual void visibilityCorrected (casacore::Matrix<CStokesVector> & vis) const = 0;
400 : // virtual void visibilityModel (casacore::Matrix<CStokesVector> & vis) const = 0;
401 : // virtual void visibilityObserved (casacore::Matrix<CStokesVector> & vis) const = 0;
402 :
403 : // Return the shape of the visibility Cube
404 :
405 : virtual casacore::IPosition visibilityShape () const = 0;
406 :
407 : // Return weight
408 :
409 : virtual void weight (casacore::Matrix<casacore::Float> & wtmat) const = 0;
410 : virtual void weight (casacore::Vector<casacore::Matrix<casacore::Float>> & wtmat) const = 0;
411 :
412 : // Determine whether WEIGHT_SPECTRUM exists.
413 :
414 : virtual casacore::Bool weightSpectrumExists () const = 0;
415 :
416 : // Determine whether SIGMA_SPECTRUM exists.
417 :
418 : virtual casacore::Bool sigmaSpectrumExists () const = 0;
419 :
420 : // Return weightspectrum (a weight for each channel)
421 :
422 : virtual void weightSpectrum (casacore::Cube<casacore::Float> & wtsp) const = 0;
423 : virtual void weightSpectrum (casacore::Vector<casacore::Cube<casacore::Float>> & wtsp) const = 0;
424 :
425 : // Return sgimaspectrum (a sigma for each channel)
426 :
427 : virtual void sigmaSpectrum (casacore::Cube<casacore::Float> & wtsp) const = 0;
428 : virtual void sigmaSpectrum (casacore::Vector<casacore::Cube<casacore::Float>> & wtsp) const = 0;
429 :
430 :
431 : virtual void setWeightScaling (casacore::CountedPtr<WeightScaling> weightscaling) = 0;
432 : virtual casacore::Bool hasWeightScaling () const = 0;
433 : virtual casacore::CountedPtr<WeightScaling> getWeightScaling () const = 0;
434 :
435 : // Return the number of sub-intervals in the current chunk
436 :
437 : // +------------------------+
438 : // | |
439 : // | Angular Data Providers |
440 : // | |
441 : // +------------------------+
442 :
443 : // true if all elements of the cube returned by getBeamOffsets are zero
444 :
445 : virtual casacore::Bool allBeamOffsetsZero () const = 0;
446 :
447 : // Return the antenna AZ/EL casacore::Vector (nant)
448 :
449 : virtual casacore::MDirection azel0 (casacore::Double time) const = 0;
450 : static void azel0Calculate (casacore::Double time, casacore::MSDerivedValues & msd,
451 : casacore::MDirection & azel0, const casacore::MEpoch & mEpoch0);
452 :
453 : virtual const casacore::Vector<casacore::MDirection> & azel (casacore::Double time) const = 0;
454 : static void azelCalculate (casacore::Double time, casacore::MSDerivedValues & msd, casacore::Vector<casacore::MDirection> & azel,
455 : casacore::Int nAnt, const casacore::MEpoch & mEpoch0);
456 :
457 : // Return feed parallactic angles casacore::Vector (nant) (1 feed/ant)
458 :
459 : virtual const casacore::Vector<casacore::Float> & feed_pa (casacore::Double time) const = 0;
460 : static casacore::Vector<casacore::Float> feed_paCalculate (casacore::Double time, casacore::MSDerivedValues & msd,
461 : casacore::Int nAntennas, const casacore::MEpoch & mEpoch0,
462 : const casacore::Vector<casacore::Float> & receptor0Angle);
463 :
464 : // Return a cube containing pairs of coordinate offsets for each
465 : // receptor of each feed (values are in radians, coordinate system is fixed
466 : // with antenna and is the same one as used to define the BEAM_OFFSET
467 : // parameter in the feed table). The cube axes are receptor, antenna, feed.
468 :
469 : virtual const casacore::Cube<casacore::RigidVector<casacore::Double, 2> > & getBeamOffsets () const = 0;
470 :
471 : virtual std::pair<bool, casacore::MDirection> getPointingAngle (int antenna, double time) const = 0;
472 :
473 : // Return the hour angle for the specified time
474 :
475 : virtual casacore::Double hourang (casacore::Double time) const = 0;
476 : static casacore::Double hourangCalculate (casacore::Double time, casacore::MSDerivedValues & msd, const casacore::MEpoch & mEpoch0);
477 :
478 : // Return nominal parallactic angle at specified time
479 : // (does not include feed position angle offset--see feed_pa)
480 : // A global value for all antennas (e.g., small array)
481 :
482 : virtual const casacore::Float & parang0 (casacore::Double time) const = 0;
483 : static casacore::Float parang0Calculate (casacore::Double time, casacore::MSDerivedValues & msd, const casacore::MEpoch & epoch0);
484 :
485 : // Per antenna:
486 :
487 : virtual const casacore::Vector<casacore::Float> & parang (casacore::Double time) const = 0;
488 : static casacore::Vector<casacore::Float> parangCalculate (casacore::Double time, casacore::MSDerivedValues & msd,
489 : int nAntennas, const casacore::MEpoch mEpoch0);
490 :
491 : // Return the current phase center as an MDirection
492 :
493 : virtual const casacore::MDirection & phaseCenter () const = 0;
494 :
495 : // Return receptor angles for all antennae and feeds
496 : // First axis of the cube is a receptor number,
497 : // 2nd is antennaId, 3rd is feedId
498 : // Note: the method is intended to provide an access to MSIter::receptorAngles
499 : // for VisBuffer in the multi-feed case. It may be worth to change the
500 : // interface of feed_pa to return the information for all feeds.
501 :
502 : virtual const casacore::Cube<casacore::Double> & receptorAngles () const = 0;
503 :
504 : // +=========================+
505 : // | |
506 : // | Chunk and MS Level Data |
507 : // | |
508 : // +=========================+
509 :
510 : // return a string mount identifier for each antenna
511 :
512 : virtual const casacore::Vector<casacore::String> & antennaMounts () const = 0;
513 : // virtual casacore::Vector<casacore::MPosition> antennaPositions () const;
514 : //casacore::MSDerivedValues makeMsd ();
515 :
516 : virtual casacore::MEpoch getEpoch () const = 0;
517 :
518 : // Return imaging weight (a weight for each channel)
519 : //virtual casacore::Matrix<casacore::Float> & imagingWeight (casacore::Matrix<casacore::Float> & wt) const = 0;
520 :
521 : virtual const VisImagingWeight & getImagingWeightGenerator () const = 0;
522 :
523 : virtual casacore::MFrequency::Types getObservatoryFrequencyType () const = 0; //???
524 : virtual casacore::MPosition getObservatoryPosition () const = 0;
525 : virtual casacore::Vector<casacore::Float> getReceptor0Angle () = 0;
526 :
527 : virtual casacore::Int getReportingFrameOfReference () const = 0;
528 : virtual void setReportingFrameOfReference (casacore::Int frame) = 0;
529 :
530 : virtual casacore::Vector<casacore::Int> getCorrelations () const = 0;
531 : virtual casacore::Vector<casacore::Stokes::StokesTypes> getCorrelationTypesDefined () const = 0;
532 : virtual casacore::Vector<casacore::Stokes::StokesTypes> getCorrelationTypesSelected () const = 0;
533 :
534 : virtual casacore::Vector<casacore::Int> getChannels (casacore::Double time, casacore::Int frameOfReference, casacore::Int spectralWndow = -1,
535 : casacore::Int msId = -1) const = 0;
536 : virtual casacore::Vector<casacore::Double> getFrequencies (casacore::Double time, casacore::Int frameOfReference, casacore::Int spectralWndow = -1,
537 : casacore::Int msId = -1) const = 0;
538 : virtual casacore::Vector<casacore::Double> getChanWidths (casacore::Double time, casacore::Int frameOfReference, casacore::Int spectralWndow = -1,
539 : casacore::Int msId = -1) const = 0;
540 :
541 :
542 : //reference to actual ms in interator
543 :
544 : virtual casacore::Int msId () const = 0; // zero-based index of current casacore::MS in set of MSs
545 : virtual const casacore::MeasurementSet & ms () const = 0;
546 : virtual casacore::Int getNMs () const = 0;
547 :
548 : // Name of current nominal MS
549 : virtual casacore::String msName() const = 0;
550 :
551 : // Call to use the slurp i/o method for all scalar columns. This
552 : // will set the casacore::BucketCache cache size to the full column length
553 : // and cause the full column to be cached in memory, if
554 : // any value of the column is used. In case of out-of-memory,
555 : // it will automatically fall-back on the smaller cache size.
556 : // Slurping the column is to be considered as a work-around for the
557 : // casacore::Table i/o code, which uses casacore::BucketCache and performs extremely bad
558 : // for random access. Slurping is useful when iterating non-sequentially
559 : // an casacore::MS or parts of an casacore::MS, it is not tested with multiple MSs.
560 :
561 : virtual void slurp () const = 0;
562 :
563 : // Access the current casacore::MSColumns object in MSIter
564 :
565 : virtual const vi::SubtableColumns & subtableColumns () const = 0;
566 :
567 : // get back the selected spectral windows and spectral channels for
568 : // current ms
569 :
570 : virtual const SpectralWindowChannels & getSpectralWindowChannels (casacore::Int msId, casacore::Int spectralWindowId) const = 0;
571 :
572 : //assign a VisImagingWeight object to this iterator
573 :
574 : virtual void useImagingWeight (const VisImagingWeight & imWgt) = 0;
575 :
576 : // Return number of antennasm spws, polids, ddids
577 :
578 : virtual casacore::Int nAntennas () const = 0;
579 : virtual casacore::Int nDataDescriptionIds () const = 0;
580 : virtual casacore::Int nPolarizationIds () const = 0;
581 : virtual casacore::rownr_t nRowsInChunk () const = 0; // number rows in current chunk
582 : virtual casacore::rownr_t nRowsViWillSweep () const = 0; // number of rows in all selected ms's
583 : virtual casacore::Int nSpectralWindows () const = 0;
584 : // number of unique time stamps in chunk
585 : virtual casacore::Int nTimes() const = 0;
586 :
587 : // +-------------------+
588 : // | |
589 : // | Writeback Methods |
590 : // | |
591 : // +-------------------+
592 :
593 : // This method writes back any changed (dirty) components of the provided
594 : // VisBuffer and is the preferred method for writing data out.
595 :
596 : virtual void writeBackChanges (VisBuffer2 * vb) = 0;
597 :
598 : // Write/modify the flags in the data.
599 : // This will flag all channels in the original data that contributed to
600 : // the output channel in the case of channel averaging.
601 : // All polarizations have the same flag value.
602 : // virtual void writeFlag (const casacore::Matrix<casacore::Bool> & flag) = 0;
603 :
604 : // Write/modify the flags in the data.
605 : // This writes the flags as found in the casacore::MS, casacore::Cube (npol,nchan,nrow),
606 : // where nrow is the number of rows in the current iteration (given by
607 : // nRow ()).
608 : virtual void writeFlag (const casacore::Cube<casacore::Bool> & flag) = 0;
609 :
610 : // Write/modify the flag row column = 0; dimension casacore::Vector (nrow)
611 : virtual void writeFlagRow (const casacore::Vector<casacore::Bool> & rowflags) = 0;
612 :
613 : virtual void writeFlagCategory(const casacore::Array<casacore::Bool>& fc) = 0;
614 :
615 : // Write/modify the visibilities.
616 : // This is possibly only for a 'reference' casacore::MS which has a new DATA column.
617 : // The first axis of the matrix should equal the selected number of channels
618 : // in the original MS.
619 : // If the casacore::MS does not contain all polarizations, only the parallel
620 : // hand polarizations are used.
621 : // virtual void writeVisCorrected (const casacore::Matrix<CStokesVector> & visibilityStokes) = 0;
622 : // virtual void writeVisModel (const casacore::Matrix<CStokesVector> & visibilityStokes) = 0;
623 : // virtual void writeVisObserved (const casacore::Matrix<CStokesVector> & visibilityStokes) = 0;
624 :
625 : // Write/modify the visibilities
626 : // This writes the data as found in the casacore::MS, casacore::Cube (npol,nchan,nrow).
627 : virtual void writeVisCorrected (const casacore::Cube<casacore::Complex> & vis) = 0;
628 : virtual void writeVisModel (const casacore::Cube<casacore::Complex> & vis) = 0;
629 : virtual void writeVisObserved (const casacore::Cube<casacore::Complex> & vis) = 0;
630 :
631 : // Write/modify the weights
632 : virtual void writeWeight (const casacore::Matrix<casacore::Float> & wt) = 0;
633 :
634 : // Write/modify the weightMat
635 : //virtual void writeWeightMat (const casacore::Matrix<casacore::Float> & wtmat) = 0;
636 :
637 : // Write/modify the weightSpectrum
638 : virtual void writeWeightSpectrum (const casacore::Cube<casacore::Float> & wtsp) = 0;
639 :
640 : // Initialize the weightSpectrum
641 0 : virtual void initWeightSpectrum (const casacore::Cube<casacore::Float> & /* wtsp */) {};
642 :
643 : // Write/modify the sigmaSpectrum
644 : virtual void writeSigmaSpectrum (const casacore::Cube<casacore::Float> & sigsp) = 0;
645 :
646 : // Initialize the sigmaSpectrum
647 0 : virtual void initSigmaSpectrum (const casacore::Cube<casacore::Float> & /* sigsp */) {};
648 :
649 : // Write/modify the Sigma
650 : virtual void writeSigma (const casacore::Matrix<casacore::Float> & sig) = 0;
651 :
652 : // Write/modify the ncorr x nrow SigmaMat.
653 : //virtual void writeSigmaMat (const casacore::Matrix<casacore::Float> & sigmat) = 0;
654 :
655 : // Write the information needed to generate on-the-fly model visibilities.
656 :
657 : virtual void writeModel(const casacore::RecordInterface& rec, casacore::Bool iscomponentlist=true,
658 : casacore::Bool incremental=false) = 0;
659 :
660 : //**********************************************************************
661 : // Methods to access the subtables.
662 : // Note that for some subclasses, like TransformingTVI, those tables
663 : // might be created on the fly, rather than read from the MS.
664 : //**********************************************************************
665 :
666 : // Access to antenna subtable
667 : virtual const casacore::MSAntennaColumns& antennaSubtablecols() const = 0;
668 :
669 : // Access to dataDescription subtable
670 : virtual const casacore::MSDataDescColumns& dataDescriptionSubtablecols() const = 0;
671 :
672 : // Access to feed subtable
673 : virtual const casacore::MSFeedColumns& feedSubtablecols() const = 0;
674 :
675 : // Access to field subtable
676 : virtual const casacore::MSFieldColumns& fieldSubtablecols() const = 0;
677 :
678 : // Access to flagCmd subtable
679 : virtual const casacore::MSFlagCmdColumns& flagCmdSubtablecols() const = 0;
680 :
681 : // Access to history subtable
682 : virtual const casacore::MSHistoryColumns& historySubtablecols() const = 0;
683 :
684 : // Access to observation subtable
685 : virtual const casacore::MSObservationColumns& observationSubtablecols() const = 0;
686 :
687 : // Access to pointing subtable
688 : virtual const casacore::MSPointingColumns& pointingSubtablecols() const = 0;
689 :
690 : // Access to polarization subtable
691 : virtual const casacore::MSPolarizationColumns& polarizationSubtablecols() const = 0;
692 :
693 : // Access to processor subtable
694 : virtual const casacore::MSProcessorColumns& processorSubtablecols() const = 0;
695 :
696 : // Access to spectralWindow subtable
697 : virtual const casacore::MSSpWindowColumns& spectralWindowSubtablecols() const = 0;
698 :
699 : // Access to state subtable
700 : virtual const casacore::MSStateColumns& stateSubtablecols() const = 0;
701 :
702 : // Access to doppler subtable
703 : virtual const casacore::MSDopplerColumns& dopplerSubtablecols() const = 0;
704 :
705 : // Access to freqOffset subtable
706 : virtual const casacore::MSFreqOffsetColumns& freqOffsetSubtablecols() const = 0;
707 :
708 : // Access to source subtable
709 : virtual const casacore::MSSourceColumns& sourceSubtablecols() const = 0;
710 :
711 : // Access to sysCal subtable
712 : virtual const casacore::MSSysCalColumns& sysCalSubtablecols() const = 0;
713 :
714 : // Access to weather subtable
715 : virtual const casacore::MSWeatherColumns& weatherSubtablecols() const = 0;
716 :
717 :
718 : protected:
719 :
720 : virtual VisBuffer2 *createAttachedVisBuffer(VisBufferOptions options);
721 :
722 : VisBuffer2 * getVisBuffer(const VisibilityIterator2 *) const;
723 :
724 : static void doWeightScaling (casacore::Bool hasWeightScaling,
725 : WeightScaling * scaling,
726 : const casacore::Array<casacore::Float>& unscaled,
727 : casacore::Array<casacore::Float>& scaled);
728 : //static void setVisBufferFillable (VisBuffer2 * vb, bool fillable);
729 : };
730 :
731 : } // end namespace vi
732 :
733 : } //# NAMESPACE CASA - END
734 :
735 : #endif // ! defined (MSVIS_ViImplementation2_H_121115_0950)
736 :
737 :
|