ratt-ru / breizorro

Image masking tool(s) possibly of Breton spiritual origin
GNU General Public License v3.0
5 stars 2 forks source link

Manual mask not parsing region files #18

Open AstroRipples opened 2 years ago

AstroRipples commented 2 years ago

Hi all. I've managed to get breizorro working now (thanks for adding the documentation yesterday!) but I'm encountering a new issue.

I'm trying to use the --subtract and --merge options to include very faint (but real) emission while excluding residual artefacts, but I'm encountering problems. Specifically, breizorro is not finding the coordinate frame when reading the DS9 region file:

WARNING: A coordinate frame was not found for region: "circle(15:57:11.3383,+27:22:35.913,206.999")", skipping. [regions.io.ds9.read]
breizorro.breizorro - 2022-10-13 09:25:24,752 INFO - Subtracting 0 regions from exc.reg

It seems odd that regions.io.ds9.read is failing to extract the coordinate frame from a region file I made using DS9 🤔 I've tried both in pixel coordinates (the image frame in DS9) and WCS, but no dice. Is a specific region file/coordinate frame format required by breizorro, or is something else underlying the problem?

bennahugo commented 2 years ago

I noticed that the latest astropy-provided reader is ultra-flakey compared to what was provided in version regions <0.5. DS9 files that are perfectly valid reading fails to read correctly with the new parsers. Unfortunately this is all I can say on the subject - haven't really used breizorro myself.

bennahugo commented 2 years ago

See e.g. https://github.com/ratt-ru/CubiCal/pull/465 on how to roll back with the API differences

AstroRipples commented 2 years ago

Okay, underlying issue found 🥳 The WSclean image FITS header is taking values: -180 < CRVAL1 < 180, whereas it looks like breizorro and MakeMask both expect 0 < CRVAL1 < 360.

In this instance, the value was -120.41416666; changing the value to 360 - (-120.4141666) = 239.5858333... (same as the DDF image FITS header) fixes the problem.

cyriltasse commented 2 years ago

well done!