andycasey / smhr

Spectroscopy Made Hard(er)
14 stars 6 forks source link

Anti-masks #126

Closed alexji closed 8 years ago

alexji commented 8 years ago

In regions with many lines (e.g. blue regions of r-process stars), it is better to set valid spectral regions than invalid spectral regions (i.e., "anti-masks").

Include this in the GUI (stellar parameters and chemical abundances) as a flag to set green regions. Shift-click to set an anti-mask instead of a mask. When an anti-mask is set, it removes all masks and switches to anti-masks (both blue/auto and red/manual masks).

This should address the primary concerns with #85.

Under the hood, implement this as a flag, and change the mask() function to flip if needed.

alexji commented 8 years ago

@afrebel @andycasey @mgull19 @maddiecain

I have implemented antimasking and tested it a little bit. To use it, click into the spectrum figure, then shift-click-drag to select regions used for fitting the line + continuum. This will erase all previous masks. To go back to normal masks, drag a mask without holding down shift (which will erase all antimasks).

Be very careful about holding down shift. You have to click into the plot to activate it. If shift is not pressed, it will delete the antimasks and apply masks again. The terminal prints out "shift pressed/released" if you are unsure if shift is pressed.

There is a new checkbox that you cannot use, it is just indicating whether the masks are currently masks or antimasks.

Note that the algorithm appears to still apply the automatic masking within the antimask region. You can effectively turn this off by increasing automask sigma to a large number. @andycasey I'm not sure if this actually does anything, because if the automasks are added to the spectral_model.metadata["mask"] they will all be interpreted as antimasks; I'll look into this more when I have a chance.

I am sure there are bugs, so please report them as issues. Closing this issue.