Unlike many DDs, MSAsRaster has _two_ levels of underlying data: the source MS, and a hypercube of visibility data, which is extracted from the MS and gridded onto 5 main axes: time, baseline, spectral window, frequency and polarization. Extracting the data is a more time-consuming operation than display of various portions of gridded data, and is triggered only through the extract_() method. Data selection options do not take effect until triggered in this way. In contrast, many options affecting display of the extracted data (such as zooms, and colormapping) affect the display immediately, as with most DDs. Setting new display axes will trigger extract_() if the current extracted hypercube does not fill them.
MSAsRaster *mar = new MSAsRaster("filename_of.ms"); wcHolder->addDisplayData(mar);
The current user interface for triggering extract_ is the 'Apply' button, which is detected internally when setOptions() is called with more than one user option field to be updated. This is not entirely satisfactory; User interface could use improvement.
Major items among other things left to to:
* MS Selection and averaging.
* World coordinates in axis labelling, position tracking and slice selection
* Alternative orderings, especially along baseline and time axes
Destructor
Apply option values stored in rec to the DisplayData. A return value of True means a refresh is needed. recOut contains any fields which were implicitly changed as a result of the call to this function. Parameters from the 'adjust' gui are sent through here, controlling and triggering many of MSAsRaster's actions. (Other input is via the mouse on the canvas, which affects the object through the event handlers).
Retrieve the current options. In addition to the values themselves, the returned record contains meta-information (prompts, help text, choices, defaults, etc.) useful in constructing gui elements to control the DD settings.
set all options to default values (unused so far; incomplete support in base classes...incomplete here as well).
Return the current options of this DisplayData as a 'restrictions' AttributeBuffer (only options that affect the way the image would be drawn are returned). It is used to determine which (if any) of the cached drawings can be used to satisfy the current draw request.
Determine whether DD is compatible with the WC[H]'s current world coordinates. MSAsRaster DDs must be in charge (the CS master), Otherwise they will not respond. Multiple MSARs on one canvas (blinking, etc.) is not supported, because of possible confusion about which one(s) should respond to flagging edits.
This routine is called to inform the DD of the current canvas's animator index. Used by confromsTo() and related methods. Return value indicates whether the index is within the data's range.
Format the data value at the given world position. Call setActiveImage(zindex) with the desired animator position before calling this routine.
Format the position of the cursor. Also requires previous call to setActiveImage(zindex); also used for position tracking.
get the Unit for displayed data values (visibilities)
Return the type of this DisplayData.
return the size of the animation axis.
Handle axis labelling.
Needed to enable or destroy drawlists and colormaps on corresp. canvas. (Only to be called by the relevant WCH).
handle flagging region selection events, via new-style (1/02) interface.
Return the animator position setting preferred if this DD about to be registered on a new DisplayPanel.
Empty cache completely.
return a new MSAsRasterDM for the given WorldCanvas.
Helper functions.
Default and copy constructors, and the assignment operator, are non-functional and should not be used. Do not make copies of DisplayData objects, or pass them by value; use references or pointers instead.
Initialization common to all useful constructors
set/restore default option values on this level only. (Not implemented).
prepare the selection MS and its VisSet.
find the ranges of the MS selection (VisSet) for the 5 hypercube axes
update/set the (2d--canvas) coordinate system from the current MS selection and display axes.
Extract the hypercube buffer of visibilities for the requested MS selection and axis settings (the most time-consuming operation).
retrieve (2D) slice data Matrix, and corresponding mask/flag matrices, to send to the display canvas.
Actually do the drawing. The return value indicates whether the DD was able to draw.
return baseline index (in the usual baseline ordering) from antenna numbers. Input must have 0 <= a1 <= a2 < nAnt_. Mapping leaves room for autocorrelations plus a 1-pixel gap between successive antenna1 groups.
A corresponding inverse, this handles non-integer 'baseline indices'. Set abase to 1 to number ant1 and ant2 from 1. (The baseline index bsl is always numbered from 0, internally). The version with the Double return value returns a1*a1mult_() + a2.
Subsidiary routine for above, determines (in effect) how many decimal places are needed for an antenna number. Returns 1000, unless 4 places are needed, in which case it returns 10000, etc.
A small routine to return the label for the "Visibility Memory" slider widget. The label includes feedback on the selected MS's total size, and is updated when that changes.
Reset Block of relevant Spectral window IDs, and return correponding Vectors of channel frequencies. freq_ is used for display of frequencies in position tracking. spwId_ translates spw 'index' into the actual spectral window ID.
Translate actual spectral window ID into the 'spw' index (zero-based pixel coordinate) along the spectral window axis. Because the user can select specific spectral windows, these two may not be the same. Returns -1 if the spectral window ID is not in the selected MS data.
Compute vis_ array dimensions which fit into allowed memory.
Return how many of the given (sorted) animation frames can be displayed from a given window (strtfrm, nfrms) on that axis. In cases where nframes>0, margin will be the minimum padding on either side, from the edges of the interval to the frames of interest.
Return the maximum number of the given (sorted) animation frames that can be displayed from a window or interval of a given size (nfrms). also returns where that interval should start (strtfrm).
Reset data scaling DParameters to newly-computed data ranges.
Return or set a flag within the bitmapped flags_ vector, as if it were
a 5-axis Array
Add the edit request that just came in (from the mouse, via handleEvent)
to the flagEdits_ List, then cause the display to be updated.
Assure that the display matrices are up-to-date with the flagging edits
list, to provide visual feedback of the edits.
Undo unsaved edits. Return value indicates whether there were any
edits to undo. extent=="all" means undo all, else just the last one.
If feedback==True, a warning message will be printed about discarded
edits.
Save all edits permanently to the MS. The return value indicates
whether there were any edits to save.
compute the lsTime_ and leTime_ vectors, which define the
'local neighborhoods' around each given time slot, for
computing running averages.
Return a single visibility point from vis_ or disp_, as a function
of time slot only. The row of times and mode must be predetermined by
setting useVis_, dPos_, axlTm_ and flgdDev_ (below). goodData_ is set
True by this routine if the data exists, is loaded and is not flagged
(False otherwise).
Phase deviations are calculated both for the original phases
(in [-180,180]), and for the phases 180 degrees opposite
(also expressed within [-180,180]); the minimum result is displayed.
This is so that phases clustered around +-180 do not show
artificially high deviations. (remainder(x,360) (from math.h)
is always in [-180,180] -- wierd, but usable for this purpose).
Return the visibility deviation for the time slot t. visDev_
determines whether this is an RMS deviation or absolute
difference from the running mean. Maintains state from the
prior calculation to speed things up in some cases. Must be
initialized as for v_() above, and sT_ set to -1, at the
beginning of a new row of times.
Calculate deviations throughout range of vis_. Used to set
data scaling sliders when visibility deviations are to be displayed.
Create dispDev_ Matrix for displaying deviations. Both this
routine and the one above initialize and use dev_() to calculate
individual deviations.
Generic string-to-index converter...
...applied to 3 of the 'enums' used internally.
This 'minimal' CachingDisplayMethod could be adapted and reused by any
other CachingDisplayData that wanted to do its own drawing.
Destructor.
void addEdit_(WorldCanvas* wc, Int xStart, Int xShape, Int yStart, Int yShape)
void postEditsToDisp_()
Bool undoEdits_(String extent="all", Bool feedback=False)
Bool saveEdits_()
void computeTimeBoxcars_()
Float v_(Int t)
Float vAlt_(Float v)
Float dev_(Int t)
void computeDevRange_()
void createDevSlice_()
static Int ind_(const String& name, const Vector<String>& names)
Axis axisNum_(const String& axisName) const
VisType visTypeNum_(const String& visTypeName) const
VisComp visCompNum_(const String& visCompName) const
class MSAsRasterDM : public CachingDisplayMethod
Interface
Description
Prerequisite
Etymology
"MSAsRasterDM" is a implementation of a
CachingDisplayMethod for
MSAsRaster .
Synopsis
MSAsRasterDM a minimal skeleton; it is implemented
in its entirety here. Its only purpose is to hold the cached drawlist
and use it when appropriate via the mechanism and data structure
implemented on the CachingDisplayMethod level. MSAsRasterDM just
turns the draw request back over to MSAsRaster, since that's where
the necessary data is.
Member Description
MSAsRasterDM(WorldCanvas *wc, AttributeBuffer *wchAttrs, AttributeBuffer *ddAttrs, hAttrs *dd): CachingDisplayMethod(wc, wchAttrs, ddAttrs, dd)
Constructor. The parameters contain state that determines
what should be drawn.
virtual ~MSAsRasterDM()
virtual Bool drawIntoList(Display::RefreshReason reason, WorldCanvasHolder &wcHolder)
The base CachingDM takes care of using any cached drawlist.
When this method is called, we know that no drawlist applies,
and that we must actually send drawing commands to the WC (though
technically, they might _not_ actually be going into a drawlist).
This skeleton DM just hands the drawing task back to the DD,
where all the data has been created and maintained anyway.
MSAsRasterDM()
Default and copy constructors, and the assignment operator, are
mon-functional and should not be used. Do not make copies of
DisplayMethod objects, or pass them by value;
use references or pointers instead.
MSAsRasterDM(const MSAsRasterDM &other)
MSAsRasterDM& operator=(const MSAsRasterDM &other)