Example #1
0
search_radius = args.search_radius * u.arcsec

logger.info("Mask config file %s" % args.mask)

logger.info("Processing images in current folder")

collec = ImageFileCollection('./',
                             glob_include="*drz.fits",
                             ext='SCI',
                             keywords=[
                                 "targname", "CRVAL1", "CRVAL2", "exptime",
                                 "naxis1", "naxis2", "wcsname"
                             ])

# put largest image first
collec.sort(("naxis1", "naxis2"))
table = collec.summary

if args.gaia:
    # get image center
    ra_targ = table['CRVAL1'][0]
    print(table)
    dec_targ = table['CRVAL2'][0]
    logger.info(
        "Looking Gaia sources around (%.3f, %.3f) with radius %.3f with less than %.1f mas/yr"
        % (ra_targ, dec_targ, search_radius.value, proper_motion_threshold))
    # improve this using a box like the image https://astroquery.readthedocs.io/en/latest/gaia/gaia.html (width and height)
    coord = SkyCoord(ra=ra_targ, dec=dec_targ, unit=(u.deg, u.deg))
    # query Gaia sources and write the result
    ref_cat = 'gaia_hst.csv'