|
LSSTApplications
1.1.2+25,10.0+13,10.0+132,10.0+133,10.0+224,10.0+41,10.0+8,10.0-1-g0f53050+14,10.0-1-g4b7b172+19,10.0-1-g61a5bae+98,10.0-1-g7408a83+3,10.0-1-gc1e0f5a+19,10.0-1-gdb4482e+14,10.0-11-g3947115+2,10.0-12-g8719d8b+2,10.0-15-ga3f480f+1,10.0-2-g4f67435,10.0-2-gcb4bc6c+26,10.0-28-gf7f57a9+1,10.0-3-g1bbe32c+14,10.0-3-g5b46d21,10.0-4-g027f45f+5,10.0-4-g86f66b5+2,10.0-4-gc4fccf3+24,10.0-40-g4349866+2,10.0-5-g766159b,10.0-5-gca2295e+25,10.0-6-g462a451+1
LSSTDataManagementBasePackage
|
At present (July 2009) we are using ds9 (http://hea-www.harvard.edu/RD/ds9) to display Images, Masks, and MaskedImages. This has a number of drawbacks (slow; slightly unstable API; awkward to use with firewalls) as well as a number of advantages: Supported by the CfA; ubiquitous in astronomy; support for WCS; support for multiple frames).
The basic functionality is in lsst.afw.display.ds9, and the workhorse routine is mtv. The simplest use is simply to setup afw and ds9, start ds9 and python, and type:
You can display images in multiple frames, either by explicitly specifying the frame, or by setting the default with ds9.setDefaultFrame(). If there's a strong desire for multiple instances of ds9 this could be supported (by choosing different tcp ports); file a ticket if this is really important for you.
The mtv command handles all of the LSST image types:
The pixels are displayed on ds9. Images don't have a Wcs, so no astronomical WCS information is available, but we do support WCSA and WCSB; the former is 0-indexed pixel coordinates allowing for the Image's XY0; the latter is 0-indexed pixel coordinates relative to the bottom left pixel being (0, 0).
mtv accepts an optional wcs argument, which allows you to provide an astronomical Wcs (but if you have an DecoratedImage or Exposure this is done for you)
Displayed like Image, but with the default WCS set from the DecoratedImage's Wcs
Overlay the current display with the Mask. A bug in ds9 prevents you from displaying a pure Mask, but you can use the isMask argument to force the Mask to be treated as a 16-bit image.
The Mask display isn't as fast as you might like, as ds9's current API requires us to send each mask plane as a separate 16-bit image (I have asked Bill Joy at CfA to change this). Each bitplane may be given a separate colour; you can inspect the current mapping with getMaskPlaneColor or set it with setMaskPlaneColor. If a mask plane has no defined colour, one will be chosen for you.
Recent versions of ds9 allow you to vary the mask's transparency, either via the GUI or with e.g. setMaskTransparency(50).
The image-plane pixels are displayed, overlaid with the mask. If you want to look at the variance too, you'll need to say something like:
Wcs There are facilities to build mosaics of images in lsst.afw.display.utils
The basic class is Mosaic:
You can return the (ix, iy)th (or nth) bounding box with getBBox()
The Mosaic class API
Add an image to the list of images to be mosaiced Set may be cleared with Mosaic.reset()
Draw the list labels at the corners of each panel. If labels is None, use the ones specified by Mosaic.append()
Draw the list labels at the corners of each panel
Get the bounding box for the nth or (ix, iy)the panel
Return a mosaic of all the images provided; if none are specified, use the list accumulated with Mosaic.append()
If frame is specified, display it
Set the value in the gutters
Set the number of pixels between panels in a mosaic
Set mosaicing mode. Valid options:
| square | Make mosaic as square as possible |
| x | Make mosaic one image high |
| y | Make mosaic one image wide |
Image commands
It turns out that writing symbols to ds9 is very slow. Whenever you're writing more than a few glyphs we strongly recommend that you turn on buffering. The simplest way to do this is by using python's with statement:
(note that ds9.Buffering() is safe even if no ds9 display is available). You can explicitly flush the buffer at anytime with ds9.flush()
Erase the specified DS9 frame
Draw all pending glyphs; you shouldn't usually need to use this.
Display an Image or Mask on a DS9 display
If lowOrderBits is True, give low-order-bits priority in display (i.e. overlay them last)
Historical note: the name "mtv" comes from Jim Gunn's forth imageprocessing system, Mirella (named after Mirella Freni); The "m" stands for Mirella.
Pan to (rowc, colc); see also zoom
Set the default frame for ds9
Set the ds9 mask colour to; eg. ds9.setMaskColor(ds9.RED)
Request that mask plane name be displayed as color; name may be a dictionary (in which case color should be omitted
Specify the visibility of a given mask plane; name may be a dictionary (in which case show w ill be ignored)
Specify ds9's mask transparency (percent); or None to not set it when loading masks
Uniconify and Raise ds9. N.b. throws an exception if frame doesn't exit
Graphics commands
Draw a symbol onto the specified DS9 frame at (col,row) = (c,r) [0-based coordinates] Possible values are:
| + | Draw a + |
| x | Draw an x |
| o | Draw a circle |
| @:Mxx,Mxy,Myy | Draw an ellipse with moments (Mxx, Mxy, Myy) (size is ignored) |
Any other value is interpreted as a string to be drawn
Internal commands that you shouldn't need to know
Exception thrown if there's some problem talking to ds9
Issue a ds9 command, raising errors as appropriate
Get the default frame for ds9
Return the colour associated with the specified mask plane name
Should we display the specified mask plane name?
Return ds9's mask transparency
Parse XPA_PORT and send return an identifier to send ds9 commands there, instead of "ds9" If you don't have XPA_PORT set, the usual xpans tricks will be played when we return "ds9".
Colours may be specified as any X11-compliant string (e.g. "orchid"), or by one of the following constants defined in ds9; the advantage of the latter approach is that the python interpreter can detect typos: BLACK, WHITE, RED, BLUE, GREEN, CYAN, MAGENTA, YELLOW.
On your home machine, type
(setenv XPA_PORT "DS9:ds9 22345 22346" for csh users, of course)
On lsstXXX.ncsa.uiuc.edu, set XPA_PORT to the same value, start python, import lsst.afw.display.ds9 and proceed:
xpa afficianados will note that I'm bypassing the xpa name server; it needs another set of 2 or 3 ports tunnelled, and setting up ACLs.
Here's a script (in afw/examples) to run on your home machine that should simplify setting up/tearing down the ssh tunnels. It's not great, so improvements would/will be welcomed.
1.8.5