Skip to content

Commit

Permalink
adding filters doc with plots of all filters
Browse files Browse the repository at this point in the history
  • Loading branch information
karllark committed Feb 24, 2024
1 parent 42a2068 commit b683663
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 239 deletions.
32 changes: 15 additions & 17 deletions beast/plotting/plot_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,10 @@
def plot_filters(
filter_names,
filterLib=None,
save_name="beast_filters",
xlim=None,
ylim=[1e-4, 2],
show_plot=True,
):

"""Plots transmission curves in log-log space.
Parameters
Expand All @@ -43,7 +41,7 @@ def plot_filters(

# wavelength grid in angstroms for response functions
# cover all HST and JWST wavelengths
waves = np.logspace(np.log10(912.), np.log10(3e5), 1001)
waves = np.logspace(np.log10(912.0), np.log10(3e5), 1001)

# read in the filter response functions
flist = phot.load_filters(
Expand All @@ -61,24 +59,25 @@ def plot_filters(
# ax.set_prop_cycle(color=[cmap(i) for i in color_indices])
color = iter(cmap(np.linspace(0.2, 0.8, len(filter_names))))

dxlim = [3e5, 912.]
dxlim = np.array([3e5, 912.0]) * 1e-4
for f in flist:
wavelength = f.wavelength * 1e-4
c = next(color)
ax.plot(f.wavelength, f.transmit, color=c, lw=2)
ax.fill_between(f.wavelength, f.transmit, alpha=0.2, color=c)
ax.plot(wavelength, f.transmit, color=c, lw=2)
ax.fill_between(wavelength, f.transmit, alpha=0.2, color=c)
yval_text = max(f.transmit * 0.1)
ax.text(
np.nanmean(f.wavelength[f.transmit > yval_text]),
np.nanmean(wavelength[f.transmit > yval_text]),
1.3 * np.nanmax(f.transmit[f.transmit > yval_text]),
f.name.split("_")[-1],
ha="center",
color=c,
)
gvals = (f.transmit > ylim[0]) & (f.transmit < ylim[1])
if min(f.wavelength[gvals]) < dxlim[0]:
dxlim[0] = min(f.wavelength[gvals])
if max(f.wavelength[gvals]) > dxlim[1]:
dxlim[1] = max(f.wavelength[gvals])
if min(wavelength[gvals]) < dxlim[0]:
dxlim[0] = min(wavelength[gvals])
if max(wavelength[gvals]) > dxlim[1]:
dxlim[1] = max(wavelength[gvals])

if xlim is None:
xlim = dxlim
Expand All @@ -87,11 +86,11 @@ def plot_filters(
ax.set_yscale("log")
ax.set_xlim(xlim)
ax.set_ylim(ylim)
ax.set_xlabel(r"$\lambda$ [$\AA$]")
ax.set_xlabel(r"$\lambda$ [$\mu m$]")
ax.set_ylabel(r"$B_i(\lambda)$")

# ax.set_xticks([0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 2.0])
ax.get_xaxis().set_major_formatter(mpl.ticker.ScalarFormatter())
# ax.get_xaxis().set_major_formatter(mpl.ticker.ScalarFormatter())

fig.tight_layout()

Expand Down Expand Up @@ -119,10 +118,9 @@ def plot_filters(
"HST_WFC3_F110W",
"HST_WFC3_F160W",
]
parser.add_argument("filter_names",
help="names of filters",
nargs='+',
default=def_filter_names)
parser.add_argument(
"filter_names", help="names of filters", nargs="+", default=def_filter_names
)
args = parser.parse_args()

fig = plot_filters(args.filter_names, show_plot=False)
Expand Down
115 changes: 19 additions & 96 deletions beast/tools/make_libfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,104 +17,27 @@ def make_filters_libfile():
"""
Extract filters from STSYNPHOT and save to main library file.
"""
# wfc3_obsmodes_uvis
wfc3_uvis = [
"f218w",
"f225w",
"f275w",
"f280n",
"f336w",
"f343n",
"f373n",
"f390m",
"f390w",
"f395n",
"f410m",
"f438w",
"f467m",
"f469n",
"f475w",
"f487n",
"f502n",
"f547m",
"f555w",
"f606w",
"f621m",
"f625w",
"f631n",
"f645n",
"f656n",
"f657n",
"f658n",
"f665n",
"f673n",
"f680n",
"f689m",
"f763m",
"f775w",
"f814w",
"f845m",
"f953n",
]

wfc3_ir = [
"f098m",
"f105w",
"f110w",
"f125w",
"f127m",
"f139m",
"f140w",
"f153m",
"f160w",
]

wfpc2 = [
"f122m",
"f157w",
"f336w",
"f410m",
"f467m",
"f547m",
"f439w",
"f569w",
"f675w",
"f791w",
"f170w",
"f185w",
"f218w",
"f255w",
"f300w",
"f380w",
"f555w",
"f622w",
"f450w",
"f606w",
"f702w",
"f814w",
]

acs_wfc = [
"f435w",
"f475w",
"f550m",
"f555w",
"f606w",
"f625w",
"f775w",
"f814w",
]

acs_sbc = [
"f115lp",
"f125lp",
"f140lp",
"f150lp",
"f165lp",
"f122m",
]

# fmt: off
wfc3_uvis = ["f218w","f225w", "f275w", "f336w", "f390w", "f438w",

Check warning on line 22 in beast/tools/make_libfile.py

View check run for this annotation

Codecov / codecov/patch

beast/tools/make_libfile.py#L22

Added line #L22 was not covered by tests
"f475w", "f555w", "f606w", "f625w", "f775w", "f814w",
"f390m", "f410m", "f467m", "f547m", "f621m", "f689m", "f763m", "f845m",
"f280n", "f343n", "f373n", "f395n", "f469n", "f487n", "f502n", "f631n",
"f645n", "f656n", "f657n", "f658n", "f665n", "f673n", "f680n", "f953n"]

wfc3_ir = ["f105w", "f110w", "f125w", "f140w", "f160w",

Check warning on line 28 in beast/tools/make_libfile.py

View check run for this annotation

Codecov / codecov/patch

beast/tools/make_libfile.py#L28

Added line #L28 was not covered by tests
"f098m", "f127m", "f139m", "f153m"]

wfpc2 = ["f157w", "f170w", "f185w", "f218w", "f255w",

Check warning on line 31 in beast/tools/make_libfile.py

View check run for this annotation

Codecov / codecov/patch

beast/tools/make_libfile.py#L31

Added line #L31 was not covered by tests
"f300w", "f336w", "f380w", "f439w", "f450w", "f555w",
"f569w", "f606w", "f622w", "f675w", "f702w", "f791w", "f814w",
"f122m", "f410m", "f467m", "f547m"]

acs_wfc = ["f435w", "f475w", "f555w", "f606w", "f625w", "f775w", "f814w", "f850lp",

Check warning on line 36 in beast/tools/make_libfile.py

View check run for this annotation

Codecov / codecov/patch

beast/tools/make_libfile.py#L36

Added line #L36 was not covered by tests
"f502n", "f550m", "f658n"]

acs_sbc = ["f115lp", "f125lp", "f140lp", "f150lp", "f165lp", "f122m"]

Check warning on line 39 in beast/tools/make_libfile.py

View check run for this annotation

Codecov / codecov/patch

beast/tools/make_libfile.py#L39

Added line #L39 was not covered by tests

jwst_nircam_sw = ["f150w2", "f070w", "f090w", "f115w", "f150w", "f200w",

Check warning on line 41 in beast/tools/make_libfile.py

View check run for this annotation

Codecov / codecov/patch

beast/tools/make_libfile.py#L41

Added line #L41 was not covered by tests
"f140m", "f162m", "f182m", "f210m",
"f164n", "f187n", "f212n"]
Expand Down
130 changes: 4 additions & 126 deletions docs/beast_setup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ BEAST Filters
=============

The filters are defined in ``beast/libs/filters.hd5``. The file
has been updated in March, 2022 using stsynphot to have correct,
has been updated in Feb 2024 using stsynphot (HST/GALEX) and
pandeia (JWST) to have correct,
total throughput for HST filters and to remove unused filters.
The file contains two groups:

Expand All @@ -154,128 +155,5 @@ The filters currently included in the BEAST filter library are as follows.

Please do not forget updating ``beast/libs/vega.hd5`` as well when making
any updates in ``beast/libs/filters.hd5``. Vega fluxes and magnitudes in
udpated filters need to be correspondingly recomputed and saved in vega.hd5.

+--------------------------+
| HST_WFC3_F218W |
+--------------------------+
| HST_WFC3_F225W |
+--------------------------+
| HST_WFC3_F275W |
+--------------------------+
| HST_WFC3_F336W |
+--------------------------+
| HST_WFC3_F390M |
+--------------------------+
| HST_WFC3_F390W |
+--------------------------+
| HST_WFC3_F410M |
+--------------------------+
| HST_WFC3_F438W |
+--------------------------+
| HST_WFC3_F467M |
+--------------------------+
| HST_WFC3_F475W |
+--------------------------+
| HST_WFC3_F547M |
+--------------------------+
| HST_WFC3_F555W |
+--------------------------+
| HST_WFC3_F606W |
+--------------------------+
| HST_WFC3_F621M |
+--------------------------+
| HST_WFC3_F625W |
+--------------------------+
| HST_WFC3_F689M |
+--------------------------+
| HST_WFC3_F763M |
+--------------------------+
| HST_WFC3_F775W |
+--------------------------+
| HST_WFC3_F814W |
+--------------------------+
| HST_WFC3_F845M |
+--------------------------+
| HST_WFC3_F098M |
+--------------------------+
| HST_WFC3_F105W |
+--------------------------+
| HST_WFC3_F110W |
+--------------------------+
| HST_WFC3_F125W |
+--------------------------+
| HST_WFC3_F127M |
+--------------------------+
| HST_WFC3_F139M |
+--------------------------+
| HST_WFC3_F140W |
+--------------------------+
| HST_WFC3_F153M |
+--------------------------+
| HST_WFC3_F160W |
+--------------------------+
| HST_WFPC2_F122M |
+--------------------------+
| HST_WFPC2_F157W |
+--------------------------+
| HST_WFPC2_F336W |
+--------------------------+
| HST_WFPC2_F410M |
+--------------------------+
| HST_WFPC2_F467M |
+--------------------------+
| HST_WFPC2_F547M |
+--------------------------+
| HST_WFPC2_F439W |
+--------------------------+
| HST_WFPC2_F569W |
+--------------------------+
| HST_WFPC2_F675W |
+--------------------------+
| HST_WFPC2_F791W |
+--------------------------+
| HST_WFPC2_F170W |
+--------------------------+
| HST_WFPC2_F185W |
+--------------------------+
| HST_WFPC2_F218W |
+--------------------------+
| HST_WFPC2_F255W |
+--------------------------+
| HST_WFPC2_F300W |
+--------------------------+
| HST_WFPC2_F380W |
+--------------------------+
| HST_WFPC2_F555W |
+--------------------------+
| HST_WFPC2_F622W |
+--------------------------+
| HST_WFPC2_F450W |
+--------------------------+
| HST_WFPC2_F606W |
+--------------------------+
| HST_WFPC2_F702W |
+--------------------------+
| HST_WFPC2_F814W |
+--------------------------+
| HST_ACS_WFC_F435W |
+--------------------------+
| HST_ACS_WFC_F475W |
+--------------------------+
| HST_ACS_WFC_F550M |
+--------------------------+
| HST_ACS_WFC_F555W |
+--------------------------+
| HST_ACS_WFC_F606W |
+--------------------------+
| HST_ACS_WFC_F625W |
+--------------------------+
| HST_ACS_WFC_F775W |
+--------------------------+
| HST_ACS_WFC_F814W |
+--------------------------+
| GALEX_FUV |
+--------------------------+
| GALEX_NUV |
+--------------------------+
updated filters need to be correspondingly recomputed and saved in vega.hd5.
See :doc:`beast_filters` for the full current set of included filters.
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Basics:
:maxdepth: 1

Run setup <beast_setup.rst>
Filters supported <beast_filters.rst>
Photometry files <photometry_files.rst>
Output files <outputs.rst>

Expand Down

0 comments on commit b683663

Please sign in to comment.