Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebbPSF to STPSF #951

Open
wants to merge 13 commits into
base: develop
Choose a base branch
from
34 changes: 1 addition & 33 deletions .github/workflows/ci_workflows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,37 +16,11 @@ jobs:
matrix:
include:

- name: Coverage test in Python 3
os: ubuntu-latest
python: '3.11'
toxenv: py311-poppydev-pysiafdev-cov

- name: Check for Sphinx doc build errors
os: ubuntu-latest
python: '3.10'
toxenv: docbuild

- name: Try Astropy development version
os: ubuntu-latest
python: '3.10'
toxenv: py310-astropydev-test

- name: Try latest versions of all dependencies
os: ubuntu-latest
python: '3.11'
toxenv: py311-latest-test

- name: Try minimum supported versions
os: ubuntu-latest
python: '3.10'
toxenv: py310-legacy-test

- name: Try released POPPY and PySIAF
os: ubuntu-latest
python: '3.10'
toxenv: py310-stable-test
continue-on-error: 'true'

steps:
- name: Checkout code
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
Expand All @@ -68,7 +42,7 @@ jobs:
key: ${{ needs.retrieve_cache.outputs.cache_key }}

- name: Set WebbPSF data path
run: echo "WEBBPSF_PATH=${{ needs.retrieve_cache.outputs.cache_path }}/webbpsf-data/" >> $GITHUB_ENV
run: echo "WEBBPSF_PATH=${{ needs.retrieve_cache.outputs.cache_path }}/stpsf-data/" >> $GITHUB_ENV

- name: Check conda info
run: conda info
Expand All @@ -87,9 +61,3 @@ jobs:
if: matrix.continue-on-error
continue-on-error: true
run: tox -e ${{ matrix.toxenv }}

- name: Upload coverage to codecov
if: ${{ contains(matrix.toxenv,'-cov') }}
uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0
with:
file: ./coverage.xml
2 changes: 0 additions & 2 deletions .github/workflows/download_data.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ on:
type: boolean
required: false
default: true
schedule:
- cron: "0 0 * * 0"
release:
push:
branches:
Expand Down
115 changes: 2 additions & 113 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,113 +1,2 @@
Documentation for WebbPSF
===============================

WebbPSF is a Python package that computes simulated point spread functions (PSFs) for NASA's James Webb Space Telescope (JWST) and Nancy Grace Roman Space Telescope. WebbPSF transforms models of telescope and instrument optical state into PSFs, taking into account detector pixel scales, rotations, filter profiles, and point source spectra. It is rather a tool for transforming optical path difference (OPD) maps, created with observatory systems engineering models, into the resulting PSFs as observed with JWST's or Roman's instruments.

.. figure:: ./fig_instrument_comparison.png
:scale: 45 %
:align: center
:alt: Sample PSFs for JWST's instruments.

Sample PSFs for JWST's instrument suite, all on the same angular scale and display stretch.

.. figure:: ./roman_figures/webbpsf-roman_page_header.png
:scale: 70 %
:align: center
:alt: Sample PSFs for the filters in the Roman WFI.

Sample PSFs for the filters in the Roman WFI on SCA01. Note that
the prism and grism PSFs shown here are monochromatic.


**Contributors:**
WebbPSF has been developed by Marshall Perrin, Marcio Meléndez, Shannon Osborne, Robel Geda, Brad Sappington, Charles-Philippe Lajoie, Joseph Long, Justin Otor, Jarron Leisenring, Neil Zimmerman, Keira Brooks, and Anand Sivaramakrishnan, with contributions from Alden Jurling, Lauren Chambers, Ewan Douglas, and `others <https://github.com/spacetelescope/webbpsf/graphs/contributors>`_.

Getting Started with WebbPSF
----------------------------

See `Using WebbPSF <usage.html>`_.

.. admonition:: Quickstart Jupyter Notebook

This documentation is complemented by an `Jupyter Notebook format quickstart tutorial <http://nbviewer.jupyter.org/github/spacetelescope/webbpsf/blob/stable/notebooks/WebbPSF_tutorial.ipynb>`_. Downloading and running that notebook is a great way to get started using WebbPSF.


.. admonition:: Getting Help

For help using or installing webbpsf, you can contact the STScI JWST Help Desk at jwsthelp.stsci.edu, category WebbPSF/JWST Telescope.


:ref:`What's new in the latest release? <whatsnew>`

