def _copy_optext_images(self): # open the object and background drizzle lists obj_list = Table.read(self.opt_names['OLIS'], format='ascii.no_header') bck_list = Table.read(self.opt_names['BLIS'], format='ascii.no_header') # go over one list for index in range(obj_list.nrows): # take and compose the filenames obj_img = config_utils.getDRIZZLE(obj_list[0][index].strip()) bck_img = config_utils.getDRIZZLE(bck_list[0][index].strip()) # open the fits file obj_fits = fits.open(obj_img, 'update') bck_fits = fits.open(bck_img, 'readonly') # replace the VAR- and the MOD- extension obj_fits['VAR'].data = bck_fits['VAR'].data obj_fits['MOD'].data = bck_fits['MOD'].data # close the files obj_fits.flush() obj_fits.close() bck_fits.close()
def _get_ext_names(self, drizzle_params): """Define the file names for extracting the drizzled spectra.""" ext_names = {} # check that a root name is given; # message and out if not if 'ROOT' not in drizzle_params: err_msg = 'Not root name given. Nothing to do!' raise aXeError(err_msg) # compose the filenames for the input list, the configuration file # and the OAF file ext_names['OLIS'] = drizzle_params['ROOT'] + '_2.lis' ext_names['BLIS'] = drizzle_params['ROOT'] + '_2.BCK.lis' ext_names['OAF'] = drizzle_params['ROOT'] + '_2.OAF' ext_names['DRZ_OAF'] = config_utils.getDRIZZLE(ext_names['OAF']) ext_names['BAF'] = drizzle_params['ROOT'] + '_2.BAF' ext_names['DRZ_BAF'] = config_utils.getDRIZZLE(ext_names['BAF']) ext_names['FITS'] = drizzle_params['ROOT'] + '.fits' ext_names['DRZ_FITS'] = config_utils.getDRIZZLE(ext_names['FITS']) ext_names['OPET'] = drizzle_params['ROOT'] + '_2.PET.fits' ext_names['DRZ_OPET'] = config_utils.getDRIZZLE(ext_names['OPET']) ext_names['BPET'] = drizzle_params['ROOT'] + '_2.BCK.PET.fits' ext_names['DRZ_BPET'] = config_utils.getDRIZZLE(ext_names['BPET']) ext_names['SPC'] = drizzle_params['ROOT'] + '_2.SPC.fits' ext_names['DRZ_SPC'] = config_utils.getDRIZZLE(ext_names['SPC']) ext_names['STP'] = drizzle_params['ROOT'] + '_2.STP.fits' ext_names['DRZ_STP'] = config_utils.getDRIZZLE(ext_names['STP']) ext_names['CONF'] = drizzle_params['ROOT'] + '.conf' ext_names['CON_CONF'] = config_utils.getCONF(ext_names['CONF']) # return the dictionary return ext_names
def _get_opt_names(self, drizzle_params): """Define the file names for the optimal extraction""" # make an empty dictionary opt_names = {} # check that a root name is given; # message and out if not if 'ROOT' not in drizzle_params: err_msg = 'Root name not given. Nothing to do!' raise aXeError(err_msg) # compose the filenames for the input list, the configuration file # and the OAF file opt_names['OLIS'] = drizzle_params['ROOT'] + '_2.lis' opt_names['BLIS'] = drizzle_params['ROOT'] + '_2.BCK.lis' opt_names['OAF'] = drizzle_params['ROOT'] + '_2.OAF' opt_names['DRZ_OAF'] = config_utils.getDRIZZLE(opt_names['OAF']) opt_names['BAF'] = drizzle_params['ROOT'] + '_2.BAF' opt_names['DRZ_BAF'] = config_utils.getDRIZZLE(opt_names['BAF']) opt_names['FITS'] = drizzle_params['ROOT'] + '.fits' opt_names['DRZ_FITS'] = config_utils.getDRIZZLE(opt_names['FITS']) opt_names['OPET'] = drizzle_params['ROOT'] + '_2_opt.PET.fits' opt_names['DRZ_OPET'] = config_utils.getDRIZZLE(opt_names['OPET']) opt_names['BPET'] = drizzle_params['ROOT'] + '_2_opt.BCK.PET.fits' opt_names['DRZ_BPET'] = config_utils.getDRIZZLE(opt_names['BPET']) opt_names['SPC'] = drizzle_params['ROOT'] + '_2_opt.SPC.fits' opt_names['DRZ_SPC'] = config_utils.getDRIZZLE(opt_names['SPC']) opt_names['STP'] = drizzle_params['ROOT'] + '_2_opt.STP.fits' opt_names['DRZ_STP'] = config_utils.getDRIZZLE(opt_names['STP']) opt_names['CONF'] = drizzle_params['ROOT'] + '.conf' opt_names['CON_CONF'] = config_utils.getCONF(opt_names['CONF']) # return the dictionary return opt_names