[lsst-dm-stack-users] Using Masks and MaskedImages

Paul Price price at astro.princeton.edu
Fri Apr 5 13:26:38 PDT 2013


On Apr 5, 2013, at 12:13 PM, Heather Kelly wrote:
> For the Sensor Test Analysis we were looking to start using the DMstack's implementation of Masks and MaskImages.  I'll admit to being rather vague on how to best implement the creation of a new Mask and wonder if you might have examples or suggestions.

You should be able to just:

m = afwImage.MaskU(width, height)
bad = m.addMaskPlane("NAUGHTY")
m.set(123, 456, bad)

I believe the list of defined mask planes is a global for the class, i.e., it's not particular to one particular Mask instance; and I think there's some care taken when reading


> I guess Mask::setMaskPlaneValues is the way to go and then output it to FITS.

No, setMaskPlaneValues allows you to give a set of mask planes specific values.
To output to FITS, try .writeFits("foo.fits")


> Would it be possible to see an example FITS file with an output Mask planes?

Try:
m = afwImage.MaskU(123, 456)
m.addMaskPlane("ONE")
m.addMaskPlane("TWO")
m.writeFits("mask.fits")


> For sensor testing, I'm imagining one extension for each segment (amp) which contains a Mask.

Unless you have a reason not to, I suggest using the MaskedImage class, which associates an Image with a Mask and variance, and takes care of annoying I/O details like extensions for you.


> Are there planned standard definitions for masks in LSST?  I see this which suggests we can define the planes however we like:
> http://lsst-web.ncsa.illinois.edu/doxygen/x_betaDoxyDoc/afw_mask_planes.html

There's a standard set of pre-defined mask planes: BAD, SAT, INTRP (note: no 'E'; dunno why), CR, EDGE, DETECTED and DETECTED_NEGATIVE.  Besides these, you can add your own.


> In the context of the Sensor tests - I'm not sure we would use the default set of Mask planes - is it possible via removeMaskPlane (and deemed ok) to modify the existing set - or we should just tack on our additional planes..  bright, dark, etc? somehow it seems easier to just tack on..

Dunno why there are pre-defined mask planes; I would have thought they might just have been defined as people need them, but I suppose it does provide a standard place for a basic set that we "know" we'll need.
But I don't see anything that prevents you from removing elements from the standard set once you've created a Mask --- though some of our stuff may assume they exist, so perhaps you should try to use the standard set if they make any sense for you.


P.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://listserv.lsstcorp.org/pipermail/dm-users/attachments/20130405/60cd04c9/attachment.html>


More information about the dm-users mailing list