def c60_example(): file1 = "/HD169454/RED_860/HD169454_w860_redu_20160808_O8.fits" # file2 = "/HD54662/RED_860/HD54662_w860_redu_20160221_O8.fits" xmin = 9555 xmax = 9600 sp1 = EdiblesSpectrum(file1) sp1.getSpectrum(xmin=xmin, xmax=xmax) sp1.flux = sp1.flux / np.max(sp1.flux) plt.plot(sp1.wave, sp1.flux, "k") plt.title("HD 169454", fontsize=14) plt.xlabel(r"Wavelength ($\AA$)", fontsize=14) plt.ylabel("Normalized Flux", fontsize=14) plt.xticks(fontsize=12) plt.yticks(fontsize=12) plt.hlines(1, xmin=9574, xmax=9579, color='r') plt.hlines(1, xmin=9578, xmax=9580, color='r', linestyle=':') plt.text(9577.0, 1.01, r"C$_{60}^+$", fontsize=12) plt.show()
def line_examples(): file = "/HD170740/RED_860/HD170740_w860_redl_20160613_O6.fits" xmin = 7055 xmax = 7130 # GEOCENTRIC sp1 = EdiblesSpectrum(file) sp1.getSpectrum(xmin=xmin, xmax=xmax) sp1.flux = sp1.flux / np.max(sp1.flux) plt.plot(sp1.wave, sp1.flux, "k") plt.title("HD 170740", fontsize=14) plt.xlabel(r"Wavelength ($\AA$)", fontsize=14) plt.ylabel("Normalized Flux", fontsize=14) plt.xticks(fontsize=12) plt.yticks(fontsize=12) plt.vlines(7065, 0.9, 1, color='r') plt.text(7065.2, 0.995, 'He I') plt.vlines(7119.5, 0.9, 1, color='r') plt.text(7119.7, 0.995, 'DIB') plt.show()
if centwave == 860: order_number = [21, 14] wavemin = float(obs['WaveMin']) wavemax = float(obs['WaveMax']) spectrum_length = wavemax - wavemin min_cutoff = spectrum_length * tr_min max_cutoff = spectrum_length * tr_max wavemin = wavemin + min_cutoff wavemax = wavemax - max_cutoff sp = EdiblesSpectrum(obs['Filename']) idx = np.where(np.logical_and(sp.wave > wavemin, sp.wave < wavemax)) sp.wave = sp.wave[idx] sp.flux = sp.flux[idx] # build a 4 anchor points spline cont = Continuum(sp, method="spline", n_anchors=4, plot=False, verbose=0) # Guess the model parameters params = cont.model.guess(sp.flux, x=sp.wave) # Fit the model result = cont.model.fit(data=sp.flux, params=params, x=sp.wave) # Get the output of the fit model out = result.eval(params=result.params, x=sp.wave) resid = sp.flux - out std = np.std(resid) idx2 = np.where(sp.flux >= (out - std)) result2 = cont.model.fit(data=sp.flux[idx2], params=params, x=sp.wave[idx2])
def reference_frames(): file1 = "/HD170740/RED_860/HD170740_w860_redl_20140915_O12.fits" file2 = "/HD170740/RED_860/HD170740_w860_redl_20140916_O12.fits" file3 = "/HD170740/RED_860/HD170740_w860_redl_20150626_O12.fits" file4 = "/HD170740/RED_860/HD170740_w860_redl_20160613_O12.fits" file5 = "/HD170740/RED_860/HD170740_w860_redl_20170705_O12.fits" xmin = 7661.5 xmax = 7669 # GEOCENTRIC sp1 = EdiblesSpectrum(file1) sp1.getSpectrum(xmin=xmin, xmax=xmax) sp1.flux = sp1.flux / np.max(sp1.flux) plt.plot(sp1.wave, sp1.flux, "k") plt.text(7661.6, 0.8, sp1.datetime.date(), fontsize=12) sp2 = EdiblesSpectrum(file2) sp2.getSpectrum(xmin=xmin, xmax=xmax) sp2.flux = sp2.flux / np.max(sp2.flux) + 1 plt.plot(sp2.wave, sp2.flux, "k") plt.text(7661.6, 1.8, sp2.datetime.date(), fontsize=12) sp3 = EdiblesSpectrum(file3) sp3.getSpectrum(xmin=xmin, xmax=xmax) sp3.flux = sp3.flux / np.max(sp3.flux) + 2 plt.plot(sp3.wave, sp3.flux, "k") plt.text(7661.6, 2.8, sp3.datetime.date(), fontsize=12) sp4 = EdiblesSpectrum(file4) sp4.getSpectrum(xmin=xmin, xmax=xmax) sp4.flux = sp4.flux / np.max(sp4.flux) + 3 plt.plot(sp4.wave, sp4.flux, "k") plt.text(7661.6, 3.8, sp4.datetime.date(), fontsize=12) sp5 = EdiblesSpectrum(file5) sp5.getSpectrum(xmin=xmin, xmax=xmax) sp5.flux = sp5.flux / np.max(sp5.flux) + 4 plt.plot(sp5.wave, sp5.flux, "k") plt.text(7661.6, 4.8, sp5.datetime.date(), fontsize=12) plt.title("HD 170740", fontsize=14) plt.xlabel(r"Wavelength ($\AA$)", fontsize=14) plt.ylabel("Normalized Flux + Offset", fontsize=14) plt.xticks(fontsize=12) plt.yticks(fontsize=12) plt.show() # BARYCENTRIC sp1.bary_flux = sp1.bary_flux / np.max(sp1.bary_flux) plt.plot(sp1.bary_wave, sp1.bary_flux, "k") plt.text(7661.6, 0.8, sp1.datetime.date(), fontsize=12) sp2.bary_flux = sp2.bary_flux / np.max(sp2.bary_flux) + 1 plt.plot(sp2.bary_wave, sp2.bary_flux, "k") plt.text(7661.6, 1.8, sp2.datetime.date(), fontsize=12) sp3.bary_flux = sp3.bary_flux / np.max(sp3.bary_flux) + 2 plt.plot(sp3.bary_wave, sp3.bary_flux, "k") plt.text(7661.6, 2.8, sp3.datetime.date(), fontsize=12) sp4.bary_flux = sp4.bary_flux / np.max(sp4.bary_flux) + 3 plt.plot(sp4.bary_wave, sp4.bary_flux, "k") plt.text(7661.6, 3.8, sp4.datetime.date(), fontsize=12) sp5.bary_flux = sp5.bary_flux / np.max(sp5.bary_flux) + 4 plt.plot(sp5.bary_wave, sp5.bary_flux, "k") plt.text(7661.6, 4.8, sp5.datetime.date(), fontsize=12) plt.title("HD 170740", fontsize=14) plt.xlabel(r"Wavelength ($\AA$)", fontsize=14) plt.ylabel("Normalized Flux + Offset", fontsize=14) plt.xticks(fontsize=12) plt.yticks(fontsize=12) plt.show()