Contents
--------

.. toctree::
:maxdepth: 1
:caption: Getting Started

intro.rst
installation.rst
relnotes.rst
usage.ipynb
psf_grids.ipynb

.. toctree::
:maxdepth: 1
:caption: Modeling JWST PSFs

jwst.rst
more_examples.rst
jwst_measured_opds.ipynb
jwst_detector_effects.ipynb
jwst_matching_psfs_to_data.ipynb
jwst_ifu_datacubes.ipynb
jwst_large_psf.ipynb
jwst_optical_budgets.ipynb
jwst_psf_subtraction.ipynb
jwst_wavefront_deltas.ipynb
less_common_usage.rst

.. toctree::
:maxdepth: 1
:caption: Modeling Roman PSFs

roman.rst

.. toctree::
:maxdepth: 1
:caption: Package Documentation

api_reference.rst
help.rst
sampling.rst
fft_optimization.rst
poppy.rst

.. toctree::
:maxdepth: 1
:caption: Developer Reference

available_opds.rst
field_dependence/multifield_documentation.ipynb
references.rst
release.rst


.. admonition:: How to cite WebbPSF

In addition to this documentation, WebbPSF is described in the following references. Users of WebbPSF are encouraged to cite one of these.

* Perrin et al. 2014, `"Updated point spread function simulations for JWST with WebbPSF" <http://adsabs.harvard.edu/abs/2014SPIE.9143E..3XP>`_, Proc. SPIE. 9143,
* Perrin et al. 2012, `"Simulating point spread functions for the James Webb Space Telescope with WebbPSF", <http://adsabs.harvard.edu/abs/2012SPIE.8442E..3DP>`_ Proc SPIE 8842, and
* Perrin 2011, `Improved PSF Simulations for JWST: Methods, Algorithms, and Validation <Improved_PSFs_for_Webb.pdf>`_, JWST Technical report JWST-STScI-002469.

In particular, the 2012 SPIE paper gives a broad overview, the 2014 SPIE paper presents comparisons to instrument cryotest data, and the Technical Report document describes in more detail the relevant optical physics, explains design decisions and motivation for WebbPSF's architecture, and presents extensive validation tests demonstrating consistency between WebbPSF and other PSF simulation packages used throughout the JWST project.


* :ref:`genindex`
* :ref:`search`

**Mailing List**

