The JWST Backgrounds Tool (JBT) is a a simple command line tool that accesses the JWST background models to return the total background intensity and its components as a function of time. This can be useful for estimating and visualizing the impact of the background on the schedulability of JWST observations. It can also be used to retrieve the background intensity spectra and their components.
The JWST Backgrounds Tool (JBT) offers a convenient way to display observing dates for which the JWST background is within a given fraction of the minimum possible background for a given position on the celestial sphere. The tool is written in python and accesses an online repository of the same background model cache that is used by the JWST ETC and the JWST scheduling system.
What does the JBT do?
For a given target (RA, DEC in decimal degrees), and wavelength (in microns), the JBT can do the following:
The JWST background cache
The JBT accesses a precompiled cached background model that was prepared by Space Telescope Science Institute. The background cache is hosted by the Mikulski Archive for Space Telescopes (MAST), so you need internet access to run the tool with the remote cache. For offline use, it is possible to download the full background cache to your local machine, although it is a large file (~50 GB). Instructions for downloading the background cache can be found in this MAST Newsletter article from August 2017.
The easiest way to install the JBT is using pip:
Note: healpy (version >= 1.10) is a required dependency, but if you do not have it, pip will install it automatically. The healpy installation may take a few minutes.
If you have installed the tool previously and want to check for and install updates,
2) Unpack the archive:
3) Install jwst_backgrounds:
Running the JBT from the command line
You can run the tool from the command line (easiest for casual use), or you can import it as a python module, which is useful for writing scripts to carry out more detailed parameter studies. A complete description of available command line options and arguments can be displayed using the command:
Using the command line, the following command will plot the bathtub curve for a given RA, DEC and wavelength, and will also plot the background intensity spectrum for day 268 (where day=1 is January 1st). Note that the options (identified with "--") must come first.
This command will open a GUI plot window and cause the background data to be plotted for RA=53.1625 degrees and DEC=-27.7914 degrees; closing this plot will expose the second plot of the bathtub curve at 4.4 μm (in this example). Closing this plot will return control to the command line. Figure 1 shows the plots resulting from this example.
Some users may find it useful to have the data generated by the tool in ASCII files for use by other programs. By default, the tool outputs files background.txt and background_versus_day.txt to the current working directory. However, if you want to redirect this output to file names of your choosing, the tool help contains instructions to do this. Here is an example:
Scripting the JBT
The JBT can be more flexible when imported into python as a module. For instance, the following lines will replicate the command line example using the convenience method bg_tools.get_background().
However, a primary reason to use the JBT python module, rather than the command line, is to explore a parameter space. For that, we can access the background class, which will return the data, but will not create the plots. For instance, the following script will retrieve the backgrounds for the Hubble Ultra Deep Field, the Orion Trapezium cluster and the Galactic Center and print their relative values at 4.4 micron, for the first day in the year for which they are visible.