Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if isACS:
flc = pyfits.open(file, mode='update')
if flc[0].header['INSTRUME'] == 'ACS':
changed_filter = True
flc[0].header['FILTER1'] = 'CLEAR1L'
flc[0].header['FILTER2'] = 'F814W'
flc.flush()
flc.close()
else:
changed_filter = False
flc.close()
else:
changed_filter = False
# Run updatewcs
updatewcs.updatewcs(file, verbose=False)
# Change back
if changed_filter:
flc = pyfits.open(file, mode='update')
flc[0].header['FILTER1'] = 'CLEAR2L'
flc[0].header['FILTER2'] = 'G800L'
flc.flush()
flc.close()
### Make ASN
asn = asnutil.ASNTable(grism['files'], output=grism['product'])
asn.create()
asn.write()
if isACS:
bits = 64+32
from drizzlepac import updatehdr
from drizzlepac.astrodrizzle import AstroDrizzle
#################
########## Direct image processing
#################
### Copy FLT files from ../RAW
isACS = '_flc' in direct['files'][0]
isWFPC2 = '_c0m' in direct['files'][0]
if not skip_direct:
for file in direct['files']:
crclean = isACS & (len(direct['files']) == 1)
fresh_flt_file(file, crclean=crclean)
updatewcs.updatewcs(file, verbose=False)
### Make ASN
if not isWFPC2:
asn = asnutil.ASNTable(inlist=direct['files'], output=direct['product'])
asn.create()
asn.write()
### Initial grism processing
skip_grism = (grism == {}) | (grism is None) | (len(grism) == 0)
if not skip_grism:
for file in grism['files']:
fresh_flt_file(file)
# Need to force F814W filter for updatewcs
if isACS:
flc = pyfits.open(file, mode='update')