def run_superbias(metadata, prev_suffix, curr_suffix, method='row_med', **args): bias_list = [ os.path.join(out_dir, '%s.p%s.fits' % (x, prev_suffix)) for x in metadata['bias'] ] print('Calculating Global Superbias') pywifes.imcombine(bias_list, superbias_fn, data_hdu=my_data_hdu) # decide what bias model you will actually subtract - could be just data if method == 'fit' or method == 'row_med': # Fit a smart surface to the bias or take the median # A bit experimental so far ... but you know what you are doing, right ? pywifes.generate_wifes_bias_fit(superbias_fn, superbias_fit_fn, data_hdu=my_data_hdu, method=method, **args) else: pywifes.imcopy(superbias_fn, superbias_fit_fn) # generate local superbiases for any science frames sci_obs_list = get_sci_obs_list(metadata) std_obs_list = get_std_obs_list(metadata) for fn in (sci_obs_list + std_obs_list): # Find if there is an associated bias (or more ?) local_biases = get_associated_calib(metadata, fn, 'bias') if local_biases: local_bias_fn = get_associated_calib(metadata, fn, 'bias')[0] print('Calculating Local Superbias for %s' % local_bias_fn) local_superbias = os.path.join( out_dir, '%s.fits' % (local_bias_fn + '.lsb')) local_superbias_fit = os.path.join( out_dir, '%s.fits' % (local_bias_fn + '.lsb_fit')) if os.path.isfile(local_superbias_fit): continue # step 1 - coadd biases local_biases_filename = [ os.path.join(out_dir, '%s.p%s.fits' % (x, prev_suffix)) for x in local_biases ] pywifes.imcombine(local_biases_filename, local_superbias, data_hdu=my_data_hdu) # step 2 - generate fit! if method == 'fit' or method == 'row_med': pywifes.generate_wifes_bias_fit(local_superbias, local_superbias_fit, data_hdu=my_data_hdu, method=method, **args) else: pywifes.imcopy(local_superbias, local_superbias_fit) return
def run_superbias(metadata, prev_suffix, curr_suffix, method='row_med', **args): bias_list = [ '%s%s.p%s.fits' % (out_dir, x, prev_suffix) for x in metadata['bias']] print 'Calculating Global Superbias' pywifes.imcombine(bias_list, superbias_fn, data_hdu=my_data_hdu) # decide what bias model you will actually subtract - could be just data if method == 'fit' or method == 'row_med': # Fit a smart surface to the bias or take the median # A bit experimental so far ... but you know what you are doing, right ? pywifes.generate_wifes_bias_fit( superbias_fn, superbias_fit_fn, data_hdu=my_data_hdu, method=method, **args) else: pywifes.imcopy(superbias_fn, superbias_fit_fn) # generate local superbiases for any science frames sci_obs_list = get_sci_obs_list(metadata) std_obs_list = get_std_obs_list(metadata) for fn in (sci_obs_list + std_obs_list): # Find if there is an associated bias (or more ?) local_biases = get_associated_calib(metadata,fn, 'bias') if local_biases: local_bias_fn = get_associated_calib(metadata,fn,'bias')[0] print 'Calculating Local Superbias for %s' % local_bias_fn local_superbias = '%s%s.fits' % (out_dir, local_bias_fn+'.lsb') local_superbias_fit = '%s%s.fits' % (out_dir, local_bias_fn+'.lsb_fit') if os.path.isfile(local_superbias_fit): continue # step 1 - coadd biases local_biases_filename = [ '%s%s.p%s.fits' % (out_dir, x, prev_suffix) for x in local_biases] pywifes.imcombine(local_biases_filename,local_superbias, data_hdu=my_data_hdu) # step 2 - generate fit! if method == 'fit' or method == 'row_med': pywifes.generate_wifes_bias_fit(local_superbias, local_superbias_fit, data_hdu=my_data_hdu, method=method, **args) else: pywifes.imcopy(local_superbias, local_superbias_fit) return
#------------------------------------------------------ # Generate super-bias def run_superbias(metadata, prev_suffix, curr_suffix, method='row_med', **args): bias_list = [ os.path.join(out_dir, '%s.p%s.fits' % (x, prev_suffix)) for x in metadata['bias']] print('Calculating Global Superbias') pywifes.imcombine(bias_list, superbias_fn, data_hdu=my_data_hdu) # decide what bias model you will actually subtract - could be just data if method == 'fit' or method == 'row_med': # Fit a smart surface to the bias or take the median # A bit experimental so far ... but you know what you are doing, right ? pywifes.generate_wifes_bias_fit( superbias_fn, superbias_fit_fn, data_hdu=my_data_hdu, method=method, **args) else: pywifes.imcopy(superbias_fn, superbias_fit_fn) # generate local superbiases for any science frames sci_obs_list = get_sci_obs_list(metadata) std_obs_list = get_std_obs_list(metadata) for fn in (sci_obs_list + std_obs_list): # Find if there is an associated bias (or more ?) local_biases = get_associated_calib(metadata,fn, 'bias') if local_biases: local_bias_fn = get_associated_calib(metadata,fn,'bias')[0] print('Calculating Local Superbias for %s' % local_bias_fn) local_superbias = os.path.join(out_dir, '%s.fits' % (local_bias_fn+'.lsb')) local_superbias_fit = os.path.join(out_dir, '%s.fits' % (local_bias_fn+'.lsb_fit')) if os.path.isfile(local_superbias_fit):