Skip to content

Commit

Permalink
Merge branch 'add_acs_uv' of github.com:karllark/beast into add_acs_uv
Browse files Browse the repository at this point in the history
Conflicts:
	beast/plotting/plot_filters.py
	beast/tools/make_libfile.py
  • Loading branch information
karllark committed Feb 26, 2024
2 parents 0cf6e17 + 55b1560 commit d92bef3
Show file tree
Hide file tree
Showing 8 changed files with 316 additions and 294 deletions.
29 changes: 14 additions & 15 deletions beast/plotting/plot_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ def plot_filters(
ylim=[1e-4, 2],
show_plot=True,
):

"""Plots transmission curves in log-log space.
Parameters
Expand All @@ -43,7 +42,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 +60,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 @@ -91,7 +91,7 @@ def plot_filters(
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 +119,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",
"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",
"f098m", "f127m", "f139m", "f153m"]

wfpc2 = ["f157w", "f170w", "f185w", "f218w", "f255w",
"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",
"f502n", "f550m", "f658n"]

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

jwst_nircam_sw = ["f150w2", "f070w", "f090w", "f115w", "f150w", "f200w",
"f140m", "f162m", "f182m", "f210m",
"f164n", "f187n", "f212n"]
Expand Down
4 changes: 3 additions & 1 deletion beast/tools/tests/test_verify_beast_settings.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pytest
import warnings
from beast.physicsmodel.stars import isochrone
from beast.tools import verify_beast_settings

Expand Down Expand Up @@ -36,7 +37,8 @@ class settings_mock_allowwarn(settings_mock_nofA):

def test_verifyparams_nowarning():
"""Test: verify_beast_settings for case of no warnings or exceptions."""
with pytest.warns(None) as record:
# with pytest.warns(None) as record:
with warnings.catch_warnings(record=True) as record:
verify_beast_settings.verify_input_format(settings_mock())
assert len(record) == 0

Expand Down
Loading

0 comments on commit d92bef3

Please sign in to comment.