If you would like to receive email announcements of future versions, please contact Marshall Perrin, or visit `maillist.stsci.edu <https://maillist.stsci.edu/scripts/wa.exe?SUBED1=webbpsf-users&A=1>` to subscribe yourself to the "[email protected]" list.
.. meta::
:http-equiv=Refresh: 0; url='https://stpsf.readthedocs.io/en/latest/'
10 changes: 1 addition & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,7 @@ dynamic = [
readme = "README.rst"
requires-python = ">=3.10"
dependencies = [
"numpy>=1.21.6",
"scipy>=1.5.0",
"matplotlib>=3.2.0",
"astropy>=5.1.0",
"photutils>=1.10.0",
"poppy>=1.0.0",
"pysiaf>=0.23.3",
"synphot>=1.0.0",
"astroquery>=0.4.6",
"stpsf>=1.5.2"
]

[project.license]
Expand Down
19 changes: 0 additions & 19 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,32 +1,14 @@
[tox]
envlist =
py{310,311,312}-test
py{310,311,312}-{poppydev,pysiafdev,astropydev,latest,stable}-test
py310-legacy-test
py{310,311,312}-{poppydev,pysiafdev}-cov

isolated_build = true

[testenv]
setenv =
astropydev: PIP_EXTRA_INDEX_URL = https://pypi.anaconda.org/astropy/simple
passenv = *
deps =
pytest
pytest-astropy
poppydev,legacy,astropydev,latest: git+https://github.com/spacetelescope/poppy.git#egg=poppy
pysiafdev,astropydev: git+https://github.com/spacetelescope/pysiaf.git#egg=pysiaf
legacy: numpy==1.21.6
legacy: pysiaf==0.11.0
legacy: astropy==5.1.0
legacy: astroquery==0.4.6
astropydev: astropy>=0.0.dev0
poppydev: synphot
latest: -rrequirements.txt
stable: poppy
stable: pysiaf
cov: pytest-cov
cov: coverage
conda deps =
scipy
matplotlib
Expand All @@ -35,7 +17,6 @@ conda deps =
astroquery
commands=
test: pytest {posargs}
cov: pytest {posargs} --cov-config=pyproject.toml --cov-report=xml --cov=webbpsf webbpsf/tests/

[testenv:docbuild]
passenv= *
Expand Down
127 changes: 20 additions & 107 deletions webbpsf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,119 +13,32 @@
Documentation can be found online at https://webbpsf.readthedocs.io/
"""

import sys
from astropy import config as _config

try:
from .version import __version__
except ImportError:
__version__ = ""

__minimum_python_version__ = "3.10"


class UnsupportedPythonError(Exception):
pass


if sys.version_info < tuple(
(int(val) for val in __minimum_python_version__.split("."))
):
raise UnsupportedPythonError(
"webbpsf does not support Python < {}".format(__minimum_python_version__)
)


# This tuple gives the *minimum* version of the WebbPSF data package
# required. If changes to the code and data mean WebbPSF won't work
# properly with an old data package, increment this version number.
# (It's checked against $WEBBPSF_DATA/version.txt)
DATA_VERSION_MIN = (1, 5, 0)


class Conf(_config.ConfigNamespace):
"""
Configuration parameters for `webbpsf`.
"""

default_oversampling = _config.ConfigItem(
4,
"Default "
+ "oversampling factor: number of times more finely sampled than "
+ "an integer pixel for the grid spacing in the PSF calculation.",
)

default_output_mode = _config.ConfigItem(
"both",
"Should output include the oversampled PSF, a copy rebinned onto the integer detector spacing, or both?\
Options: 'oversampled','detector','both' ",
)
default_fov_arcsec = _config.ConfigItem(
5.0, "Default field of view size, in arcseconds per side of the square "
)

# Should be package settings:
WEBBPSF_PATH = _config.ConfigItem(
"from_environment_variable",
"Directory path to data files required for WebbPSF calculations, such as OPDs and filter transmissions.\
This will be overridden by the environment variable $WEBBPSF_PATH, if present.",
)
autoconfigure_logging = _config.ConfigItem(
False,
"Should WebbPSF configure logging for itself and POPPY? This adds handlers that report "
"calculation progress and information",
)
logging_level = _config.ConfigItem(
["INFO", "DEBUG", "WARN", "ERROR", "CRITICAL", "NONE"],
# (the default value is the first item in the options list)
"Desired logging level for WebbPSF optical calculations.",
)
logging_filename = _config.ConfigItem(
"none", "Desired filename to save log messages to."
)
logging_format_screen = _config.ConfigItem(
"[%(name)7s] %(message)s", "Format for lines logged to the screen."
)
logging_format_file = _config.ConfigItem(
"%(asctime)s [%(name)s:%(levelname)s] %(filename)s:%(lineno)d: %(message)s",
"Format for lines logged to a file.",
)
import os
import stpsf
import sys
import warnings

warnings.warn(
""""

conf = Conf()
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

from . import utils # noqa - must go after config
from . import trending # noqa - must go after config
from .utils import setup_logging, restart_logging, system_diagnostic, measure_strehl # noqa - must go after config
THE WEBBPSF LIBRARY HAS BEEN DEPRECATED
All existing WebbPSF code has been migrated to the STPSF package.
Please update your code to use STPSF instead of WebbPSF.
https://github.com/spacetelescope/stpsf
or
pip install stpsf
WebbPSF is now an alias of STPSF and is running code from the STPSF library.

from poppy import ( # noqa
display_psf,
display_psf_difference,
display_ee,
measure_ee,
display_profiles,
radial_profile,
measure_radial,
measure_fwhm,
measure_sharpness,
measure_centroid,
specFromSpectralType,
fwcentroid,
)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

from .webbpsf_core import ( # noqa
instrument,
SpaceTelescopeInstrument,
JWInstrument,
NIRCam,
NIRISS,
NIRSpec,
MIRI,
FGS,
""",
DeprecationWarning,
stacklevel=2, # Shows the webbpsf import code
)

from .opds import enable_adjustable_ote # noqa

from .roman import WFI, RomanCoronagraph # noqa
sys.modules["webbpsf"] = stpsf

from .match_data import setup_sim_to_match_file # noqa
os.environ["STPSF_PATH"] = os.environ.get("WEBBPSF_PATH", "")
BradleySappington marked this conversation as resolved.
Show resolved Hide resolved
Loading
Loading