Skip to content

Instantly share code, notes, and snippets.

@iancze
Created November 22, 2019 19:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iancze/d8862ca23b4a035852ff87b2a0565b37 to your computer and use it in GitHub Desktop.
Save iancze/d8862ca23b4a035852ff87b2a0565b37 to your computer and use it in GitHub Desktop.
Read and plot the APF spectra
import numpy as np
from scipy.io import readsav
from matplotlib import pyplot as plt
w_idl = readsav("w_rl23.2142")
w = w_idl["w"] # wavelengths in AA
fl_idl = readsav("rl23.2127")
f = fl_idl["sp"] # fluxes in arbitrary units
print(w.shape)
print(f.shape)
# each array is 65 orders, 4608 pixels
# which echelle order we want to plot
order = 40
fig, ax = plt.subplots(nrows=1)
ax.plot(w[order], f[order])
ax.set_xlabel(r"$\lambda$ [$\AA$]")
ax.set_ylabel("counts")
plt.show()
# fig.savefig("spectrum.png")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment