Skip to content

Instantly share code, notes, and snippets.

@christopherlovell
Created January 11, 2024 16:15
Show Gist options
  • Save christopherlovell/181125b5139e1b1227773594ebd49719 to your computer and use it in GitHub Desktop.
Save christopherlovell/181125b5139e1b1227773594ebd49719 to your computer and use it in GitHub Desktop.
Synthesizer load filter test
import numpy as np
import matplotlib.pyplot as plt
from synthesizer.filters import Filter, FilterCollection
filter_codes = ["JWST/NIRCam.F444W", "JWST/NIRCam.F480M"]
filtcoll = FilterCollection(filter_codes=filter_codes)
fig, ax = filtcoll.plot_transmission_curves(show=False, linestyle='solid')
new_lams = np.linspace(2000, 55000, 1000)
dat = np.loadtxt('F444W.txt')
lam, trans = dat[:,0], dat[:,1]
filt_444 = Filter("F444W_so", transmission=trans, new_lam=lam)
dat = np.loadtxt('F480M.txt')
lam, trans = dat[:,0], dat[:,1]
filt_480 = Filter("F480M_so", transmission=trans, new_lam=lam)
combined_filters = FilterCollection(
filters=[filt_444, filt_480]
)
combined_filters.plot_transmission_curves(
show=False, fig=fig, ax=ax, linestyle='dashed'
)
ax.legend()
plt.savefig('filter_response.png')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment