From c8599e778acde596eeef3f9f14dc934803f01155 Mon Sep 17 00:00:00 2001 From: Karl Gordon Date: Wed, 14 Feb 2024 14:04:40 -0500 Subject: [PATCH 01/21] updating install docs to make them simpler and faster --- docs/example.rst | 13 ----------- docs/install.rst | 57 ++++++++++++------------------------------------ 2 files changed, 14 insertions(+), 56 deletions(-) diff --git a/docs/example.rst b/docs/example.rst index a176f08c8..bc23a35f3 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/install.rst b/docs/install.rst index 9b1ff678e..f83f4ad70 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. From fbab10e810000be42e73b1f4904a5d888f029c63 Mon Sep 17 00:00:00 2001 From: Karl Gordon Date: Wed, 14 Feb 2024 14:26:34 -0500 Subject: [PATCH 02/21] fixing deprecated pytest behavior --- beast/tools/tests/test_verify_beast_settings.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/beast/tools/tests/test_verify_beast_settings.py b/beast/tools/tests/test_verify_beast_settings.py index 2e5fccf56..75f8fc2bf 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 From c09fbc185bac06470c36809fa2767afd2cd7e277 Mon Sep 17 00:00:00 2001 From: Karl Gordon Date: Wed, 14 Feb 2024 14:47:55 -0500 Subject: [PATCH 03/21] formating issue --- docs/install.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/install.rst b/docs/install.rst index f83f4ad70..a8fb2782f 100644 --- a/docs/install.rst +++ b/docs/install.rst @@ -17,8 +17,8 @@ One easy way to obtain the above is through the AstroConda Python stack: environments, etc. - 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. + 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 From 7b0cb9fdd063a7cd2ac92b8c55006d9fc38016f9 Mon Sep 17 00:00:00 2001 From: Karl Gordon Date: Wed, 14 Feb 2024 15:37:38 -0500 Subject: [PATCH 04/21] adding in ACS HRC filters and enhancing the filter plotting routine --- beast/plotting/plot_filters.py | 32 +++++++++++++++------- beast/tools/make_libfile.py | 50 +++++++++++++++++++++++++++++++++- 2 files changed, 71 insertions(+), 11 deletions(-) diff --git a/beast/plotting/plot_filters.py b/beast/plotting/plot_filters.py index 06bd81bda..394ede3db 100755 --- a/beast/plotting/plot_filters.py +++ b/beast/plotting/plot_filters.py @@ -16,7 +16,7 @@ def plot_filters( filter_names, filterLib=None, save_name="beast_filters", - xlim=[1.4e3, 2e4], + xlim=[3e3, 1e3], ylim=[1e-4, 2], show_plot=True, ): @@ -50,8 +50,11 @@ def plot_filters( ) color_indices = np.log10(np.array(np.sort([f.norm for f in flist]))) - color_indices -= color_indices.min() - color_indices /= color_indices.max() + if len(color_indices) > 1: + color_indices -= color_indices.min() + color_indices /= color_indices.max() + else: + color_indices = [0.0] cmap = mpl.cm.plasma # ax.set_prop_cycle(color=[cmap(i) for i in color_indices]) @@ -61,19 +64,25 @@ def plot_filters( 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) + yval_text = max(f.transmit * 0.1) ax.text( - np.nanmean(f.wavelength[f.transmit > 100.0 * ylim[0]]), - 1.3 * np.nanmax(f.transmit[f.transmit > ylim[0]]), + np.nanmean(f.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]) < xlim[0]: + xlim[0] = min(f.wavelength[gvals]) + if max(f.wavelength[gvals]) > xlim[1]: + xlim[1] = max(f.wavelength[gvals]) ax.set_xscale("log") ax.set_yscale("log") ax.set_xlim(xlim) ax.set_ylim(ylim) - ax.set_xlabel(r"$\lambda$ [$\mu m$]") + ax.set_xlabel(r"$\lambda$ [$\AA$]") 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]) @@ -95,9 +104,7 @@ def plot_filters( default="filters.appendVegaFilter", help="Save figure to file", ) - args = parser.parse_args() - - filter_names = [ + def_filter_names = [ "HST_WFC3_F225W", "HST_WFC3_F275W", "HST_WFC3_F336W", @@ -107,8 +114,13 @@ def plot_filters( "HST_WFC3_F110W", "HST_WFC3_F160W", ] + parser.add_argument("filter_names", + help="names of filters", + nargs='+', + default=def_filter_names) + args = parser.parse_args() - fig = plot_filters(filter_names, show_plot=False) + fig = plot_filters(args.filter_names, show_plot=False) if args.tex: plt.rc({"usetex": True}) diff --git a/beast/tools/make_libfile.py b/beast/tools/make_libfile.py index 1a083e937..dccc6966c 100644 --- a/beast/tools/make_libfile.py +++ b/beast/tools/make_libfile.py @@ -84,6 +84,16 @@ def make_libfile(): "f775w", "f814w", ] + + acs_hrc = [ + "f115lp", + "f125lp", + "f140lp", + "f150lp", + "f165lp", + "f122m", + ] + # galex galex = ["fuv", "nuv"] @@ -228,7 +238,7 @@ def make_libfile(): pwaves.append(newfilt.lpivot.value) comments.append("avg of 1, 2, 3, 4") - # Loop through ACS filters + # Loop through ACS WFC filters for filt in acs_wfc: # define wfc1, wfc2 modes @@ -270,6 +280,44 @@ def make_libfile(): pwaves.append(newfilt.lpivot.value) comments.append("avg of wfc1 and wfc2") + # Loop through ACS HRC filters + for filt in acs_hrc: + + # define ir mode + mode = "acs, sbc, " + filt + + # pull bandpasses from stsynphot for the two uvis modes + bp = stsyn.band(mode) + + # extract the wavelength array + wave = bp.waveset + + # define the filter name + filter_name = "HST_ACS_SBC_" + filt.upper() + + # build array of wavelength and throughput + arr = np.array( + list(zip(wave.value.astype(np.float64), bp(wave).astype(np.float64))), + dtype=[("WAVELENGTH", "float64"), ("THROUGHPUT", "float64")], + ) + + # append dataset to the hdf5 filters group + f.create_dataset(filter_name, data=arr) + + # generate filter instance to compute relevant info + newfilt = phot.Filter(wave, bp(wave), name=filt.upper()) + + # populate contents lists with relevant information + tablenames.append(filter_name) + observatories.append("HST") + instruments.append("ACS") + names.append(newfilt.name) + norms.append(newfilt.norm.value) + cwaves.append(newfilt.cl.value) + pwaves.append(newfilt.lpivot.value) + comments.append("") + + # Loop through GALEX filters: for filt in galex: # define ir mode From 0479948d28422c09a3647d928440433cfb7b26f5 Mon Sep 17 00:00:00 2001 From: Karl Gordon Date: Wed, 14 Feb 2024 15:42:23 -0500 Subject: [PATCH 05/21] update variables to match reality --- beast/tools/make_libfile.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/beast/tools/make_libfile.py b/beast/tools/make_libfile.py index dccc6966c..981204a4d 100644 --- a/beast/tools/make_libfile.py +++ b/beast/tools/make_libfile.py @@ -85,7 +85,7 @@ def make_libfile(): "f814w", ] - acs_hrc = [ + acs_sbc = [ "f115lp", "f125lp", "f140lp", @@ -280,8 +280,8 @@ def make_libfile(): pwaves.append(newfilt.lpivot.value) comments.append("avg of wfc1 and wfc2") - # Loop through ACS HRC filters - for filt in acs_hrc: + # Loop through ACS SBC filters + for filt in acs_sbc: # define ir mode mode = "acs, sbc, " + filt From 7f05a535d325d45b5a290d6e1365a0df52c48dcd Mon Sep 17 00:00:00 2001 From: Karl Gordon Date: Wed, 14 Feb 2024 15:44:08 -0500 Subject: [PATCH 06/21] fix codestyle --- beast/tools/make_libfile.py | 1 - 1 file changed, 1 deletion(-) diff --git a/beast/tools/make_libfile.py b/beast/tools/make_libfile.py index 981204a4d..26ff42d74 100644 --- a/beast/tools/make_libfile.py +++ b/beast/tools/make_libfile.py @@ -317,7 +317,6 @@ def make_libfile(): pwaves.append(newfilt.lpivot.value) comments.append("") - # Loop through GALEX filters: for filt in galex: # define ir mode From bfd062461f5d5d3af298e0abdb4abcc60f33e484 Mon Sep 17 00:00:00 2001 From: Karl Gordon Date: Thu, 15 Feb 2024 10:05:28 -0500 Subject: [PATCH 07/21] adding in MIRI filters --- beast/plotting/plot_filters.py | 17 ++++--- beast/tools/make_libfile.py | 90 ++++++++++++++++++++++++++++++++++ 2 files changed, 101 insertions(+), 6 deletions(-) diff --git a/beast/plotting/plot_filters.py b/beast/plotting/plot_filters.py index 394ede3db..1d093d517 100755 --- a/beast/plotting/plot_filters.py +++ b/beast/plotting/plot_filters.py @@ -16,7 +16,7 @@ def plot_filters( filter_names, filterLib=None, save_name="beast_filters", - xlim=[3e3, 1e3], + xlim=None, ylim=[1e-4, 2], show_plot=True, ): @@ -42,7 +42,8 @@ def plot_filters( fig, ax = plt.subplots(1, 1, figsize=(10, 6)) # wavelength grid in angstroms for response functions - waves = np.logspace(3, np.log10(3e4), 501) + # cover all HST and JWST wavelengths + waves = np.logspace(np.log10(912.), np.log10(3e5), 1001) # read in the filter response functions flist = phot.load_filters( @@ -60,6 +61,7 @@ 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.] for f in flist: c = next(color) ax.plot(f.wavelength, f.transmit, color=c, lw=2) @@ -73,10 +75,13 @@ def plot_filters( color=c, ) gvals = (f.transmit > ylim[0]) & (f.transmit < ylim[1]) - if min(f.wavelength[gvals]) < xlim[0]: - xlim[0] = min(f.wavelength[gvals]) - if max(f.wavelength[gvals]) > xlim[1]: - xlim[1] = max(f.wavelength[gvals]) + 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 xlim is None: + xlim = dxlim ax.set_xscale("log") ax.set_yscale("log") diff --git a/beast/tools/make_libfile.py b/beast/tools/make_libfile.py index 26ff42d74..38e71b473 100644 --- a/beast/tools/make_libfile.py +++ b/beast/tools/make_libfile.py @@ -2,6 +2,8 @@ import numpy as np import stsynphot as stsyn +from pandeia.engine.instrument_factory import InstrumentFactory +import astropy.units as u import h5py @@ -18,23 +20,39 @@ def make_libfile(): "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 = [ @@ -94,6 +112,22 @@ def make_libfile(): "f122m", ] + jwst_miri = [ + "f560w", + "f770w", + "f1000w", + "f1065c", + "f1140c", + "f1130w", + "f1280w", + "f1500w", + "f1550c", + "f1800w", + "f2100w", + "f2300c", + "f2550w", + ] + # galex galex = ["fuv", "nuv"] @@ -353,6 +387,62 @@ def make_libfile(): pwaves.append(newfilt.lpivot.value) comments.append("") + for filt in jwst_miri: + # mock configuration + conf = { + "detector": { + "nexp": 1, + "ngroup": 10, + "nint": 1, + "readout_pattern": "fastr1", + "subarray": "full", + }, + "dynamic_scene": True, + "instrument": { + "aperture": "imager", + "filter": filt, + "instrument": "miri", + "mode": "imaging", + }, + } + + # create a configured instrument + instrument_factory = InstrumentFactory(config=conf) + + # set up your wavelengths + pwave = np.logspace(np.log10(3.0), np.log10(40.0), 501) * u.micron + + # get the throughput of the instrument over the desired wavelength range + eff = instrument_factory.get_total_eff(pwave.value) + + # get wavelengths in Angstroms + wave = pwave.to(u.AA) + + # define the filter name + filter_name = "JWST_MIRI_" + filt.upper() + + # build array of wavelength and throughput + arr = np.array( + list(zip(wave.value.astype(np.float64), eff.astype(np.float64))), + dtype=[("WAVELENGTH", "float64"), ("THROUGHPUT", "float64")], + ) + + # append dataset to the hdf5 filters group + f.create_dataset(filter_name, data=arr) + + # generate filter instance to compute relevant info + newfilt = phot.Filter(wave, eff, name=filt.upper()) + + # populate contents lists with relevant information + tablenames.append(filter_name) + observatories.append("GALEX") + instruments.append("GALEX") + names.append(newfilt.name) + norms.append(newfilt.norm.value) + cwaves.append(newfilt.cl.value) + pwaves.append(newfilt.lpivot.value) + comments.append("") + # smash the contents arrays together contents = np.array( list( From 2863b2851022c1244e82561ff23c32c5c408008a Mon Sep 17 00:00:00 2001 From: Karl Gordon Date: Thu, 15 Feb 2024 10:25:08 -0500 Subject: [PATCH 08/21] adding in NIRCam filters --- beast/tools/make_libfile.py | 146 +++++++++++++++++++++++++++++++----- 1 file changed, 129 insertions(+), 17 deletions(-) diff --git a/beast/tools/make_libfile.py b/beast/tools/make_libfile.py index 38e71b473..ac2ab6605 100644 --- a/beast/tools/make_libfile.py +++ b/beast/tools/make_libfile.py @@ -112,21 +112,18 @@ def make_libfile(): "f122m", ] - jwst_miri = [ - "f560w", - "f770w", - "f1000w", - "f1065c", - "f1140c", - "f1130w", - "f1280w", - "f1500w", - "f1550c", - "f1800w", - "f2100w", - "f2300c", - "f2550w", - ] + # fmt: off + jwst_nircam_sw = ["f150w2", "f070w", "f090w", "f115w", "f150w", "f200w", + "f140m", "f162m", "f182m", "f210m", + "f164n", "f187n", "f212n"] + + jwst_nircam_lw = ["f332w2", "f277w", "f356w", "f444w", + "f250m", "f300m", "f335m", "f360m", "f410m", "f430m", "f460m", "f480m", + "f323n", "f405n", "f466n", "f470n"] + + jwst_miri = ["f560w", "f770w", "f1000w", "f1130w", "f1280w", "f1500w", "f1800w", "f2100w", "f2550w", + "f1065c", "f1140c", "f1550c", "f2300c"] + # fmt: on # galex galex = ["fuv", "nuv"] @@ -387,6 +384,121 @@ def make_libfile(): pwaves.append(newfilt.lpivot.value) comments.append("") + for filt in jwst_nircam_sw: + # mock configuration + conf = { + "detector": { + "nexp": 1, + "ngroup": 10, + "nint": 1, + "readout_pattern": "deep2", + "subarray": "full" + }, + "instrument": { + "aperture": "sw", + "disperser": "null", + "filter": filt, + "instrument": "nircam", + "mode": "sw_imaging" + }, + } + + # create a configured instrument + instrument_factory = InstrumentFactory(config=conf) + + # set up your wavelengths + pwave = np.logspace(np.log10(0.5), np.log10(7.0), 501) * u.micron + + # get the throughput of the instrument over the desired wavelength range + eff = instrument_factory.get_total_eff(pwave.value) + + # get wavelengths in Angstroms + wave = pwave.to(u.AA) + + # define the filter name + filter_name = "JWST_NIRCAM_" + filt.upper() + + # build array of wavelength and throughput + arr = np.array( + list(zip(wave.value.astype(np.float64), eff.astype(np.float64))), + dtype=[("WAVELENGTH", "float64"), ("THROUGHPUT", "float64")], + ) + + # append dataset to the hdf5 filters group + f.create_dataset(filter_name, data=arr) + + # generate filter instance to compute relevant info + newfilt = phot.Filter(wave, eff, name=filt.upper()) + + # populate contents lists with relevant information + tablenames.append(filter_name) + observatories.append("JWST") + instruments.append("NIRCAM") + names.append(newfilt.name) + norms.append(newfilt.norm.value) + cwaves.append(newfilt.cl.value) + pwaves.append(newfilt.lpivot.value) + comments.append("") + + + for filt in jwst_nircam_lw: + # mock configuration + conf = { + "detector": { + "nexp": 1, + "ngroup": 10, + "nint": 1, + "readout_pattern": "deep2", + "subarray": "full" + }, + "instrument": { + "aperture": "lw", + "disperser": "null", + "filter": filt, + "instrument": "nircam", + "mode": "lw_imaging" + }, + } + + # create a configured instrument + instrument_factory = InstrumentFactory(config=conf) + + # set up your wavelengths + pwave = np.logspace(np.log10(0.5), np.log10(7.0), 501) * u.micron + + # get the throughput of the instrument over the desired wavelength range + eff = instrument_factory.get_total_eff(pwave.value) + + # get wavelengths in Angstroms + wave = pwave.to(u.AA) + + # define the filter name + filter_name = "JWST_NIRCAM_" + filt.upper() + + # build array of wavelength and throughput + arr = np.array( + list(zip(wave.value.astype(np.float64), eff.astype(np.float64))), + dtype=[("WAVELENGTH", "float64"), ("THROUGHPUT", "float64")], + ) + + # append dataset to the hdf5 filters group + f.create_dataset(filter_name, data=arr) + + # generate filter instance to compute relevant info + newfilt = phot.Filter(wave, eff, name=filt.upper()) + + # populate contents lists with relevant information + tablenames.append(filter_name) + observatories.append("JWST") + instruments.append("NIRCAM") + names.append(newfilt.name) + norms.append(newfilt.norm.value) + cwaves.append(newfilt.cl.value) + pwaves.append(newfilt.lpivot.value) + comments.append("") + + + for filt in jwst_miri: # mock configuration conf = { @@ -435,8 +547,8 @@ def make_libfile(): # populate contents lists with relevant information tablenames.append(filter_name) - observatories.append("GALEX") - instruments.append("GALEX") + observatories.append("JWST") + instruments.append("MIRI") names.append(newfilt.name) norms.append(newfilt.norm.value) cwaves.append(newfilt.cl.value) From bca4bc1e5c7aee482a9f6a60432e8bd8a5696761 Mon Sep 17 00:00:00 2001 From: Karl Gordon Date: Thu, 15 Feb 2024 10:30:06 -0500 Subject: [PATCH 09/21] adding in NIRISS --- beast/tools/make_libfile.py | 57 +++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/beast/tools/make_libfile.py b/beast/tools/make_libfile.py index ac2ab6605..8dad29eef 100644 --- a/beast/tools/make_libfile.py +++ b/beast/tools/make_libfile.py @@ -120,6 +120,9 @@ def make_libfile(): jwst_nircam_lw = ["f332w2", "f277w", "f356w", "f444w", "f250m", "f300m", "f335m", "f360m", "f410m", "f430m", "f460m", "f480m", "f323n", "f405n", "f466n", "f470n"] + + jwst_niriss = ["f090w", "f115w", "f150w", "f200w", "f277w", "f356w", "f444w", + "f140m", "f158m", "f380m", "f430m", "f480m"] jwst_miri = ["f560w", "f770w", "f1000w", "f1130w", "f1280w", "f1500w", "f1800w", "f2100w", "f2550w", "f1065c", "f1140c", "f1550c", "f2300c"] @@ -497,7 +500,61 @@ def make_libfile(): pwaves.append(newfilt.lpivot.value) comments.append("") + for filt in jwst_niriss: + # mock configuration + conf = { + "detector": { + "nexp": 1, + "ngroup": 10, + "nint": 1, + "readout_pattern": "nis", + "subarray": "full" + }, + "instrument": { + "aperture": "imager", + "disperser": "null", + "filter": filt, + "instrument": "niriss", + "mode": "imaging" + }, + } + + # create a configured instrument + instrument_factory = InstrumentFactory(config=conf) + + # set up your wavelengths + pwave = np.logspace(np.log10(0.5), np.log10(7.0), 501) * u.micron + + # get the throughput of the instrument over the desired wavelength range + eff = instrument_factory.get_total_eff(pwave.value) + + # get wavelengths in Angstroms + wave = pwave.to(u.AA) + + # define the filter name + filter_name = "JWST_NIRISS_" + filt.upper() + + # build array of wavelength and throughput + arr = np.array( + list(zip(wave.value.astype(np.float64), eff.astype(np.float64))), + dtype=[("WAVELENGTH", "float64"), ("THROUGHPUT", "float64")], + ) + + # append dataset to the hdf5 filters group + f.create_dataset(filter_name, data=arr) + + # generate filter instance to compute relevant info + newfilt = phot.Filter(wave, eff, name=filt.upper()) + # populate contents lists with relevant information + tablenames.append(filter_name) + observatories.append("JWST") + instruments.append("NIRISS") + names.append(newfilt.name) + norms.append(newfilt.norm.value) + cwaves.append(newfilt.cl.value) + pwaves.append(newfilt.lpivot.value) + comments.append("") for filt in jwst_miri: # mock configuration From 6c2c4c015115d21604882cc7d982db0a003fae5c Mon Sep 17 00:00:00 2001 From: Karl Gordon Date: Thu, 15 Feb 2024 10:30:29 -0500 Subject: [PATCH 10/21] removing extra space --- beast/tools/make_libfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/beast/tools/make_libfile.py b/beast/tools/make_libfile.py index 8dad29eef..60dae6ee4 100644 --- a/beast/tools/make_libfile.py +++ b/beast/tools/make_libfile.py @@ -120,7 +120,7 @@ def make_libfile(): jwst_nircam_lw = ["f332w2", "f277w", "f356w", "f444w", "f250m", "f300m", "f335m", "f360m", "f410m", "f430m", "f460m", "f480m", "f323n", "f405n", "f466n", "f470n"] - + jwst_niriss = ["f090w", "f115w", "f150w", "f200w", "f277w", "f356w", "f444w", "f140m", "f158m", "f380m", "f430m", "f480m"] From 8eb6ea2025873678b6b9b100fb3cd9659e07b047 Mon Sep 17 00:00:00 2001 From: Karl Gordon Date: Thu, 15 Feb 2024 10:31:10 -0500 Subject: [PATCH 11/21] extra line --- beast/tools/make_libfile.py | 1 - 1 file changed, 1 deletion(-) diff --git a/beast/tools/make_libfile.py b/beast/tools/make_libfile.py index 60dae6ee4..94e8bda44 100644 --- a/beast/tools/make_libfile.py +++ b/beast/tools/make_libfile.py @@ -443,7 +443,6 @@ def make_libfile(): pwaves.append(newfilt.lpivot.value) comments.append("") - for filt in jwst_nircam_lw: # mock configuration conf = { From 6cd4a5790b45fb82b4c5b74a27b0d6c603ec5159 Mon Sep 17 00:00:00 2001 From: Karl Gordon Date: Thu, 15 Feb 2024 11:28:35 -0500 Subject: [PATCH 12/21] adding in a test to make sure filters and vega hdf5 files are consisent --- .../tests/test_filters_and_vega_consistent.py | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 beast/observationmodel/tests/test_filters_and_vega_consistent.py diff --git a/beast/observationmodel/tests/test_filters_and_vega_consistent.py b/beast/observationmodel/tests/test_filters_and_vega_consistent.py new file mode 100644 index 000000000..8572899cf --- /dev/null +++ b/beast/observationmodel/tests/test_filters_and_vega_consistent.py @@ -0,0 +1,28 @@ +from astropy.table import QTable + +from beast.config import __ROOT__ +from beast.observationmodel.vega import Vega +from beast.observationmodel import phot + +def test_filters_and_vega_consistent(): + """ + Test to ensure that the filters.hd5 and vega.hd5 are consistent. + In other words, both have the same filters. + """ + ftab = QTable.read(__ROOT__ + "filters.hd5", path="content") + vtab = QTable.read(__ROOT__ + "vega.hd5", path="sed") + + otxt = "" + for cfilt in ftab["TABLENAME"].data: + if cfilt not in vtab["FNAME"].data: + otxt = f"{otxt} {cfilt}" + assert otxt == "", "filters in filters.hd5 missing from vega.hd5:" + otxt + + otxt = "" + for cfilt in vtab["FNAME"].data: + if cfilt not in ftab["TABLENAME"].data: + otxt = f"{otxt} {cfilt}" + assert otxt == "", "filters in vega.hd5 missing from filters.hd5:" + otxt + +if __name__ == "__main__": # pragma: no cover + test_filters_and_vega_consistent() \ No newline at end of file From e3858927f64a4134629191f7d68e6e5b4d738723 Mon Sep 17 00:00:00 2001 From: Karl Gordon Date: Thu, 15 Feb 2024 11:36:39 -0500 Subject: [PATCH 13/21] adding dependancy --- setup.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.cfg b/setup.cfg index ca16800c7..e42fca74a 100644 --- a/setup.cfg +++ b/setup.cfg @@ -30,6 +30,7 @@ install_requires = graphviz asdf stsynphot + pandeia.engine [options.entry_points] console_scripts = From cda417fb90e58126a7f5e19b2e1fb000d71ef41c Mon Sep 17 00:00:00 2001 From: Karl Gordon Date: Thu, 15 Feb 2024 11:55:10 -0500 Subject: [PATCH 14/21] allow new test to run remotely --- .../tests/test_filters_and_vega_consistent.py | 5 +++++ beast/tools/get_libfiles.py | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/beast/observationmodel/tests/test_filters_and_vega_consistent.py b/beast/observationmodel/tests/test_filters_and_vega_consistent.py index 8572899cf..d40d6e5e4 100644 --- a/beast/observationmodel/tests/test_filters_and_vega_consistent.py +++ b/beast/observationmodel/tests/test_filters_and_vega_consistent.py @@ -1,6 +1,7 @@ from astropy.table import QTable from beast.config import __ROOT__ +from beast.tools import get_libfiles from beast.observationmodel.vega import Vega from beast.observationmodel import phot @@ -9,6 +10,10 @@ def test_filters_and_vega_consistent(): Test to ensure that the filters.hd5 and vega.hd5 are consistent. In other words, both have the same filters. """ + + # download the BEAST library files + get_libfiles.get_libfiles(vega_filters_only=True) + ftab = QTable.read(__ROOT__ + "filters.hd5", path="content") vtab = QTable.read(__ROOT__ + "vega.hd5", path="sed") diff --git a/beast/tools/get_libfiles.py b/beast/tools/get_libfiles.py index de79a7184..a45559f0b 100644 --- a/beast/tools/get_libfiles.py +++ b/beast/tools/get_libfiles.py @@ -15,12 +15,14 @@ def _download_rename(filename, url_loc, local_loc): return filename -def get_libfiles(): +def get_libfiles(vega_filters_only=False): """ Download all the library files needed by the BEAST """ for ckey, clib in libs.items(): - _download_rename(clib, libs_server, __ROOT__) + if ((not vega_filters_only) or + (vega_filters_only & (ckey in ["vega", "filters"]))): + _download_rename(clib, libs_server, __ROOT__) if __name__ == "__main__": # pragma: no cover From 1ff6dcf9e561a35685f77ad39e4c57da65629eca Mon Sep 17 00:00:00 2001 From: Karl Gordon Date: Thu, 15 Feb 2024 11:58:10 -0500 Subject: [PATCH 15/21] fixing codestyle --- .../tests/test_filters_and_vega_consistent.py | 6 +++--- beast/tools/get_libfiles.py | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/beast/observationmodel/tests/test_filters_and_vega_consistent.py b/beast/observationmodel/tests/test_filters_and_vega_consistent.py index d40d6e5e4..8578f383c 100644 --- a/beast/observationmodel/tests/test_filters_and_vega_consistent.py +++ b/beast/observationmodel/tests/test_filters_and_vega_consistent.py @@ -2,8 +2,7 @@ from beast.config import __ROOT__ from beast.tools import get_libfiles -from beast.observationmodel.vega import Vega -from beast.observationmodel import phot + def test_filters_and_vega_consistent(): """ @@ -29,5 +28,6 @@ def test_filters_and_vega_consistent(): otxt = f"{otxt} {cfilt}" assert otxt == "", "filters in vega.hd5 missing from filters.hd5:" + otxt + if __name__ == "__main__": # pragma: no cover - test_filters_and_vega_consistent() \ No newline at end of file + test_filters_and_vega_consistent() diff --git a/beast/tools/get_libfiles.py b/beast/tools/get_libfiles.py index a45559f0b..a3372b615 100644 --- a/beast/tools/get_libfiles.py +++ b/beast/tools/get_libfiles.py @@ -20,8 +20,7 @@ def get_libfiles(vega_filters_only=False): Download all the library files needed by the BEAST """ for ckey, clib in libs.items(): - if ((not vega_filters_only) or - (vega_filters_only & (ckey in ["vega", "filters"]))): + if ((not vega_filters_only) or (vega_filters_only & (ckey in ["vega", "filters"]))): _download_rename(clib, libs_server, __ROOT__) From 7a3fc65bec6a6dc4ef56c7f64cf4cdc248489355 Mon Sep 17 00:00:00 2001 From: Karl Gordon Date: Thu, 15 Feb 2024 16:16:16 -0500 Subject: [PATCH 16/21] adding updating of vega.hd5 file --- beast/tools/make_libfile.py | 65 +++++++++++++++++++++++++++++++++++-- 1 file changed, 63 insertions(+), 2 deletions(-) diff --git a/beast/tools/make_libfile.py b/beast/tools/make_libfile.py index 94e8bda44..23a33c2e0 100644 --- a/beast/tools/make_libfile.py +++ b/beast/tools/make_libfile.py @@ -1,9 +1,11 @@ # script to generate BEAST library files +import os import numpy as np import stsynphot as stsyn from pandeia.engine.instrument_factory import InstrumentFactory import astropy.units as u +from astropy.table import QTable import h5py @@ -11,7 +13,7 @@ from beast.observationmodel import phot -def make_libfile(): +def make_filters_libfile(): """ Extract filters from STSYNPHOT and save to main library file. """ @@ -644,5 +646,64 @@ def make_libfile(): hf.close() +def make_vega_libfile(): + + # Read an updated filters.hd5 lib + __default_filtlist__ = __ROOT__ + "/filters.hd5" + filtlist = QTable.read(__default_filtlist__, path="content") + filters = [cfilt.decode("UTF-8") for cfilt in filtlist["TABLENAME"].data] + + # filenames for vega info + __default_vega__ = __ROOT__ + "/vega.hd5" + __default_vega_old__ = __ROOT__ + "/vega_old.hd5" + + # rename the current file so we can write a new version + os.rename(__default_vega__, __default_vega_old__) + + # Get a spectrum from the need-to-be updated vega lib + vega_old = QTable.read(__default_vega_old__, path="spectrum") + vl = vega_old["WAVELENGTH"].data + vf = vega_old["FLUX"].data + + # Write out an updated vega.hd5 file + vega = h5py.File(__default_vega__, "w") + + vega.create_dataset("spectrum", data=vega_old) + flist = phot.load_filters(filters, interp=True, lamb=vl, filterLib=__default_filtlist__) + + fname = [] + cwave = [] + lum = [] + mag = [] + + for i in range(len(flist)): + fname.append(flist[i].name) + cwave.append(flist[i].cl) + flux = flist[i].getFlux(vl, vf) + lum.append(flux) + mag.append(-2.5 * np.log10(flux)) + + contents = np.array( + list( + zip( + fname, + cwave, + lum, + mag, + ) + ), + dtype=[ + ("FNAME", "S30"), + ("CWAVE", " Date: Thu, 15 Feb 2024 16:18:57 -0500 Subject: [PATCH 17/21] fixing codestyle --- beast/tools/make_libfile.py | 46 +++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/beast/tools/make_libfile.py b/beast/tools/make_libfile.py index 23a33c2e0..28abe18ea 100644 --- a/beast/tools/make_libfile.py +++ b/beast/tools/make_libfile.py @@ -397,14 +397,14 @@ def make_filters_libfile(): "ngroup": 10, "nint": 1, "readout_pattern": "deep2", - "subarray": "full" + "subarray": "full", }, "instrument": { "aperture": "sw", "disperser": "null", "filter": filt, "instrument": "nircam", - "mode": "sw_imaging" + "mode": "sw_imaging", }, } @@ -453,14 +453,14 @@ def make_filters_libfile(): "ngroup": 10, "nint": 1, "readout_pattern": "deep2", - "subarray": "full" + "subarray": "full", }, "instrument": { "aperture": "lw", "disperser": "null", "filter": filt, "instrument": "nircam", - "mode": "lw_imaging" + "mode": "lw_imaging", }, } @@ -509,14 +509,14 @@ def make_filters_libfile(): "ngroup": 10, "nint": 1, "readout_pattern": "nis", - "subarray": "full" + "subarray": "full", }, "instrument": { "aperture": "imager", "disperser": "null", "filter": filt, "instrument": "niriss", - "mode": "imaging" + "mode": "imaging", }, } @@ -669,7 +669,9 @@ def make_vega_libfile(): vega = h5py.File(__default_vega__, "w") vega.create_dataset("spectrum", data=vega_old) - flist = phot.load_filters(filters, interp=True, lamb=vl, filterLib=__default_filtlist__) + flist = phot.load_filters( + filters, interp=True, lamb=vl, filterLib=__default_filtlist__ + ) fname = [] cwave = [] @@ -684,21 +686,21 @@ def make_vega_libfile(): mag.append(-2.5 * np.log10(flux)) contents = np.array( - list( - zip( - fname, - cwave, - lum, - mag, - ) - ), - dtype=[ - ("FNAME", "S30"), - ("CWAVE", " Date: Thu, 15 Feb 2024 16:24:22 -0500 Subject: [PATCH 18/21] making code simpler --- beast/tools/make_libfile.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/beast/tools/make_libfile.py b/beast/tools/make_libfile.py index 28abe18ea..b91e35661 100644 --- a/beast/tools/make_libfile.py +++ b/beast/tools/make_libfile.py @@ -678,10 +678,10 @@ def make_vega_libfile(): lum = [] mag = [] - for i in range(len(flist)): - fname.append(flist[i].name) - cwave.append(flist[i].cl) - flux = flist[i].getFlux(vl, vf) + for cfilt in flist: + fname.append(cfilt.name) + cwave.append(cfilt.cl) + flux = cfilt.getFlux(vl, vf) lum.append(flux) mag.append(-2.5 * np.log10(flux)) From b683663f8e87a822925809f0e431b0dbcc399a17 Mon Sep 17 00:00:00 2001 From: "Karl D. Gordon" Date: Sat, 24 Feb 2024 05:41:40 -0500 Subject: [PATCH 19/21] adding filters doc with plots of all filters --- beast/plotting/plot_filters.py | 32 ++++---- beast/tools/make_libfile.py | 115 +++++------------------------ docs/beast_setup.rst | 130 +-------------------------------- docs/index.rst | 1 + 4 files changed, 39 insertions(+), 239 deletions(-) diff --git a/beast/plotting/plot_filters.py b/beast/plotting/plot_filters.py index 1d093d517..05aa135ab 100755 --- a/beast/plotting/plot_filters.py +++ b/beast/plotting/plot_filters.py @@ -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 @@ -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( @@ -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 @@ -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() @@ -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) diff --git a/beast/tools/make_libfile.py b/beast/tools/make_libfile.py index b91e35661..a5a4d6752 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/docs/beast_setup.rst b/docs/beast_setup.rst index d6b4c1f2e..6f43d4293 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/index.rst b/docs/index.rst index 920022309..57fd9a863 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -30,6 +30,7 @@ Basics: :maxdepth: 1 Run setup + Filters supported Photometry files Output files From d2a0790aaacd72a002518cf362c9a0a2e3364e91 Mon Sep 17 00:00:00 2001 From: "Karl D. Gordon" Date: Sat, 24 Feb 2024 05:50:15 -0500 Subject: [PATCH 20/21] adding in missing doc file --- beast/tools/make_libfile.py | 2 +- docs/beast_filters.rst | 257 ++++++++++++++++++++++++++++++++++++ 2 files changed, 258 insertions(+), 1 deletion(-) create mode 100644 docs/beast_filters.rst diff --git a/beast/tools/make_libfile.py b/beast/tools/make_libfile.py index a5a4d6752..742369774 100644 --- a/beast/tools/make_libfile.py +++ b/beast/tools/make_libfile.py @@ -19,7 +19,7 @@ def make_filters_libfile(): """ # fmt: off - wfc3_uvis = ["f218w","f225w", "f275w", "f336w", "f390w", "f438w", + 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", diff --git a/docs/beast_filters.rst b/docs/beast_filters.rst new file mode 100644 index 000000000..ecbd3da6f --- /dev/null +++ b/docs/beast_filters.rst @@ -0,0 +1,257 @@ +####### +Filters +####### + +Filters included in the BEAST + +Hubble +====== + +WFC3 +---- + +Imaging, UVIS, Wide + +.. plot:: + + from beast.plotting.plot_filters import plot_filters + + 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"]) + From 55b1560901071c45689bf8c11975d370bb181efe Mon Sep 17 00:00:00 2001 From: "Karl D. Gordon" Date: Sat, 24 Feb 2024 05:59:27 -0500 Subject: [PATCH 21/21] adding in filters download for RTD build --- docs/beast_filters.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/beast_filters.rst b/docs/beast_filters.rst index ecbd3da6f..e9364b1f1 100644 --- a/docs/beast_filters.rst +++ b/docs/beast_filters.rst @@ -16,6 +16,10 @@ Imaging, UVIS, Wide 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]