def fix_headers(filename,what): hadmrFITS.copy_key(header_base,filename) hadmrFITS.delete_key(filename,kw_pol_ret25) hadmrFITS.delete_key(filename,kw_pol_ret50) # which emodulation? if 'diff' in filename: demod=kw_pol_demod_diff else: demod=kw_pol_demod_ratio hadmrFITS.write_newkey(filename,[kw_pol_demod, demod, kw_pol_demod_com]) stokes=[kw_pol_stokes, kw_pol_stokes_v, kw_pol_stokes_com] if what=='V': hadmrFITS.write_newkey(filename,stokes) elif what=='Q': stokes[1]=kw_pol_stokes_q hadmrFITS.write_newkey(filename,stokes) elif what=='U': stokes[1]=kw_pol_stokes_u hadmrFITS.write_newkey(filename,stokes) elif what=='N': stokes[1]=kw_pol_stokes_n hadmrFITS.write_newkey(filename,stokes) elif what=='I': stokes[1]=kw_pol_stokes_i hadmrFITS.write_newkey(filename,stokes)
for i in indexlist: qq[i]=1 ccf_noise=(sum(compress(qq,CCF_slope**2)/compress(qq,CCF_noise_tot[1:-1]**2)))**(-0.5) WLOG('info',log_opt,'Estimated RV accuracy on stellar spectrum: %.2f[m/s]' %(meanpondref)) WLOG('info',log_opt,'Estimated RV accuracy on CCF : %.2f[m/s]' %(ccf_noise*1000.)) # # archive in fits # WLOG('',log_opt,'Archiving CCF on file: '+cor_fitsfilename[fiber]) hadmrFITS.Save_ccf(RV_CCF,CCF,average_CCF,cor_fitsfilename[fiber],ccf_mask,\ sum(CCF_max)/sum(pix_passed_all),sum(tot_line[ccf_order_range]),abs(100*CCF_res[0]),CCF_res[1],CCF_res[2]*2.3548,RV,_kw_CCF) # Add CCF photon noise keyword kw_CCF_NOISE[1]=ccf_noise hadmrFITS.write_newkey(cor_fitsfilename[fiber],kw_CCF_NOISE) # # copy e2ds file kw into CCF # hadmrFITS.copy_key(I_e2ds_fitsfilename,cor_fitsfilename[fiber]) # Update DVRMS keyword kw_DVRMS[1]=meanpondref hadmrFITS.update_key(cor_fitsfilename[fiber],kw_DVRMS) # Add flux correction keywords kw_FLUX_CORR_MIN[1]=corr.min() kw_FLUX_CORR_MAX[1]=corr.max() hadmrFITS.write_newkey(cor_fitsfilename[fiber],kw_FLUX_CORR_MIN) hadmrFITS.write_newkey(cor_fitsfilename[fiber],kw_FLUX_CORR_MAX)
th_file=os.path.join(dirfits,dic_db['TH_'+fiber][1]) wave[fiber],param_ll[fiber],param_x=hadmrFITS.get_e2ds_ll(th_file,_kw_TH_CAL_) WLOG('',log_opt,'Wavelength calibration is set using '+os.path.split(th_file)[1]) ############################# # Save E2DSFF on fits file # ############################# WLOG('',log_opt,'Saving E2DS spectrum of Fiber '+fiber+' in '+os.path.split(e2ds_fitsfilename[fiber])[1]) hadmrFITS.write_data(e2ds_fitsfilename[fiber],e2dsff[fiber]) # Copy keywords of the raw frame hadmrFITS.copy_key(fitsfilename,e2ds_fitsfilename[fiber]) hadmrFITS.write_newkey(e2ds_fitsfilename[fiber],kw_version) hadmrFITS.write_newkey(e2ds_fitsfilename[fiber],kw_CCD_SIGDET) hadmrFITS.write_newkey(e2ds_fitsfilename[fiber],kw_CCD_CONAD) # Copy keywords of the localization frame kw_LOCO_FILE[1]=dic_db['LOC_'+fiber][1] hadmrFITS.write_newkey(e2ds_fitsfilename[fiber],kw_LOCO_FILE) hadmrFITS.copy_keys_root(loco_file,e2ds_fitsfilename[fiber],kw_root_drs_loc) # Copy keywords of the flat field frame kw_FLAT_FILE[1]=dic_db['FLAT_'+fiber][1] hadmrFITS.write_newkey(e2ds_fitsfilename[fiber],kw_FLAT_FILE) hadmrFITS.copy_keys_root(flat_file,e2ds_fitsfilename[fiber],kw_root_drs_flat) # Copy keywords of the blaze frame kw_BLAZE_FILE[1]=dic_db['BLAZE_'+fiber][1] hadmrFITS.write_newkey(e2ds_fitsfilename[fiber],kw_BLAZE_FILE)