diff --git a/.github/workflows/ci_workflows.yml b/.github/workflows/ci_workflows.yml index 4a0aed1b..64ef2efc 100644 --- a/.github/workflows/ci_workflows.yml +++ b/.github/workflows/ci_workflows.yml @@ -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 @@ -68,28 +42,10 @@ 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 - - name: Run tests with requirements file - if: ${{ contains(matrix.toxenv,'-latest') }} - run: | - cp requirements.txt ${{ runner.temp }} - tox -e ${{ matrix.toxenv }} - - - name: Run tests - if: ${{ matrix.continue-on-error == null && contains(matrix.toxenv,'-latest') != true }} + - name: Run Sphinx doc build run: tox -e ${{ matrix.toxenv }} - - - name: Run tests and allow failures - 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 diff --git a/.github/workflows/download_data.yml b/.github/workflows/download_data.yml index 9802d8ce..8f63b7b6 100644 --- a/.github/workflows/download_data.yml +++ b/.github/workflows/download_data.yml @@ -56,8 +56,6 @@ on: type: boolean required: false default: true - schedule: - - cron: "0 0 * * 0" release: push: branches: diff --git a/docs/index.rst b/docs/index.rst index 1f3086bd..5b11b4c2 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -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 `_. - -Getting Started with WebbPSF ----------------------------- - -See `Using WebbPSF `_. - -.. admonition:: Quickstart Jupyter Notebook - - This documentation is complemented by an `Jupyter Notebook format quickstart tutorial `_. 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? ` - -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" `_, Proc. SPIE. 9143, - * Perrin et al. 2012, `"Simulating point spread functions for the James Webb Space Telescope with WebbPSF", `_ Proc SPIE 8842, and - * Perrin 2011, `Improved PSF Simulations for JWST: Methods, Algorithms, and Validation `_, 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 ` to subscribe yourself to the "webbpsf-users@maillist.stsci.edu" list. +.. meta:: + :http-equiv=Refresh: 0; url='https://stpsf.readthedocs.io/en/latest/' \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 31257c27..dd390fb0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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] diff --git a/tox.ini b/tox.ini index c07c0424..1d31db74 100644 --- a/tox.ini +++ b/tox.ini @@ -1,42 +1,8 @@ [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 +envlist = docbuild 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 - cython - photutils - astroquery -commands= - test: pytest {posargs} - cov: pytest {posargs} --cov-config=pyproject.toml --cov-report=xml --cov=webbpsf webbpsf/tests/ - [testenv:docbuild] passenv= * deps= @@ -53,15 +19,3 @@ conda_deps= pandoc commands= sphinx-build docs docs/_build - -[testenv:codestyle] -skip_install = true -description = check package code style -deps = - pycodestyle -commands = - pycodestyle webbpsf - -[testenv:flake8] -exclude= .git,__pycache__, test* -max-line-length = 120 diff --git a/webbpsf/__init__.py b/webbpsf/__init__.py index 6a99574a..15a1ca6e 100644 --- a/webbpsf/__init__.py +++ b/webbpsf/__init__.py @@ -13,119 +13,27 @@ 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`. - """ +import os +import stpsf +import sys +import warnings - 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 " +_warned = False +# TODO SAPP - update [READTHEDOCS_PAGE_TBD] to be correct location once created +if not _warned: + warnings.warn( + """" + This message is for information only and WebbPSF will continue to function as normal. + The WebbPSF library has been moved/renamed to STPSF. Please see [READTHEDOCS_PAGE_TBD] for more information. + WebbPSF is now an alias of STPSF and is running code from the STPSF library. + """, + DeprecationWarning, + stacklevel=2, # Shows the webbpsf import code ) + _warned = True - # 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.", - ) - - -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 - -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, -) - -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", "") diff --git a/webbpsf/conftest.py b/webbpsf/conftest.py deleted file mode 100644 index b955d9a9..00000000 --- a/webbpsf/conftest.py +++ /dev/null @@ -1,25 +0,0 @@ -# this contains imports plugins that configure py.test for astropy tests. -# by importing them here in conftest.py they are discoverable by py.test -# no matter how it is invoked within the source tree. - -try: - from pytest_astropy_header.display import PYTEST_HEADER_MODULES, TESTED_VERSIONS -except ImportError: # In case this plugin is not installed - PYTEST_HEADER_MODULES = {} - TESTED_VERSIONS = {} - -# This really depends on how you set up your package version, -# modify as needed. -try: - from webbpsf import __version__ as version -except ImportError: - version = '' - - -def pytest_configure(): - PYTEST_HEADER_MODULES.pop('Pandas', None) - PYTEST_HEADER_MODULES.pop('h5py', None) - PYTEST_HEADER_MODULES['Astropy'] = 'astropy' - PYTEST_HEADER_MODULES['Photutils'] = 'photutils' - PYTEST_HEADER_MODULES['Poppy'] = 'poppy' - TESTED_VERSIONS['Webbpsf'] = version