lofar-astron / factor

Facet calibration for LOFAR
http://www.astron.nl/citt/facet-doc
GNU General Public License v2.0
19 stars 12 forks source link

Bug in mask merging with region file provided by user #200

Closed adrabent closed 7 years ago

adrabent commented 7 years ago

Hi,

when providing a self-made region file for masking this is happening: strange_mask To the southwest a strange box appears which resembles the "boarder" of the premask created by factor before. I guess something went wrong with the "merge_mask" part of factor.

botteon commented 7 years ago

I have seen this in one of my runs. I thought that it was due to how the mask was drawn (in my case, with CASA). Did you try to draw again the mask (e.g. with a more roundish shape) and check if the issue persists?

AHorneffer commented 7 years ago

Oh, I thought I fixed that some time ago. The code that determines if a pixel is inside or outside th mask doesn't like it if two points of the polygon are too close to each other (and change between concave and convex and probably something else...).

I need to check if I committed the code I wrote back then.

AHorneffer commented 7 years ago

O.K. I committed that fix on 17 Nov 2016. (For issue #144, commit: dbe0760)

As the problem apparently still occurs: can you attach the image and the hand-made region here (or on dropbox)?

CDumba commented 7 years ago

Find the handmade region file and image here

AHorneffer commented 7 years ago

O.K. the short answer is that in the one polygon the first and the second-from-last point are identical, so when evaluating the vertex [second-from-last, last, first] it cannot decide if it is concave or convex. You can avoid this problem by making sure that no two points are close to each other and not having other pathological features in there. E.g. with: patch_399.reg-fixed.txt

The long answer is that that a region in which two of the connecting lines between neighboring points cross each other (i.e. if where the "left" and "right" sides of an edge change between "inside" and "outside") then the determination which pixels are "inside" and which are "outside" goes wrong.