Skip to content

Predict background levels that JWST will see, for a given RA, DEC, and wavelength

License

Notifications You must be signed in to change notification settings

janerigby/jwst_backgrounds

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

''' This version of the code is obsolete!  It has been cleaned up and is now 
maintained by STScI, as the JWST Background Tool
See https://jwst-docs.stsci.edu/jwst-other-tools/jwst-backgrounds-tool

old readme below
jwst_backgrounds.py is a a simple program to predict the levels of background emission
in JWST observations, for use in proposal planning.
It accesses a precompiled background cache prepared by STScI.
For a given target (RA, DEC), and wavelength, it does the following:
- Plot the spectrum of the background for that target on a given calendar day.
- Plot the total background for that target versus calendar day.
- Compute the number of days per year that the target is observable at low background,
  for a given wavelength and a selectable threshold.
This code was written by Jane Rigby, Jane.Rigby@nasa.gov
The background cache was prepared by Wane Kinzel at STScI.  
Software is provided as-is, with no warranty.

  
INSTALLATION:
0) You need a python 2.7.  jwst_backgrounds has been tested on regular Anaconda, and AstroConda 0.0.1
1) Install pandas if you don't already have it.  It's already in AstroConda.
2) Install healpy (version >= 1.10).  Conda has an outdated version, so I used pip:
    pip install --user healpy
3) Download jwst_backgrounds.py, move it to your working directory or your Python directory.
4) Download the background cache (50 GB).  Move it to a nice place.
5) Untar the background cache:  "tar -xvf  jwst_bkg_cache_1.0.tar"
6) In jwst_backgrounds.py, change the path below "User should change these paths" to point to
   the directory where you downloaded the background cache in step 4.
   
RUNNING THE CODE:
>ipython			# Start python.
import jwst_backgrounds 	# Import the background functions
# Below is an example that plots a background curve for a given RA, DEC, wavelength, threshold
results = jwst_backgrounds.plot_bkg(261.6833333, -73.33222222, 2.15, thresh=1.1, plot_spec=True, plot_days=True, print2file=True)  # Example.
(calendar, RA, DEC, pos, wave_array, nonzodi_bg, thermal, zodi_bg, stray_light_bg, total) = results  #Optional, dig into the results.


TROUBLESHOOTING:
If matplotlib does not display the images, then try editing your ~/.matplotlib/matplotlibrc file,
and choosing a different backend:  
backend: MacOSX
#backend: TkAgg
#backend: GTKCairo

'''

About

Predict background levels that JWST will see, for a given RA, DEC, and wavelength

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages