diff --git a/beast/plotting/plot_filters.py b/beast/plotting/plot_filters.py index 1d093d51..e1f44097 100755 --- a/beast/plotting/plot_filters.py +++ b/beast/plotting/plot_filters.py @@ -20,7 +20,6 @@ def plot_filters( ylim=[1e-4, 2], show_plot=True, ): - """Plots transmission curves in log-log space. Parameters @@ -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( @@ -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 @@ -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() @@ -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) diff --git a/beast/tools/make_libfile.py b/beast/tools/make_libfile.py index b91e3566..74236977 100644 --- a/beast/tools/make_libfile.py +++ b/beast/tools/make_libfile.py @@ -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"] diff --git a/beast/tools/tests/test_verify_beast_settings.py b/beast/tools/tests/test_verify_beast_settings.py index 2e5fccf5..75f8fc2b 100644 --- a/beast/tools/tests/test_verify_beast_settings.py +++ b/beast/tools/tests/test_verify_beast_settings.py @@ -1,4 +1,5 @@ import pytest +import warnings from beast.physicsmodel.stars import isochrone from beast.tools import verify_beast_settings @@ -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 diff --git a/docs/beast_filters.rst b/docs/beast_filters.rst new file mode 100644 index 00000000..e9364b1f --- /dev/null +++ b/docs/beast_filters.rst @@ -0,0 +1,261 @@ +####### +Filters +####### + +Filters included in the BEAST + +Hubble +====== + +WFC3 +---- + +Imaging, UVIS, Wide + +.. plot:: + + from beast.plotting.plot_filters import plot_filters + + # required to get the filters library needed for building on RTD + from beast.tools import get_libfiles + get_libfiles.get_libfiles(vega_filters_only=True) + + wfc3_uvis = ["f218w","f225w", "f275w", "f336w", "f390w", "f438w", + "f475w", "f555w", "f606w", "f625w", "f775w", "f814w"] + filters = [f"HST_WFC3_{cfilt.upper()}" for cfilt in wfc3_uvis] + plot_filters(filters) + +Imaging, UVIS, Medium + +.. plot:: + + from beast.plotting.plot_filters import plot_filters + + wfc3_uvis = ["f390m", "f410m", "f467m", "f547m", "f621m", "f689m", "f763m", "f845m"] + filters = [f"HST_WFC3_{cfilt.upper()}" for cfilt in wfc3_uvis] + plot_filters(filters) + +Imaging, UVIS, Narrow, Blue + +.. plot:: + + from beast.plotting.plot_filters import plot_filters + + wfc3_uvis = ["f280n", "f343n", "f373n", "f395n", "f469n", "f487n", "f502n", "f631n"] + filters = [f"HST_WFC3_{cfilt.upper()}" for cfilt in wfc3_uvis] + plot_filters(filters) + +Imaging, UVIS, Narrow, Red +(Note: F656N not included, error when plotting) + +.. plot:: + + from beast.plotting.plot_filters import plot_filters + + wfc3_uvis = ["f645n", "f657n", "f658n", "f665n", "f673n", "f680n", "f953n"] + filters = [f"HST_WFC3_{cfilt.upper()}" for cfilt in wfc3_uvis] + plot_filters(filters) + +Imaging, IR, wide + +.. plot:: + + from beast.plotting.plot_filters import plot_filters + + wfc3_ir = ["f105w", "f110w", "f125w", "f140w", "f160w"] + filters = [f"HST_WFC3_{cfilt.upper()}" for cfilt in wfc3_ir] + plot_filters(filters) + +Imaging, IR, medium + +.. plot:: + + from beast.plotting.plot_filters import plot_filters + + wfc3_ir = ["f098m", "f127m", "f139m", "f153m"] + filters = [f"HST_WFC3_{cfilt.upper()}" for cfilt in wfc3_ir] + plot_filters(filters) + +ACS +--- + +Imaging, WFC, wide + +.. plot:: + + from beast.plotting.plot_filters import plot_filters + + acs_wfc = ["f435w", "f475w", "f555w", "f606w", "f625w", "f775w", "f814w"] + filters = [f"HST_ACS_WFC_{cfilt.upper()}" for cfilt in acs_wfc] + plot_filters(filters) + + +Imaging, WFC, extrawide, medium and narrow + +.. plot:: + + from beast.plotting.plot_filters import plot_filters + + acs_wfc = ["f850lp", "f502n", "f550m", "f658n"] + filters = [f"HST_ACS_WFC_{cfilt.upper()}" for cfilt in acs_wfc] + plot_filters(filters) + +Imaging, SBC + +.. plot:: + + from beast.plotting.plot_filters import plot_filters + + acs_sbc = ["f115lp", "f125lp", "f140lp", "f150lp", "f165lp", "f122m"] + filters = [f"HST_ACS_SBC_{cfilt.upper()}" for cfilt in acs_sbc] + plot_filters(filters) + +WFPC2 +----- + +Imaging, UV, Wide + +.. plot:: + + from beast.plotting.plot_filters import plot_filters + + wfpc2 = ["f157w", "f170w", "f185w", "f218w", "f255w", "f300w"] + filters = [f"HST_WFPC2_{cfilt.upper()}" for cfilt in wfpc2] + plot_filters(filters) + +Imaging, Optical, Blue + +.. plot:: + + from beast.plotting.plot_filters import plot_filters + + wfpc2 = ["f336w", "f380w", "f439w", "f450w", "f555w", "f569w"] + filters = [f"HST_WFPC2_{cfilt.upper()}" for cfilt in wfpc2] + plot_filters(filters) + +Imaging, Optical, Red + +.. plot:: + + from beast.plotting.plot_filters import plot_filters + + wfpc2 = ["f606w", "f622w", "f675w", "f702w", "f791w", "f814w"] + filters = [f"HST_WFPC2_{cfilt.upper()}" for cfilt in wfpc2] + plot_filters(filters) + +Imaging, Medium + +.. plot:: + + from beast.plotting.plot_filters import plot_filters + + wfpc2 = ["f122m", "f410m", "f467m", "f547m"] + filters = [f"HST_WFPC2_{cfilt.upper()}" for cfilt in wfpc2] + plot_filters(filters) + +Webb +==== + +NIRCam +------ + +Imaging, Very Wide Bands + +.. plot:: + + from beast.plotting.plot_filters import plot_filters + + jwst_nircam = ["f150w2", "f332w2"] + filters = [f"JWST_NIRCAM_{cfilt.upper()}" for cfilt in jwst_nircam] + plot_filters(filters) + +Imaging, Wide Bands + +.. plot:: + + from beast.plotting.plot_filters import plot_filters + + jwst_nircam = ["f070w", "f090w", "f115w", "f150w", "f200w", + "f277w", "f356w", "f444w"] + filters = [f"JWST_NIRCAM_{cfilt.upper()}" for cfilt in jwst_nircam] + plot_filters(filters) + +Imaging, Medium Bands + +.. plot:: + + from beast.plotting.plot_filters import plot_filters + + jwst_nircam = ["f140m", "f162m", "f182m", "f210m", + "f250m", "f300m", "f335m", "f360m", "f410m", "f430m", "f460m", "f480m"] + filters = [f"JWST_NIRCAM_{cfilt.upper()}" for cfilt in jwst_nircam] + plot_filters(filters) + +Imaging, Narrow Bands + +.. plot:: + + from beast.plotting.plot_filters import plot_filters + + jwst_nircam = ["f164n", "f187n", "f212n", + "f323n", "f405n", "f466n", "f470n"] + filters = [f"JWST_NIRCAM_{cfilt.upper()}" for cfilt in jwst_nircam] + plot_filters(filters) + +NIRISS +------ + +Imaging, Wide Bands + +.. plot:: + + from beast.plotting.plot_filters import plot_filters + + jwst_niriss = ["f090w", "f115w", "f150w", "f200w", "f277w", "f356w", "f444w"] + filters = [f"JWST_NIRISS_{cfilt.upper()}" for cfilt in jwst_niriss] + plot_filters(filters) + +Imaging, Medium Bands + +.. plot:: + + from beast.plotting.plot_filters import plot_filters + + jwst_niriss = ["f140m", "f158m", "f380m", "f430m", "f480m"] + filters = [f"JWST_NIRISS_{cfilt.upper()}" for cfilt in jwst_niriss] + plot_filters(filters) + +MIRI +---- + +Imaging + +.. plot:: + + from beast.plotting.plot_filters import plot_filters + + jwst_miri = ["f560w", "f770w", "f1000w", "f1130w", "f1280w", "f1500w", "f1800w", "f2100w", "f2550w"] + filters = [f"JWST_MIRI_{cfilt.upper()}" for cfilt in jwst_miri] + plot_filters(filters) + +Coronagraphy + +.. plot:: + + from beast.plotting.plot_filters import plot_filters + + jwst_miri = ["f1065c", "f1140c", "f1550c", "f2300c"] + filters = [f"JWST_MIRI_{cfilt.upper()}" for cfilt in jwst_miri] + plot_filters(filters) + +GALEX +===== + +Imaging + +.. plot:: + + from beast.plotting.plot_filters import plot_filters + + plot_filters(["GALEX_FUV", "GALEX_NUV"]) + diff --git a/docs/beast_setup.rst b/docs/beast_setup.rst index d6b4c1f2..6f43d429 100644 --- a/docs/beast_setup.rst +++ b/docs/beast_setup.rst @@ -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: @@ -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. diff --git a/docs/example.rst b/docs/example.rst index a176f08c..bc23a35f 100644 --- a/docs/example.rst +++ b/docs/example.rst @@ -16,19 +16,6 @@ This example is based on a small amount of METAL program data. METAL is an HST program (PI: J. Roman-Duval) that included parallel imaging of regions in the Large Magellanic Cloud. -If you installed Python through AstroConda, first activate the correct -AstroConda environment - -.. code-block:: console - - $ conda activate astroconda - -Verify that the current default Python is version 3 - -.. code-block:: console - - $ python --version - Next, bring up the BEAST help message, which describes the available switch options, with diff --git a/docs/index.rst b/docs/index.rst index 92002230..57fd9a86 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -30,6 +30,7 @@ Basics: :maxdepth: 1 Run setup + Filters supported Photometry files Output files diff --git a/docs/install.rst b/docs/install.rst index 9b1ff678..a8fb2782 100644 --- a/docs/install.rst +++ b/docs/install.rst @@ -7,18 +7,7 @@ Requirements Running the BEAST requires: -- Python >= 3.7 -- Astropy >= 1.3 - -In turn, Astropy depends on -`other packages `_ for -optional features. From these you will need: - -- `hdf5 `_ to read/write `Table` objects from/to HDF5 files. - -You will also need: - -- `PyTables `_ to manage large amounts of data. +- Python >= 3.8 One easy way to obtain the above is through the AstroConda Python stack: @@ -27,33 +16,19 @@ One easy way to obtain the above is through the AstroConda Python stack: you can use the `conda` command to install any other packages and create environments, etc. -- Setup the AstroConda Channel - -.. code-block:: console - - $ conda config --add channels http://ssb.stsci.edu/astroconda - -- Install AstroConda with Python 3 (recommended) +- Create a conda environment for the BEAST. + Replace with the name of the conda environment you want (e.g., `beast`). + The specific version of python can be different than 3.11, note it must be at least 3.8. .. code-block:: console - $ conda create -n astroconda stsci + $ conda create -n python=3.11 -- Ensure the minimum Python requirements above are met. If needed, specify the minimum version required +- Switch to this newly create conda environment .. code-block:: console - $ python --version - $ conda create -n astroconda stsci python=3.7 - -- Make sure that the ``PyTables`` and ``hdf5`` packages are installed - -.. code-block:: console - - $ conda install -n astroconda pytables - - $ conda install -n astroconda hdf5 - + $ conda activate Installation for Users ====================== @@ -61,13 +36,10 @@ Installation for Users In addition to installing the code, library files also need to be installed. See :ref:`library-files`. -.. note:: - The ``numpy`` package must be installed before installing the BEAST. This package is needed as part of the installation process, not just as a prerequisite for running the BEAST. - Using pip --------- -``beast`` can be installed using pip: +``beast`` can be installed using pip. This installs the latest released version. .. code-block:: console @@ -79,7 +51,7 @@ If you already have an older version installed, use: $ pip install --upgrade beast -Or, from the master trunk on the repository, considered developmental code: +Or, from the repository directly. This installs the development version with the latest features. .. code-block:: console @@ -147,14 +119,13 @@ Installation for Production Runs Using a dedicated conda environment for production BEAST runs may be desirable. Such an environment provides a way to ensure that production runs are reproducible by fixing the versions of all the -software used. The instructions below assume that the `astroconda channel -`_ is being used. +software used. Create a conda environment, and name it differently from your default and other environments: .. code-block:: console - $ conda create -n beast_production python=3.6 + $ conda create -n beast_production python=3.11 Activate the environment after all the packages are finished installing: @@ -170,17 +141,17 @@ Install dependencies using conda (better for speed): Next, install the BEAST. You have three options: -Option 1: Use pip to install a stable version of the BEAST (e.g. v1.3): +Option 1: Use pip to install a stable version of the BEAST (e.g. v2.0): .. code-block:: console - $ pip install beast==1.3 + $ pip install beast==2.0 Option 2: Get the latest production branch, which can be ahead of the pypi version: .. code-block:: console - $ pip install git+https://github.com/BEAST-Fitting/beast.git@v1.x + $ pip install git+https://github.com/BEAST-Fitting/beast.git@v2.x Option 3: If you'll be doing development, follow the instructions above (:ref:`Dev_install`). Note that you can make separate environments for development and production modes.