def testOrderMerged(self): """Merge order-merged hermes spectra NO vrad (Feige 66)""" temp = '/STER/mercator/hermes/%s/reduced/%s_HRF_OBJ_ext_CosmicsRemoved_log_merged_c.fits' objlist = [('20090619', '237033'), ('20090701', '240226'), ('20090712', '241334'), ('20090712', '241335'), ('20100107', '00268012'), ('20100120', '00272619'), ('20100120', '00272620'), ('20100203', '00273577'), ('20100203', '00273578'), ('20100303', '00275671'), ('20100303', '00275672'), ('20100410', '00281505'), ('20100519', '00284636'), ('20110222', '00334558'), ('20110319', '00336547'), ('20110324', '00339848'), ('20110401', '00342273'), ('20110402', '00342363'), ('20110406', '00342699'), ('20110408', '00342896'), ('20120107', '00391289'), ('20120110', '00391633'), ('20120116', '00392217'), ('20120127', '00393151'), ('20120209', '00394175'), ('20120330', '00399697'), ('20120420', '00404769'), ('20120506', '00406531'), ('20130106', '00445346'), ('20130215', '00452556'), ('20130406', '00457718'), ('20130530', '00474128')] mergeList = [temp % o for o in objlist] #wtotal, f = fits.read_spectrum(mergeList[0]) #ftotal = np.zeros_like(f) #for ifile in mergeList: #w, f = fits.read_spectrum(ifile) #ftotal += np.interp(wtotal,w,f) #pl.plot(wtotal, ftotal) wave, flux, header = hermes.merge_hermes_spectra(mergeList, sigma=3, offset=None, base='average') #pl.plot(wave, flux) #pl.show() #-- Test that cosmics are removed self.assertNoCosmic(wave, flux, (4362.7, 4362.9)) self.assertNoCosmic(wave, flux, (4974.2, 4974.4)) self.assertNoCosmic(wave, flux, (5656.1, 5656.3)) self.assertNoCosmic(wave, flux, (6161.7, 6161.9)) self.assertNoCosmic(wave, flux, (6166.5, 6166.8), sigma=4) self.assertNoCosmic(wave, flux, (6200.2, 6200.5)) self.assertNoCosmic(wave, flux, (6546.9, 6547.1)) self.assertNoCosmic(wave, flux, (7996.8, 7997.0)) self.assertNoCosmic(wave, flux, (8001.7, 8001.9)) #-- Test that absorption lines are still there self.assertAbsorptionLine(wave, flux, (3933.4, 3933.7), (3934.1, 3934.9), depth=0.6) self.assertAbsorptionLine(wave, flux, (5159.8, 5160.3), (5157.8, 5159.4), depth=0.8) self.assertAbsorptionLine(wave, flux, (5874.9, 5876.2), (5870.7, 5872.9), depth=0.6) self.assertAbsorptionLine(wave, flux, (6001.7, 6002.0), (6000., 6001.45), depth=0.95)
def testOrderMergedVrad(self): """Merge order-merged hermes spectra with vrad (KIC 9540226)""" pre = '/STER/mercator/hermes/' post_merged = '_HRF_OBJ_ext_CosmicsRemoved_log_merged_c.fits' # objlist = ['20120730/reduced/00415609', '20120808/reduced/00416266', '20120808/reduced/00416267', '20120818/reduced/00417309', '20120818/reduced/00417310', '20120905/reduced/00419141', '20120911/reduced/00419682', '20120913/reduced/00419913', '20120913/reduced/00419914', '20120924/reduced/00421148'] mergeList = [pre+o+post_merged for o in objlist] vrad = [-21.190, -17.473, -17.528, -11.621, -11.613, 5.974, 13.297, 15.793, 15.810, 18.739] #wtotal, f = fits.read_spectrum(mergeList[0]) #ftotal = np.zeros_like(f) #for ifile in mergeList: #w, f = fits.read_spectrum(ifile) #ftotal += np.interp(wtotal,w,f) #pl.plot(wtotal, ftotal) wave, flux, header = hermes.merge_hermes_spectra(mergeList, vrads=vrad, sigma=1.5, offset='none', base='average', runs=3) #pl.plot(wave, flux) #pl.show() #-- Test that cosmics are removed self.assertNoCosmic(wave, flux, (4060.1, 4060.3)) self.assertNoCosmic(wave, flux, (4212.3, 4212.4)) self.assertNoCosmic(wave, flux, (4320.0, 4320.2), sigma=2) self.assertNoCosmic(wave, flux, (7056.5, 7056.7)) self.assertNoCosmic(wave, flux, (8344.1, 8344.8)) #-- Test that absorption lines are still there self.assertAbsorptionLine(wave, flux, (5892.5, 5893.0), (5893.4, 5894.8), depth=0.6) self.assertAbsorptionLine(wave, flux, (7326.0, 7326.3), (7324.8, 7325.8), depth=0.5) #-- Test that the shift is correct f1 = flux[(wave>5883.71) & (wave<5883.94)] f2 = flux[(wave>5883.32) & (wave<5883.68)] self.assertTrue(np.min(f1) < np.min(f2), msg='Spectra NOT correctly shifted') f1 = flux[(wave>5914.00) & (wave<5914.30)] f2 = flux[(wave>5913.69) & (wave<5914.00)] self.assertTrue(np.min(f1) < np.min(f2), msg='Spectra NOT correctly shifted')
def testOrderMerged(self): """Merge order-merged hermes spectra NO vrad (Feige 66)""" temp = '/STER/mercator/hermes/%s/reduced/%s_HRF_OBJ_ext_CosmicsRemoved_log_merged_c.fits' objlist = [('20090619','237033'), ('20090701','240226'), ('20090712','241334'), ('20090712','241335'), ('20100107','00268012'), ('20100120','00272619'), ('20100120','00272620'), ('20100203','00273577'), ('20100203','00273578'), ('20100303','00275671'), ('20100303','00275672'), ('20100410','00281505'), ('20100519','00284636'), ('20110222','00334558'), ('20110319','00336547'), ('20110324','00339848'), ('20110401','00342273'), ('20110402','00342363'), ('20110406','00342699'), ('20110408','00342896'), ('20120107','00391289'), ('20120110','00391633'), ('20120116','00392217'), ('20120127','00393151'), ('20120209','00394175'), ('20120330','00399697'), ('20120420','00404769'), ('20120506','00406531'), ('20130106','00445346'), ('20130215','00452556'), ('20130406','00457718'), ('20130530','00474128')] mergeList = [temp%o for o in objlist] #wtotal, f = fits.read_spectrum(mergeList[0]) #ftotal = np.zeros_like(f) #for ifile in mergeList: #w, f = fits.read_spectrum(ifile) #ftotal += np.interp(wtotal,w,f) #pl.plot(wtotal, ftotal) wave, flux, header = hermes.merge_hermes_spectra(mergeList, sigma=3, offset=None, base='average') #pl.plot(wave, flux) #pl.show() #-- Test that cosmics are removed self.assertNoCosmic(wave, flux, (4362.7, 4362.9)) self.assertNoCosmic(wave, flux, (4974.2, 4974.4)) self.assertNoCosmic(wave, flux, (5656.1, 5656.3)) self.assertNoCosmic(wave, flux, (6161.7, 6161.9)) self.assertNoCosmic(wave, flux, (6166.5, 6166.8), sigma=4) self.assertNoCosmic(wave, flux, (6200.2, 6200.5)) self.assertNoCosmic(wave, flux, (6546.9, 6547.1)) self.assertNoCosmic(wave, flux, (7996.8, 7997.0)) self.assertNoCosmic(wave, flux, (8001.7, 8001.9)) #-- Test that absorption lines are still there self.assertAbsorptionLine(wave, flux, (3933.4, 3933.7), (3934.1, 3934.9), depth=0.6) self.assertAbsorptionLine(wave, flux, (5159.8, 5160.3), (5157.8, 5159.4), depth=0.8) self.assertAbsorptionLine(wave, flux, (5874.9, 5876.2), (5870.7, 5872.9), depth=0.6) self.assertAbsorptionLine(wave, flux, (6001.7, 6002.0), (6000., 6001.45), depth=0.95)