transientskp / tkp

A transients-discovery pipeline for astronomical image-based surveys
http://docs.transientskp.org/
BSD 2-Clause "Simplified" License
19 stars 14 forks source link

WSClean images with RA>180 not handled correctly #572

Closed AntoniaR closed 2 years ago

AntoniaR commented 4 years ago

Images with RA values >180 made using WSClean have their WCS defined as -180<RA<180 rather than 0<RA<360. TraP can use the negative RA values however source association fails.

Currently this is fixed by editing the fits header of the images with

import astropy.io.fits as pyfits

hdulist=pyfits.open(img, mode='update')
prihdr=hdulist[0].header
if hdulist[0].header['CRVAL1']<0.:
    ra=hdulist[0].header['CRVAL1']+360.
    prihdr['CRVAL1']=ra
hdulist.flush()

However, we probably cannot assume we can edit the fits images directly so we need to isolate the source association issue or convert the negative RA values automatically in TraP

AntoniaR commented 4 years ago

@bartscheers Do you know if this would be straight forward to fix in the source association step?

TraP can handle -180<RA<180 but the source association in the database cannot... I guess it may affect the queries that were specifically designed for the 0-360 boundary.

Alternatively we will have to check and convert the RA from every source extraction using the code above.

bartscheers commented 4 years ago

As far as I can recall, source association assumes 0<ra<360. Sources near the 360-0 border are associated using the Cartesian coordinates.

AntoniaR commented 4 years ago

Ok, thanks! That sounds complex to edit as we would then need to also look at the -180 - 180 border too. I think it makes sense to convert the co-ordinates to 0-360 before inserting into the database.

AntoniaR commented 3 years ago

The fix in Pull Request #592 seems to work well in solving this WSClean -180<ra<180 issue. I convert the RAs of the image centres and the source positions to 0<ra<360 prior to insertion to the database.