Beispiel #1
0
def run_obs_coadd(metadata,
                  prev_suffix,
                  curr_suffix,
                  method='sum',
                  scale=None):
    for obs in (metadata['sci'] + metadata['std']):
        # if just one, then copy it
        if len(obs['sci']) == 1:
            fn = obs['sci'][0]
            in_fn = '%s%s.p%s.fits' % (out_dir, fn, prev_suffix)
            out_fn = '%s%s.p%s.fits' % (out_dir, fn, curr_suffix)
            print 'Copying image %s' % in_fn.split('/')[-1]
            pywifes.imcopy(in_fn, out_fn)
        # coadd sci frames!
        else:
            in_fn_list = [
                '%s%s.p%s.fits' % (out_dir, fn, prev_suffix)
                for fn in obs['sci']
            ]
            out_fn = '%s%s.p%s.fits' % (out_dir, obs['sci'][0], curr_suffix)
            print 'Coadding images for %s' % in_fn_list[0].split('/')[-1]
            pywifes.imcombine_mef(in_fn_list,
                                  out_fn,
                                  scale=scale,
                                  method=method)
    return
Beispiel #2
0
def run_obs_coadd(metadata,
                  prev_suffix,
                  curr_suffix,
                  method='sum',
                  scale=None):
    for obs in (metadata['sci'] + metadata['std']):
        # if just one, then copy it
        if len(obs['sci']) == 1:
            fn = obs['sci'][0]
            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('Copying image %s' % in_fn.split('/')[-1])
            pywifes.imcopy(in_fn, out_fn)
        # coadd sci frames!
        else:
            in_fn_list = [
                os.path.join(out_dir, '%s.p%s.fits' % (fn, prev_suffix))
                for fn in obs['sci']
            ]
            out_fn = os.path.join(out_dir,
                                  '%s.p%s.fits' % (obs['sci'][0], curr_suffix))
            print('Coadding images for %s' % in_fn_list[0].split('/')[-1])
            pywifes.imcombine_mef(in_fn_list,
                                  out_fn,
                                  scale=scale,
                                  method=method)
    return
Beispiel #3
0
def run_obs_coadd(metadata, prev_suffix, curr_suffix,
                  method='sum', scale=None):
    for obs in (metadata['sci']+metadata['std']):
        # if just one, then copy it
        if len(obs['sci']) == 1:
            fn = obs['sci'][0]
            in_fn  = '%s%s.p%s.fits' % (out_dir, fn, prev_suffix)
            out_fn = '%s%s.p%s.fits' % (out_dir, fn, curr_suffix)
            print 'Copying image %s' % in_fn.split('/')[-1]
            pywifes.imcopy(in_fn, out_fn)            
        # coadd sci frames!
        else:
            in_fn_list = ['%s%s.p%s.fits' % (out_dir, fn, prev_suffix)
                          for fn in obs['sci']]
            out_fn = '%s%s.p%s.fits' % (out_dir, obs['sci'][0], curr_suffix)
            print 'Coadding images for %s' % in_fn_list[0].split('/')[-1]
            pywifes.imcombine_mef(in_fn_list, out_fn,
                                  scale=scale,
                                  method=method)
    return
Beispiel #4
0
        if len(obs['sci']) == 1:
            fn = obs['sci'][0]
            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('Copying image %s' % in_fn.split('/')[-1])
            pywifes.imcopy(in_fn, out_fn)            
        # coadd sci frames!
        else:
            in_fn_list = [os.path.join(out_dir, '%s.p%s.fits' % (fn, prev_suffix))
                          for fn in obs['sci']]
            out_fn = os.path.join(out_dir, '%s.p%s.fits' % (obs['sci'][0], curr_suffix))
            print('Coadding images for %s' % in_fn_list[0].split('/')[-1])
            pywifes.imcombine_mef(in_fn_list, out_fn,
                                  scale=scale,
                                  method=method)
    return

#------------------------------------------------------
# Flatfield Response
def run_flat_response(metadata, prev_suffix, curr_suffix,
                      mode='all'):
    # now fit the desired style of response function
    print('Generating flatfield response function')
    if mode == 'all':
        pywifes.wifes_2dim_response(super_dflat_mef,
                                    super_tflat_mef,
                                    flat_resp_fn,
                                    wsol_fn=wsol_out_fn)
    elif mode == 'dome':