Line data Source code
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 <casacore/casa/aips.h>
32 : #include <casacore/casa/Arrays/Cube.h>
33 : #include <casacore/casa/Arrays/Vector.h>
34 : #include <casacore/casa/Arrays/Matrix.h>
35 : #include <casacore/casa/BasicSL/Complex.h>
36 : #include <casacore/measures/Measures/MDirection.h>
37 : #include <casacore/measures/Measures/MEpoch.h>
38 : #include <msvis/MSVis/VisModelDataI.h>
39 : #include <msvis/MSVis/StokesVector.h>
40 : #include <msvis/MSVis/VisibilityIterator.h>
41 : #include <msvis/MSVis/VisBufferComponents.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 : //
75 : class VbDirtyComponents {
76 :
77 : public:
78 :
79 : typedef std::set<VisBufferComponents::EnumType> Set;
80 : typedef Set::const_iterator const_iterator;
81 :
82 : VbDirtyComponents operator+ (const VbDirtyComponents & other) const;
83 :
84 : const_iterator begin () const;
85 : casacore::Bool contains (VisBufferComponents::EnumType component) const;
86 : const_iterator end () const;
87 :
88 : static VbDirtyComponents all ();
89 : static VbDirtyComponents exceptThese (VisBufferComponents::EnumType component, ...);
90 : static VbDirtyComponents none ();
91 : static VbDirtyComponents singleton (VisBufferComponents::EnumType component);
92 : static VbDirtyComponents these (VisBufferComponents::EnumType component, ...);
93 :
94 : protected:
95 :
96 : private:
97 :
98 : Set set_p;
99 :
100 : static const VbDirtyComponents all_p;
101 :
102 : static VbDirtyComponents initializeAll ();
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.
167 : VisBuffer(ROVisibilityIterator & iter);
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 1017477 : virtual casacore::Int & nCorr() {
205 1017477 : return nCorrOK_p ? nCorr_p : fillnCorr();
206 : }
207 18378 : virtual casacore::Int nCorr() const {
208 18378 : return This->nCorr();
209 : }
210 :
211 10326720 : virtual casacore::Int & nChannel() {
212 10326720 : return nChannelOK_p ? nChannel_p : fillnChannel();
213 : }
214 781378 : virtual casacore::Int nChannel() const {
215 781378 : return This->nChannel();
216 : }
217 :
218 48306 : virtual casacore::Vector<casacore::Int>& channel() {
219 48306 : return channelOK_p ? channel_p : fillChannel();
220 : }
221 0 : virtual const casacore::Vector<casacore::Int>& channel() const {
222 0 : 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 :
232 : ///Because of it being publicly exposed ...using nRow, nChannel, nCorr etc to
233 : /// determine the size of the buffer can be totally WRONG
234 : ///They MAY NOT represent the shape
235 : /// of a buffer filled in this iteration.
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...
239 : /// For example VisBuffAccumulator changes these in an unconnected fashion;
240 : //without updating fillnrow
241 : /// datacube shape etc etc.
242 : /// You are warned nrow_p etc are public variables effectively (despite being
243 : ///declared private) so it can be changed
244 : /// anywhere the code uses a vb, intentionally or accidentally.
245 4575257 : virtual casacore::Int & nRow() {
246 4575257 : return nRowOK_p ? nRow_p : fillnRow();
247 : }
248 915516 : virtual casacore::Int nRow() const {
249 915516 : return This->nRow();
250 : }
251 :
252 : virtual casacore::Int nRowChunk() const;
253 :
254 1157776 : virtual casacore::Vector<casacore::Int>& antenna1() {
255 1157776 : return antenna1OK_p ? antenna1_p : fillAnt1();
256 : }
257 606970 : virtual const casacore::Vector<casacore::Int>& antenna1() const {
258 606970 : return This->antenna1();
259 : }
260 :
261 978559 : virtual casacore::Vector<casacore::Int>& antenna2() {
262 978559 : return antenna2OK_p ? antenna2_p : fillAnt2();
263 : }
264 427723 : virtual const casacore::Vector<casacore::Int>& antenna2() const {
265 427723 : return This->antenna2();
266 : }
267 :
268 487 : virtual casacore::Vector<casacore::Int>& feed1() {
269 487 : return feed1OK_p ? feed1_p : fillFeed1();
270 : }
271 122 : virtual const casacore::Vector<casacore::Int>& feed1() const {
272 122 : return This->feed1();
273 : }
274 :
275 487 : virtual casacore::Vector<casacore::Int>& feed2() {
276 487 : return feed2OK_p ? feed2_p : fillFeed2();
277 : }
278 122 : virtual const casacore::Vector<casacore::Int>& feed2() const {
279 122 : 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.
296 771 : virtual casacore::Vector<casacore::Float>& feed1_pa() {
297 771 : return feed1_paOK_p ? feed1_pa_p : fillFeed1_pa();
298 : }
299 771 : virtual const casacore::Vector<casacore::Float>& feed1_pa() const {
300 771 : return This->feed1_pa();
301 : }
302 :
303 771 : virtual casacore::Vector<casacore::Float>& feed2_pa() {
304 771 : return feed2_paOK_p ? feed2_pa_p : fillFeed2_pa();
305 : }
306 771 : virtual const casacore::Vector<casacore::Float>& feed2_pa() const {
307 771 : return This->feed2_pa();
308 : }
309 :
310 0 : virtual casacore::Vector<casacore::SquareMatrix<casacore::Complex, 2> >& CJones() {
311 0 : return cjonesOK_p ? cjones_p : fillCjones();
312 : }
313 0 : virtual const casacore::Vector<casacore::SquareMatrix<casacore::Complex, 2> >& CJones() const {
314 0 : return This->CJones();
315 : }
316 :
317 : // Note that feed_pa is a function instead of a cached value
318 : virtual casacore::Vector<casacore::Float> feed_pa(casacore::Double time) const;
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.
323 0 : virtual casacore::Vector<casacore::MDirection>& direction1() {
324 0 : return direction1OK_p ? direction1_p
325 0 : : fillDirection1();
326 : }
327 0 : virtual const casacore::Vector<casacore::MDirection>& direction1() const {
328 0 : return This->direction1();
329 : }
330 :
331 0 : virtual casacore::Vector<casacore::MDirection>& direction2() {
332 0 : return direction2OK_p ? direction2_p :
333 0 : fillDirection2();
334 : }
335 0 : virtual const casacore::Vector<casacore::MDirection>& direction2() const {
336 0 : return This->direction2();
337 : }
338 0 : virtual casacore::MDirection& firstDirection1() {
339 0 : return firstDirection1OK_p ? firstDirection1_p
340 0 : : fillFirstDirection1();
341 : }
342 0 : virtual const casacore::MDirection& firstDirection1() const {
343 0 : return This->firstDirection1();
344 : }
345 : // NOMINAL parallactic angle (feed p.a. offset NOT included)
346 : virtual casacore::Float parang0(casacore::Double time) const;
347 : virtual casacore::Vector<casacore::Float> parang(casacore::Double time) const;
348 :
349 : // Note that azel is a function instead of a cached value
350 : virtual casacore::MDirection azel0(casacore::Double time) const;
351 : virtual casacore::Vector<casacore::Double>& azel0Vec(casacore::Double time, casacore::Vector<casacore::Double>& azelVec) const;
352 : virtual casacore::Vector<casacore::MDirection> azel(casacore::Double time) const;
353 : virtual casacore::Matrix<casacore::Double>& azelMat(casacore::Double time, casacore::Matrix<casacore::Double>& azelMat) const;
354 :
355 : // Hour angle for specified time
356 : virtual casacore::Double hourang(casacore::Double time) const;
357 :
358 34403 : virtual casacore::Int fieldId() const {
359 34403 : return fieldIdOK_p ? fieldId_p : This->fillFieldId();
360 : }
361 :
362 0 : virtual casacore::Int& fieldIdRef() {
363 0 : return fieldIdOK_p ? fieldId_p : This->fillFieldId();
364 : }
365 :
366 0 : virtual casacore::Int& arrayIdRef() {
367 0 : return arrayIdOK_p ? arrayId_p : This->fillArrayId();
368 : }
369 :
370 1318 : virtual casacore::Int arrayId() const {
371 1318 : return arrayIdOK_p ? arrayId_p : This->fillArrayId();
372 : }
373 :
374 : // Return flag for each channel & row
375 8848569 : virtual casacore::Matrix<casacore::Bool>& flag() {
376 8848569 : return flagOK_p ? flag_p : fillFlag();
377 : }
378 434120 : virtual const casacore::Matrix<casacore::Bool>& flag() const {
379 434120 : return This->flag();
380 : }
381 :
382 : // Return flag for each polarization, channel and row
383 320014 : virtual casacore::Cube<casacore::Bool>& flagCube() {
384 320014 : return flagCubeOK_p ? flagCube_p : fillFlagCube();
385 : }
386 10522 : virtual const casacore::Cube<casacore::Bool>& flagCube() const {
387 10522 : return This->flagCube();
388 : }
389 :
390 1592773 : virtual casacore::Vector<casacore::Bool>& flagRow() {
391 1592773 : return flagRowOK_p ? flagRow_p : fillFlagRow();
392 : }
393 534378 : virtual const casacore::Vector<casacore::Bool>& flagRow() const {
394 534378 : return This->flagRow();
395 : }
396 :
397 : // Return flags for each polarization, channel, category, and row.
398 0 : virtual casacore::Array<casacore::Bool>& flagCategory() {
399 0 : return flagCategoryOK_p ? flagCategory_p : fillFlagCategory();
400 : }
401 0 : virtual const casacore::Array<casacore::Bool>& flagCategory() const {
402 0 : return This->flagCategory();
403 : }
404 :
405 4985 : virtual casacore::Vector<casacore::Int>& scan() {
406 4985 : return scanOK_p ? scan_p : fillScan();
407 : }
408 0 : virtual const casacore::Vector<casacore::Int>& scan() const {
409 0 : return This->scan();
410 : }
411 :
412 : // scalar version for convenience, when scan known constant for
413 : // entire iteration/buffer.
414 122 : virtual casacore::Int scan0() {
415 122 : return scan()(0);
416 : }
417 :
418 0 : virtual casacore::Vector<casacore::Int>& processorId() {
419 0 : return processorIdOK_p ? processorId_p : fillProcessorId();
420 : }
421 0 : virtual const casacore::Vector<casacore::Int>& processorId() const {
422 0 : return This->processorId();
423 : }
424 :
425 9653 : virtual casacore::Vector<casacore::Int>& observationId() {
426 9653 : return observationIdOK_p ? observationId_p : fillObservationId();
427 : }
428 9200 : virtual const casacore::Vector<casacore::Int>& observationId() const {
429 9200 : return This->observationId();
430 : }
431 :
432 0 : virtual casacore::Vector<casacore::Int>& stateId() {
433 0 : return stateIdOK_p ? stateId_p : fillStateId();
434 : }
435 0 : virtual const casacore::Vector<casacore::Int>& stateId() const {
436 0 : return This->stateId();
437 : }
438 :
439 : // Gets SPECTRAL_WINDOW/CHAN_FREQ (in Hz, acc. to the casacore::MS def'n v.2).
440 1683296 : virtual casacore::Vector<casacore::Double>& frequency() {
441 1683296 : return frequencyOK_p ? frequency_p : fillFreq();
442 : }
443 27960 : virtual const casacore::Vector<casacore::Double>& frequency() const {
444 27960 : 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 :
464 376 : virtual casacore::MDirection & phaseCenter() {
465 376 : return phaseCenterOK_p ? phaseCenter_p : fillPhaseCenter();
466 : }
467 352 : virtual casacore::MDirection phaseCenter() const {
468 352 : 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 13481 : virtual casacore::Int polFrame() const {
473 13481 : return polFrameOK_p ? polFrame_p : This->fillPolFrame();
474 : }
475 :
476 223877 : virtual casacore::Vector<casacore::Int>& corrType() {
477 223877 : return corrTypeOK_p ? corrType_p : fillCorrType();
478 : }
479 188050 : virtual const casacore::Vector<casacore::Int>& corrType() const {
480 188050 : return This->corrType();
481 : }
482 :
483 0 : virtual casacore::Vector<casacore::Float>& sigma() {
484 0 : return sigmaOK_p ? sigma_p : fillSigma();
485 : }
486 0 : virtual const casacore::Vector<casacore::Float>& sigma() const {
487 0 : return This->sigma();
488 : }
489 :
490 29947 : virtual casacore::Matrix<casacore::Float>& sigmaMat() {
491 29947 : return sigmaMatOK_p ? sigmaMat_p : fillSigmaMat();
492 : }
493 0 : virtual const casacore::Matrix<casacore::Float>& sigmaMat() const {
494 0 : return This->sigmaMat();
495 : }
496 :
497 7616 : virtual casacore::Int & spectralWindow() {
498 7616 : return spectralWindowOK_p ? spectralWindow_p : This->fillSpW();
499 : }
500 29345 : virtual casacore::Int spectralWindow() const {
501 29345 : return spectralWindowOK_p ? spectralWindow_p : This->fillSpW();
502 : }
503 0 : virtual casacore::Int polarizationId() const {
504 0 : return visIter_p->polarizationId();
505 : }
506 0 : virtual casacore::Int& dataDescriptionIdRef() {
507 0 : return dataDescriptionIdOK_p ? dataDescriptionId_p : This->fillDataDescriptionId ();
508 : }
509 264 : virtual casacore::Int dataDescriptionId() const {
510 264 : return dataDescriptionIdOK_p ? dataDescriptionId_p : This->fillDataDescriptionId ();
511 : }
512 1306393 : virtual casacore::Vector<casacore::Double>& time() {
513 1306393 : return timeOK_p ? time_p : fillTime();
514 : }
515 730878 : virtual const casacore::Vector<casacore::Double>& time() const {
516 730878 : return This->time();
517 : }
518 :
519 0 : virtual casacore::Vector<casacore::Double>& timeCentroid() {
520 0 : return timeCentroidOK_p ? timeCentroid_p : fillTimeCentroid();
521 : }
522 0 : virtual const casacore::Vector<casacore::Double>& timeCentroid() const {
523 0 : return This->timeCentroid();
524 : }
525 :
526 179047 : virtual casacore::Vector<casacore::Double>& timeInterval() {
527 179047 : return timeIntervalOK_p ? timeInterval_p : fillTimeInterval();
528 : }
529 179047 : virtual const casacore::Vector<casacore::Double>& timeInterval() const {
530 179047 : return This->timeInterval();
531 : }
532 :
533 0 : virtual casacore::Vector<casacore::Double>& exposure() {
534 0 : return exposureOK_p ? exposure_p : fillExposure();
535 : }
536 0 : virtual const casacore::Vector<casacore::Double>& exposure() const {
537 0 : return This->exposure();
538 : }
539 :
540 2919455 : virtual casacore::Vector<casacore::RigidVector<casacore::Double, 3> >& uvw() {
541 2919455 : return uvwOK_p ? uvw_p : filluvw();
542 : }
543 926786 : virtual const casacore::Vector<casacore::RigidVector<casacore::Double, 3> >& uvw() const {
544 926786 : return This->uvw();
545 : }
546 :
547 0 : virtual casacore::Matrix<casacore::Double>& uvwMat() {
548 0 : return uvwMatOK_p ? uvwMat_p : filluvwMat();
549 : }
550 0 : virtual const casacore::Matrix<casacore::Double>& uvwMat() const {
551 0 : return This->uvwMat();
552 : }
553 :
554 0 : virtual casacore::Matrix<CStokesVector>& visibility() {
555 0 : return visibilityOK_p ? visibility_p : fillVis(VisibilityIterator::Observed);
556 : }
557 0 : virtual const casacore::Matrix<CStokesVector>& visibility() const {
558 0 : return This->visibility();
559 : }
560 :
561 0 : virtual casacore::Matrix<CStokesVector>& modelVisibility() {
562 0 : return modelVisibilityOK_p ? modelVisibility_p :
563 0 : fillVis(VisibilityIterator::Model);
564 : }
565 0 : virtual const casacore::Matrix<CStokesVector>& modelVisibility() const {
566 0 : return This->modelVisibility();
567 : }
568 :
569 0 : virtual casacore::Matrix<CStokesVector>& correctedVisibility() {
570 0 : return correctedVisibilityOK_p ? correctedVisibility_p :
571 0 : fillVis(VisibilityIterator::Corrected);
572 : }
573 0 : virtual const casacore::Matrix<CStokesVector>& correctedVisibility() const {
574 0 : return This->correctedVisibility();
575 : }
576 :
577 10214573 : virtual casacore::Cube<casacore::Complex>& visCube() {
578 10214573 : return visCubeOK_p ? visCube_p : fillVisCube(VisibilityIterator::Observed);
579 : }
580 922812 : virtual const casacore::Cube<casacore::Complex>& visCube() const {
581 922812 : return This->visCube();
582 : }
583 :
584 9865377 : virtual casacore::Cube<casacore::Complex>& modelVisCube() {
585 9865377 : return modelVisCubeOK_p ? modelVisCube_p :
586 9865377 : fillVisCube(VisibilityIterator::Model);
587 : }
588 :
589 0 : virtual casacore::Cube<casacore::Complex>& modelVisCube(const casacore::Bool & matchVisCubeShape) {
590 : // Avoids call to fillVisCube(VisIter::Model)
591 0 : modelVisCubeOK_p = true;
592 0 : if (matchVisCubeShape) {
593 : // shape it in memory like data
594 0 : modelVisCube_p.resize(visCube().shape());
595 0 : modelVisCube_p = casacore::Complex(0.0);
596 : }
597 : // ... and return it in the usual way
598 0 : return modelVisCube();
599 : }
600 :
601 927250 : virtual const casacore::Cube<casacore::Complex>& modelVisCube() const {
602 927250 : return This->modelVisCube();
603 : }
604 :
605 8515 : virtual casacore::Cube<casacore::Complex>& correctedVisCube() {
606 8515 : return correctedVisCubeOK_p ? correctedVisCube_p :
607 8515 : fillVisCube(VisibilityIterator::Corrected);
608 : }
609 433 : virtual const casacore::Cube<casacore::Complex>& correctedVisCube() const {
610 433 : 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.
617 : casacore::Cube<casacore::Complex>& dataCube(const casacore::MS::PredefinedColumns whichcol=casacore::MS::DATA);
618 : const casacore::Cube<casacore::Complex>& dataCube(const casacore::MS::PredefinedColumns
619 : whichcol=casacore::MS::DATA) const;
620 :
621 0 : virtual casacore::Cube<casacore::Float>& floatDataCube() {
622 0 : return floatDataCubeOK_p ? floatDataCube_p : fillFloatDataCube();
623 : }
624 0 : virtual const casacore::Cube<casacore::Float>& floatDataCube() const {
625 0 : return This->floatDataCube();
626 : }
627 :
628 : // Returns the weights for each row averaged over the parallel hand correlations.
629 970760 : virtual casacore::Vector<casacore::Float>& weight() {
630 970760 : return weightOK_p ? weight_p : fillWeight();
631 : }
632 352341 : virtual const casacore::Vector<casacore::Float>& weight() const {
633 352341 : return This->weight();
634 : }
635 :
636 : // Returns the nPol_p x curNumRow_p weight matrix.
637 1524553 : virtual casacore::Matrix<casacore::Float>& weightMat() {
638 1524553 : return weightMatOK_p ? weightMat_p : fillWeightMat();
639 : }
640 177715 : virtual const casacore::Matrix<casacore::Float>& weightMat() const {
641 177715 : return This->weightMat();
642 : }
643 :
644 : // Is a valid WEIGHT_SPECTRUM available?
645 0 : virtual casacore::Bool existsWeightSpectrum() const {
646 0 : return visIter_p ? visIter_p->existsWeightSpectrum() : false;
647 : }
648 :
649 4705 : virtual casacore::Cube<casacore::Float>& weightSpectrum() {
650 4705 : return weightSpectrumOK_p ? weightSpectrum_p : fillWeightSpectrum();
651 : }
652 4585 : virtual const casacore::Cube<casacore::Float>& weightSpectrum() const {
653 4585 : return This->weightSpectrum();
654 : }
655 :
656 : virtual casacore::Matrix<casacore::Float>& imagingWeight();
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 :
667 0 : virtual casacore::Cube<casacore::Float>& weightCube() {
668 0 : 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)
682 : virtual casacore::Vector<casacore::Int> antIdRange() const;
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.
689 : virtual casacore::Vector<casacore::rownr_t>& rowIds();
690 :
691 0 : virtual const casacore::Vector<casacore::rownr_t>& rowIds() const {
692 0 : 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.
724 : void chanAveFlagCategory(casacore::Array<casacore::Bool>& flagcat, const casacore::Int nChanOut);
725 :
726 : // Form casacore::Stokes parameters from correlations
727 : // (these are preliminary versions)
728 : virtual void formStokes();
729 : virtual void formStokesWeightandFlag();
730 : virtual void formStokes(casacore::Cube<casacore::Complex>& vis);
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)
746 : virtual void phaseCenterShift(const casacore::Vector<casacore::Double>& phase);
747 : // Rotate visibility phase for phase center offsets (arcsecs)
748 : virtual void phaseCenterShift(casacore::Double dx, casacore::Double dy);
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);
764 : virtual void setCorrectedVisCube(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);
770 : virtual void setCorrectedVisCube(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::MSColumns object via VisIter
785 197711 : virtual const casacore::MSColumns & msColumns() const {
786 197711 : 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
794 350 : virtual void allSelectedSpectralWindows(casacore::Vector<casacore::Int>& spws, casacore::Vector<casacore::Int>& nvischan) {
795 350 : visIter_p->allSelectedSpectralWindows(spws, nvischan);
796 350 : }
797 :
798 0 : virtual void getChannelSelection(casacore::Block< casacore::Vector<casacore::Int> >& blockNGroup,
799 : casacore::Block< casacore::Vector<casacore::Int> >& blockStart,
800 : casacore::Block< casacore::Vector<casacore::Int> >& blockWidth,
801 : casacore::Block< casacore::Vector<casacore::Int> >& blockIncr,
802 : casacore::Block< casacore::Vector<casacore::Int> >& blockSpw) const {
803 0 : visIter_p->getChannelSelection(blockNGroup, blockStart, blockWidth, blockIncr, blockSpw);
804 0 : };
805 350 : void allSelectedSpectralWindows(casacore::Vector<casacore::Int>& spws, casacore::Vector<casacore::Int>& nvischan) const {
806 350 : This->allSelectedSpectralWindows(spws, nvischan);
807 350 : }
808 :
809 : // Return the actual msid, useful if using multiple ms to monitor which
810 : // ms in the list is being dealt with
811 205648 : virtual casacore::Int msId() const {
812 205648 : This->checkMSId();
813 205648 : return oldMSId_p;
814 : }
815 :
816 : //checked if the ms has changed since the last chunk processed
817 5261 : virtual casacore::Bool newMS() const {
818 5261 : This->checkMSId();
819 5261 : 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 84 : void updateCoord (const VisBuffer * other,
842 : casacore::Bool otherOk,
843 : const Coord & (VisBuffer::* getCoord) () const,
844 : Coord & coord,
845 : casacore::Bool & coordOk)
846 : {
847 84 : if (otherOk){
848 28 : coord.assign ((other ->* getCoord) ());
849 28 : coordOk = true;
850 : }
851 : else {
852 56 : ((this ->* getCoord) ());
853 : }
854 84 : }
855 :
856 : template <typename Scalar>
857 70 : void updateCoordS (const VisBuffer * other,
858 : casacore::Bool otherOk,
859 : Scalar (VisBuffer::* getCoord) () const,
860 : Scalar & coord,
861 : casacore::Bool & coordOk)
862 : {
863 70 : if (otherOk){
864 28 : coord = (other ->* getCoord) ();
865 28 : coordOk = true;
866 : }
867 : else {
868 42 : ((this ->* getCoord) ());
869 : }
870 70 : }
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 236170 : 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 236170 : newStatus = force || oldStatus;
897 :
898 236170 : if (newStatus) {
899 6556 : newCache.assign (((& other) ->* oldCache) ());
900 : }
901 236170 : }
902 :
903 : template<typename T>
904 54582 : 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 54582 : newStatus = force || oldStatus;
919 :
920 54582 : if (newStatus) {
921 :
922 7434 : newCache = ((& other) ->* oldCache) ();
923 : }
924 54582 : }
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
931 : virtual casacore::Vector<casacore::Int> unique(const casacore::Vector<casacore::Int>& indices) const;
932 :
933 : casacore::Bool corrSorted_p; // Have correlations been sorted by sortCorr?
934 : VbDirtyComponents dirtyComponents_p;
935 : casacore::Int lastPointTableRow_p;
936 : casacore::Int oldMSId_p;
937 : VisBuffer * This;
938 : casacore::Bool twoWayConnection_p;
939 : ROVisibilityIterator * visIter_p;
940 : casacore::CountedPtr <VisModelDataI> visModelData_p;
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 :
966 : virtual casacore::Vector<casacore::Int>& fillAnt1();
967 : virtual casacore::Vector<casacore::Int>& fillAnt2();
968 : virtual casacore::Int & fillArrayId();
969 : //virtual casacore::Matrix<casacore::Int>& fillChanAveBounds();
970 : virtual casacore::Vector<casacore::Int>& fillChannel();
971 : virtual casacore::Vector<casacore::SquareMatrix<casacore::Complex, 2> >& fillCjones();
972 : virtual casacore::Vector<casacore::Int>& fillCorrType();
973 : virtual casacore::Int & fillDataDescriptionId ();
974 : virtual casacore::Vector<casacore::MDirection>& fillDirection1();
975 : virtual casacore::MDirection& fillFirstDirection1();
976 : virtual casacore::Vector<casacore::MDirection>& fillDirection2();
977 : virtual casacore::Vector<casacore::Double>& fillExposure();
978 : virtual casacore::Vector<casacore::Int>& fillFeed1();
979 : virtual casacore::Vector<casacore::Float>& fillFeed1_pa();
980 : virtual casacore::Vector<casacore::Int>& fillFeed2();
981 : virtual casacore::Vector<casacore::Float>& fillFeed2_pa();
982 : virtual casacore::Int & fillFieldId();
983 : virtual casacore::Matrix<casacore::Bool>& fillFlag();
984 : virtual casacore::Array<casacore::Bool>& fillFlagCategory();
985 : virtual casacore::Cube<casacore::Bool>& fillFlagCube();
986 : virtual casacore::Vector<casacore::Bool> & fillFlagRow();
987 : virtual casacore::Cube<casacore::Float>& fillFloatDataCube();
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();
995 : virtual casacore::Vector<casacore::Int> & fillObservationId();
996 : virtual casacore::MDirection & fillPhaseCenter();
997 : virtual casacore::Int & fillPolFrame();
998 : virtual casacore::Vector<casacore::Int> & fillProcessorId();
999 : virtual casacore::Vector<casacore::Int> & fillScan();
1000 : virtual casacore::Vector<casacore::Float>& fillSigma();
1001 : virtual casacore::Matrix<casacore::Float>& fillSigmaMat();
1002 : virtual casacore::Int & fillSpW();
1003 : virtual casacore::Vector<casacore::Int> & fillStateId();
1004 : virtual casacore::Vector<casacore::Double>& fillTime();
1005 : virtual casacore::Vector<casacore::Double>& fillTimeCentroid();
1006 : virtual casacore::Vector<casacore::Double>& fillTimeInterval();
1007 : virtual casacore::Vector<casacore::RigidVector<casacore::Double, 3> >& filluvw();
1008 : virtual casacore::Matrix<casacore::Double>& filluvwMat();
1009 : virtual casacore::Matrix<CStokesVector>& fillVis(VisibilityIterator::DataColumn whichOne);
1010 : virtual casacore::Cube<casacore::Complex>& fillVisCube(VisibilityIterator::DataColumn whichOne);
1011 : virtual casacore::Vector<casacore::Float>& fillWeight();
1012 : virtual casacore::Matrix<casacore::Float>& fillWeightMat();
1013 : virtual casacore::Cube<casacore::Float>& fillWeightSpectrum();
1014 :
1015 : casacore::Bool newMS_p;
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 :
1036 5912 : CacheStatus (antenna1);
1037 5912 : CacheStatus (antenna2);
1038 6162 : CacheStatus (arrayId);
1039 5898 : CacheStatus (channel);
1040 5898 : CacheStatus (cjones);
1041 5898 : CacheStatus (correctedVisCube);
1042 5898 : CacheStatus (correctedVisibility);
1043 5898 : CacheStatus (corrType);
1044 6162 : CacheStatus (dataDescriptionId);
1045 5898 : CacheStatus (direction1);
1046 5898 : CacheStatus (direction2);
1047 0 : CacheStatus (firstDirection1);
1048 5898 : CacheStatus (exposure);
1049 5898 : CacheStatus (feed1_pa);
1050 5912 : CacheStatus (feed1);
1051 5898 : CacheStatus (feed2_pa);
1052 5912 : CacheStatus (feed2);
1053 6162 : CacheStatus (fieldId);
1054 5898 : CacheStatus (flagCategory);
1055 5898 : CacheStatus (flagCube);
1056 5898 : CacheStatus (flag);
1057 5898 : CacheStatus (flagRow);
1058 5898 : CacheStatus (floatDataCube);
1059 6162 : CacheStatus (frequency);
1060 5898 : CacheStatus (imagingWeight);
1061 5898 : CacheStatus (modelVisCube);
1062 5898 : CacheStatus (modelVisibility);
1063 0 : CacheStatus (ms);
1064 6148 : CacheStatus (nChannel);
1065 6148 : CacheStatus (nCorr);
1066 5912 : CacheStatus (nRow);
1067 5898 : CacheStatus (observationId);
1068 5898 : CacheStatus (phaseCenter);
1069 5898 : CacheStatus (polFrame);
1070 5898 : CacheStatus (processorId);
1071 5898 : CacheStatus (rowIds);
1072 5898 : CacheStatus (scan);
1073 5898 : CacheStatus (sigmaMat);
1074 5898 : CacheStatus (sigma);
1075 6162 : CacheStatus (spectralWindow);
1076 5898 : CacheStatus (stateId);
1077 5898 : CacheStatus (timeCentroid);
1078 5898 : CacheStatus (timeInterval);
1079 5912 : CacheStatus (time);
1080 5898 : CacheStatus (uvwMat);
1081 5898 : CacheStatus (uvw);
1082 5898 : CacheStatus (visCube);
1083 5898 : CacheStatus (visibility);
1084 5898 : CacheStatus (weightMat);
1085 5898 : CacheStatus (weight);
1086 5898 : CacheStatus (weightSpectrum);
1087 :
1088 : // Cached values (alphabetical order)
1089 :
1090 : casacore::Vector<casacore::Int> antenna1_p;
1091 : casacore::Vector<casacore::Int> antenna2_p;
1092 : casacore::Int arrayId_p;
1093 : casacore::Matrix<casacore::Int> chanAveBounds_p;
1094 : casacore::Vector<casacore::Int> channel_p;
1095 : casacore::Vector<casacore::SquareMatrix<casacore::Complex, 2> > cjones_p;
1096 : casacore::Cube<casacore::Complex> correctedVisCube_p;
1097 : casacore::Matrix<CStokesVector> correctedVisibility_p;
1098 : casacore::Vector<casacore::Int> corrType_p;
1099 : casacore::Int dataDescriptionId_p;
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
1102 : casacore::MDirection firstDirection1_p;
1103 : casacore::Vector<casacore::Double> exposure_p;
1104 : casacore::Vector<casacore::Int> feed1_p;
1105 : casacore::Vector<casacore::Float> feed1_pa_p;
1106 : casacore::Vector<casacore::Int> feed2_p;
1107 : casacore::Vector<casacore::Float> feed2_pa_p;
1108 : casacore::Int fieldId_p;
1109 : casacore::Matrix<casacore::Bool> flag_p;
1110 : casacore::Array<casacore::Bool> flagCategory_p;
1111 : casacore::Cube<casacore::Bool> flagCube_p;
1112 : casacore::Vector<casacore::Bool> flagRow_p;
1113 : casacore::Cube<casacore::Float> floatDataCube_p;
1114 : casacore::Vector<casacore::Double> frequency_p;
1115 : mutable casacore::Matrix<casacore::Float> imagingWeight_p;
1116 : //casacore::Vector<casacore::Double> lsrFrequency_p;
1117 : casacore::Cube<casacore::Complex> modelVisCube_p;
1118 : casacore::Matrix<CStokesVector> modelVisibility_p;
1119 : casacore::Int nChannel_p;
1120 : casacore::Int nCorr_p;
1121 : // casacore::Int nCat_p;
1122 : casacore::Int nRow_p;
1123 : casacore::Vector<casacore::Int> observationId_p;
1124 : casacore::MDirection phaseCenter_p;
1125 : casacore::Int polFrame_p;
1126 : casacore::Vector<casacore::Int> processorId_p;
1127 : casacore::Vector<casacore::rownr_t> rowIds_p;
1128 : casacore::Vector<casacore::Int> scan_p;
1129 : casacore::Vector<casacore::Float> sigma_p;
1130 : casacore::Matrix<casacore::Float> sigmaMat_p;
1131 : casacore::Int spectralWindow_p;
1132 : casacore::Vector<casacore::Int> stateId_p;
1133 : casacore::Vector<casacore::Double> time_p;
1134 : casacore::Vector<casacore::Double> timeCentroid_p;
1135 : casacore::Vector<casacore::Double> timeInterval_p;
1136 : casacore::Vector<casacore::RigidVector<casacore::Double, 3> > uvw_p;
1137 : casacore::Matrix<casacore::Double> uvwMat_p;
1138 : casacore::Cube<casacore::Complex> visCube_p;
1139 : casacore::Matrix<CStokesVector> visibility_p;
1140 : casacore::Vector<casacore::Float> weight_p;
1141 : casacore::Cube<casacore::Float> weightCube_p;
1142 : casacore::Matrix<casacore::Float> weightMat_p;
1143 : casacore::Cube<casacore::Float> weightSpectrum_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 : //
1198 : class VisBufferAutoPtr {
1199 :
1200 : public:
1201 :
1202 : VisBufferAutoPtr ();
1203 : VisBufferAutoPtr (VisBufferAutoPtr & other);
1204 : explicit VisBufferAutoPtr (VisBuffer &);
1205 : explicit VisBufferAutoPtr (VisBuffer *);
1206 : explicit VisBufferAutoPtr (ROVisibilityIterator * rovi);
1207 : explicit VisBufferAutoPtr (ROVisibilityIterator & rovi);
1208 : ~VisBufferAutoPtr ();
1209 :
1210 : VisBufferAutoPtr & operator= (VisBufferAutoPtr & other);
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 :
1228 : VisBuffer * visBuffer_p;
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 :
|