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