Requirements & Installation

The latest released version of WebbPSF can be installed with the conda package management system or using pip.

For ease of installation, we recommend using AstroConda, an astronomy-optimized software distribution for scientific Python built on Anaconda. Install AstroConda according to their instructions, then activate the environment with:

$ source activate astroconda

(Note: if you named your environment something other than astroconda, change the above command appropriately.)

Next, install WebbPSF (along with its dependencies and required reference data) with:

(astroconda)$ conda install webbpsf

Installing with conda (but no AstroConda)

If you already use conda, but do not want to install the full suite of STScI software, you can simply add the AstroConda channel and install WebbPSF as follows (creating a new environment named webbpsf-env):

$ conda config --add channels http://ssb.stsci.edu/astroconda
$ conda create -n webbpsf-env webbpsf
$ source activate webbpsf-env

Upgrading to the latest version is done with conda update -n webbpsf-env --all.

Warning

You must install WebbPSF into a specific environment (e.g. webbpsf-env); our conda package will not work if installed into the default “root” environment.

Installing with pip

If you have Python 2.7, 3.4, or 3.5 already installed another way, WebbPSF and its underlying optical library POPPY may be installed from the Python Package Index in the usual manner for Python packages.

$ pip install --upgrade webbpsf
[... progress report ...]

Successfully installed webbpsf

Note that pip install webbpsf only installs the program code. You still must download and install the data files, as described below. To obtain source spectra for calculations, you should also follow installation instructions for pysynphot.

To use the Jupyter Notebook GUI, you will need to install ipywidgets:

$ pip install ipywidgets
$ jupyter nbextension enable --py --sys-prefix widgetsnbextension

(See the ipywidgets README for more info.)

Tip

If you wish to install WebbPSF on a machine for which you do not have administrative access, you can do so by using Python’s built-in “–user” mechanism for installing packages into your home directory.

$ pip install webbpsf --user

Warning

If you get the message SystemError: Cannot compile 'Python.h'. Perhaps you need to install python-dev|python-devel. during install even when Python.h is available, this means setup.py was unable to install NumPy. This can sometimes be fixed by executing pip install numpy separately, before installing WebbPSF. See the bug report at numpy/numpy#2434 for details.

Installing or updating pysynphot

Pysynphot is an optional dependency, but is highly recommended. Installation instructions can be found here in the POPPY docs.

Installing the Required Data Files

Files containing such information as the JWST pupil shape, instrument throughputs, and aperture positions are distributed separately from WebbPSF. To run WebbPSF, you must download these files and tell WebbPSF where to find them using the WEBBPSF_PATH environment variable.

  1. Download the following file: webbpsf-data-0.6.0.tar.gz [approx. 240 MB]

  2. Untar webbpsf-data-0.6.0.tar.gz into a directory of your choosing.

  3. Set the environment variable WEBBPSF_PATH to point to that directory. e.g.

    export WEBBPSF_PATH=$HOME/data/webbpsf-data

for bash. (You will probably want to add this to your .bashrc.)

You should now be able to successfully import webbpsf in a Python session, or start the GUI with the command webbpsfgui.

Warning

If you have previously installed the data files for an earlier version of WebbPSF, and then update to a newer version, the software may prompt you that you must download and install a new updated version of the data files.

For STScI Users Only

Users at STScI may access the required data files from the Central Storage network. Set the following environment variables in your bash shell. (You will probably want to add this to your .bashrc.)

export WEBBPSF_PATH="/grp/jwst/ote/webbpsf-data"
export PYSYN_CDBS="/grp/hst/cdbs"

Software Requirements

Required Python version: WebbPSF is supported on both Python 2.7 and 3.4+.

Required Python packages:

Recommended Python packages:

Optional Python packages:

Some calculations with POPPY can benefit from the optional packages psutil and pyFFTW, but these are not needed in general. See the POPPY installation docs for more details. These optional packages are only worth adding for speed improvements if you are spending substantial time running calculations.

Installing a pre-release version or contributing to WebbPSF development

The WebbPSF source code repository is hosted at GitHub, as is the repository for POPPY. Users may clone or fork in the usual manner. Pull requests with code enhancements welcomed.

To install the current development version of WebbPSF, you can use pip to install directly from a git repository. To install WebbPSF and POPPY from git, uninstall any existing copies of WebbPSF and POPPY, then invoke pip as follows:

$ pip install -e git+https://github.com/mperrin/poppy.git#egg=poppy \
   -e git+https://github.com/mperrin/webbpsf.git#egg=webbpsf

This will create directories ./src/poppy and ./src/webbpsf in your current directory containing the cloned repository. If you have commit access to the repository, you may want to clone via ssh with a URL like git+ssh://git@github.com:mperrin/webbpsf.git. Documentation of the available options for installing directly from Git can be found in the pip documentation.

Remember to install the required data files, if you have not already installed them.