casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MSAsRaster.h
Go to the documentation of this file.
1 //# MSAsRaster.h: DisplayData (drawing layer) for raster displays of an MS
2 //# Copyright (C) 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 //#
27 //# $Id$
28 
29 #ifndef TRIALDISPLAY_MSASRASTER_H
30 #define TRIALDISPLAY_MSASRASTER_H
31 
32 
33 #include <casa/aips.h>
35 #include <ms/MeasurementSets.h>
37 #include <casa/Arrays/Vector.h>
38 #include <casa/Quanta/Unit.h>
39 #include <casa/BasicSL/String.h>
53 
54 namespace casa { //# NAMESPACE CASA - BEGIN
55 
56  class MSAsRasterDM;
57 
58 
59 // <summary>
60 // Class for displaying data within an casacore::MS as a raster (gridded) image.
61 // </summary>
62 
63 // <prerequisite>
64 // <li> CachingDisplayData
65 // <li> WorldCanvas[Holder]
66 // <li> MeasurementSet
67 // <li> CoordinateSystem
68 // <li> Array
69 // </prerequisite>
70 
71 // <etymology>
72 // "MSAsRaster" is a implementation of a <linkto class=ActiveCaching2dDD>
73 // ActiveCaching2dDD </linkto> which provides for the display of Measurement
74 // Set data (visibilities) as a raster image.
75 // </etymology>
76 
77 // <synopsis>
78 // MSAsRaster displays Measurement Set data which can be presented as a
79 // regular grid, on a WorldCanvas (data which is sparse and
80 // irregular on its display axes would typically be plotted using MSAsXY
81 // instead). Display or iteration axes include time, baseline,
82 // channels and polarizations. Visibilities of the selected slice are drawn
83 // as a Raster image.
84 //
85 // Unlike many DDs, MSAsRaster has _two_ levels of underlying data: the source
86 // casacore::MS, and a hypercube of visibility data, which is extracted from the casacore::MS and
87 // gridded onto 5 main axes: time, baseline, spectral window, frequency and
88 // polarization. Extracting the data is a more time-consuming operation
89 // than display of various portions of gridded data, and is triggered only
90 // through the extract_() method. casacore::Data selection options do not take effect
91 // until triggered in this way. In contrast, many options affecting display
92 // of the extracted data (such as zooms, and colormapping) affect
93 // the display immediately, as with most DDs. Setting new display axes will
94 // trigger extract_() if the current extracted hypercube does not fill them.
95 //
96 // </synopsis>
97 
98 // <example>
99 // <srcblock>
100 // MSAsRaster *mar = new MSAsRaster("filename_of.ms");
101 // wcHolder->addDisplayData(mar);
102 // </srcblock>
103 // </example>
104 //
105 // <motivation>
106 // To move compute-intensive tasks of data handling
107 // for Measurement Set display out of glish into C++
108 // </motivation>
109 
110 // <todo asof="2001/02/01">
111 //
112 // The current user interface for triggering extract_ is the 'Apply' button,
113 // which is detected internally when setOptions() is called with more than
114 // one user option field to be updated. This is not entirely satisfactory;
115 // User interface could use improvement.
116 //
117 // Major items among other things left to to:
118 //
119 // * casacore::MS Selection and averaging.
120 //
121 // * World coordinates in axis labelling, position tracking and slice
122 // selection
123 //
124 // * Alternative orderings, especially along baseline and time axes
125 //
126 // </todo>
127 
129 
130  public:
131 
133 
134  // constructor
135  // from the filename of an MS
136  MSAsRaster( const casacore::String msname, const viewer::DisplayDataOptions &ddo );
137 
138  //# from an casacore::MS object
139  //# MSAsRaster(casacore::MeasurementSet* ms);
140  //#unneeded?--prefer to control permissions...
141 
142  // Destructor
143  virtual ~MSAsRaster();
144 
145 
146  // Apply option values stored in <src>rec</src> to the DisplayData. A
147  // return value of <src>true</src> means a refresh is needed.
148  // <src>recOut</src> contains any fields which were implicitly
149  // changed as a result of the call to this function.
150  // Parameters from the 'adjust' gui are sent through here,
151  // controlling and triggering many of
152  // MSAsRaster's actions. (Other input is via the mouse on the
153  // canvas, which affects the object through the event handlers).
155 
156  // Retrieve the current options. In addition to the values themselves, the
157  // returned record contains meta-information (prompts, help text,
158  // choices, defaults, etc.) useful in constructing gui elements to
159  // control the DD settings.
160  // Note: If the user interface is to be zero-based, you should call
161  // setUIBase(0) _before_ using this routine -- see setUIBase().
162  virtual casacore::Record getOptions( bool scrub=false ) const;
163 
164  // set all options to default values (unused so far; incomplete
165  // support in base classes...incomplete here as well).
166  virtual void setDefaultOptions();
167 
168 
169  // Return the current options of this DisplayData as a 'restrictions'
170  // AttributeBuffer (only options that affect the way the image would
171  // be drawn are returned). It is used to determine which (if any) of
172  // the cached drawings can be used to satisfy the current draw request.
174 
175 
176  // Determine whether DD is compatible with the WC[H]'s current
177  // world coordinates. MSAsRaster DDs must be in charge (the CS master),
178  // Otherwise they will not respond. Multiple MSARs on one canvas
179  // (blinking, etc.) is not supported, because of possible confusion
180  // about which one(s) should respond to flagging edits.
182  csConformed_ = wc.isCSmaster(this);
183  return csConformed_;
184  }
185 
186  // casacore::Format the data value at the given world position.
187  // Call setActiveImage(zindex) with the desired animator position
188  // before calling this routine.
190 
191  // casacore::Format the position of the cursor. Also requires previous call to
192  // setActiveImage(zindex); also used for position tracking.
194  const casacore::Bool &displayAxesOnly = false);
196  const casacore::Bool& displayAxesOnly = false);
197 
198  // get the casacore::Unit for displayed data values (visibilities)
199  virtual const casacore::Unit dataUnit() const;
201  return casacore::IPosition( );
202  }
204  return 0;
205  }
206  std::vector<int> displayAxes( ) const {
207  return std::vector<int>( );
208  }
209 
210 
211  // Return the type of this DisplayData.
213  return Display::Raster;
214  }
215  // Pure virtual function from DisplayData...
217  return "ms";
218  }
219 
220 
221  // return the size of the animation axis.
222  // <group>
223  virtual casacore::uInt nelements() const {
224  return msShape_[axisOn_(Z)];
225  }
226  virtual casacore::uInt nelements(const WorldCanvasHolder &) const {
227  return msShape_[axisOn_(Z)];
228  }
229  // </group>
230 
231  // Handle axis labelling.
232  virtual casacore::Bool labelAxes(const WCRefreshEvent &ev);
233  virtual casacore::Bool canLabelAxes() const;
234 
235  // Needed to enable or destroy drawlists and colormaps on corresp. canvas.
236  // (Only to be called by the relevant WCH).
237  // <group>
238  virtual void notifyRegister(WorldCanvasHolder *wch) ;
239  virtual void notifyUnregister(WorldCanvasHolder& wch,
240  casacore::Bool ignoreRefresh = false) ;
241  // </group>
242 
243  // handle flagging region selection events, via new-style (1/02)
244  // interface.
245  virtual void handleEvent(DisplayEvent& ev);
246 
247  // Return the animator position setting preferred if this DD
248  // about to be registered on a new DisplayPanel.
249  virtual casacore::Bool zIndexHint(casacore::Int& preferredZIndex) const;
250 
251  // Empty cache completely.
252  virtual void purgeCache() {
255  } //# (include our labeller)
256 
257  // Empty cache of all DMs for a given WCH.
258  virtual void purgeCache(const WorldCanvasHolder& wch) {
261  } //# (include our labeller)
262 
263  // DD 'Absolute Pixel Coordinates', e.g. channel numbers, are internally
264  // 0-based (they begin numbering at 0), but certain external user-interface
265  // methods (e.g. showPosition(), used for position tracking) have
266  // produced 1-based output traditionally for the glish-based viewer.
267  // uiBase_, and related methods uiBase() and setUIBase(), allow newer
268  // (python/Qt-based) code to cause external ui functions like showValue()
269  // to report 0-based values instead. Unless setUIBase(0) is called, the
270  // traditional 1-based reporting behavior is retained by default.
271  // For this DD, in addition to tracking, this setting affects labelling,
272  // slider-based position setting, and casacore::MS selection on Field or Sp. Window.
273  //
274  // If you are using 0-basing in the user interface, you should call
275  // setUIBase(0) right after constructing this DisplayData, before other
276  // user interface operations such as getOptions(); the method has not
277  // been tested other than for a one-time setUIBase(0) call directly after
278  // DD construction.
279  virtual void setUIBase(casacore::Int uibase) {
280  casacore::Int oldUIBase = uiBase();
282  if(oldUIBase != uiBase()) {
283  setCS_(); // fixes axis labelling, among other things...
284  purgeCache();
285  }
286  }
287  // In case it helps; the method should probably be called
288  // only before we've had a chance to cache anything though....
289 
290 
291 
292  virtual const casacore::String &name( ) const {
293  return msName_;
294  }
295 
296  // added to allow flagging control from mouse tools... <drs>
297  bool flag( WorldCanvas *wc, double blc_x, double blc_y, double trc_x, double trc_y );
298 
299  std::string errorMessage( ) const { return ""; }
300 
301  protected:
302 
303  // This routine is called to inform the DD of the current canvas's
304  // animator index. Used by confromsTo() and related methods.
305  // Return value indicates whether the index is within the data's range.
307  activeZIndex_ = zindex;
308  // activeZIndex_ and zIndexConformed_ protected on the DD
309  // base level; they are intended to be set only by these
310  // [protected] setActiveZIndex_() methods, which are in turn
311  // called by DD::conformsToZIndex().
313  return zIndexConformed_;
314  }
315 
316  // Construct and destroy the user option DisplayParameters.
317  // To be used by constructors/destructor only.
318  // <group>
319  void constructParameters_();
320  void deleteParameters_();
321  // </group>
322 
323  // return a new MSAsRasterDM for the given WorldCanvas.
324  virtual CachingDisplayMethod *newDisplayMethod(WorldCanvas *worldCanvas,
325  AttributeBuffer *wchAttributes,
326  AttributeBuffer *ddAttributes,
327  CachingDisplayData *dd);
328 
329  // Helper functions.
330  //# gcc-3.4.2 cannot distinguish between the 2 functions in complex.
331  // <group>
332  static casacore::Float real (const casacore::Complex& val) {
333  return val.real();
334  }
335  static casacore::Float imag (const casacore::Complex& val) {
336  return val.imag();
337  }
338  // </group>
339 
340  private:
341 
342 
343  // Constructs position information for non-deviation display
344  // state averaging...
345  casacore::String avgPos( const casacore::String &dim, int v );
346 
347  // The (multiple) DMs which this DD creates just hold drawlist handles.
348  // They send the actual drawing chores back to MSAsRaster::draw_().
349  // The friend designation is so that draw_() can be made private.
350  friend class MSAsRasterDM;
351 
352  // Default and copy constructors, and the assignment operator, are
353  // non-functional and should not be used. Do not make copies of
354  // DisplayData objects, or pass them by value;
355  // use references or pointers instead.
356  // <group>
357  MSAsRaster(): mspos_(this) { }
358  MSAsRaster(const MSAsRaster &other): ActiveCaching2dDD(other), mspos_(this) { }
359  MSAsRaster& operator=(const MSAsRaster &/*other*/) {
360  return *this;
361  }
362  // </group>
363 
364  // Initialization common to all useful constructors
365  void initMSAR_( const viewer::DisplayDataOptions &ddo );
366 
367  // set/restore default option values on this level only. (Not implemented).
368  void setDefaultMSAROptions_();
369 
370 
371  //#-------------------------------------------------------------------
372  //# The Workhorses--steps in producing the display from the casacore::MS and the
373  //# the user input settings. (Most of the control logic is elsewhere).
374 
375  // prepare the selection casacore::MS and its VisSet.
377 
378  // find the ranges of the casacore::MS selection (VisSet) for the 5 hypercube axes
379  void findRanges_();
380 
381  // update/set the (2d--canvas) coordinate system from the current MS
382  // selection and display axes.
384 
385  // Extract the hypercube buffer of visibilities for the requested
386  // casacore::MS selection and axis settings (the most time-consuming operation).
387  void extract_();
388 
389  // retrieve (2D) slice data casacore::Matrix, and corresponding mask/flag
390  // matrices, to send to the display canvas.
391  void createDisplaySlice_();
392 
393  // Actually do the drawing.
394  // The return value indicates whether the DD was able to draw.
396  WorldCanvasHolder &wch, WorldCanvas &wc);
397 
398 
399 
400  //#------baseline reordering routines-------------------------------------
401 
402  // Called from findRanges_(), computes translation matrices between
403  // antenna1,antenna2 and baseline index (a1A_, a2A_, a1L_, a2L_,
404  // bslA_, bslL_).
405  void computeBaselineSorts_();
406 
407 
408  // Set the baseline index translation Arrays a1_, a2_ and bsl_ by
409  // copying as appropriate according to the current sort. (Source Arrays
410  // should already have been created by computeBaselineSorts_(), above).
411  // also sets total number of baselines, nbsl_, which becomes
412  // msShape_[BASELN] except in single dish case.
413  void setBslSort_();
414 
415 
416  // Shuffle vis_ into new baseline order, per user request for sort change.
417  // (Information needed to do this should already have been set up by
418  // the previous two routines).
419  void reSortVis_();
420 
421 
422 
423  //#-----small helper routines.-----------------------------------------
424 
425  // Return baseline index (for the ant1-ant2 sort _only_) from
426  // antenna numbers. casacore::Input must have 0 <= a1 <= a2 < nAnt_.
427  // Mapping leaves room for autocorrelations plus a 1-pixel gap between
428  // successive antenna1 groups.
429  //
430  //# (Crude--needs improvement: *Wasteful if some antennas have ANTENNA
431  //# table entries but don't appear in the visibility data. *The gaps
432  //# really should appear only in the final display casacore::Matrix, when needed.
433  //# *Slots for autocorrs should also be inserted only if the selected
434  //# data includes them. *Other baseline ordering options should exist).
436  return a1*(nAnt_+2) - a1*(a1+1)/2 + a2-a1;
437  }
438 
439  // A corresponding inverse, this handles non-integer 'baseline indices'.
440  // Set abase to 1 to number ant1 and ant2 from 1. (The baseline index
441  // bsl is always numbered from 0, internally). The version with the
442  // casacore::Double return value returns a1 + a2/a1mult_() (for labelling --
443  // example: for baseline index corresp. to 13-24, returns 13.024).
444  // <group>
445  void a1a2_(casacore::Double& a1, casacore::Double& a2, casacore::Double bsl, casacore::Int abase=0) const;
447  // </group>
448 
449  // Subsidiary routine for above, determines (in effect) how many decimal
450  // places are needed for an antenna number (including one leading zero).
451  // Returns 1000 for 10-99 antennas, 10000 for 100-999 antennas, etc.
453  casacore::Double m=10.;
454  while(m <= nAnt_-1+uiBase()) m*=10.;
455  return 10*m;
456  }
457 
458 
459  // A small routine to return the label for the "Visibility Memory"
460  // slider widget. The label includes feedback on the selected casacore::MS's
461  // total size, and is updated when that changes.
463 
464 
465  // Reset casacore::Block of relevant Spectral window IDs, and return
466  // correponding Vectors of channel frequencies. freq_ is used for display
467  // of frequencies in position tracking. spwId_ translates spw 'index'
468  // into the actual spectral window ID.
469  void resetFreq_() {
470  for(casacore::uInt s=0; s<freq_.nelements(); s++) {
471  delete static_cast<casacore::Vector<casacore::Double>*>(freq_[s]);
472  }
473  freq_.resize(0, true);
474  spwId_.resize(0, true);
475  }
476 
477  // Translate actual spectral window ID into the 'spw' index (zero-based
478  // pixel coordinate) along the spectral window axis. Because the
479  // user can select specific spectral windows, these two may not be the same.
480  // Returns -1 if the spectral window ID is not in the selected casacore::MS data.
483  for(casacore::Int spw=0; spw<nspw; spw++) if(spwId_[spw]==spwid) return spw;
484  return -1;
485  }
486 
487  // Compute vis_ array dimensions which fit into allowed memory.
488  // visShpA is the actual shape to be allocated to vis_; visShp is the
489  // portion which will actually be used at present; it may be smaller on the
490  // BASELN axis if baselines are currently sorted by length (no 'gaps').
492 
493  // Return how many of the given (sorted) animation frames
494  // can be displayed from a given window (strtfrm, nfrms) on that axis.
495  // In cases where nframes>0, margin will be the minimum padding on either
496  // side, from the edges of the interval to the frames of interest.
498 
499  // Return the maximum number of the given (sorted) animation frames that
500  // can be displayed from a window or interval of a given size (nfrms).
501  // also returns where that interval should start (strtfrm).
503 
504  // Reset data scaling DParameters to newly-computed data ranges.
505  void resetMinMax_();
506 
507 
508  // represent channels with their frequency?
509  bool freqAxis( Axis ) const;
510 
511  //#------flagging routines----------------------------------------------
512 
513  // Return or set a flag within the bitmapped flags_ vector, as if it were
514  // a 5-axis casacore::Array<casacore::Bool> corresponding in dimensions to vis_.
515  // (Note: flags_ is an internal array corresponding to the current state of
516  // flags in the casacore::MS, but these routines in themselves do not read or write
517  // any flags to disk).
518  // <group>
521  // </group>
522 
523  // Add the edit request that just came in (from the mouse, via handleEvent)
524  // to the flagEdits_ casacore::List, then cause the display to be updated.
525  void addEdit_(WorldCanvas* wc, casacore::Int xStart, casacore::Int xShape,
526  casacore::Int yStart, casacore::Int yShape);
527 
528  // Assure that the display matrices are up-to-date with the flagging edits
529  // list, to provide visual feedback of the edits.
530  void postEditsToDisp_();
531 
532  // Undo unsaved edits. Return value indicates whether there were any
533  // edits to undo. extent=="all" means undo all, else just the last one.
534  // If feedback==true, a warning message will be printed about discarded
535  // edits.
536  casacore::Bool undoEdits_(casacore::String extent="all", casacore::Bool feedback=false);
537 
538  // Save all edits permanently to the MS. The return value indicates
539  // whether there were any edits to save.
541 
542 
543  //#------visibility deviation (difference, RMS) routines----------------
544 
545  // compute the lsTime_ and leTime_ vectors, which define the
546  // 'local neighborhoods' around each given time slot, for
547  // computing running averages.
548  void computeTimeBoxcars_();
549 
550  // Return a single visibility point from vis_ or disp_, as a function
551  // of time slot only. The row of times and mode must be predetermined by
552  // setting useVis_, dPos_, axlTm_ and flgdDev_ (below). goodData_ is set
553  // true by this routine if the data exists, is loaded and is not flagged
554  // (false otherwise).
556 
557  // Phase deviations are calculated both for the original phases
558  // (in [-180,180]), and for the phases 180 degrees opposite
559  // (also expressed within [-180,180]); the minimum result is displayed.
560  // This is so that phases clustered around +-180 do not show
561  // artificially high deviations. (remainder(x,360) (from math.h)
562  // is always in [-180,180] -- wierd, but usable for this purpose).
564  return remainder(v-180., 360.);
565  }
566 
567  // Return the visibility deviation for the time slot t. visDev_
568  // determines whether this is an RMS deviation or absolute
569  // difference from the running mean. Maintains state from the
570  // prior calculation to speed things up in some cases. Must be
571  // initialized as for v_() above, and sT_ set to -1, at the
572  // beginning of a new row of times.
574 
575  // Calculate deviations throughout range of vis_. Used to set
576  // data scaling sliders when visibility deviations are to be displayed.
577  void computeDevRange_();
578 
579  // Create dispDev_ casacore::Matrix for displaying deviations. Both this
580  // routine and the one above initialize and use dev_() to calculate
581  // individual deviations.
582  void createDevSlice_();
583 
584 
585 
586 
587 //=================== casacore::Data ======================= (mostly) ========
588 
589 
590 
591  //------Main enums (and their conversions to strings)-------------------
592 
593  // (or, rather, they _used_ to be enums, until the compiler started
594  // whining and moaning about their use as Ints, casacore::Vector/casacore::Array/Block
595  // indices, etc. (Strong typing: grrr...)
596 
597  static const casacore::Int INVALID; // (==-1) (fairly general purpose).
598 
599  // The visibility hypercube (vis_) has 5 axes, in this order.
600  static const Axis TIME=0, BASELN=1, CHAN=2, POL=3, SP_W=4,
602 
603  // Each axis can placed on the canvas display (X or Y), the animator (Z),
604  // or on one of 2 auxiliary slider controls (SL0, SL1)
606  static const AxisLoc X=0, Y=1, Z=2, SL0=3, SL1=4, NLOCS=5;
607 
612  RESIDUAL=3, // RATIO=4,
614 
616  static const VisComp AMPLITUDE=0, PHASE=1, REAL=2, IMAGINARY=3,
617  NCOMPS=4, // # of actual components (above)
619  NCOMPNAMES=8, // Number of choices in the
620  // GUI choice box (itsVisComp). itsVisComp is split into visComp_
621  // (which must be one of the first four values above) and visDev_.
622  // (see visDev_ below, and also setOptions()).
624 
626  static const VisDev NORMAL=0, DIFF=1, RMS=2, INVALID_VD=-1;
627 
628  // Generic string-to-index converter...
630  for(casacore::uInt i=0; i<names.nelements(); i++) if(names(i)==name) return i;
631  return -1;
632  }
633 
634  // ...applied to 3 of the 'enums' used internally.
635  // <group>
636  Axis axisNum_(const casacore::String& axisName) const {
637  return Axis(ind_(axisName, axisName_));
638  }
639 
640  VisType visTypeNum_(const casacore::String& visTypeName) const {
641  return VisType(ind_(visTypeName, visTypeName_));
642  }
643 
644  VisComp visCompNum_(const casacore::String& visCompName) const {
645  return VisComp(ind_(visCompName, visCompName_));
646  }
647  // </group>
648 
649 
650 //-----more constants and statics ----------------------------------------
651 
652  // These should be static const, but there's no way to initialize them.
653  // Print strings, corresponding to Axis, VisType and VisComp enums above.
657 
658  static const casacore::Float NO_DATA; // Arbitrary value commandeered
659  // to stand for 'no data in the selected casacore::MS at this position in
660  // the visibility cube'. vis_ is initialized to this value before
661  // data is extracted into it from the selected MS. After extract_,
662  // elements left with this value will be masked out during display.
664  // Very similar, but used only in the disp_ array, for data
665  // which is not loaded into memory (vis_) at present.
667  // Also similar. Returned by dev_() when there are less than 2
668  // values in the local neighborhood from which to compute a
669  // meaningful deviation, or if the data is flagged.
670 
671  // NB: The values above are large negative numbers which will not
672  // correspond to legitimate data values in the data arrays
673  // where they appear. The dispFlags_ overlay matrix uses different
674  // values (NODATA, NOTLOAED, below) to indicate these same two
675  // conditions--small enum-like sequential integers which can be mapped to
676  // definite colors easily.
677 
678  // dispFlags_ and the flagCM_ custom colormap use the following coding:
679 
680  static const casacore::Float NOTLOADED, // not in vis_ memory buffer (grey)
681  NODATA, // no data in the casacore::MS selection (black)
682  OLDFLAG, // old flag, from the casacore::MS file (medium blue)
683  NEWFLAG; // newly edited, unsaved flag (lighter blue)
684  static const casacore::Int NCOLORS=4; // number of colors above.
685 
686  //-----primary user input data-------------------------------------------
687 
688  // Passed in through constructors and setOpts parameters.
689 
690  casacore::String msName_; // casacore::MS filename.
691 
692  // User option DisplayParameters specific to MSAsRaster
693 
694 
695  // Maximum memory to use for vis_ buffer.
697 
698  // Which axes will be on X, Y, Animator. Chosen from
699  // time, baseline, channel, polarization and spectral window.
703 
704  // Which slice to display, for the other two axes.
705  // The _label_ of the sliders (and the axes they control) vary.
706  // They control the slice position of the axes not selected above.
707  // Animator position is determined externally by WCH restriction 'zIndex'.
710 
711  // Baseline sort (antenna1-antenna2 vs. baseline length).
713 
714  // Sent to scale handler for scaling data to color within these limits.
717 
718  // Axis Labelling? (Yes/No).
720  // Units of display for Channels
722 
723  // changes to these options require data extraction:
724 
725  //# // the casacore::MS selections record:
726  //# DParameterRecord (or DParameterMSSelect) *itsSelections;
727 
728  // Observed, Corrected, Model, etc.
730 
731  //Which real visibiliy component to display: Real, Imag, Amp, Phase.
733 
734  // how many values to use (ideally) in moving averages.
736 
737 
738  //----derived from above: what is now requested-----------------------
739 
740  casacore::Vector<casacore::Int> axisOn_; // the axis on each location. This will be any
741  // permutation of (TIME, BASELN, CHAN, POL, SP_W), corresponding to the
742  // axis to display or control on X, Y, Z, SL0, and SL1, in that order.
743 
744  casacore::Block<casacore::Int> pos_; // The position setting on the animator and sliders.
745  // Zero-based (although the user sees 1-based values).
746  // pos_ is indexed by Axis (TIME, BASELN, etc). For axes being
747  // displayed, the position is not immediately relevant, but serves
748  // as a memory of the last setting and is restored to a slice control
749  // whenever the axis moves off the display. Corresponds somewhat to
750  // itsFixedPosition in PrincipalAxesDD.
751 
752  VisType visType_; // enums corresp. to strings in itsVisType/Comp
753  VisComp visComp_; // and in sync with them.
754  VisDev visDev_; // (12/02) itsVisComp now maps into _two_ 'enums':
755  // visComp_ and visDev_.
756  // visComp_ is _only_ AMP, PHASE, REAL or IMAGINARY
757  // (above is what is stored in large vis_ casacore::Array)
758  // and visDev_ tells whether to display the
759  // straight vis component (NORMAL), a difference
760  // from a running average (DIFF) or a running
761  // RMS (RMS).
762 
763  casacore::Int nDAvg_; // RMS/Diff average value in itsNAvg (above).
764  casacore::Int nPAvg_; // number of planes to average
765 
766  casacore::Vector<casacore::Int> fieldIds_; // user-selected field IDs and
767  casacore::Vector<casacore::Int> spwIds_; // spectral window IDs (0-based).
768 
769 
770  //----current state of main internal data: what is already computed----
771 
772  // (These are set (successively) in initMSAR_, selectVS_, findRanges_,
773  // extract_, createDisplaySlice_, and createDevSlice_).
774 
775 
776  // The original, unselected MS
777 
778  casacore::MeasurementSet *itsMS; // The (unselected) casacore::MS to be displayed.
779  VisibilityIterator* vs_; // VisSet of (unselected) itsMS
780  casacore::Bool msValid_; // valid, writable, non-null (unselected) casacore::MS?
781  // (should be set true (permanently) during
782  // construction, or this object will be useless,
783  // and do nothing).
784  casacore::ROMSColumns* msCols_; // utility object for (unselected) itsMS.
785  casacore::Int nFieldIds_; // Total number of fields, spectral windows,
786  casacore::Int nSpwIds_; // in the (unselected) MS.
787  casacore::Vector<casacore::Int> nChan_; // Number of channels, by Spectral window ID.
788  casacore::Matrix<casacore::Double> chanFreq_; // frequency mapping of channels, per Spectral window ID
789  casacore::Bool dish_; // true if the casacore::MS is 'single-dish' (has FLOAT_DATA,
790  // which will then be used instead of the DATA column).
791 
792 
793  // The selected MS.
794 
795  casacore::MS* mssel_; // the selected casacore::MS and its VisSet--kept in sync
796  VisibilityIterator* wvi_p; // with user input (itsMS, fieldIds_, spwIds_).
797  casacore::Bool msselValid_; // mssel_ and vssel_ are valid and non-null. We will
798  // not draw until this is set true (in selectVS_).
799 
800  casacore::Int nAnt_; // # rows in antenna table (for now). Later: size
801  // of the set of antennas appearing in mssel_
802  // main data rows.
803  // NB: nAnt_==1 is tested, rather than dish_ (which
804  // should be equivalent), to determine whether feeds
805  // are displayed instead of baselines.
806 
807  casacore::Block<casacore::Int> msShape_; // shape of visibilites of the whole selected MS
808  // = {nTime, nBsln, nChan, nPol, nSpw}.
809  // msShape_[BASELN] reflects the size requirement for
810  // the baseline sort in use (see antSort_, below).
811  casacore::Block<casacore::Int> msShapeA_; // Identical to msShape_, except possibly on BASELN
812  // axis when baselines are sorted by length
813  // (antSort==false). In that case, msShapeA_[BASELN]
814  // is the number of baseline slots that _would_ be
815  // required if the antenna sort were used, including
816  // 1-element 'gaps' where antenna1 changes.
817  // msShape_[BASELN] is the number of actual baselines
818  // needed; the gaps are not needed when displaying the
819  // sort by baseline length. However, when able to fit
820  // into memory, vis_ is sized according to the larger
821  // msShapeA_[BASELN] in any case, so that switching
822  // between sorts does not require resizing or
823  // reloading vis_, but only reshuffling of the
824  // baseline planes in memory.
825 
826  casacore::Bool antSort_; // true (the default) means baselines are (to be)
827  // sorted by antenna1-antenna2. false means sorting
828  // by (unprojected, uvw) baseline length.
829 
830  casacore::Matrix<casacore::Double> bLen_; // (Unprojected) baseline lengths, indexed by antenna
831  // numbers (symmetric, 0 along diagonal). Used to
832  // order baselines by length on request.
833 
834  casacore::Vector<casacore::Int> a1_, a2_, // These Arrays provide quick conversions between
835  a1A_, a2A_, // (antenna1,antenna2) and baseline index. Of course
836  a1L_, a2L_, // arguments ( a1_(bsl), a2_(bsl), bsl_(a1, a2) )
837  len2ant_, ant2len_; // must be Ints within range; their values are
838  casacore::Matrix<casacore::Int> bsl_, // according to the _current_ baseline sort
839  bslA_, bslL_; // (antSort_). (In contrast, methods a1a2_() and
840  casacore::Int nbsl_, // bsln_() may take casacore::Float arguments, but convert
841  nbslA_, nbslL_; // _only_ according to the Antenna1-Antenna2 sort).
842  // The A and L versions are for antenna and length
843  // sorts, respectively; they are copied into a1_, a2_,
844  // and bsl_ in accordance with the current sort.
845  // len2ant_ and ant2len_ provide conversion between
846  // baseline indices for the two sorts. nbsl* give
847  // the number of baselines for the applicable case
848  // (if sgl dish, they will be 1, but irrelevant;
849  // msShape_[BASELN] will be set to number of feeds
850  // instead).
851 
852 
853  casacore::Vector<casacore::Double> time_; // sorted vector of actual times in mssel_
854  // only first msShape_[TIME] ( <= time_.shape() )
855  // are valid.
856  casacore::Vector<casacore::Int> field_; // vector for field ids corresponding to time slots;
857  // indexed as time_ is, above. For now, field id
858  // is assumed to be unique for a given time. Used
859  // to avoid computing running averages across
860  // field boundaries.
861  casacore::Vector<casacore::Int> scan_; // same as above, for scan numbers.
862  casacore::Vector<casacore::String> fieldName_; // Names corresponding to field_ above.
863 
864  casacore::Block<casacore::Int> spwId_; // Spectral window index-to-ID translation.
865  // The user can select the spectral windows to
866  // view. This casacore::Block holds the (sorted) spectral
867  // windows actually found in the selected casacore::MS--usually
868  // it will be identical to the user selection (spwIds_,
869  // above). Its length is the size of the Spectral
870  // Window axis (msShape_[SP_W]).
871  // Note that throughout the code, the variable 'spw'
872  // refers to the _index_ into this block, not the
873  // Spectral window ID itself. Actual IDs will have
874  // 'Id' in the variable name.
875  casacore::Block<void*> freq_; // *freq_[spw] is really a casacore::Vector<casacore::Double>.
876  // (*freq_[spw])[chan] holds the CHAN_FREQ for
877  // the given spw index and channel (in Hz).
878 
879  // The following translate pol ID and the polarization index within a cell
880  // of data in the casacore::MS, to the 'pol' index within the internal visibility
881  // cube. There is no 'polID axis' separate from the pol axis internally or
882  // for the display; it is flattened to a single pol axis, using these
883  // tables. They are set up in findRanges_.
884  casacore::Int nPolIds_; // Number of rows in the POLARIZATION subtable
885  // (and the size of the next two vectors).
886  casacore::Vector<casacore::Int> nPolsIn_; // number of correlations in each polId.
887  casacore::Vector<casacore::Int> pidBase_; // difference between a visibility's 'pol' index
888  // within msShape_[POL] and its index within
889  // the casacore::MS table's visibility data cell, for given
890  // polId (or -1, if the polID is not in the
891  // selected data).
892  // The following 2 vectors will have sizes = msShape_[POL], and
893  // are indexed according to the internal polarization 'data pixel
894  // number' (generally referred to as 'pol').
895  casacore::Vector<casacore::Int> polId_; // polarizationId for given pol.
897 
898 
899  // The visibility hypercube.
900 
901  casacore::Array<casacore::Float> vis_; // the (large) memory buffer: 5-axis hypercube of
902  // gridded casacore::MS visibilities (for t, bsl, chan, pol, spw, in that
903  // order). Conceptually, this is a (contiguous, hyper-rectangular)
904  // 'window' or 'cursor' into the whole gridded ms as characterized
905  // by msShape_ above. It _will_ be the whole thing, if it fits
906  // into memory; in any case, the two display axes will be full size.
907  casacore::Bool visValid_; // Is vis_ valid for current selected casacore::MS?
908  casacore::Block<casacore::Int> visShape_; // shape of extracted vis_ casacore::Array (used*) and
909  casacore::Block<casacore::Int> visStart_; // start of extracted vis_ casacore::Array, within msShape_
910 
911  casacore::Block<casacore::Int> visShapeA_; // *Identical to visShape_ except possibly on the
912  // BASELN axis, and then only when computeVisShape_()
913  // determines that the entire msShapeA_[BASELN]
914  // will fit into memory, and the length sort
915  // is also in effect. In that case,
916  // visShapeA_[BASELN] == msShapeA_[BASELN] and
917  // visShape_[BASELN] == msShape_[BASELN] (which is
918  // msShapeA_[BASELN] - (nAnt_-1) ).
919  // vis_ is actually sized according to visShapeA_.
920 
922  VisComp curVisComp_; // type and component of current vis_.
923 
924  casacore::Float dataRngMin_, dataRngMax_; // The 'data ranges' for vis_.
925  // Used (only) for scaling data values to colors; they are
926  // too expensive to compute except during extract_().
927  // Not the actual min/max of the data in general, since they
928  // may be sampled and/or clipped to 3-sigma limits.
929  casacore::Float devRngMin_, devRngMax_; // same thing, for the case when
930  // visibility deviations are being displayed. Both types
931  // of ranges are kept, in case the user switches from one
932  // type ot display to the other. devRngMin_ is set to
933  // NO_DATA if these haven't been computed yet.
934  // computeDevRange_() is called from extract_ or
935  // setOptions to compute these when needed.
936 
937 
938  // The display matrices which are drawn on the canvas.
939 
940  casacore::Matrix<casacore::Float> disp_; // casacore::Matrix of data values actually passed to the
941  // display canvas.
942  Axis dispX_, dispY_; // displayed axes that disp_ represents.
943  casacore::Block<casacore::Int> dispPos_; // non-display axis ('slice') positions disp_
944  // represents, by Axis. Settings for display axes,
945  // (i.e. dispPos_[dispX_] and dispPos_[dispY_]),
946  // are irrelevant).
947  casacore::Bool dispValid_; // Has disp_ been created since extract_ was
948  // called?
949  casacore::Bool dispNotLoaded_; // Is the entire disp_ casacore::Matrix set to the
950  // NOT_LOADED value?
951 
952  casacore::Matrix<casacore::Float> dispDev_; // Similar to disp_, but for visibility deviation
953  // data displays. (Filled by createDevSlice_()).
954  casacore::Bool dispDevValid_; // Is dispDev_ valid for current disp_ and
955  // (if necessary) the state of flag edits?
956  VisDev dispDevType_; // Type of deviation (RMS or DIFF) that dispDev_
957  // represents.
958  casacore::Int dispDevNAvg_; // Nominal number of values in running averages
959  // in effect when dispDev_ was last computed.
960 
961 
962 
963 
964  //---------------additional control state----------------------------------
965  // ...for communication of control logic between various methods (mainly
966  // setOptions, draw_ and extract_)
967 
968  casacore::Bool visDataChg_; // means that casacore::MS selection, visType_ or visComp_
969  // do not reflect current state of vis_. Set by
970  // setOptions. Indicates to extract_ that it should
971  // completely recalculate data ranges (and set
972  // the actual dataMin/Max_ sent to the scale handler
973  // accordingly). setOptions also uses it to help
974  // determine whether it should call extract_.
975 
976  casacore::Bool postDataRng_; // A kind of reply to the above; set true after
977  // extract_ has recalculated data ranges from
978  // scratch (as opposed to merely expanding them).
979  // When true, setOptions will return these new
980  // ranges unaltered to the gui, via recOut.
981 
982 
983  //----translation between casacore::MS values and internal hypercube indices---------
984 
985  struct MSpos_;
986  friend struct MSpos_;
987  struct MSpos_ {
988 
989  // An MSpos_ holds information about a given position of interest within
990  // the main casacore::MS visibility Table. Its data members are the values at
991  // that position as actually stored in the casacore::MS (times, antennas, etc.);
992  // these can be freely set and queried by MSAsRaster, the only user of
993  // this struct. It provides translation between these values and the
994  // hypercube indices (pos_) used internally. It was time to quit
995  // performing these translations ad hoc and consolidate them here (3/04).
996  // (Still to do: use this instead of old ad hoc methods in, e.g.,
997  // showPosition()).
998 
999  // When casacore::MS selection changes, MSAsRaster::findRanges_() computes several
1000  // tables (time_, spwId_, freq_, polId_, nAnt_, etc.) which [re-]define
1001  // the correspondence of casacore::MS data to hypercube positions. An MSpos_
1002  // set up prior to this change can be queried afterward as to the data's
1003  // position (if any) in the new hypercube. It is also useful in
1004  // determining whether flagging edits (which are stored in terms of
1005  // hypercube positions) apply to casacore::MS data beyond what is currently
1006  // selected.
1007 
1008  // Below is the real content of an MSpos_: data for a position within
1009  // an casacore::MS in terms of the values actually stored there.
1010  // Note that, in its current version, MSAsRaster assumes that this
1011  // data uniquely determines a visibility-and-flag within the casacore::MS (and
1012  // feed is not considered either, when there is more than one antenna).
1013 
1017 
1018  // IMO, a _nested_ struct/class should have visibility (and access
1019  // permission(?)) into the nesting class, but it doesn't (except, rather
1020  // oddly, for the static consts of MSAsRaster: TIME, NAXES, etc.,
1021  // which are directly in scope and accessible here). Hence the
1022  // need to have a pointer to the nesting object and for it to declare
1023  // this class a friend. The nesting class's 'this' should be
1024  // available implicitly to this class instead. As is, it's
1025  // rather clumsy to implement classes/structs that are purely in support
1026  // of another class....
1027 
1028  const MSAsRaster* m; // parent dd, needed for access to the
1029  // MSAsRaster tables which it set up in
1030  // findRanges_: nAnt_, time_, spwId_, freq_,
1031  // polId_, etc.
1032 
1033  casacore::Int ts, te; // Ancillary output of t() (in terms of hypercube
1034  // time-slot indices). When t() returns INVALID (time
1035  // not found) they are the bracketing time slots, i.e.
1036  // ts+1==te and (where ts or te are in timeslot range)
1037  // time_[ts] < time < time_[te].
1038 
1039 
1040  // Construct MSpos_ with no valid values set (yet).
1041 
1042  MSpos_(const MSAsRaster* msar):
1044  spwId(INVALID), polId(INVALID), chan(INVALID), polName("Invalid"),
1045  m(msar), ts(INVALID), te(INVALID) { }
1046 
1047 
1048  // Construct MSpos_ according to 5-element casacore::Block corresponding to a
1049  // position within the internal hypercube.
1050 
1051  MSpos_(const MSAsRaster* msar, const casacore::Block<casacore::Int>& pos): m(msar) {
1052  set(pos);
1053  }
1054 
1055 
1056  // Translation methods (for times, baselines, channels,
1057  // spectral windows, and polarizations). All but the last seven
1058  // set MSpos_ state to the appropriate values as stored in the MS.
1059 
1060  // hypercube indices to casacore::MS values
1061 
1063  sett(pos[TIME]);
1064  setb(pos[BASELN]);
1065  sets(pos[SP_W]);
1066  setc(pos[CHAN]);
1067  setp(pos[POL]);
1068  }
1069 
1070  void sett(casacore::Int t);
1071  void setb(casacore::Int b);
1072  void sets(casacore::Int s);
1073  void setc(casacore::Int c);
1074  void setp(casacore::Int p);
1075 
1076  // casacore::MS values to hypercube indices.
1077 
1079  time=tm;
1080  return t();
1081  }
1083  ant1=a1;
1084  ant2=a2;
1085  feed=INVALID;
1086  return b();
1087  }
1089  feed=fd;
1090  ant1=ant2=INVALID;
1091  return b();
1092  }
1094  spwId=sid;
1095  return s();
1096  }
1098  chan=ch;
1099  return c();
1100  }
1102  spwId=sid;
1103  chan=ch;
1104  return c();
1105  }
1107  polId=pid;
1108  polName=pnm;
1109  return p();
1110  }
1112  polId=pid;
1113  return p0();
1114  }
1115 
1117  if(polId<0 || polId>=casacore::Int(m->pidBase_.nelements())) return INVALID;
1118  return m->pidBase_[polId];
1119  }
1120 
1122  switch(ax) {
1123  case TIME:
1124  return t();
1125  case BASELN:
1126  return b();
1127  case SP_W:
1128  return s();
1129  case CHAN:
1130  return c();
1131  case POL:
1132  return p();
1133  default:
1134  return INVALID;
1135  }
1136  }
1137 
1138  casacore::Int t();
1139  casacore::Int b();
1140  casacore::Int s();
1141  casacore::Int c();
1142  casacore::Int p();
1143  };
1144 
1145 
1146 
1147  MSpos_ mspos_; // used by findRanges_() to maintain the casacore::MS 'slice'
1148  // position being viewed as much as possible when
1149  // casacore::MS selection is changed--e.g., to remain on the
1150  // same time (if it is still in the selected casacore::MS),
1151  // even though its time-slot index (slice position)
1152  // may have changed.
1153 
1154 
1155  //----flagging state-------------------------------------------------------
1156 
1158  casacore::Bool flagsInClr_; // equivalent to itsFlagColor->value()=="In Color"
1159 
1161  casacore::Bool unflag_; // equivalent to itsUnflag->value()=="Unflag"
1162 
1163  casacore::Block<casacore::Bool> flagAll_; // from UI checkboxes for each axis (there is
1164  // no checkbox-type DParameter yet)..
1165 
1167  // choice box for applying edits to entire antenna.
1168  casacore::Bool entireAnt_; // equivalent to itsEntireAnt->value()=="Yes"
1169 
1171  // defines the button for undoing one edit.
1173  // defines the button for undoing all edits.
1175  // choice box for using entire casacore::MS (vs. selected
1176  // casacore::MS only) when saving edits.
1178  // defines the button for saving all edits.
1179 
1180  casacore::Vector<casacore::uInt> flags_; // Bitmapped storage for flags retrieved
1181  // from the casacore::MS (only); not for new, unsaved flags.
1182  // Virtually, this has the same shape as vis_.
1183 
1184  casacore::Matrix<casacore::Bool> dispMask_; // Mask for disp_ or dispFlags_. Distinguishes
1185  // good data from flagged/missing data. Which
1186  // is true and which false depends on flagsInClr_.
1187  casacore::Matrix<casacore::Float> dispFlags_; // For the (slower) 'color flags' option, this
1188  // will overlay the main data array to show
1189  // flags in color.
1190  casacore::Bool dispFlagsInClr_; // Are the current display matrices set up to
1191  // draw flags in color?
1192  casacore::uInt dispNEdits_; // Number of flag edits already reflected
1193  // in display matrices and masks.
1194 
1195 
1196 
1197  // FlagEdit_ holds information about a single
1198  // (new, unsaved) flagging edit command.
1199 
1200  struct FlagEdit_;
1201  friend struct FlagEdit_;
1202  struct FlagEdit_ {
1203 
1204 
1205  MSAsRaster* msar; // parent dd, needed for access to its members.
1206 
1207  // All 3 of these Blocks are indexed by Axis, and have NAXES elements.
1208  casacore::Block<casacore::Bool> all; // all[axis]==T: apply edit to entire axis.
1209  casacore::Block<casacore::Int> start; // all[axis]==F: apply edit from start[axis] up to
1210  casacore::Block<casacore::Int> shape; // (but not including) start[axis]+shape[axis].
1211 
1212  // Note that all[axis] will imply start[axis]==0 &&
1213  // shape[axis]==msShape_[axis], but _not vice-versa_.
1214  // all[axis] has the _additional_ meaning that the
1215  // edit should extend beyond hypercube (selected
1216  // casacore::MS) boundaries, to the _entire_ casacore::MS, when saving
1217  // flags (if itsEditEntireMS is turned on).
1218 
1219 
1220  casacore::Bool unflag; // T=unflag F=flag
1221 
1222  casacore::Bool entireAnt; // T=apply to all baselines with Antenna1 of selection.
1223 
1224  // The following are set by appliesToChunk(spw, nChan, pol0, nPol) at
1225  // the beginning of each chunk, within saveEdits_().
1226  // A given chunk has a fixed polId and spwId, which imply a given
1227  // shape (nPol, nChan) of visibilities and flags as actually stored in
1228  // the MS.
1229 
1230  casacore::Bool appChunk; // Does the edit apply to the spectral window and
1231  // at least some of the pols and channels implied by
1232  // the chunk's data description ID?
1233  casacore::Int sPol,ePol, sChan,eChan; // If appChunk is true, (and the
1234  // edit applies to the row's time and baseline -- tested
1235  // elsewhere), then the visibilities in the casacore::MS row where
1236  // the edit applies have pol and channel index ranges
1237  // [sPol,ePol) and [sChan,eChan). (Note that these are
1238  // _different_ index ranges from those determined by
1239  // start & shape, above, which are relative to the
1240  // _internal hypercube_ shape, msShape_).
1241 
1242  FlagEdit_(MSAsRaster* m): // constructor.
1243  msar(m),
1244  all(NAXES, false), start(NAXES), shape(NAXES, 1),
1245  unflag(false), entireAnt(false),
1246  appChunk(false), sPol(0),ePol(0), sChan(0),eChan(0) { }
1247 
1248  // Return the range (half-open interval) over which the edit definitely
1249  // applies*, on the given axis. This is the range selected with the
1250  // mouse or (when edit.all[ax]==true) the entire axis range.
1251  //
1252  // * Exception: when antenna-based editing is on (entireAnt==true),
1253  // baselines of only one antenna will be edited regardless -- see
1254  // appliesTo(casacore::Int bsln). The interval returned is still as stated
1255  // above, however).
1257  strt=start[ax];
1258  fin=strt+shape[ax];
1259  }
1260 
1261  // Is the given position within the range above, on the given axis?
1263  return start[ax]<=pos && pos<start[ax]+shape[ax];
1264  }
1265 
1266  // Retrieve ranges for loops. Same as getSureRange(), except for
1267  // antenna-based baseline testing, when the entire baseline range
1268  // of the selected casacore::MS is returned. In that case, applicability
1269  // of the edit to the individual baselines must still be tested
1270  // within the loop, with edit.appliesTo(bsln).
1272  if(entireAnt && ax==BASELN) {
1273  strt=0;
1274  fin=msar->msShape_[ax];
1275  } else getSureRange(ax, strt,fin);
1276  }
1277 
1278  // Is the given position in the 'loop range' on the given axis?
1280  casacore::Int strt, fin;
1281  getLoopRange(ax, strt,fin);
1282  return (strt<=pos && pos<fin);
1283  }
1284 
1285  // Does edit apply to given hypercube position (relative to
1286  // entire casacore::MS)? (pos must be NAXES in size).
1288  for(Axis ax=0; ax<NAXES; ax++) if(!appliesTo(ax, pos(ax))) return false;
1289  return true;
1290  }
1291 
1292  // Does edit apply to given position on given axis?
1294  return inLoopRange(ax, pos) && applies2(ax, pos);
1295  }
1296 
1297  // Same as above, but for use (only) where inLoopRange(ax, pos)
1298  // is already known to be true. This one is used within loops,
1299  // for efficiency.
1301  return ax!=BASELN || !entireAnt || appliesTo(pos);
1302  }
1303 
1304  // Does edit apply to the given baseline? (Also for use only where
1305  // inLoopRange(BASELN, bsln) is already known to be true). This is
1306  // used mainly for testing baselines against antenna-based edits.
1308 
1309  // Does the edit apply to the current casacore::MS iteration chunk?
1311 
1312  // Does the edit apply to a given (raw) time?
1314 
1316  };
1317 
1318 
1319 
1320 
1321  std::list<void*> flagEdits_; // casacore::List of all the (so-far-unsaved) edits.
1322  // (<void*> rather than <FlagEdit_*> just to avoid the extra templates)
1323 
1324 
1325  //---state for computing [RMS] deviation from local visibility average---
1326  // (Not very object-oriented--more like Fortran common. Sorry, pressed
1327  // for time. To be reworked into object(s) sometime, if it can be
1328  // done efficiently).
1329 
1331  // Beginning and (1 beyond) ending time index defining the 'boxcar'
1332  // or local neighborhood over which averages are computed, for given
1333  // time slot. (Note that, for now, these are assumed to be only a
1334  // function of time. Later, these may become Matrices, indexed
1335  // also by casacore::Array ID or baseline). Recomputed (computeTimeBoxcars_)
1336  // when nAvg_ changes, and after extract_.
1337  // lsv, lev versions are for vis_, i.e relative to visStart_[TIME],
1338  // and of length visShape_[TIME].
1339 
1344  // Initializing input to dev_(t) and its subsidiary routine v_(t).
1345  // These create something similar to an casacore::ArrayAccessor, in that
1346  // vis_ (or disp_, depending on useVis_) can be accessed by giving
1347  // only the value along the time axis. dPos_ fixes the row of times
1348  // to use within vis_ or disp_; axlTm_ gives the location of the
1349  // time axis within dPos_. The value of the index along that
1350  // axis (only) will be varied as needed, by dev_() and v_().
1351 
1352  // flgdDev_ should usually be set false, causing dev_ simply to
1353  // return INSUF_DATA for flagged points. In one obscure case, it
1354  // is set true to request dev_ to calculate deviations even for
1355  // the flagged points.
1356 
1358  // This really should be a return value from v_(); placed here for
1359  // 'efficiency'. Set after each call to v_(): true iff the data
1360  // existed, was loaded, and was not flagged.
1361 
1366  // Saved state from the last call to dev_(). When moving along
1367  // a time axis, it sometimes saves time to have these previous
1368  // results handy. d_ is the most recently computed deviation.
1369  // sT_ (boxcar start time slot) must be set to -1 when starting to
1370  // compute deviations on a new line of times, indicating that
1371  // none of this 'saved state' is valid yet.
1372 
1373 
1374 
1375 
1376  //----------helper objects and their control data-----------
1377 
1378  // This does data scaling for WorldCanvas
1380 
1381  // This labels the axes. An actual CachingDisplayData itself, contained
1382  // within MSAsRaster and controlled through it. MSAsRaster propagates
1383  // getOptions and setOptions calls and draw commands to it, and sets the
1384  // WC DisplayCoordinateSystem which it uses.
1386 
1387  // A private internal colormap for showing colors for various conditions
1388  // (flagged, no data, data not loaded). This is not the colormap set
1389  // by the user for mapping data values. It has rigid single colors
1390  // for the different conditions.
1392 
1393  private:
1394 
1395  bool adjustAvgRange( VisDev newstate, casacore::Record &outrec, bool force=false );
1396 
1397  };
1398 
1399 
1400 
1401 //#----------MSAsRasterDM----------------------------------------------------
1402 
1403 // <summary>
1404 // (Minimal) DisplayMethod for MSAsRaster.
1405 // </summary>
1406 
1407 // <prerequisite>
1408 // <li> MSAsRaster
1409 // <li> CachingDisplayMethod
1410 // </prerequisite>
1411 
1412 // <etymology>
1413 // "MSAsRasterDM" is a implementation of a <linkto class=CachingDisplayMethod>
1414 // CachingDisplayMethod </linkto> for <linkto class=MSAsRaster>
1415 // MSAsRaster </linkto>.
1416 // </etymology>
1417 
1418 // <synopsis>
1419 // MSAsRasterDM a minimal skeleton; it is implemented
1420 // in its entirety here. Its only purpose is to hold the cached drawlist
1421 // and use it when appropriate via the mechanism and data structure
1422 // implemented on the CachingDisplayMethod level. MSAsRasterDM just
1423 // turns the draw request back over to MSAsRaster, since that's where
1424 // the necessary data is.
1425 
1426 // This 'minimal' CachingDisplayMethod could be adapted and reused by any
1427 // other CachingDisplayData that wanted to do its own drawing.
1428 
1429 // </synopsis>
1430 
1432 
1433  public:
1434 
1435  // Constructor. The parameters contain state that determines
1436  // what should be drawn.
1438  AttributeBuffer *ddAttrs, CachingDisplayData *dd):
1439  CachingDisplayMethod(wc, wchAttrs, ddAttrs, dd) { }
1440 
1441  // Destructor.
1442  virtual ~MSAsRasterDM() { }
1443 
1444  protected:
1445 
1446  // The base CachingDM takes care of using any cached drawlist.
1447  // When this method is called, we know that no drawlist applies,
1448  // and that we must actually send drawing commands to the WC (though
1449  // technically, they might _not_ actually be going into a drawlist).
1450  // This skeleton DM just hands the drawing task back to the DD,
1451  // where all the data has been created and maintained anyway.
1452 
1454  WorldCanvasHolder &wcHolder) {
1455  MSAsRaster *msar = dynamic_cast<MSAsRaster *>(parentDisplayData());
1456  if (!msar) throw(casacore::AipsError("invalid parent of MSAsRasterDM"));
1457 
1458  return msar->draw_(reason, wcHolder, *(worldCanvas()) );
1459  }
1460 
1461 
1462  private:
1463 
1464  // Default and copy constructors, and the assignment operator, are
1465  // mon-functional and should not be used. Do not make copies of
1466  // DisplayMethod objects, or pass them by value;
1467  // use references or pointers instead.
1468  // <group>
1471  MSAsRasterDM& operator=(const MSAsRasterDM &/*other*/) {
1472  return *this;
1473  }
1474  // </group>
1475 
1476  };
1477 
1478 
1479 } //# NAMESPACE CASA - END
1480 
1481 #endif
1482 
void createDisplaySlice_()
retrieve (2D) slice data casacore::Matrix, and corresponding mask/flag matrices, to send to the displ...
casacore::Bool inLoopRange(casacore::Int ax, casacore::Int pos)
Is the given position in the &#39;loop range&#39; on the given axis?
Definition: MSAsRaster.h:1279
casacore::Int Axis
Definition: MSAsRaster.h:132
A Vector of integers, for indexing into Array&lt;T&gt; objects.
Definition: IPosition.h:119
DParameterChoice * itsEditEntireMS
defines the button for undoing all edits.
Definition: MSAsRaster.h:1174
casacore::Vector< casacore::Int > scan_
indexed as time_ is, above.
Definition: MSAsRaster.h:861
casacore::Vector< casacore::uInt > flags_
defines the button for saving all edits.
Definition: MSAsRaster.h:1180
virtual void notifyUnregister(WorldCanvasHolder &wch, casacore::Bool ignoreRefresh=false)
ignoreRefresh tells the DD not to refresh just to clean up DMs
casacore::Int nValid_
Definition: MSAsRaster.h:1364
casacore::Array< casacore::Float > vis_
The visibility hypercube.
Definition: MSAsRaster.h:901
casacore::Double sumva_
Definition: MSAsRaster.h:1363
int Int
Definition: aipstype.h:50
casacore::Bool unflag_
Definition: MSAsRaster.h:1161
casacore::Bool saveEdits_()
Save all edits permanently to the MS.
Implementation of DisplayParameter to package interface to button autoguis.
Class providing active behaviour for 2d CachingDisplayDatas.
bool freqAxis(Axis) const
represent channels with their frequency?
Assistance class for auto-caching of DisplayData objects.
casacore::Double time
An MSpos_ holds information about a given position of interest within the main casacore::MS visibilit...
Definition: MSAsRaster.h:1014
virtual casacore::Bool setActiveZIndex_(casacore::Int zindex)
This routine is called to inform the DD of the current canvas&#39;s animator index.
Definition: MSAsRaster.h:306
static const VisComp AMPRMS
Definition: MSAsRaster.h:618
casacore::Vector< casacore::Int > field_
only first msShape_TIME) are valid.
Definition: MSAsRaster.h:856
static const VisComp IMAGINARY
Definition: MSAsRaster.h:616
casacore::Int sT_
This really should be a return value from v_(); placed here for &#39;efficiency&#39;.
Definition: MSAsRaster.h:1362
Class for displaying data within an casacore::MS as a raster (gridded) image.
Definition: MSAsRaster.h:128
Class which stores WorldCanvas refresh event information.
DParameterChoice * itsYAxis
Definition: MSAsRaster.h:701
void setp(casacore::Int p)
casacore::Vector< casacore::Int > ant2len_
Definition: MSAsRaster.h:834
DParameterButton * itsUndoAll
defines the button for undoing one edit.
Definition: MSAsRaster.h:1172
casacore::Vector< casacore::Int > a1A_
Definition: MSAsRaster.h:834
casacore::Vector< casacore::String > polName_
Definition: MSAsRaster.h:896
size_t nelements() const
How many elements does this array have? Product of all axis lengths.
Definition: ArrayBase.h:99
static const VisComp REAL
Definition: MSAsRaster.h:616
casacore::Vector< casacore::Int > a1L_
Definition: MSAsRaster.h:834
void constructParameters_()
Construct and destroy the user option DisplayParameters.
MSAsRasterDM(WorldCanvas *wc, AttributeBuffer *wchAttrs, AttributeBuffer *ddAttrs, CachingDisplayData *dd)
Constructor.
Definition: MSAsRaster.h:1437
casacore::Bool appliesTo(Axis ax, casacore::Int pos)
Does edit apply to given position on given axis?
Definition: MSAsRaster.h:1293
void resetFreq_()
Reset casacore::Block of relevant Spectral window IDs, and return correponding Vectors of channel fre...
Definition: MSAsRaster.h:469
casacore::Int c(casacore::Int ch)
Definition: MSAsRaster.h:1097
Axis dispX_
display canvas.
Definition: MSAsRaster.h:942
DParameterChoice * itsVisType
changes to these options require data extraction:
Definition: MSAsRaster.h:729
Colormap flagCM_
A private internal colormap for showing colors for various conditions (flagged, no data...
Definition: MSAsRaster.h:1391
casacore::Bool dispFlagsInClr_
will overlay the main data array to show flags in color.
Definition: MSAsRaster.h:1190
std::vector< int > displayAxes() const
Definition: MSAsRaster.h:206
casacore::Bool flgdDev_
Definition: MSAsRaster.h:1343
static const VisDev INVALID_VD
Definition: MSAsRaster.h:626
casacore::Vector< casacore::Int > nPolsIn_
(and the size of the next two vectors).
Definition: MSAsRaster.h:886
casacore::IPosition dPos_
Definition: MSAsRaster.h:1341
DParameterChoice * itsParamSpectralUnit
Units of display for Channels.
Definition: MSAsRaster.h:721
static casacore::Float imag(const casacore::Complex &val)
Definition: MSAsRaster.h:335
static const Axis NAXES
Definition: MSAsRaster.h:601
virtual void setDefaultOptions()
set all options to default values (unused so far; incomplete support in base classes...incomplete here as well).
casacore::Block< casacore::Int > pos_
permutation of (TIME, BASELN, CHAN, POL, SP_W), corresponding to the axis to display or control on X...
Definition: MSAsRaster.h:744
virtual casacore::uInt nelements(const WorldCanvasHolder &) const
Return the number of display elements (ie.
Definition: MSAsRaster.h:226
casacore::Int VisDev
Definition: MSAsRaster.h:625
casacore::Float dev_(casacore::Int t)
Return the visibility deviation for the time slot t.
casacore::Vector< casacore::Int > a2L_
Definition: MSAsRaster.h:834
void reSortVis_()
Shuffle vis_ into new baseline order, per user request for sort change.
DParameterRange< casacore::Int > * itsSL0Pos
Which slice to display, for the other two axes.
Definition: MSAsRaster.h:708
virtual void purgeCache(const WorldCanvasHolder &wch)
Empty cache of all DMs for a given WCH.
Definition: MSAsRaster.h:258
virtual void purgeCache()
Empty cache completely.
Definition: MSAsRaster.h:252
DisplayDataType
WorldCanvasHolder - what type of DisplayData is this, need to know for drawing order.
Definition: DisplayEnums.h:355
DParameterChoice * itsBslnSort
Baseline sort (antenna1-antenna2 vs.
Definition: MSAsRaster.h:712
Buffer for storing Attributes.
std::list< void * > flagEdits_
Definition: MSAsRaster.h:1321
casacore::Int VisComp
Definition: MSAsRaster.h:615
void sett(casacore::Int t)
static const Axis TIME
The visibility hypercube (vis_) has 5 axes, in this order.
Definition: MSAsRaster.h:600
DParameterRange< casacore::Float > * itsDataMin
Sent to scale handler for scaling data to color within these limits.
Definition: MSAsRaster.h:715
DParameterRange< casacore::Float > * itsDataMax
Definition: MSAsRaster.h:716
static const Axis SP_W
Definition: MSAsRaster.h:600
VisComp visCompNum_(const casacore::String &visCompName) const
Definition: MSAsRaster.h:644
casacore::Int nPAvg_
Definition: MSAsRaster.h:764
WorldAxesDD itsAxisLabeller
This labels the axes.
Definition: MSAsRaster.h:1385
static const casacore::Float NODATA
Definition: MSAsRaster.h:680
void resize(size_t n, Bool forceSmaller=False, Bool copyElements=True)
Resizes the Block.
Definition: Block.h:377
casacore::Int nAnt_
not draw until this is set true (in selectVS_).
Definition: MSAsRaster.h:800
DParameterRange< casacore::Int > * itsNAvg
how many values to use (ideally) in moving averages.
Definition: MSAsRaster.h:735
virtual casacore::Bool labelAxes(const WCRefreshEvent &ev)
Handle axis labelling.
void setc(casacore::Int c)
MSAsRaster & operator=(const MSAsRaster &)
Definition: MSAsRaster.h:359
casacore::Matrix< casacore::Float > disp_
visibility deviations are being displayed.
Definition: MSAsRaster.h:940
size_t nelements() const
The number of elements contained in this Block&lt;T&gt;.
Definition: Block.h:611
static const VisDev DIFF
Definition: MSAsRaster.h:626
casacore::Vector< casacore::String > fieldName_
Definition: MSAsRaster.h:862
ABSTRACT TOOL CLASSES A PlotTool is a higher level event handler for a PlotCanvas The idea is to take common tasks which may require multiple events and put them in one place PlotTools also provide additional functionality in that they can be active and blocking non blocking The PlotCanvas will only send events to active and will not send events to later tools or event handlers if the latest tool was blocking In this way a single tool can be used to handle ALL user interaction via the GUI at one time
Definition: PlotTool.h:43
static casacore::Float real(const casacore::Complex &val)
Helper functions.
Definition: MSAsRaster.h:332
virtual void setUIBase(casacore::Int uibase)
Definition: DisplayData.h:692
casacore::Block< casacore::Bool > flagAll_
Definition: MSAsRaster.h:1163
void resetMinMax_()
Reset data scaling DParameters to newly-computed data ranges.
static const AxisLoc SL1
Definition: MSAsRaster.h:606
virtual casacore::Bool drawIntoList(Display::RefreshReason reason, WorldCanvasHolder &wcHolder)
The base CachingDM takes care of using any cached drawlist.
Definition: MSAsRaster.h:1453
casacore::Float dataRngMax_
Definition: MSAsRaster.h:924
casacore::Float vAlt_(casacore::Float v)
Phase deviations are calculated both for the original phases (in [-180,180]), and for the phases 180 ...
Definition: MSAsRaster.h:563
casacore::Bool dispValid_
represents, by Axis.
Definition: MSAsRaster.h:947
std::string errorMessage() const
Definition: MSAsRaster.h:299
casacore::Matrix< casacore::Float > dispDev_
NOT_LOADED value?
Definition: MSAsRaster.h:952
static const VisType NTYPES
Definition: MSAsRaster.h:613
const casacore::IPosition dataShape() const
Definition: MSAsRaster.h:200
void postEditsToDisp_()
Assure that the display matrices are up-to-date with the flagging edits list, to provide visual feedb...
casacore::Matrix< casacore::Float > dispFlags_
good data from flagged/missing data.
Definition: MSAsRaster.h:1187
casacore::Int bsln_(casacore::Int a1, casacore::Int a2) const
Return baseline index (for the ant1-ant2 sort only) from antenna numbers.
Definition: MSAsRaster.h:435
casacore::Vector< casacore::Int > a2A_
Definition: MSAsRaster.h:834
VisDev dispDevType_
(if necessary) the state of flag edits?
Definition: MSAsRaster.h:956
casacore::ImageStatistics< casacore::Float >::stat_list stats_t
Definition: RegionInfo.h:49
VisibilityIterator * vs_
Definition: MSAsRaster.h:779
bool adjustAvgRange(VisDev newstate, casacore::Record &outrec, bool force=false)
casacore::Int spw_(casacore::Int spwid)
Translate actual spectral window ID into the &#39;spw&#39; index (zero-based pixel coordinate) along the spec...
Definition: MSAsRaster.h:481
void computeVisShape_(casacore::Block< casacore::Int > &visShp, casacore::Block< casacore::Int > &visShpA)
Compute vis_ array dimensions which fit into allowed memory.
casacore::Matrix< casacore::Int > bslL_
Definition: MSAsRaster.h:838
casacore::Int nbslL_
Definition: MSAsRaster.h:840
casacore::String msName_
--—primary user input data----------------------------------------—
Definition: MSAsRaster.h:690
static casacore::Int ind_(const casacore::String &name, const casacore::Vector< casacore::String > &names)
Generic string-to-index converter...
Definition: MSAsRaster.h:629
virtual casacore::String showValue(const casacore::Vector< casacore::Double > &world)
casacore::Format the data value at the given world position.
DParameterChoice * itsFlagColor
position being viewed as much as possible when casacore::MS selection is changed–e.g., to remain on the same time (if it is still in the selected casacore::MS), even though its time-slot index (slice position) may have changed.
Definition: MSAsRaster.h:1157
void setFlag_(casacore::IPosition &slot, casacore::Bool flag)
DParameterChoice * itsVisComp
Which real visibiliy component to display: Real, Imag, Amp, Phase.
Definition: MSAsRaster.h:732
static const AxisLoc Y
Definition: MSAsRaster.h:606
casacore::Block< casacore::Int > visStart_
Definition: MSAsRaster.h:909
casacore::Matrix< casacore::Double > chanFreq_
Definition: MSAsRaster.h:788
static const casacore::Float NOT_LOADED
to stand for &#39;no data in the selected casacore::MS at this position in the visibility cube&#39;...
Definition: MSAsRaster.h:663
FlagEdit_(MSAsRaster *m)
edit applies to the row&#39;s time and baseline – tested elsewhere), then the visibilities in the casacor...
Definition: MSAsRaster.h:1242
casacore::String polName
Definition: MSAsRaster.h:1016
casacore::Int VisType
Definition: MSAsRaster.h:608
casacore::String avgPos(const casacore::String &dim, int v)
Constructs position information for non-deviation display state averaging...
casacore::Bool unflag
Note that all[axis] will imply start[axis]==0 &amp;&amp; shape[axis]==msShape_[axis], but not vice-versa...
Definition: MSAsRaster.h:1220
virtual casacore::Bool conformsToCS(const WorldCanvas &wc)
Determine whether DD is compatible with the WC[H]&#39;s current world coordinates.
Definition: MSAsRaster.h:181
casacore::Vector< casacore::String > visCompName_
Definition: MSAsRaster.h:656
const MSAsRaster * m
IMO, a nested struct/class should have visibility (and access permission(?)) into the nesting class...
Definition: MSAsRaster.h:1028
casacore::Int p0()
Definition: MSAsRaster.h:1116
casacore::Vector< casacore::Double > time_
The A and L versions are for antenna and length sorts, respectively; they are copied into a1_...
Definition: MSAsRaster.h:853
casacore::Int sPol
at least some of the pols and channels implied by the chunk&#39;s data description ID?
Definition: MSAsRaster.h:1233
DParameterChoice * itsXAxis
Which axes will be on X, Y, Animator.
Definition: MSAsRaster.h:700
casacore::Bool draw_(Display::RefreshReason reason, WorldCanvasHolder &wch, WorldCanvas &wc)
Actually do the drawing.
DParameterButton * itsUndoOne
Definition: MSAsRaster.h:1170
casacore::Vector< casacore::Int > polId_
within msShape_[POL] and its index within the casacore::MS table&#39;s visibility data cell...
Definition: MSAsRaster.h:895
casacore::Bool isCSmaster(const DisplayData *dd) const
Is the specified DisplayData the one in charge of WC state? (During DD::sizeControl() execution...
Definition: WorldCanvas.h:1062
virtual AttributeBuffer optionsAsAttributes()
Return the current options of this DisplayData as a &#39;restrictions&#39; AttributeBuffer (only options that...
virtual WorldCanvas * worldCanvas()
Return the WorldCanvas recorded in this CachingDisplayMethod.
casacore::Bool msselValid_
Definition: MSAsRaster.h:797
casacore::Double a1mult_()
Subsidiary routine for above, determines (in effect) how many decimal places are needed for an antenn...
Definition: MSAsRaster.h:452
void set(const casacore::Block< casacore::Int > &pos)
Translation methods (for times, baselines, channels, spectral windows, and polarizations).
Definition: MSAsRaster.h:1062
static const VisComp AMPLITUDE
Definition: MSAsRaster.h:616
defines physical units
Definition: Unit.h:189
MSAsRaster(const MSAsRaster &other)
Definition: MSAsRaster.h:358
casacore::Bool appliesTo(casacore::IPosition pos)
Does edit apply to given hypercube position (relative to entire casacore::MS)? (pos must be NAXES in ...
Definition: MSAsRaster.h:1287
casacore::MeasurementSet * itsMS
-—current state of main internal data: what is already computed-—
Definition: MSAsRaster.h:778
MSAsRasterDM & operator=(const MSAsRasterDM &)
Definition: MSAsRaster.h:1471
casacore::Int b(casacore::Int a1, casacore::Int a2)
Definition: MSAsRaster.h:1082
casacore::Float devRngMax_
Definition: MSAsRaster.h:929
casacore::Bool entireAnt_
choice box for applying edits to entire antenna.
Definition: MSAsRaster.h:1168
virtual casacore::Bool zIndexHint(casacore::Int &preferredZIndex) const
Return the animator position setting preferred if this DD about to be registered on a new DisplayPane...
casacore::Bool visValid_
gridded casacore::MS visibilities (for t, bsl, chan, pol, spw, in that order).
Definition: MSAsRaster.h:907
casacore::String visMbLabel_()
A small routine to return the label for the &quot;Visibility Memory&quot; slider widget.
DParameterRange< casacore::Int > * itsSL1Pos
Definition: MSAsRaster.h:709
void setDefaultMSAROptions_()
set/restore default option values on this level only.
MSpos_(const MSAsRaster *msar)
time-slot indices).
Definition: MSAsRaster.h:1042
static const casacore::Float NEWFLAG
Definition: MSAsRaster.h:680
VisComp visComp_
Definition: MSAsRaster.h:753
casacore::uInt dataDim() const
Definition: MSAsRaster.h:203
casacore::Vector< casacore::Int > a1_
numbers (symmetric, 0 along diagonal).
Definition: MSAsRaster.h:834
casacore::Bool undoEdits_(casacore::String extent="all", casacore::Bool feedback=false)
Undo unsaved edits.
casacore::Bool visDataChg_
in effect when dispDev_ was last computed.
Definition: MSAsRaster.h:968
casacore::Int maxframes_(const casacore::Block< casacore::Int > &frames, casacore::Int &strtfrm, casacore::Int nfrms)
Return the maximum number of the given (sorted) animation frames that can be displayed from a window ...
casacore::Bool flagsInClr_
Definition: MSAsRaster.h:1158
casacore::Bool dish_
Definition: MSAsRaster.h:789
casacore::Bool dispNotLoaded_
called?
Definition: MSAsRaster.h:949
casacore::Double sumv2a_
Definition: MSAsRaster.h:1363
static const VisComp PHRMS
Definition: MSAsRaster.h:618
VisComp curVisComp_
Definition: MSAsRaster.h:922
static const casacore::Int INVALID
=================== casacore::Data ======================= (mostly) ========
Definition: MSAsRaster.h:597
casacore::ROMSColumns * msCols_
(should be set true (permanently) during construction, or this object will be useless, and do nothing).
Definition: MSAsRaster.h:784
A DisplayData to setup a World coordinate plot.
Definition: WorldAxesDD.h:58
bool flag(WorldCanvas *wc, double blc_x, double blc_y, double trc_x, double trc_y)
added to allow flagging control from mouse tools...
virtual CachingDisplayMethod * newDisplayMethod(WorldCanvas *worldCanvas, AttributeBuffer *wchAttributes, AttributeBuffer *ddAttributes, CachingDisplayData *dd)
return a new MSAsRasterDM for the given WorldCanvas.
Base class for auto-caching DisplayData objects.
virtual void setUIBase(casacore::Int uibase)
DD &#39;Absolute Pixel Coordinates&#39;, e.g.
Definition: MSAsRaster.h:279
casacore::Vector< casacore::Int > nChan_
Definition: MSAsRaster.h:787
casacore::Int nbsl_
Definition: MSAsRaster.h:840
casacore::Vector< casacore::Int > a2_
Definition: MSAsRaster.h:834
double Double
Definition: aipstype.h:55
static const VisComp PHDIFF
Definition: MSAsRaster.h:618
static const VisType CORRECTED
Definition: MSAsRaster.h:610
A class to provide easy read-only access to MeasurementSet columns.
Definition: MSColumns.h:111
casacore::Bool inSureRange(Axis ax, casacore::Int pos)
Is the given position within the range above, on the given axis?
Definition: MSAsRaster.h:1262
casacore::Matrix< casacore::Int > bslA_
Definition: MSAsRaster.h:838
static const VisType OBSERVED
Definition: MSAsRaster.h:609
Class describing the most basic event information in the display classes.
Definition: DisplayEvent.h:82
casacore::Block< casacore::Int > shape
Definition: MSAsRaster.h:1210
MSAsRasterDM()
Default and copy constructors, and the assignment operator, are mon-functional and should not be used...
Definition: MSAsRaster.h:1469
void getSureRange(Axis ax, casacore::Int &strt, casacore::Int &fin)
Return the range (half-open interval) over which the edit definitely applies*, on the given axis...
Definition: MSAsRaster.h:1256
casacore::Bool msValid_
Definition: MSAsRaster.h:780
WCPowerScaleHandler itsPowerScaleHandler
Saved state from the last call to dev_().
Definition: MSAsRaster.h:1379
casacore::Int nbslA_
Definition: MSAsRaster.h:840
void findRanges_()
find the ranges of the casacore::MS selection (VisSet) for the 5 hypercube axes
virtual ~MSAsRaster()
Destructor.
casacore::Block< casacore::Int > spwId_
Definition: MSAsRaster.h:864
casacore::Float devRngMin_
Used (only) for scaling data values to colors; they are too expensive to compute except during extrac...
Definition: MSAsRaster.h:929
static const VisComp AMPDIFF
Definition: MSAsRaster.h:618
casacore::Bool operator==(FlagEdit_ &other)
casacore::Int dispDevNAvg_
represents.
Definition: MSAsRaster.h:958
casacore::Double sumv_
Definition: MSAsRaster.h:1363
A hierarchical collection of named fields of various types.
Definition: Record.h:180
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
void a1a2_(casacore::Double &a1, casacore::Double &a2, casacore::Double bsl, casacore::Int abase=0) const
A corresponding inverse, this handles non-integer &#39;baseline indices&#39;.
Rastered data - should go first.
Definition: DisplayEnums.h:357
DParameterButton * itsSaveEdits
choice box for using entire casacore::MS (vs.
Definition: MSAsRaster.h:1177
casacore::Matrix< casacore::Double > bLen_
sorted by antenna1-antenna2.
Definition: MSAsRaster.h:830
casacore::Int eT_
Definition: MSAsRaster.h:1362
casacore::Vector< casacore::Int > lsvTime_
Definition: MSAsRaster.h:1330
static const AxisLoc Z
Definition: MSAsRaster.h:606
virtual void notifyRegister(WorldCanvasHolder *wch)
Needed to enable or destroy drawlists and colormaps on corresp.
casacore::Block< casacore::Int > dispPos_
Definition: MSAsRaster.h:943
virtual ~MSAsRasterDM()
Destructor.
Definition: MSAsRaster.h:1442
float Float
Definition: aipstype.h:54
casacore::Block< casacore::Int > visShapeA_
Definition: MSAsRaster.h:911
static const VisComp NCOMPNAMES
Definition: MSAsRaster.h:619
casacore::Bool applies2(Axis ax, casacore::Int pos)
Same as above, but for use (only) where inLoopRange(ax, pos) is already known to be true...
Definition: MSAsRaster.h:1300
virtual casacore::Int uiBase() const
DD &#39;Absolute Pixel Coordinates&#39;, e.g.
Definition: DisplayData.h:688
MSAsRasterDM(const MSAsRasterDM &other)
Definition: MSAsRaster.h:1470
static const Axis BASELN
Definition: MSAsRaster.h:600
DParameterChoice * itsEntireAnt
no checkbox-type DParameter yet).
Definition: MSAsRaster.h:1166
MSpos_(const MSAsRaster *msar, const casacore::Block< casacore::Int > &pos)
Construct MSpos_ according to 5-element casacore::Block corresponding to a position within the intern...
Definition: MSAsRaster.h:1051
Implementation of DisplayParameter to store choice parameters.
void extract_()
Extract the hypercube buffer of visibilities for the requested casacore::MS selection and axis settin...
void deleteParameters_()
virtual casacore::Record getOptions(bool scrub=false) const
Retrieve the current options.
casacore::Int operator[](Axis ax)
Definition: MSAsRaster.h:1121
void computeTimeBoxcars_()
compute the lsTime_ and leTime_ vectors, which define the &#39;local neighborhoods&#39; around each given tim...
virtual Display::DisplayDataType classType()
Return the type of this DisplayData.
Definition: MSAsRaster.h:212
A Table intended to hold astronomical data (a set of Measurements).
casacore::Block< casacore::Int > visShape_
Definition: MSAsRaster.h:908
virtual casacore::Bool setOptions(casacore::Record &rec, casacore::Record &recOut)
Apply option values stored in rec to the DisplayData.
void setBslSort_()
Set the baseline index translation Arrays a1_, a2_ and bsl_ by copying as appropriate according to th...
DisplayData * parentDisplayData()
Return the parent DisplayData.
static const casacore::Int NCOLORS
Definition: MSAsRaster.h:684
casacore::Bool zIndexConformed_
Definition: DisplayData.h:766
casacore::Float v_(casacore::Int t)
Return a single visibility point from vis_ or disp_, as a function of time slot only.
casacore::Vector< casacore::Int > lsTime_
(&lt;void*&gt; rather than &lt;FlagEdit_*&gt; just to avoid the extra templates)
Definition: MSAsRaster.h:1330
DParameterRange< casacore::Int > * itsVisMb
User option DisplayParameters specific to MSAsRaster.
Definition: MSAsRaster.h:696
casacore::Int nframes_(const casacore::Block< casacore::Int > &frames, casacore::Int strtfrm, casacore::Int nfrms, casacore::Int &margin)
Return how many of the given (sorted) animation frames can be displayed from a given window (strtfrm...
casacore::uInt dispNEdits_
draw flags in color?
Definition: MSAsRaster.h:1192
casacore::String dataType() const
Pure virtual function from DisplayData...
Definition: MSAsRaster.h:216
VisibilityIterator * wvi_p
Definition: MSAsRaster.h:796
casacore::Bool appChunk
The following are set by appliesToChunk(spw, nChan, pol0, nPol) at the beginning of each chunk...
Definition: MSAsRaster.h:1230
DParameterChoice * itsZAxis
Definition: MSAsRaster.h:702
casacore::Bool goodData_
Initializing input to dev_(t) and its subsidiary routine v_(t).
Definition: MSAsRaster.h:1357
casacore::Block< casacore::Int > msShapeA_
= {nTime, nBsln, nChan, nPol, nSpw}.
Definition: MSAsRaster.h:811
static const VisType INVALID_VT
Definition: MSAsRaster.h:613
virtual casacore::uInt nelements() const
return the size of the animation axis.
Definition: MSAsRaster.h:223
virtual casacore::Bool canLabelAxes() const
DisplayCoordinateSystem setCS_()
update/set the (2d–canvas) coordinate system from the current MS selection and display axes...
virtual void handleEvent(DisplayEvent &ev)
handle flagging region selection events, via new-style (1/02) interface.
Axis axisNum_(const casacore::String &axisName) const
...applied to 3 of the &#39;enums&#39; used internally.
Definition: MSAsRaster.h:636
RefreshReason
Callback reasons for PCRefreshEvent and WCRefreshEvent.
Definition: DisplayEnums.h:267
static const VisDev RMS
Definition: MSAsRaster.h:626
casacore::Block< casacore::Int > msShape_
of the set of antennas appearing in mssel_ main data rows.
Definition: MSAsRaster.h:807
Describes a method of generating a table of colors.
Definition: Colormap.h:104
casacore::Vector< casacore::Int > leTime_
Definition: MSAsRaster.h:1330
Base class for all Casacore library errors.
Definition: Error.h:134
virtual casacore::String showPosition(const casacore::Vector< casacore::Double > &world, const casacore::Bool &displayAxesOnly=false)
casacore::Format the position of the cursor.
A holder to interface between DisplayDatas and a WorldCanvas.
casacore::MS * mssel_
which will then be used instead of the DATA column).
Definition: MSAsRaster.h:795
Implementation of drawing in world coordinates on top of a PixelCanvas.
Definition: WorldCanvas.h:204
casacore::Bool flag_(casacore::IPosition &slot)
Return or set a flag within the bitmapped flags_ vector, as if it were a 5-axis casacore::Array&lt;casac...
void initMSAR_(const viewer::DisplayDataOptions &ddo)
Initialization common to all useful constructors.
static const VisComp INVALID_VC
GUI choice box (itsVisComp).
Definition: MSAsRaster.h:623
casacore::Vector< casacore::Int > spwIds_
Definition: MSAsRaster.h:767
static const VisComp NCOMPS
Definition: MSAsRaster.h:617
static const AxisLoc SL0
Definition: MSAsRaster.h:606
casacore::Bool dispDevValid_
data displays.
Definition: MSAsRaster.h:954
casacore::Int nDAvg_
visComp_ and visDev_.
Definition: MSAsRaster.h:763
MSAsRaster()
Default and copy constructors, and the assignment operator, are non-functional and should not be used...
Definition: MSAsRaster.h:357
casacore::Vector< casacore::Int > axisOn_
-—derived from above: what is now requested--------------------—
Definition: MSAsRaster.h:740
casacore::Int p0(casacore::Int pid)
Definition: MSAsRaster.h:1111
static const Axis INVALID_AXIS
Definition: MSAsRaster.h:601
casacore::Int AxisLoc
Each axis can placed on the canvas display (X or Y), the animator (Z), or on one of 2 auxiliary slide...
Definition: MSAsRaster.h:605
casacore::Block< casacore::Int > start
Definition: MSAsRaster.h:1209
VisType curVisType_
BASELN axis, and then only when computeVisShape_() determines that the entire msShapeA_[BASELN] will ...
Definition: MSAsRaster.h:921
static const VisType RESIDUAL
Definition: MSAsRaster.h:612
casacore::Int c(casacore::Int sid, casacore::Int ch)
Definition: MSAsRaster.h:1101
void getLoopRange(casacore::Int ax, casacore::Int &strt, casacore::Int &fin)
Retrieve ranges for loops.
Definition: MSAsRaster.h:1271
String: the storage and methods of handling collections of characters.
Definition: String.h:223
casacore::Block< casacore::Bool > all
All 3 of these Blocks are indexed by Axis, and have NAXES elements.
Definition: MSAsRaster.h:1208
casacore::Bool useVis_
Beginning and (1 beyond) ending time index defining the &#39;boxcar&#39; or local neighborhood over which ave...
Definition: MSAsRaster.h:1340
void createDevSlice_()
Create dispDev_ casacore::Matrix for displaying deviations.
casacore::Int activeZIndex_
Indicates the &#39;current&#39; animation frame, i.e.
Definition: DisplayData.h:755
casacore::Vector< casacore::Int > pidBase_
Definition: MSAsRaster.h:887
static const casacore::Float OLDFLAG
Definition: MSAsRaster.h:680
static const VisDev NORMAL
Definition: MSAsRaster.h:626
static const casacore::Float NO_DATA
Definition: MSAsRaster.h:658
static const casacore::Float INSUF_DATA
Very similar, but used only in the disp_ array, for data which is not loaded into memory (vis_) at pr...
Definition: MSAsRaster.h:666
void computeBaselineSorts_()
Called from findRanges_(), computes translation matrices between antenna1,antenna2 and baseline index...
casacore::Int nSpwIds_
Definition: MSAsRaster.h:786
casacore::Matrix< casacore::Bool > dispMask_
from the casacore::MS (only); not for new, unsaved flags.
Definition: MSAsRaster.h:1184
VisibilityIterator iterates through one or more writable MeasurementSets.
casacore::Block< void * > freq_
The user can select the spectral windows to view.
Definition: MSAsRaster.h:875
(Minimal) DisplayMethod for MSAsRaster.
Definition: MSAsRaster.h:1431
casacore::Vector< casacore::Int > fieldIds_
Definition: MSAsRaster.h:766
void sets(casacore::Int s)
casacore::Int t(casacore::Double tm)
casacore::MS values to hypercube indices.
Definition: MSAsRaster.h:1078
casacore::Matrix< casacore::Int > bsl_
Definition: MSAsRaster.h:838
static const Axis CHAN
Definition: MSAsRaster.h:600
casacore::Bool antSort_
axis when baselines are sorted by length (antSort==false).
Definition: MSAsRaster.h:826
casacore::Int nFieldIds_
Definition: MSAsRaster.h:785
casacore::Vector< casacore::Int > levTime_
Definition: MSAsRaster.h:1330
static const Axis POL
Definition: MSAsRaster.h:600
static const VisType MODEL
Definition: MSAsRaster.h:611
void setb(casacore::Int b)
virtual const casacore::String & name() const
In case it helps; the method should probably be called only before we&#39;ve had a chance to cache anythi...
Definition: MSAsRaster.h:292
void addEdit_(WorldCanvas *wc, casacore::Int xStart, casacore::Int xShape, casacore::Int yStart, casacore::Int yShape)
Add the edit request that just came in (from the mouse, via handleEvent) to the flagEdits_ casacore::...
VisType visTypeNum_(const casacore::String &visTypeName) const
Definition: MSAsRaster.h:640
virtual void purgeCache()
Empty cache completely.
DParameterChoice * itsAxisLabelling
Axis Labelling? (Yes/No).
Definition: MSAsRaster.h:719
DParameterChoice * itsUnflag
Definition: MSAsRaster.h:1160
casacore::Int s(casacore::Int sid)
Definition: MSAsRaster.h:1093
casacore::Vector< casacore::String > visTypeName_
Definition: MSAsRaster.h:655
casacore::Float dataRngMin_
Definition: MSAsRaster.h:924
Linear, logarithmic and exponential scaling of data for the WorldCanvas.
static const AxisLoc NLOCS
Definition: MSAsRaster.h:606
casacore::Vector< casacore::Int > len2ant_
Definition: MSAsRaster.h:834
casacore::Int nPolIds_
(*freq_[spw])[chan] holds the CHAN_FREQ for the given spw index and channel (in Hz).
Definition: MSAsRaster.h:884
static const VisComp PHASE
Definition: MSAsRaster.h:616
static const casacore::Float NOTLOADED
Also similar.
Definition: MSAsRaster.h:680
casacore::Bool postDataRng_
do not reflect current state of vis_.
Definition: MSAsRaster.h:976
void selectVS_(const viewer::DisplayDataOptions &ddo=viewer::DisplayDataOptions())
prepare the selection casacore::MS and its VisSet.
casacore::Double sumv2_
Definition: MSAsRaster.h:1363
static const AxisLoc X
Definition: MSAsRaster.h:606
casacore::Int b(casacore::Int fd)
Definition: MSAsRaster.h:1088
VisType visType_
Zero-based (although the user sees 1-based values).
Definition: MSAsRaster.h:752
virtual const casacore::Unit dataUnit() const
get the casacore::Unit for displayed data values (visibilities)
casacore::Bool csConformed_
Definition: DisplayData.h:766
unsigned int uInt
Definition: aipstype.h:51
casacore::Float d_
Definition: MSAsRaster.h:1365
casacore::Bool appliesToChunk(casacore::Int pol0, casacore::Int nPol, casacore::Int spw, casacore::Int nChan)
Does the edit apply to the current casacore::MS iteration chunk?
casacore::Int ts
MSAsRaster tables which it set up in findRanges_: nAnt_, time_, spwId_, freq_, polId_, etc.
Definition: MSAsRaster.h:1033
void computeDevRange_()
Calculate deviations throughout range of vis_.
casacore::Int p(casacore::Int pid, casacore::Int pnm)
Definition: MSAsRaster.h:1106
casacore::Vector< casacore::String > axisName_
--—more constants and statics -------------------------------------—
Definition: MSAsRaster.h:654