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

pathologic casa regions cause bad clean masks #201

Closed AHorneffer closed 7 years ago

AHorneffer commented 7 years ago

This is related to #200 and #144.

When using a hand-made mask with factor, one can define a polygon in which two of the edges of the polygon cross each other. In this case the "right" side of the edge goes from "inside" to "outside" (or vice versa), which the code in Factor cannot handle. See below for an example of such a pathologic case.

IMHO Factor doesn't really need to handle this "correctly", it would be enough if it can detect it and then complain to the user. (But right now I don't have a good idea how to detect that elegantly.)

P.S. Factor also gets confused if two non-neighboring points are on top of each other. (Neighboring points that are too close to each other get thrown out.)

pathologic-clean-region

AHorneffer commented 7 years ago

I found and added some code to detect intersections of the line-segments. Right now it raises a ValueError if it detects an intersection in a hand-made polygon. Is that what we want it to do? Shall I push the code to the master branch?

P.S. another case of what can happen when line-segments intersect below: pathologic-clean-region2

darafferty commented 7 years ago

I think raising an error is fine -- most such cases are probably accidental, anyway.