Esempio n. 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  = 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
Esempio n. 2
0
def run_superflat_mef(metadata, prev_suffix, curr_suffix, source):
    if source == 'dome':
        if os.path.isfile(super_dflat_fn):
            in_fn  = super_dflat_fn
        else:
            in_fn = super_dflat_raw
        out_fn = super_dflat_mef

    elif source == 'twi':
        if os.path.isfile(super_tflat_fn):
            in_fn  = super_tflat_fn
        else :
            in_fn = super_tflat_raw
        out_fn = super_tflat_mef

    else:
        raise ValueError('Flatfield type not recognized')
    # check the slitlet definition file
    if os.path.isfile(slitlet_def_fn):
        slitlet_fn = slitlet_def_fn
    else:
        slitlet_fn=None
    # run it!
    print('Generating MEF %sflat' % source)
    pywifes.wifes_slitlet_mef(in_fn, out_fn,
                              data_hdu=my_data_hdu,
                              slitlet_def_file=slitlet_fn)
    return
Esempio n. 3
0
def run_superflat_mef(metadata, prev_suffix, curr_suffix, source):
    if source == 'dome':
        if os.path.isfile(super_dflat_fn):
            in_fn  = super_dflat_fn
        else:
            in_fn = super_dflat_raw
        out_fn = super_dflat_mef

    elif source == 'twi':
        if os.path.isfile(super_tflat_fn):
            in_fn  = super_tflat_fn
        else :
            in_fn = super_tflat_raw
        out_fn = super_tflat_mef

    else:
        raise ValueError, 'Flatfield type not recognized'
    # check the slitlet definition file
    if os.path.isfile(slitlet_def_fn):
        slitlet_fn = slitlet_def_fn
    else:
        slitlet_fn=None
    # run it!
    print 'Generating MEF %sflat' % source
    pywifes.wifes_slitlet_mef(in_fn, out_fn,
                              data_hdu=my_data_hdu,
                              slitlet_def_file=slitlet_fn)
    return
Esempio n. 4
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
Esempio n. 5
0
            in_fn  = super_tflat_fn
        else :
            in_fn = super_tflat_raw
        out_fn = super_tflat_mef

    else:
        raise ValueError('Flatfield type not recognized')
    # check the slitlet definition file
    if os.path.isfile(slitlet_def_fn):
        slitlet_fn = slitlet_def_fn
    else:
        slitlet_fn=None
    # run it!
    print('Generating MEF %sflat' % source)
    pywifes.wifes_slitlet_mef(in_fn, out_fn,
                              data_hdu=my_data_hdu,
                              slitlet_def_file=slitlet_fn)
    return

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: