Line data Source code
1 : /*
2 : * VisBuffer2Adapter.h
3 : *
4 : * Created on: Oct 9, 2012
5 : * Author: jjacobs
6 : */
7 :
8 : #ifndef VISBUFFER2ADAPTER_H_
9 : #define VISBUFFER2ADAPTER_H_
10 :
11 : #include <msvis/MSVis/VisBuffer.h>
12 : #include <msvis/MSVis/VisBuffer2.h>
13 : #include <msvis/MSVis/VisBufferImpl2.h>
14 : #include <casacore/casa/BasicSL/String.h>
15 : #include <stdcasa/UtilJ.h>
16 : #include <msvis/MSVis/VisibilityIterator2.h>
17 : #include <msvis/MSVis/VisibilityIteratorImpl2.h>
18 :
19 : using casa::utilj::toStdError;
20 :
21 : #define IllegalOperation() \
22 : Throw (casacore::String::format ("Illegal operation: %s", __func__));
23 :
24 : #define CheckWritability() \
25 : ThrowIf (vb2Rw_p == 0, casacore::String::format ("VB is not writable in %s", __func__));
26 :
27 : namespace casa {
28 :
29 : namespace vi {
30 :
31 : class VisBuffer2Adapter : public VisBuffer {
32 :
33 : public:
34 :
35 0 : VisBuffer2Adapter (VisBuffer2 * vb) : vb2_p (vb) , vb2Rw_p (vb)
36 : {
37 0 : construct();
38 0 : }
39 0 : VisBuffer2Adapter (const VisBuffer2 * vb) : msColumns_p (0), vb2_p (vb), vb2Rw_p (0)
40 : {
41 0 : construct();
42 0 : }
43 :
44 : void
45 0 : construct ()
46 : {
47 : const VisibilityIteratorImpl2 * vi =
48 0 : dynamic_cast<const VisibilityIteratorImpl2 *>(
49 0 : dynamic_cast<const VisBufferImpl2 *>(vb2_p)->getViiP());
50 :
51 0 : msColumns_p = vi->msColumnsKluge();
52 :
53 0 : vi->allSpectralWindowsSelected (spectralWindows_p, nChannels_p);
54 :
55 0 : }
56 :
57 0 : ~VisBuffer2Adapter () {}
58 :
59 0 : virtual VisBuffer & assign(const VisBuffer &, casacore::Bool = true) {IllegalOperation();}
60 :
61 0 : virtual VisBuffer * clone () const {IllegalOperation();}
62 :
63 0 : virtual void invalidate(){IllegalOperation();}
64 :
65 : //#if 0
66 :
67 : // <group>
68 : // Access functions
69 : //
70 0 : virtual casacore::Int & nCorr() { nCorr_p = vb2_p->nCorrelations(); return nCorr_p;}
71 0 : virtual casacore::Int nCorr() const { return vb2_p-> nCorrelations(); }
72 :
73 0 : virtual casacore::Int & nChannel() { nChannelsScalar_p = vb2_p-> nChannels(); return nChannelsScalar_p;}
74 0 : virtual casacore::Int nChannel() const { return vb2_p-> nChannels(); }
75 :
76 0 : virtual casacore::Vector<casacore::Int>& channel() { IllegalOperation (); }
77 0 : virtual const casacore::Vector<casacore::Int>& channel() const { IllegalOperation(); }
78 :
79 0 : virtual casacore::Int & nRow() { nRows_p = vb2_p->nRows (); return nRows_p;}
80 :
81 0 : virtual casacore::Vector<casacore::Int>& antenna1() { return const_cast<casacore::Vector<casacore::Int>&> (vb2_p-> antenna1());}
82 0 : virtual const casacore::Vector<casacore::Int>& antenna1() const { return vb2_p-> antenna1(); }
83 :
84 0 : virtual casacore::Vector<casacore::Int>& antenna2() { return const_cast<casacore::Vector<casacore::Int>&> (vb2_p-> antenna2());}
85 0 : virtual const casacore::Vector<casacore::Int>& antenna2() const { return vb2_p-> antenna2(); }
86 :
87 0 : virtual casacore::Vector<casacore::Int>& feed1() { return const_cast<casacore::Vector<casacore::Int>&> (vb2_p-> feed1());}
88 0 : virtual const casacore::Vector<casacore::Int>& feed1() const { return vb2_p-> feed1(); }
89 :
90 0 : virtual casacore::Vector<casacore::Int>& feed2() { return const_cast<casacore::Vector<casacore::Int>&> (vb2_p-> feed2());}
91 0 : virtual const casacore::Vector<casacore::Int>& feed2() const { return vb2_p-> feed2(); }
92 :
93 : // feed1_pa() and feed2_pa() return an array of parallactic angles
94 : // (each corresponds to the first receptor of the feed) one for each
95 : // row in the current buffer. In contrast, feed_pa() calculates
96 : // the angles for each antenna. These methods are implemented for
97 : // VisBuffer only to benefit from caching of the feed and antenna IDs.
98 :
99 0 : virtual casacore::Vector<casacore::Float>& feed1_pa() { IllegalOperation (); }
100 0 : virtual const casacore::Vector<casacore::Float>& feed1_pa() const { return vb2_p-> feedPa1(); }
101 :
102 0 : virtual casacore::Vector<casacore::Float>& feed2_pa() { IllegalOperation (); }
103 0 : virtual const casacore::Vector<casacore::Float>& feed2_pa() const { return vb2_p-> feedPa2(); }
104 :
105 0 : virtual casacore::Vector<casacore::SquareMatrix<casacore::Complex, 2> >& CJones() { IllegalOperation (); }
106 0 : virtual const casacore::Vector<casacore::SquareMatrix<casacore::Complex, 2> >& CJones() const { return vb2_p-> cjones(); }
107 :
108 : // Note that feed_pa is a function instead of a cached value
109 0 : virtual casacore::Vector<casacore::Float> feed_pa(casacore::Double time) const{ return vb2_p-> feedPa (time); }
110 :
111 : // direction1() and direction2() return arrays of directions where
112 : // the first and the second antenna/feed are pointed to. One value for
113 : // each row in the current buffer.
114 0 : virtual casacore::Vector<casacore::MDirection>& direction1() { IllegalOperation (); }
115 0 : virtual const casacore::Vector<casacore::MDirection>& direction1() const { return vb2_p-> direction1(); }
116 :
117 0 : virtual casacore::Vector<casacore::MDirection>& direction2() { IllegalOperation (); }
118 0 : virtual const casacore::Vector<casacore::MDirection>& direction2() const { return vb2_p-> direction2(); }
119 :
120 :
121 : // NOMINAL parallactic angle (feed p.a. offset NOT included)
122 0 : virtual casacore::Float parang0(casacore::Double time) const{ return vb2_p-> parang0(time); }
123 0 : virtual casacore::Vector<casacore::Float> parang(casacore::Double time) const{ return vb2_p-> parang(time); }
124 :
125 : // Note that azel is a function instead of a cached value
126 0 : virtual casacore::MDirection azel0(casacore::Double time) const{ return vb2_p-> azel0(time); }
127 0 : virtual casacore::Vector<casacore::Double>& azel0Vec(casacore::Double , casacore::Vector<casacore::Double>& ) const{ IllegalOperation(); }
128 0 : virtual casacore::Vector<casacore::MDirection> azel(casacore::Double time) const{ return vb2_p-> azel(time); }
129 0 : virtual casacore::Matrix<casacore::Double>& azelMat(casacore::Double , casacore::Matrix<casacore::Double>& ) const{ IllegalOperation(); }
130 :
131 : // Hour angle for specified time
132 0 : virtual casacore::Double hourang(casacore::Double time) const{ return vb2_p-> hourang(time); }
133 :
134 0 : virtual casacore::Int fieldId() const { return vb2_p-> fieldId()(0); }
135 :
136 0 : virtual casacore::Int& fieldIdRef() { IllegalOperation(); }
137 :
138 0 : virtual casacore::Int& arrayIdRef() { IllegalOperation(); }
139 :
140 0 : virtual casacore::Int arrayId() const { return vb2_p-> arrayId()(0); }
141 :
142 : // Return flag for each channel & row
143 0 : virtual casacore::Matrix<casacore::Bool>& flag() { IllegalOperation(); }
144 0 : virtual const casacore::Matrix<casacore::Bool>& flag() const { IllegalOperation(); }
145 :
146 : // Return flag for each polarization, channel and row
147 0 : virtual casacore::Cube<casacore::Bool>& flagCube() { return const_cast<casacore::Cube<casacore::Bool>&> (vb2_p-> flagCube());}
148 0 : virtual const casacore::Cube<casacore::Bool>& flagCube() const { return vb2_p-> flagCube(); }
149 :
150 0 : virtual casacore::Vector<casacore::Bool>& flagRow() { return const_cast<casacore::Vector<casacore::Bool>&> (vb2_p-> flagRow());}
151 0 : virtual const casacore::Vector<casacore::Bool>& flagRow() const { return vb2_p-> flagRow(); }
152 :
153 : // Return flags for each polarization, channel, category, and row.
154 0 : virtual casacore::Array<casacore::Bool>& flagCategory() { IllegalOperation (); }
155 0 : virtual const casacore::Array<casacore::Bool>& flagCategory() const { return vb2_p-> flagCategory(); }
156 :
157 0 : virtual casacore::Vector<casacore::Int>& scan() { return const_cast<casacore::Vector<casacore::Int>&> (vb2_p-> scan());}
158 0 : virtual const casacore::Vector<casacore::Int>& scan() const { return vb2_p-> scan(); }
159 :
160 : // scalar version for convenience, when scan known constant for
161 : // entire iteration/buffer.
162 0 : virtual casacore::Int scan0() { IllegalOperation(); }
163 :
164 0 : virtual casacore::Vector<casacore::Int>& processorId() { return const_cast<casacore::Vector<casacore::Int>&> (vb2_p-> processorId());}
165 0 : virtual const casacore::Vector<casacore::Int>& processorId() const { return vb2_p-> processorId(); }
166 :
167 0 : virtual casacore::Vector<casacore::Int>& observationId() { return const_cast<casacore::Vector<casacore::Int>&> (vb2_p-> observationId());}
168 0 : virtual const casacore::Vector<casacore::Int>& observationId() const { return vb2_p-> observationId(); }
169 :
170 0 : virtual casacore::Vector<casacore::Int>& stateId() { return const_cast<casacore::Vector<casacore::Int>&> (vb2_p-> stateId());}
171 0 : virtual const casacore::Vector<casacore::Int>& stateId() const { return vb2_p-> stateId(); }
172 :
173 : // Gets SPECTRAL_WINDOW/CHAN_FREQ (in Hz, acc. to the casacore::MS def'n v.2).
174 0 : virtual casacore::Vector<casacore::Double>& frequency() {
175 0 : return const_cast<casacore::Vector<casacore::Double>&> (vb2_p->getFrequencies(0));
176 : }
177 0 : virtual const casacore::Vector<casacore::Double>& frequency() const
178 : {
179 0 : return vb2_p->getFrequencies(0);
180 : }
181 :
182 : //if ignoreconv=true..frequency is served as is in the data frame
183 0 : virtual void lsrFrequency(const casacore::Int & spw, casacore::Vector<casacore::Double>& freq, casacore::Bool & convert,
184 : const casacore::Bool ignoreConv = false) const
185 : {
186 : const VisibilityIteratorImpl2 * vi =
187 0 : dynamic_cast<const VisibilityIteratorImpl2 *>(
188 0 : dynamic_cast<const VisBufferImpl2 *>(vb2_p)->getViiP());
189 :
190 0 : casacore::Int frame = -1;
191 0 : if (ignoreConv){
192 0 : frame = vi->getObservatoryFrequencyType ();
193 : }
194 : else{
195 0 : frame = casacore::MFrequency::LSRK;
196 : }
197 :
198 0 : convert = frame != casacore::MFrequency::LSRK; // make this parameter write-only
199 :
200 0 : freq = vi->getFrequencies (this->time()(0), frame, spw, vi->msId());
201 0 : }
202 :
203 0 : virtual casacore::Int numberCoh () const { IllegalOperation(); }
204 :
205 0 : virtual casacore::MDirection & phaseCenter() { IllegalOperation (); }
206 0 : virtual casacore::MDirection phaseCenter() const { return vb2_p-> phaseCenter(); }
207 :
208 0 : virtual casacore::Int polFrame() const { return vb2_p-> polarizationFrame(); }
209 :
210 0 : virtual casacore::Vector<casacore::Int>& corrType() { return const_cast<casacore::Vector<casacore::Int> &> (vb2_p-> correlationTypes()); }
211 0 : virtual const casacore::Vector<casacore::Int>& corrType() const { return vb2_p-> correlationTypes(); }
212 :
213 0 : virtual casacore::Vector<casacore::Float>& sigma() { IllegalOperation (); }
214 0 : virtual const casacore::Vector<casacore::Float>& sigma() const { IllegalOperation(); }
215 :
216 0 : virtual casacore::Matrix<casacore::Float>& sigmaMat() { IllegalOperation (); }
217 0 : virtual const casacore::Matrix<casacore::Float>& sigmaMat() const { return vb2_p-> sigma(); }
218 :
219 0 : virtual casacore::Int & spectralWindow() { spectralWindow_p = vb2_p->spectralWindows()(0); return spectralWindow_p;}
220 0 : virtual casacore::Int spectralWindow() const { return vb2_p-> spectralWindows()(0); }
221 0 : virtual casacore::Int polarizationId() const { return vb2_p-> polarizationId(); }
222 0 : virtual casacore::Int& dataDescriptionIdRef() { IllegalOperation(); }
223 0 : virtual casacore::Int dataDescriptionId() const { return vb2_p-> dataDescriptionIds()(0); }
224 0 : virtual casacore::Vector<casacore::Double>& time() { IllegalOperation (); }
225 0 : virtual const casacore::Vector<casacore::Double>& time() const { return vb2_p-> time(); }
226 :
227 0 : virtual casacore::Vector<casacore::Double>& timeCentroid() { IllegalOperation (); }
228 0 : virtual const casacore::Vector<casacore::Double>& timeCentroid() const { return vb2_p-> timeCentroid(); }
229 :
230 0 : virtual casacore::Vector<casacore::Double>& timeInterval() { IllegalOperation (); }
231 0 : virtual const casacore::Vector<casacore::Double>& timeInterval() const { return vb2_p-> timeInterval(); }
232 :
233 0 : virtual casacore::Vector<casacore::Double>& exposure() { IllegalOperation (); }
234 0 : virtual const casacore::Vector<casacore::Double>& exposure() const { return vb2_p-> exposure(); }
235 :
236 0 : virtual casacore::Vector<casacore::RigidVector<casacore::Double, 3> >& uvw()
237 : {
238 0 : if (uvw_p.empty()){
239 :
240 0 : fillUvw ();
241 :
242 : }
243 :
244 0 : return uvw_p;
245 : }
246 :
247 0 : virtual const casacore::Vector<casacore::RigidVector<casacore::Double, 3> >& uvw() const
248 : {
249 0 : if (uvw_p.empty()){
250 :
251 0 : fillUvw ();
252 :
253 : }
254 :
255 0 : return uvw_p;
256 : }
257 :
258 : void
259 0 : fillUvw() const {
260 :
261 0 : const casacore::Matrix<casacore::Double> & u = vb2_p->uvw();
262 :
263 0 : casacore::Int nRows = u.shape()(1);
264 0 : uvw_p.resize (nRows);
265 :
266 0 : for (casacore::Int i = 0; i < nRows; i++){
267 0 : casacore::RigidVector<casacore::Double,3> t;
268 0 : for (casacore::Int j = 0; j < 3; j++){
269 0 : t (j) = u (j, i);
270 : }
271 0 : uvw_p (i) = t;
272 : }
273 0 : }
274 :
275 :
276 0 : virtual casacore::Matrix<casacore::Double>& uvwMat() { IllegalOperation (); }
277 0 : virtual const casacore::Matrix<casacore::Double>& uvwMat() const { return vb2_p-> uvw(); }
278 :
279 0 : virtual casacore::Matrix<CStokesVector>& visibility() { IllegalOperation (); }
280 0 : virtual const casacore::Matrix<CStokesVector>& visibility() const { IllegalOperation (); }
281 :
282 0 : virtual casacore::Matrix<CStokesVector>& modelVisibility() { IllegalOperation (); }
283 0 : virtual const casacore::Matrix<CStokesVector>& modelVisibility() const { IllegalOperation (); }
284 :
285 0 : virtual casacore::Matrix<CStokesVector>& correctedVisibility() { IllegalOperation (); }
286 0 : virtual const casacore::Matrix<CStokesVector>& correctedVisibility() const { IllegalOperation (); }
287 :
288 0 : virtual casacore::Cube<casacore::Complex>& visCube() { IllegalOperation (); }
289 0 : virtual const casacore::Cube<casacore::Complex>& visCube() const { return vb2_p-> visCube(); }
290 :
291 0 : virtual casacore::Cube<casacore::Complex>& modelVisCube() { return const_cast<casacore::Cube<casacore::Complex> &> (vb2_p->visCubeModel()); }
292 :
293 0 : virtual casacore::Cube<casacore::Complex>& modelVisCube(const casacore::Bool & ) { IllegalOperation (); }
294 :
295 0 : virtual const casacore::Cube<casacore::Complex>& modelVisCube() const { return vb2_p->visCubeModel(); }
296 :
297 0 : virtual casacore::Cube<casacore::Complex>& correctedVisCube() { IllegalOperation(); }
298 0 : virtual const casacore::Cube<casacore::Complex>& correctedVisCube() const { return vb2_p-> visCubeCorrected(); }
299 :
300 : // Return visCube(), modelVisCube(), or correctedVisCube(),
301 : // according to whichcol. They throw an exception if whichcol is
302 : // unsupported, but note the encouraged default.
303 : // TODO: Optionally return DATA if whichcol is unavailable.
304 : casacore::Cube<casacore::Complex>& dataCube(const casacore::MS::PredefinedColumns whichcol=casacore::MS::DATA);
305 : const casacore::Cube<casacore::Complex>& dataCube(const casacore::MS::PredefinedColumns
306 : whichcol=casacore::MS::DATA) const;
307 :
308 0 : virtual casacore::Cube<casacore::Float>& floatDataCube() { IllegalOperation(); }
309 0 : virtual const casacore::Cube<casacore::Float>& floatDataCube() const { return vb2_p-> visCubeFloat (); }
310 :
311 : // Returns the weights for each row averaged over the parallel hand correlations.
312 0 : virtual casacore::Vector<casacore::Float>& weight() { IllegalOperation(); }
313 0 : virtual const casacore::Vector<casacore::Float>& weight() const { IllegalOperation(); }
314 :
315 : // Returns the nPol_p x curNumRow_p weight matrix.
316 0 : virtual casacore::Matrix<casacore::Float>& weightMat() { IllegalOperation(); }
317 0 : virtual const casacore::Matrix<casacore::Float>& weightMat() const { return vb2_p-> weight(); }
318 :
319 : // Is a valid WEIGHT_SPECTRUM available?
320 0 : virtual casacore::Bool existsWeightSpectrum() const { IllegalOperation(); }
321 :
322 0 : virtual casacore::Cube<casacore::Float>& weightSpectrum() { IllegalOperation();; }
323 0 : virtual const casacore::Cube<casacore::Float>& weightSpectrum() const { return vb2_p-> weightSpectrum(); }
324 :
325 0 : virtual casacore::Matrix<casacore::Float>& imagingWeight(){ IllegalOperation(); }
326 0 : virtual const casacore::Matrix<casacore::Float>& imagingWeight() const{ return vb2_p-> imagingWeight(); }
327 :
328 0 : virtual casacore::Cube<casacore::Float>& weightCube() { IllegalOperation(); }
329 : //</group>
330 :
331 : //<group>
332 : // Utility functions to provide coordinate or column ranges of the
333 : // data in the VisBuffer. Flagging is applied before computing the ranges.
334 : //
335 : // Generic accessor to column ranges of integer type, as specified by
336 : // enumerations defined in class MSCalEnums. Throws an exception
337 : // if the enum is not for a recognized integer column.
338 0 : virtual casacore::Vector<casacore::Int> vecIntRange(const MSCalEnums::colDef & ) const{ IllegalOperation(); }
339 :
340 : // Antenna id. range (includes both ANTENNA1 and ANTENNA2 columns)
341 0 : virtual casacore::Vector<casacore::Int> antIdRange() const{ IllegalOperation(); }
342 :
343 : // casacore::Time range
344 0 : virtual casacore::Bool timeRange(casacore::MEpoch & , casacore::MVEpoch & , casacore::MVEpoch & ) const
345 0 : { IllegalOperation(); }
346 :
347 : // Return the row Ids from the original ms. If the ms used is a subset of
348 : // another ms then rowIds() return the row ids of the original ms.
349 0 : virtual casacore::Vector<casacore::rownr_t>& rowIds(){ IllegalOperation(); }
350 :
351 0 : virtual const casacore::Vector<casacore::rownr_t>& rowIds() const { return vb2_p-> rowIds(); };
352 :
353 : //</group>
354 :
355 : // Frequency average the buffer (visibility() column only)
356 0 : virtual void freqAverage(){ IllegalOperation(); }
357 :
358 : // Frequency average the buffer (visCube and [if present] modelVisCube)
359 : void freqAveCubes(){ IllegalOperation(); }
360 :
361 : // Average channel axis according to chanavebounds, for whichever of DATA,
362 : // MODEL_DATA, CORRECTED_DATA, FLOAT_DATA, FLAG, and WEIGHT_SPECTRUM are
363 : // present. It will only treat the first 5 as present if they have already
364 : // been loaded into the buffer!
365 : void channelAve(const casacore::Matrix<casacore::Int>& ){ IllegalOperation(); }
366 :
367 : // Average channel axis by factor.
368 : template<class T> void chanAveVisCube(casacore::Cube<T>& , casacore::Int ){ IllegalOperation(); }
369 :
370 : // Accumulate channel axis by factor, without applying WEIGHT_SPECTRUM even
371 : // if it is present.
372 : // It is primarily intended for averaging WEIGHT_SPECTRUM itself.
373 : template<class T> void chanAccCube(casacore::Cube<T>& , casacore::Int ){ IllegalOperation(); }
374 :
375 : // This defaults to no conceptual side effects, but usually it is more
376 : // efficient to let it leave weightSpectrum() in a channel averaged state.
377 : // restoreWeightSpectrum has no effect if !existsWeightSpectrum().
378 0 : virtual void chanAveFlagCube(casacore::Cube<casacore::Bool>& , const casacore::Int ,
379 0 : const casacore::Bool = true){ IllegalOperation(); }
380 :
381 : // Doesn't do anything if flagcat is degenerate.
382 : void chanAveFlagCategory(casacore::Array<casacore::Bool>& flagcat, const casacore::Int nChanOut);
383 :
384 : // Form casacore::Stokes parameters from correlations
385 : // (these are preliminary versions)
386 0 : virtual void formStokes(){ IllegalOperation(); }
387 0 : virtual void formStokesWeightandFlag(){ IllegalOperation(); }
388 0 : virtual void formStokes(casacore::Cube<casacore::Complex>& ){ IllegalOperation(); }
389 0 : virtual void formStokes(casacore::Cube<casacore::Float>& ){ IllegalOperation(); } // Will throw up if asked to do all 4.
390 :
391 : // casacore::Sort/unsort the correlations, if necessary
392 : // (Rudimentary handling of non-canonically sorted correlations--use with care!)
393 0 : virtual void sortCorr(){ IllegalOperation(); }
394 0 : virtual void unSortCorr(){ IllegalOperation(); }
395 :
396 : // Normalize the visCube by the modelVisCube
397 : // (and optionally also divide visCube_p by its normalized amp)
398 0 : virtual void normalize(const casacore::Bool & = false){ CheckWritability(); vb2Rw_p-> normalize(); }
399 :
400 : // Fill weightMat according to sigma column
401 0 : virtual void resetWeightMat(){ IllegalOperation(); }
402 :
403 : // Rotate visibility phase for given vector (dim = nrow of vb) of phases (metres)
404 0 : virtual void phaseCenterShift(const casacore::Vector<casacore::Double>& ){ IllegalOperation(); }
405 : // Rotate visibility phase for phase center offsets (arcsecs)
406 0 : virtual void phaseCenterShift(casacore::Double , casacore::Double ){ IllegalOperation(); }
407 :
408 : // Update coordinate info - useful for copied VisBuffers that need
409 : // to retain some state for later reference.
410 : // Presently this fills antenna, array, field and spectralWindow ids, time,
411 : // frequency and number of rows.
412 : // if dirDependent is set to false the expensive direction dependent calculation of parallactic or direction of
413 : // antenna from pointing table is avoided
414 : //Add more as needed.
415 0 : virtual void updateCoordInfo(const VisBuffer * = NULL, const casacore::Bool =true){ IllegalOperation(); }
416 :
417 : // Set the visibility to a constant, note that this only changes the buffer,
418 : // no values are written back to tables from here.
419 0 : virtual void setVisCube(casacore::Complex c){ CheckWritability(); vb2Rw_p-> setVisCube(c); }
420 0 : virtual void setModelVisCube(casacore::Complex c){ CheckWritability(); vb2Rw_p-> setVisCubeModel(c); }
421 0 : virtual void setCorrectedVisCube(casacore::Complex ){ IllegalOperation(); }
422 :
423 : // Set the visibility, note that this only changes the buffer,
424 : // no values are written back to tables from here.
425 0 : virtual void setVisCube(const casacore::Cube<casacore::Complex>& vis){ CheckWritability(); vb2Rw_p-> setVisCube(vis); }
426 0 : virtual void setModelVisCube(const casacore::Cube<casacore::Complex>& vis){ CheckWritability(); vb2Rw_p-> setVisCubeModel(vis); }
427 0 : virtual void setCorrectedVisCube(const casacore::Cube<casacore::Complex>& vis){ CheckWritability(); vb2Rw_p-> setVisCubeCorrected(vis); }
428 :
429 : // Like the above, but for FLOAT_DATA, keeping it as real floats.
430 0 : virtual void setFloatDataCube(const casacore::Cube<casacore::Float>& fcube){ CheckWritability(); vb2Rw_p-> setVisCubeFloat(fcube); }
431 :
432 : // Set model according to a casacore::Stokes vector
433 0 : virtual void setModelVisCube(const casacore::Vector<casacore::Float>& /*stokes*/){ IllegalOperation (); }
434 :
435 : // Reference external model visibilities
436 0 : virtual void refModelVis(const casacore::Matrix<CStokesVector>& ){ IllegalOperation(); }
437 :
438 : // Remove scratch cols data from vb
439 0 : virtual void removeScratchCols(){ IllegalOperation(); }
440 :
441 : // Access the current casacore::MSColumns object via VisIter
442 0 : virtual const casacore::MSColumns & msColumns() const
443 : {
444 0 : Assert (msColumns_p != 0);
445 0 : return * msColumns_p;
446 : }
447 :
448 0 : virtual casacore::Int numberAnt () const{ return vb2_p-> nAntennas (); }
449 :
450 : // Get all selected spectral windows not just the one in the actual buffer
451 0 : virtual void allSelectedSpectralWindows(casacore::Vector<casacore::Int>& spectralWindows, casacore::Vector<casacore::Int>& nChannels)
452 : {
453 0 : spectralWindows.assign (spectralWindows_p);
454 0 : nChannels.assign (nChannels_p);
455 0 : }
456 :
457 0 : virtual void getChannelSelection(casacore::Block< casacore::Vector<casacore::Int> >& ,
458 : casacore::Block< casacore::Vector<casacore::Int> >& ,
459 : casacore::Block< casacore::Vector<casacore::Int> >& ,
460 : casacore::Block< casacore::Vector<casacore::Int> >& ,
461 0 : casacore::Block< casacore::Vector<casacore::Int> >& ) const { IllegalOperation(); }
462 : void allSelectedSpectralWindows(casacore::Vector<casacore::Int>& spws, casacore::Vector<casacore::Int>& nvischan) const ;
463 :
464 : // Return the actual msid, useful if using multiple ms to monitor which
465 : // ms in the list is being dealt with
466 0 : virtual casacore::Int msId() const { return vb2_p-> msId(); }
467 :
468 : //checked if the ms has changed since the last chunk processed
469 0 : virtual casacore::Bool newMS() const { return vb2_p-> isNewMs(); }
470 : //get the name of the ms the buffer is at empty string if no visiter is attached
471 0 : virtual casacore::String msName(casacore::Bool =false) const{ return vb2_p-> msName(); }
472 :
473 0 : virtual casacore::Bool newArrayId () const{ return vb2_p-> isNewArrayId (); }
474 0 : virtual casacore::Bool newFieldId () const{ return vb2_p-> isNewFieldId (); }
475 0 : virtual casacore::Bool newSpectralWindow () const{ return vb2_p-> isNewSpectralWindow (); }
476 :
477 : //
478 :
479 :
480 : private:
481 :
482 :
483 : const casacore::MSColumns * msColumns_p; // [use]
484 : casacore::Vector<casacore::Int> nChannels_p;
485 : casacore::Int nChannelsScalar_p;
486 : casacore::Int nCorr_p;
487 : casacore::Int nRows_p;
488 : casacore::Int spectralWindow_p;
489 : casacore::Vector<casacore::Int> spectralWindows_p;
490 : mutable casacore::Vector<casacore::RigidVector<casacore::Double, 3> > uvw_p;
491 : const vi::VisBuffer2 * vb2_p; // [use]
492 : vi::VisBuffer2 * vb2Rw_p; // [use]
493 :
494 : };
495 :
496 : } // end namespace vi
497 :
498 : } // end namespace casa
499 :
500 :
501 : #endif /* VISBUFFER2ADAPTER_H_ */
|