mustang-project / Heisenberg

2 stars 1 forks source link

Error in particular combinations of Masking Flags #34

Closed DTHaydon closed 8 years ago

DTHaydon commented 8 years ago

With the parameter combination of

mask_images     1
mstar_ext       0
mstar_int       0

A section of the code (see Code Section, but I believe that this issue is repeated elsewhere) fails because a variable is not defined. This results because the values of mstar_ext and mstar_int prevent any of the if conditions being satisfied.

I think the initial if mask_images then begin should probably be (pseudo code):

if mask_images AND (mstar_ext OR mstar_int)

(This might be fixed as part of #9)

Code Section:

if mask_images then begin
    if mstar_ext && mstar_int then begin
        mask_tool, starfiletot $ ;image variables
            , ds9_positive_path = maskdir + path_sep() + star_ext_mask, ds9_negative_path = maskdir + path_sep() + star_int_mask $ ;ds9 region file keywords ; positive = allowed regions, negative = not allowed regions
            , masked_image_path = maskeddir + starfile $ ;path to write masked image to
            , image_masked = starmap $ ;overwrite original image array with masked one
            , header_output = starmaphdr $
            , convert = convert_masks
    endif else if mstar_ext then begin
        mask_tool, starfiletot $ ;image variables
            , ds9_positive_path = maskdir + path_sep() + star_ext_mask $ ;ds9 region file keywords ; positive = allowed regions, negative = not allowed regions
            , masked_image_path = maskeddir + starfile $ ;path to write masked image to
            , image_masked = starmap $ ;overwrite original image array with masked one
            , header_output = starmaphdr $
            , convert = convert_masks
    endif else if mstar_int then begin
        mask_tool, starfiletot $ ;image variables
            , ds9_negative_path = maskdir + path_sep() + star_int_mask $ ;ds9 region file keywords ; positive = allowed regions, negative = not allowed regions
            , masked_image_path = maskeddir + starfile $ ;path to write masked image to
            , image_masked = starmap $ ;overwrite original image array with masked one
            , header_output = starmaphdr $
            , convert = convert_masks
    endif
endif else begin ;else just read in file.
    starmap=readfits(starfiletot,hdr,/silent) ;read Halpha map
    starmaphdr=hdr ;header of Halpha map
endelse
alexhygate commented 8 years ago

Hi Dan, not sure where the bug is here? What part of the code stops working as it should? Can you be more specific?

alexhygate commented 8 years ago

If you mean that the code currently has four options: 1) both masks, 2) external mask only 3) internal mask and 4) no masks and think this is too many then there is an open issue for me to try to redue this to two options: 1) mask(s) and 2) no masks. https://github.com/mustang-project/KL14/issues/11

alexhygate commented 8 years ago

(I realise that the title of #11 is somewhat cryptic though)

alexhygate commented 8 years ago

Ok now I understand. This is a bug. I will fix it!

jmdkastro commented 8 years ago

That was a fun conversation to watch ;)

alexhygate commented 8 years ago

:p

jmdkastro commented 8 years ago

Fixed by https://github.com/mustang-project/KL14/pull/36