Exemplo n.º 1
0
from __future__ import division, print_function
"""
Makes the reference files necessary to do the final drizzling.

This needs to be run from the directory "reduce_acs.py" is in.  Also requires
ureka to be activated.
"""
import os
import shutil
import reduce_acs

ref_scale = 0.03
ref_filter = 'F606W'
refs_dir = 'drizzled_refs'

asnd, _ = reduce_acs.find_target_associations('/Volumes/ErikDroboData/data/ACS/pisc_dwarfs/',
                                              {'HI22': 'PiscA', 'HI23': 'PiscB'})

for i, (objnm, asns) in enumerate(asnd.items()):
    print('Making ref for', objnm, '- object', i+1, 'of', len(asnd))

    refasn = [asn for asn in asns if asn.filter == ref_filter]
    if len(refasn) == 0:
        raise ValueError('Found no association with filter {0} for obj {1}'.format(ref_filter, objnm))
    elif len(refasn) > 1:
        print('Found multiple associations with filter', ref_filter, 'using first one')
    refasn = refasn[:1]

    outnm = objnm + '_ref'
    workingdir = os.path.join(refs_dir, objnm)
    reduce_acs.do_drizzle(refasn, outnm, workingdir, final_scale=ref_scale, final_wcs=True)
Exemplo n.º 2
0
This needs to be run from the directory "reduce_acs.py" is in.  Also requires
ureka to be activated.
"""
import os
import reduce_acs

# the jref seems to *sometimes* be needed... not clear on when exactly or why
os.environ['jref'] = '/Users/erik/astrodata/HST_jref'

refs_dir = 'drizzled_refs'
pixfrac = 0.6
build = False
dirprefix = 'drizzled_build_' if build else 'drizzled_'
final_wht_type = None

asnd, _ = reduce_acs.find_target_associations('raw', {'HI22': 'PiscA', 'HI23': 'PiscB'})

for objnm, asns in asnd.items():
    reffn = os.path.abspath(os.path.join(refs_dir, objnm + '_ref_drc_sci.fits'))
    for i, asn in enumerate(asns):
        print('Starting', i+1, 'of', len(asns), 'associations for ', objnm)
        if final_wht_type is None:
            whtending = ''
        else:
            whtending = '_' + final_wht_type
        reduce_acs.do_drizzle([asn], objnm + '_' + asn.filter + whtending, dirprefix,
                              final_refimage=reffn, final_wcs=True,
                              final_pixfrac=pixfrac, final_wht_type=final_wht_type,
                              build=build)

    print('Doing combination of all associations for', objnm)