Issue with getMaskPlaneColor?

Hi all,

I have a question regarding the colors of the masks when using afwDisplay (this is v20.0.0).

Here are the few lines used for display.

afwDisplay.setDefaultBackend('matplotlib')

display = afwDisplay.Display(frame=9, backend='matplotlib', title='Difference')
display.scale("linear", "zscale")   
display.mtv(imagediff)
display.show_colorbar()
plt.show()

where imagediff is a cutout of an image difference (deepDiff_differenceExp_sub) performed by @mchbib on HSC data.

Here is a screenshot:

This is using %matplotlib ipympl so that when I put my mouse cursor on the lower left, I can see that the masks in pink-ish are INEXACT_PSF and REJECTED.

But if I want to actually check what the colors are supposed to be, using

for maskName, maskBit in imagediff.mask.getMaskPlaneDict().items(): print('{}: {}'.format(maskName, display.getMaskPlaneColor(maskName)))

as suggested here, I get:

BRIGHT_OBJECT: None
CLIPPED: None
CR: magenta
CROSSTALK: None
DETECTED: blue
DETECTED_NEGATIVE: cyan
EDGE: yellow
FAKE: None
INEXACT_PSF: None
INTRP: green
NOT_DEBLENDED: None
NO_DATA: orange
REJECTED: None
SAT: green
SENSOR_EDGE: None
SUSPECT: yellow
UNMASKEDNAN: None

so REJECTED and INEXACT_PSF appear as None.

Is this some kind of bug?

Best,

Ben

I expect it simply means that a color for those mask planes hasn’t been explicitly configured.

1 Like

http://doxygen.lsst.codes/stack/doxygen/x_masterDoxyDoc/afw_sec_display.html#afwSecImageTypes says “If a mask plane has no defined colour, one will be chosen for you.”

1 Like

Thanks !
It is just a bit confusing that the default is not what is then defined by mtv.
I guess it’s because the way it creates new colors when they are not defined depends on how the others are chosen.
Isn’t there a way to have the function mtv update the dictionary so that after we call it we can check the color scheme used?

I don’t believe the code as written supports that. You could fix the code (I’m sure the Project would appreciate a pull request), or explicitly set the mask plane colors before calling mtv.