Closed lkosz closed 3 years ago
Those corners are generated using the WCS file, computing the sky locations of the four corners of the image.
Can I find anywhere formula for it? Or maybe there is an application which makes it?
Yes, but it's not a trivial formula. https://github.com/dstndstn/astrometry.net/blob/main/util/sip.c#L115
Yes, it's quite complicated, but found other method:
#!/usr/bin/env python3
import numpy as np
from astropy import wcs
from astropy.io import fits
imagew=1280-1
imageh=960-1
wcsfile = fits.open('wcs.fits')
w = wcs.WCS(wcsfile[0].header)
corners = np.array([[0, 0], [imagew,0], [imagew,imageh], [0, imageh], [0, 0]], dtype=np.float32)
world = w.wcs_pix2world(corners, 0)
poly = ','.join(map(str, world.flatten()))
print(poly)
Hello
eg. link: https://www.legacysurvey.org/viewer/?ra=286.7403&dec=-12.4767&layer=unwise-neo6&poly=286.5333,-13.0876,287.3981,-12.4980,286.9463,-11.8656,286.0825,-12.4537,286.5333,-13.0876
On each recognition page there is "Legacy Surveys sky browser" link as above. Ra and dec are center of picture got from wcs file, but how is this "poly" array generated? It's a simple rotation of ra_min, ra_max, dec_min, dec_max around ra/dec center?