Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
TBD
"""
from drizzlepac import updatehdr
from stwcs import updatewcs
from drizzlepac.astrodrizzle import AstroDrizzle
wcs_log = Table.read('{0}_wcs.log'.format(direct['product']),
format='ascii.commented_header')
wcs_hdu = pyfits.open('{0}_wcs.fits'.format(direct['product']))
if get_fresh_flt:
for file in grism['files']:
fresh_flt_file(file)
updatewcs.updatewcs(file, verbose=False)
direct_flt = pyfits.open(direct['files'][0])
ref_catalog = direct_flt['SCI',1].header['WCSNAME']
#### User-defined shifts
if xyscale is not None:
# Use user-defined shifts
xsh, ysh, rot, scale = xyscale
tmp_wcs = '/tmp/{0}_tmpwcs.fits'.format(str(direct['product']))
ext = len(wcs_hdu)-1
wcs_hdu[ext].writeto(tmp_wcs, clobber=True)
for file in grism['files']:
updatehdr.updatewcs_with_shift(file, tmp_wcs,
xsh=xsh,