示例#1
0
def run_bias_sub(metadata, prev_suffix, curr_suffix,
                 method='sub', **args):
    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)
    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
        # figure out which bias to subtract
        local_biases = get_associated_calib(metadata,fn, 'bias')
        if local_biases:
            local_bias_fn = get_associated_calib(metadata,fn,'bias')[0]
            local_superbias = '%s%s.fits' % (out_dir, local_bias_fn+'.lsb')
            bias_fit_fn = '%s%s.fits' % (out_dir, local_bias_fn+'.lsb_fit')
            bias_type = 'local'
        else:
            bias_fit_fn = superbias_fit_fn
            bias_type = 'global'
        # subtract it!
        print 'Subtracting %s superbias for %s' % (
            bias_type, in_fn.split('/')[-1])
        if method == 'copy':
            pywifes.imcopy(in_fn, out_fn)
        else:
            pywifes.imarith(in_fn, '-', bias_fit_fn, out_fn, 
                            data_hdu=my_data_hdu)
    return
示例#2
0
def run_bias_sub(metadata, prev_suffix, curr_suffix,
                 method='sub', **args):
    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)
    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
        # figure out which bias to subtract
        local_biases = get_associated_calib(metadata,fn, 'bias')
        if local_biases:
            local_bias_fn = get_associated_calib(metadata,fn,'bias')[0]
            local_superbias = os.path.join(out_dir, '%s.fits' % (local_bias_fn+'.lsb'))
            bias_fit_fn = os.path.join(out_dir, '%s.fits' % (local_bias_fn+'.lsb_fit'))
            bias_type = 'local'
        else:
            bias_fit_fn = superbias_fit_fn
            bias_type = 'global'
        # subtract it!
        print('Subtracting %s superbias for %s'%(bias_type, in_fn.split('/')[-1]))
        if method == 'copy':
            pywifes.imcopy(in_fn, out_fn)
        else:
            pywifes.imarith(in_fn, '-', bias_fit_fn, out_fn, 
                            data_hdu=my_data_hdu)
    return
示例#3
0
        # figure out which bias to subtract
        local_biases = get_associated_calib(metadata,fn, 'bias')
        if local_biases:
            local_bias_fn = get_associated_calib(metadata,fn,'bias')[0]
            local_superbias = os.path.join(out_dir, '%s.fits' % (local_bias_fn+'.lsb'))
            bias_fit_fn = os.path.join(out_dir, '%s.fits' % (local_bias_fn+'.lsb_fit'))
            bias_type = 'local'
        else:
            bias_fit_fn = superbias_fit_fn
            bias_type = 'global'
        # subtract it!
        print('Subtracting %s superbias for %s'%(bias_type, in_fn.split('/')[-1]))
        if method == 'copy':
            pywifes.imcopy(in_fn, out_fn)
        else:
            pywifes.imarith(in_fn, '-', bias_fit_fn, out_fn, 
                            data_hdu=my_data_hdu)
    return

#------------------------------------------------------
# Generate super-flat
def run_superflat(metadata, prev_suffix, curr_suffix,
                  source, scale=None, method='median'):
    if source == 'dome':
        flat_list = [
            os.path.join(out_dir, '%s.p%s.fits' % (x, prev_suffix))
            for x in metadata['domeflat']]
        out_fn = super_dflat_raw
    elif source == 'twi':
        flat_list = [
            os.path.join(out_dir, '%s.p%s.fits' % (x, prev_suffix))
            for x in metadata['twiflat']]