def run_wave_soln(metadata, prev_suffix, curr_suffix, **args): # First, generate the master arc solution, based on generic arcs wsol_in_fn = '%s%s.p%s.fits' % (out_dir, 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) # local wave solutions for science or standards 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: # Check if the file has a dedicated arc associated with it ... # Only for Science and Std stars for now (sky not required at this stage) # (less critical for the rest anyway ...) # As per Mike I. pull request: if two arcs are present, find a solution # for both to later interpolate between them. # Restrict it to the first two arcs in the list (in case the feature is # being unknowingly used, avoid too much lost time). local_arcs = get_associated_calib(metadata,fn, 'arc') if local_arcs : for i in range(np.min([2,np.size(local_arcs)])): local_arc_fn = '%s%s.p%s.fits' % (out_dir, local_arcs[i], prev_suffix) local_wsol_out_fn = '%s%s.wsol.fits' % (out_dir, local_arcs[i]) if os.path.isfile(local_wsol_out_fn): continue print 'Deriving local wavelength solution for %s' % local_arcs[i] pywifes.derive_wifes_wave_solution(local_arc_fn, local_wsol_out_fn, **args) return
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) # local wave solutions for science or standards 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: # Check if the file has a dedicated arc associated with it ... # Only for Science and Std stars for now (sky not required at this stage) # (less critical for the rest anyway ...) # As per Mike I. pull request: if two arcs are present, find a solution # for both to later interpolate between them. # Restrict it to the first two arcs in the list (in case the feature is # being unknowingly used, avoid too much lost time). local_arcs = get_associated_calib(metadata,fn, 'arc') if local_arcs : for i in range(np.min([2,np.size(local_arcs)])): local_arc_fn = os.path.join(out_dir, '%s.p%s.fits' % (local_arcs[i], prev_suffix)) local_wsol_out_fn = os.path.join(out_dir, '%s.wsol.fits' % (local_arcs[i])) if os.path.isfile(local_wsol_out_fn): continue print('Deriving local wavelength solution for %s' % local_arcs[i]) pywifes.derive_wifes_wave_solution(local_arc_fn, local_wsol_out_fn, **args) return
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) # local wave solutions for science or standards 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: # Check if the file has a dedicated arc associated with it ... # Only for Science and Std stars for now (sky not required at this stage) # (less critical for the rest anyway ...) # As per Mike I. pull request: if two arcs are present, find a solution # for both to later interpolate between them. # Restrict it to the first two arcs in the list (in case the feature is # being unknowingly used, avoid too much lost time). local_arcs = get_associated_calib(metadata,fn, 'arc') if local_arcs : for i in range(np.min([2,np.size(local_arcs)])): local_arc_fn = os.path.join(out_dir, '%s.p%s.fits' % (local_arcs[i], prev_suffix))