Beispiel #1
0
def run_slitlet_mef(metadata, prev_suffix, curr_suffix, ns=False):
    full_obs_list = get_full_obs_list(metadata)
    sci_obs_list  = get_sci_obs_list(metadata)
    std_obs_list  = get_std_obs_list(metadata)
    sky_obs_list  = get_sky_obs_list(metadata)
    ns_proc_list = sci_obs_list+std_obs_list
    # check the slitlet definition file
    if os.path.isfile(slitlet_def_fn):
        slitlet_fn = slitlet_def_fn
    else:
        slitlet_fn=None
    for fn in full_obs_list:
        in_fn  = '%s%s.p%s.fits' % (out_dir, fn, prev_suffix)
        out_fn = '%s%s.p%s.fits' % (out_dir, fn, curr_suffix)
        if skip_done and os.path.isfile(out_fn):
            continue
        print 'Creating MEF file for %s' % in_fn.split('/')[-1]
        if ns and fn in ns_proc_list:
            sky_fn = '%s%s.s%s.fits' % (out_dir, fn, curr_suffix)
            pywifes.wifes_slitlet_mef_ns(in_fn, out_fn, sky_fn,
                                         data_hdu=my_data_hdu,
                                         slitlet_def_file=slitlet_fn)
        else:
            pywifes.wifes_slitlet_mef(in_fn, out_fn, data_hdu=my_data_hdu,
                                      slitlet_def_file=slitlet_fn)
        gc.collect()
    return
Beispiel #2
0
def run_slitlet_mef(metadata, prev_suffix, curr_suffix, ns=False):
    full_obs_list = get_full_obs_list(metadata)
    sci_obs_list  = get_sci_obs_list(metadata)
    std_obs_list  = get_std_obs_list(metadata)
    sky_obs_list  = get_sky_obs_list(metadata)
    ns_proc_list = sci_obs_list+std_obs_list
    # check the slitlet definition file
    if os.path.isfile(slitlet_def_fn):
        slitlet_fn = slitlet_def_fn
    else:
        slitlet_fn=None
    for fn in full_obs_list:
        in_fn  = os.path.join(out_dir, '%s.p%s.fits' % (fn, prev_suffix))
        out_fn = os.path.join(out_dir, '%s.p%s.fits' % (fn, curr_suffix))
        if skip_done and os.path.isfile(out_fn):
            continue
        print('Creating MEF file for %s' % in_fn.split('/')[-1])
        if ns and fn in ns_proc_list:
            sky_fn = os.path.join(out_dir, '%s.s%s.fits' % (fn, curr_suffix))
            pywifes.wifes_slitlet_mef_ns(in_fn, out_fn, sky_fn,
                                         data_hdu=my_data_hdu,
                                         slitlet_def_file=slitlet_fn)
        else:
            pywifes.wifes_slitlet_mef(in_fn, out_fn, data_hdu=my_data_hdu,
                                      slitlet_def_file=slitlet_fn)
        gc.collect()
    return
Beispiel #3
0
    ns_proc_list = sci_obs_list+std_obs_list
    # check the slitlet definition file
    if os.path.isfile(slitlet_def_fn):
        slitlet_fn = slitlet_def_fn
    else:
        slitlet_fn=None
    for fn in full_obs_list:
        in_fn  = os.path.join(out_dir, '%s.p%s.fits' % (fn, prev_suffix))
        out_fn = os.path.join(out_dir, '%s.p%s.fits' % (fn, curr_suffix))
        if skip_done and os.path.isfile(out_fn):
            continue
        print('Creating MEF file for %s' % in_fn.split('/')[-1])
        if ns and fn in ns_proc_list:
            sky_fn = os.path.join(out_dir, '%s.s%s.fits' % (fn, curr_suffix))
            pywifes.wifes_slitlet_mef_ns(in_fn, out_fn, sky_fn,
                                         data_hdu=my_data_hdu,
                                         slitlet_def_file=slitlet_fn)
        else:
            pywifes.wifes_slitlet_mef(in_fn, out_fn, data_hdu=my_data_hdu,
                                      slitlet_def_file=slitlet_fn)
        gc.collect()
    return

#------------------------------------------------------
# Wavelength solution
def run_wave_soln(metadata, prev_suffix, curr_suffix, **args):
    # First, generate the master arc solution, based on generic arcs
    wsol_in_fn  = os.path.join(out_dir, '%s.p%s.fits' % ( metadata['arc'][0],
                                     prev_suffix))
    print('Deriving master wavelength solution from %s' % wsol_in_fn.split('/')[-1])
    pywifes.derive_wifes_wave_solution(wsol_in_fn, wsol_out_fn,
                                       **args)