diff --git a/dev_utils/master_data_release.sh b/dev_utils/master_data_release.sh index b1785026..c05f748a 100755 --- a/dev_utils/master_data_release.sh +++ b/dev_utils/master_data_release.sh @@ -21,9 +21,10 @@ new_directory="$main_directory/webbpsf-data-$VER" symlink_directory="/grp/jwst/ote/webbpsf-data" cp "$PWD/webbpsf-data-$VER.tar.gz" "$main_directory" -tar -xzf "$PWD/webbpsf-data-$VER.tar.gz" -C "$main_directory" -mv "$main_directory/webbpsf-data" "$new_directory" -ln -s "$new_directory" "$symlink_directory" +mkdir "$new_directory" +tar -xzf "$PWD/webbpsf-data-$VER.tar.gz" -C "$new_directory" +rm "$symlink_directory" +ln -s "$new_directory/webbpsf-data" "$symlink_directory" ./make-minimal-datafiles.py ${PWD}/webbpsf-data-${VER}.tar.gz $VER diff --git a/docs/README figure.ipynb b/docs/README figure.ipynb index 52d39ee8..45b05d1a 100644 --- a/docs/README figure.ipynb +++ b/docs/README figure.ipynb @@ -701,8 +701,8 @@ "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.7.3" + "pygments_lexer": "python", + "version": "3.10.0" } }, "nbformat": 4, diff --git a/docs/available_opds.rst b/docs/available_opds.rst index 39a0030e..dc9fb351 100644 --- a/docs/available_opds.rst +++ b/docs/available_opds.rst @@ -5,14 +5,14 @@ Appendix: Available Optical Path Difference (OPD) files On-Orbit OPD Measurements ------------------------- -The default OPD in WebbPSF is now an on-orbit measured OPD from early in cycle 1 science operations: +The default OPD in WebbPSF is now an on-orbit measured OPD from early in cycle 1 science operations: - * `JWST_OTE_OPD_cycle1_example_2022-07-30.fits`: The specific OPD measurement selected, from 2022 July 30, intentionally represents a slightly conservative alignment state (after a couple weeks of relative stability, shortly before a next wavefront correction). This is about a 75th percentile performance level, based on operational experience during the first few months of cycle 1. Most observations will have OPDs similar to this, or slightly better; a smaller number will have not quite as good. + * `JWST_OTE_OPD_cycle1_example_2022-07-30.fits`: The specific OPD measurement selected, from 2022 July 30, intentionally represents a slightly conservative alignment state (after a couple weeks of relative stability, shortly before a next wavefront correction). This is about a 75th percentile performance level, based on operational experience during the first few months of cycle 1. Most observations will have OPDs similar to this, or slightly better; a smaller number will have not quite as good. -This intentionally-slightly-conservative OPD was chosen for use in the cycle 2 ETC and is set as the default here for consistency. -For modeling PSFs of science observations, it is generally best to retrieve and use the -`measured in-flight wavefronts `_ based on the date of -the science observation. +This intentionally-slightly-conservative OPD was chosen for use in the cycle 2 ETC and is set as the default here for consistency. +For modeling PSFs of science observations, it is generally best to retrieve and use the +`measured in-flight wavefronts `_ based on the date of +the science observation. @@ -20,16 +20,16 @@ the science observation. Pre-Launch Model OPDs (Obsolete) --------------------------------- -Prior versions of this page documented the _pre-flight_ models for JWST wavefronts. These models are now happily obsolete, and can be replaced by +Prior versions of this page documented the `_pre-flight_` models for JWST wavefronts. These models are now happily obsolete, and can be replaced by `actual measured in-flight wavefronts `_. - + Most pre-launch predicted OPDs are no longer included in the WebbPSF data files distribution. The only such files still included are - * `JWST_OTE_OPD_RevAA_prelaunch_predicted.fits.gz`: This contains predicted OPDs based on the best available optical models at the time of launch, including the calibrated, known surface figures of each mirror as measured in ground testing. For most purposes this is superceded by the on-orbit measurements. It is retained for back-compatibility mostly. - - -For any cases in which you may need further information about the other pre-launch predicted OPD files, -consult the `older versions of this page hosted on readthedocs`_. - + * `JWST_OTE_OPD_RevAA_prelaunch_predicted.fits.gz`: This contains predicted OPDs based on the best available optical models at the time of launch, including the calibrated, known surface figures of each mirror as measured in ground testing. For most purposes this is superceded by the on-orbit measurements. It is retained for back-compatibility mostly. + + +For any cases in which you may need further information about the other pre-launch predicted OPD files, +consult the `older versions of this page hosted on readthedocs `_. + diff --git a/docs/conf.py b/docs/conf.py index 3eed6ead..76a4ed1d 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -70,6 +70,7 @@ extensions = [ "sphinx.ext.mathjax", "sphinx.ext.autodoc", + "sphinx.ext.graphviz", "sphinx.ext.intersphinx", "sphinx.ext.todo", "sphinx.ext.inheritance_diagram", @@ -80,11 +81,12 @@ "sphinx_issues", "nbsphinx", "numpydoc", - "astroquery", ] numpydoc_show_class_members = False +autosummary_generate = True +graphviz_dot = "dot" # Add any paths that contain templates here, relative to this directory. templates_path = ["_templates"] diff --git a/docs/field_dependence/multifield_documentation.ipynb b/docs/field_dependence/multifield_documentation.ipynb index a10b7399..a3feff49 100644 --- a/docs/field_dependence/multifield_documentation.ipynb +++ b/docs/field_dependence/multifield_documentation.ipynb @@ -522,8 +522,8 @@ "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.7.7" + "pygments_lexer": "python", + "version": "3.10.0" } }, "nbformat": 4, diff --git a/docs/index.rst b/docs/index.rst index ab9e2dd0..196b21d3 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -19,7 +19,7 @@ WebbPSF is a Python package that computes simulated point spread functions (PSFs **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 `_. +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 ---------------------------- @@ -77,7 +77,6 @@ Contents api_reference.rst help.rst - performance.rst sampling.rst fft_optimization.rst poppy.rst diff --git a/docs/installation.rst b/docs/installation.rst index 7ecd2fc1..5ef5f9f3 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -73,7 +73,7 @@ Files containing such information as the JWST pupil shape, instrument throughput 2. Untar ``webbpsf-data-LATEST.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 + export WEBBPSF_PATH=$HOME/data/webbpsf-data for bash. (You will probably want to add this to your ``.bashrc``.) diff --git a/docs/jwst_detector_effects.ipynb b/docs/jwst_detector_effects.ipynb index ef25b89e..d0d1cfae 100644 --- a/docs/jwst_detector_effects.ipynb +++ b/docs/jwst_detector_effects.ipynb @@ -39,7 +39,7 @@ "metadata": {}, "outputs": [], "source": [ - "import webbpsf \n", + "import webbpsf\n", "import numpy as np\n", "import matplotlib.pyplot as plt" ] @@ -275,7 +275,7 @@ ], "source": [ "wave_arr = np.array([])\n", - "fwhm_fun_arr_no_effects = np.array([]) \n", + "fwhm_fun_arr_no_effects = np.array([])\n", "for filters in niriss.filter_list[:-1]:\n", " niriss = webbpsf.NIRISS()\n", " niriss.filter = filters\n", @@ -286,8 +286,7 @@ " single_webbpsf_niriss_no_effects = niriss.calc_psf(fov_pixels=fov_pixels)\n", " wave_arr = np.append(wave_arr, single_webbpsf_niriss_no_effects[3].header['WAVELEN'])\n", " fitted_psf = measure_fwhm(single_webbpsf_niriss_no_effects[3].data)\n", - " fwhm_fun_arr_no_effects = np.append(fwhm_fun_arr_no_effects,np.sqrt(fitted_psf.x_fwhm * fitted_psf.y_fwhm)*niriss.pixelscale)\n", - " " + " fwhm_fun_arr_no_effects = np.append(fwhm_fun_arr_no_effects,np.sqrt(fitted_psf.x_fwhm * fitted_psf.y_fwhm)*niriss.pixelscale)\n" ] }, { @@ -325,7 +324,7 @@ ], "source": [ "wave_arr = np.array([])\n", - "fwhm_fun_arr = np.array([]) \n", + "fwhm_fun_arr = np.array([])\n", "for filters in niriss.filter_list[:-1]:\n", " niriss = webbpsf.NIRISS()\n", " niriss.filter = filters\n", @@ -334,8 +333,7 @@ " single_webbpsf_niriss = niriss.calc_psf(fov_pixels=fov_pixels)\n", " wave_arr = np.append(wave_arr, single_webbpsf_niriss[3].header['WAVELEN'])\n", " fitted_psf = measure_fwhm(single_webbpsf_niriss[3].data)\n", - " fwhm_fun_arr = np.append(fwhm_fun_arr,np.sqrt(fitted_psf.x_fwhm * fitted_psf.y_fwhm)*niriss.pixelscale)\n", - " " + " fwhm_fun_arr = np.append(fwhm_fun_arr,np.sqrt(fitted_psf.x_fwhm * fitted_psf.y_fwhm)*niriss.pixelscale)\n" ] }, { @@ -379,10 +377,9 @@ "\n", "for fn in stdpsf:\n", " hd = fits.open(fn)\n", - " eps_data = ndimage.zoom(hd[0].data[12],0.25) # the ePSF is binned down to detector-sampled \n", + " eps_data = ndimage.zoom(hd[0].data[12],0.25) # the ePSF is binned down to detector-sampled\n", " fitted_psf_epsf = measure_fwhm(eps_data)\n", - " fwhm_fun_arr_epsf = np.append(fwhm_fun_arr_epsf,np.sqrt(fitted_psf_epsf.x_fwhm * fitted_psf_epsf.y_fwhm)*niriss.pixelscale)\n", - " " + " fwhm_fun_arr_epsf = np.append(fwhm_fun_arr_epsf,np.sqrt(fitted_psf_epsf.x_fwhm * fitted_psf_epsf.y_fwhm)*niriss.pixelscale)\n" ] }, { @@ -466,6 +463,14 @@ "\n" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "575dd903", + "metadata": {}, + "outputs": [], + "source": [] + }, { "cell_type": "markdown", "id": "89334f7b", @@ -502,7 +507,7 @@ "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", + "pygments_lexer": "python", "version": "3.11.7" } }, diff --git a/docs/jwst_matching_psfs_to_data.ipynb b/docs/jwst_matching_psfs_to_data.ipynb index 26c6c089..6fe21c36 100644 --- a/docs/jwst_matching_psfs_to_data.ipynb +++ b/docs/jwst_matching_psfs_to_data.ipynb @@ -226,7 +226,7 @@ "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", + "pygments_lexer": "python", "version": "3.11.7" } }, diff --git a/docs/jwst_measured_opds.ipynb b/docs/jwst_measured_opds.ipynb index 2aeae7f9..f27d8a7a 100644 --- a/docs/jwst_measured_opds.ipynb +++ b/docs/jwst_measured_opds.ipynb @@ -722,7 +722,7 @@ "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", + "pygments_lexer": "python", "version": "3.11.7" } }, diff --git a/docs/jwst_optical_budgets.ipynb b/docs/jwst_optical_budgets.ipynb index 3f3bd9de..da3e5b25 100644 --- a/docs/jwst_optical_budgets.ipynb +++ b/docs/jwst_optical_budgets.ipynb @@ -303,8 +303,8 @@ "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.7.7" + "pygments_lexer": "python", + "version": "3.10.0" } }, "nbformat": 4, diff --git a/docs/jwst_psf_subtraction.ipynb b/docs/jwst_psf_subtraction.ipynb index ddeee950..f875436a 100644 --- a/docs/jwst_psf_subtraction.ipynb +++ b/docs/jwst_psf_subtraction.ipynb @@ -630,7 +630,7 @@ "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", + "pygments_lexer": "python", "version": "3.11.7" } }, diff --git a/docs/jwst_wavefront_deltas.ipynb b/docs/jwst_wavefront_deltas.ipynb index 89011605..da4eddcf 100644 --- a/docs/jwst_wavefront_deltas.ipynb +++ b/docs/jwst_wavefront_deltas.ipynb @@ -103,8 +103,8 @@ "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.9.10" + "pygments_lexer": "python", + "version": "3.10.0" } }, "nbformat": 4, diff --git a/docs/release.rst b/docs/release.rst index 034b1480..aee9b6f0 100644 --- a/docs/release.rst +++ b/docs/release.rst @@ -24,7 +24,7 @@ Releasing new data packages #. Update the URL in ``installation.rst`` under :ref:`data_install` Details for using `master_data_release.sh`: -------------------------------------- +------------------------------------------- Invoke ``dev_utils/master_data_release.sh`` one of the following ways to make a gzipped tarred archive of the WebbPSF data suitable for distribution. @@ -43,25 +43,25 @@ Releasing new versions ====================== If you are making a release for `poppy` at the same time as a release in WebbPSF, do that first. -Update the dependency requirement to the new version of poppy, in ``webbpsf/pyproject.toml`. +Update the dependency requirement to the new version of poppy, in ``webbpsf/pyproject.toml``. When you are ready, proceed with the WebbPSF release as follows: -#. Get the `develop` branch into the state that you want, including all PRs merged, updated release notes. This includes all tests passing both locally and on GitHub Actions. -#. Tag the commit with `v`, being sure to sign the tag with the `-s` option. - * ``git tag -s v -m "Release v"`` + #. Get the `develop` branch into the state that you want, including all PRs merged, updated release notes. This includes all tests passing both locally and on GitHub Actions. + #. Tag the commit with `v`, being sure to sign the tag with the `-s` option. + * ``git tag -s v -m "Release v"`` -#. Push tag to github, on `develop` -#. On github, make a PR from `develop` to `stable` (this can be done ahead of time and left open, until all individual PRs are merged into `develop`.). -#. After verifying that PR is complete and tests pass, merge it. (Once merged, both the `stable` and `develop` branches should match). -#. Release on Github: + #. Push tag to github, on `develop` + #. On github, make a PR from `develop` to `stable` (this can be done ahead of time and left open, until all individual PRs are merged into `develop`.). + #. After verifying that PR is complete and tests pass, merge it. (Once merged, both the `stable` and `develop` branches should match). + #. Release on Github: - #. On Github, click on "[N] Releases". - #. Select "Draft a new release". - #. Specify the version number, title, and brief description of the release. - #. Press "Publish Release". + #. On Github, click on "[N] Releases". + #. Select "Draft a new release". + #. Specify the version number, title, and brief description of the release. + #. Press "Publish Release". -#. Release to PyPI. This should now happen automatically on GitHub Actions. This will be triggered by a GitHub Actions build of a tagged commit on the `stable` branch, so it will happen automatically on the prior step for the PR into `stable`. + #. Release to PyPI. This should now happen automatically on GitHub Actions. This will be triggered by a GitHub Actions build of a tagged commit on the `stable` branch, so it will happen automatically on the prior step for the PR into `stable`. .. note:: diff --git a/docs/relnotes.rst b/docs/relnotes.rst index 1c978ee0..a6615fb5 100644 --- a/docs/relnotes.rst +++ b/docs/relnotes.rst @@ -31,11 +31,90 @@ Version 1.3.0 *2024 May* -This release comes with new features and improvements including but not limited to: +This release comes with new features and improvements for JWST PSF models, including but not limited to: -X. Improved support for NIRSpec and MIRI IFU PSF calculations, including addition of a ``mode`` attribute for toggling between imaging mode and IFU mode simulations; an option for much faster (but slightly simplified) IFU datacube PSF calculations. Spectral bandpass information added for the IFU bands for both NIRSpec and MIRI. For NIRSpec, IFU mode PSF outputs are rotated by an additional 90 degrees to match the convention used in pipeline-output s3d datacubes made using the IFUAlign orientation. This extra rotation can be optionally disabled if so desired; see the NIRSpec class docstring. -X. Improved PSF models for MIRI imager, in particular including an empirical model for the field-dependent shifts of the cruciform artifact seen at short wavelengths. +1. Improved support for NIRSpec and MIRI IFU PSF calculations, including addition of a ``mode`` attribute for toggling between imaging mode and IFU mode simulations; an option for much faster (but slightly simplified) IFU datacube PSF calculations. Spectral bandpass information was added for the IFU bands for both NIRSpec and MIRI. For NIRSpec, IFU mode PSF outputs are rotated by an additional 90 degrees to match the convention used in pipeline-output s3d datacubes made using the IFUAlign orientation. This extra rotation can be optionally disabled if so desired; see the NIRSpec class docstring. +2. Improved PSF models for MIRI imager, in particular including an empirical model for the field-dependent shifts of the cruciform artifact seen at short wavelengths, and improved fidelity for modeling MIRI LRS slit PSFs. +3. For all JWST instruments, simulation of interpixel capacitance effects is now included for oversampled outputs as well as for the detector-sampled outputs. +4. Various improvements to the `setup_sim_to_match_data` function to automatically configure PSF simulations correctly for a more complete set of JWST observing modes. +5. Additional trending functions for assessing JWST wavefront error stability over time around specified science observations, and improvements to existing trending plots. +Please note, the minimum supported version of Python is increaed to Python 3.10, consistent with the minimumfor astropy. + +**What's Changed** + +* Add interpixel capacitance effects (IPC) for both distortion extension in the simulated PSF and adding some more per-instrument specializations in setup_sim_to_match_file by @obi-wan76 in https://github.com/spacetelescope/webbpsf/pull#768 + +* setup_sim_to_match_file fix setting aperture name for SW/LW parallel coronagraphy by @mperrin in https://github.com/spacetelescope/webbpsf/pull/752 + +* Trending: add option to plot OTE-only WFE in wfe_histogram_plot by @Skyhawk172 in https://github.com/spacetelescope/webbpsf/pull/750 + +* #727_RMS_Label fixed the issue that rms_label is not initialized. by @bchen2 in https://github.com/spacetelescope/webbpsf/pull/730 + +* use PyPI upload workflow from OpenAstronomy by @zacharyburnett in https://github.com/spacetelescope/webbpsf/pull/749 + +* import GriddedPSFModel from photutils.psf by @braingram in https://github.com/spacetelescope/webbpsf/pull/755 + +* update NRC coron dispersion coeffs by @JarronL in https://github.com/spacetelescope/webbpsf/pull/766 + +* Update trending plot to subtract piston before displaying proposed correction by @mperrin in https://github.com/spacetelescope/webbpsf/pull/756 + +* add aperture name support for NIRSpec slit and IFU apertures; also, 100x faster data cube calculations. by @mperrin in https://github.com/spacetelescope/webbpsf/pull/767 + +* Support MIRI LRS slit in aperturename and setup_sim_to_match_file functions by @mperrin in https://github.com/spacetelescope/webbpsf/pull/781 + +* Coronagraph calcs: add 'coron_include_pre_lyot_plane' option for extra output plane by @mperrin in https://github.com/spacetelescope/webbpsf/pull/778 + +* Add `nrc_ta_image_comparison` function to trending tools by @mperrin in https://github.com/spacetelescope/webbpsf/pull/789 + +* Support the slightly non-square dimensions of the MIRI detector (1024, 1032) pixels in size. Fixes #676 by @mperrin in https://github.com/spacetelescope/webbpsf/pull/803 + +* filter custom opbtable for month by @BradleySappington in https://github.com/spacetelescope/webbpsf/pull/802 + +* Allow setup_sim_to_match_data to select choice of WFS before or after by @mperrin in https://github.com/spacetelescope/webbpsf/pull/819 + +* [SCSB-145] require Python 3.10 by @zacharyburnett in https://github.com/spacetelescope/webbpsf/pull/817 + +* add show_wfs_during_program function by @mperrin in https://github.com/spacetelescope/webbpsf/pull/798 + +* add delta_wfe_around_time function by @mperrin in https://github.com/spacetelescope/webbpsf/pull/826 + +* Performance enhancement: avoid repeated slow loads of the SIAF by @mperrin in https://github.com/spacetelescope/webbpsf/pull/825 + +* NRC TA plot enhancements by @mperrin in https://github.com/spacetelescope/webbpsf/pull/794 + +* add functions to download WFSC WL image data by @mperrin in https://github.com/spacetelescope/webbpsf/pull/827 + +* improve MIRI LRS model details by @mperrin in https://github.com/spacetelescope/webbpsf/pull/787 + +* #839 Visit Id naming smarts in get_visit_nrc_ta_image by @kulpster85 in https://github.com/spacetelescope/webbpsf/pull/840 + +* #835 - Improvements to trending.plot_wfs_obs_delta & wfe_histogram_pl… by @kulpster85 in https://github.com/spacetelescope/webbpsf/pull/836 + +* avoid linear interpolation between WFE values by @mperrin in https://github.com/spacetelescope/webbpsf/pull/834 + +* Update for WFI to use pysiaf instead of soc_roman_tools by @Skyhawk172 in https://github.com/spacetelescope/webbpsf/pull/848 + +* Infrastructure improvements for improved IFU sims by @mperrin in https://github.com/spacetelescope/webbpsf/pull/770 + +* Allow specifying NIRCam LW detectors equivalently like 'NRCA5' or 'NRCALONG' by @mperrin in https://github.com/spacetelescope/webbpsf/pull/849 + +* Improved model for MIRI cruciform artifact, part 1 by @mperrin in https://github.com/spacetelescope/webbpsf/pull/837 + +* Manual lint by @BradleySappington in https://github.com/spacetelescope/webbpsf/pull/847 + +* Implement support for NIRCam DHS sub apertures by @mperrin in https://github.com/spacetelescope/webbpsf/pull/845 + +**New Contributors** +* @braingram made their first contribution in https://github.com/spacetelescope/webbpsf/pull/740 + +* @bchen2 made their first contribution in https://github.com/spacetelescope/webbpsf/pull/731 + +* @eteq made their first contribution in https://github.com/spacetelescope/webbpsf/pull/807 + +* @bryce-wedig made their first contribution in https://github.com/spacetelescope/webbpsf/pull/815 + +**Full Changelog**: https://github.com/spacetelescope/webbpsf/compare/v1.2.1...v1.3.0.rc1 Version 1.2.1 @@ -269,7 +348,7 @@ Note, when upgrading to this version you will need to update to the latest data **JWST Improvements** -- *Added a new capability to model the impact of thermal variations*, from telescope slews relative to the sun, onto mirror alignments and therefore onto PSFs. This new ``thermal_slew`` method can be used to create a delta OPD for some elapsed time after the slew at either the maximum slew angle, some specified angle, or with a scaling factor applied to maximum case. Once combined with an input OPD (requirements or predicted), the new shape of the mirrors can be used to simulate predicted PSFs some time after a slew. See this `Jupyter notebook `_ for examples. [:pr:`269`, :user:`kjbrooks`] +- *Added a new capability to model the impact of thermal variations*, from telescope slews relative to the sun, onto mirror alignments and therefore onto PSFs. This new ``thermal_slew`` method can be used to create a delta OPD for some elapsed time after the slew at either the maximum slew angle, some specified angle, or with a scaling factor applied to maximum case. Once combined with an input OPD (requirements or predicted), the new shape of the mirrors can be used to simulate predicted PSFs some time after a slew. See this `Jupyter notebook (ex1) `_ for examples. [:pr:`269`, :user:`kjbrooks`] - *Improved wavefront error extrapolation method for field points near FOV corners* that are outside the bounds of Zernike reference table data, in order to provide more seamless extrapolation. [:pr:`283`, :user:`JarronL`] - *Improvements in NIRCam optical model*: Updated polynomial model for NIRCam defocus versus wavelength. Adds Zernike coefficients for the wavefront error at NIRCam coronagraphy field points. [:pr:`283`, :user:`JarronL`] - NIRISS NRM mask was flipped along the X axis to match the as-built instrument and measured PSFs [:pr:`275`, :user:`KevinVolkSTScI`, :user:`anand0xff`, :user:`mperrin`] @@ -278,7 +357,7 @@ Note, when upgrading to this version you will need to update to the latest data **WFIRST Improvements** - *The WFI optical model has been updated to use optical data from the Cycle 8 design revision.* These include updated Zernike coefficients for field-dependent wavefront error, and masked and unmasked pupil images for each SCA, and updated filter throughputs (consistent with values used in Pandeia 1.4.2). The correct pupil file will automatically be selected for each calculation based on the chosen detector position and filter. The pupil files are consistent with those provided in the WFI cycle 8 reference information, but have been resampled onto a common pixel scale. See :ref:`WFIRST instrument model details ` for more. [:pr:`309` :user:`robelgeda`] -- Note, WFI's filters have been renamed so they all begin with “F”; see the table `here `_ . +- Note, WFI's filters have been renamed so they all begin with “F”; `see the table here `_ . - *The WFI wavelength range has now been extended to cover the 0.48 - 2.0 µm range.* [:pr:`309` :user:`robelgeda`] - *Expanded ``psf_grid`` method’s functionality so it can also be used to make grids of WFIRST PSFs.* Note that focal plane distortion is not yet implemented for WFIRST PSFs and so ``add_distortion`` keyword should not be used for this case. [:pr:`294`, :user:`shanosborne`] - *The WFIRST F062 filter bandpass red edge was corrected* from 8000A to 7600A, and associated unit tests were updated to include F062 [:pr:`288`, :user:`robelgeda`] @@ -288,7 +367,7 @@ Note, when upgrading to this version you will need to update to the latest data - *Many improvements in the PSF Grid functionality for generating photutils.GriddedPSFModels*: - - New options in ``psf_grid`` to specify both/either the output filename and output directory location. See this `Jupyter notebook `_ for examples. [:pr:`294`, :user:`shanosborne`] + - New options in ``psf_grid`` to specify both/either the output filename and output directory location. See this `Jupyter notebook (ex2) `_ for examples. [:pr:`294`, :user:`shanosborne`] - sFfilenames when saving out a ``psf_grid`` FITS object which has it’s ``filename`` parameter set will now end with ``_det.fits`` instead of the previous ``_det_filt.fits`` [:pr:`294`, :user:`shanosborne`] - Update added to ``utils.to_griddedpsfmodel`` where a 2-dimensional array input with a header containing only 1 ``DET_YX`` keyword can be turned into ``GriddedPSFModel`` object without error as it implies the case of a PSF grid with num_psfs = 1. [:pr:`294`, :user:`shanosborne`] - Remove deletion of ``det_yx`` and ``oversamp`` keywords from ``psf_grid`` output to allow for easier implementation in certain cases. Normal case users will have extra keywords but will not change functionality [:pr:`291`, :user:`shanosborne`] @@ -326,7 +405,7 @@ This release focused on software engineering improvements, rather than changes i **New functionality:** -- *Added new capability to create grids of fiducial, distorted PSFs* spanning a chosen instrument/detector. This new ``psf_grid`` method is meant to be used as the first step of using the ``photutils`` package to do PSF-fitting photometry on simulated JWST PSFs. This method will output a list of or single ``photutils`` ``GriddedPSFModel`` object(s) which can then be read into ``photutils`` to apply interpolation to the grid and simulate a spatially dependent PSF anywhere on the instrument. See this `Jupyter notebook `_ for examples. This method requires ``photutils`` version 0.6 or higher. [`#241, ` _, @shanosborne with inputs from @mperrin, @larrybradley, @hcferguson, and @eteq] +- *Added new capability to create grids of fiducial, distorted PSFs* spanning a chosen instrument/detector. This new ``psf_grid`` method is meant to be used as the first step of using the ``photutils`` package to do PSF-fitting photometry on simulated JWST PSFs. This method will output a list of or single ``photutils`` ``GriddedPSFModel`` object(s) which can then be read into ``photutils`` to apply interpolation to the grid and simulate a spatially dependent PSF anywhere on the instrument. See this `Jupyter notebook (ex3) `_ for examples. This method requires ``photutils`` version 0.6 or higher. [`#241, ` _, @shanosborne with inputs from @mperrin, @larrybradley, @hcferguson, and @eteq] **Bug fixes and small changes:** @@ -366,7 +445,7 @@ handled automatically if you use `conda`, otherwise you will need to download an .. admonition:: Python version support: Future releases will require Python 3. Please note, this is the *final* release of WebbPSF to support Python 2.7. All - future releases will require Python 3.5+. See `here `_ for more information on migrating to Python 3. + future releases will require Python 3.5+. `See here `_ for more information on migrating to Python 3. .. admonition:: Deprecated function names will go away in next release. @@ -415,7 +494,7 @@ handled automatically if you use `conda`, otherwise you will need to download an `_ for examples of what this looks like for Hubble PSFs) For the JWST instruments, this effect is largest for FGS, and fairly small but noticeable - for the other SIs. See `this Jupyter notebook `_ for + for the other SIs. See this `Jupyter notebook (ex4) `_ for examples of the effect on JWST PSFs. Note that the distorted PSFs are added as *additional extensions* in the output FITS file, so you will need to read from extension 2 or 3 if you want the PSF with the distortion included; extensions 0 and 1 remain consistent with prior versions. The distortion information is taken from the Science @@ -442,7 +521,7 @@ handled automatically if you use `conda`, otherwise you will need to download an acts as a cross-shaped convolution kernel, strongest at the shortest wavelengths. See MIRI document MIRI-TN-00076-ATC for details on the relevant physics and detector calibration. This is implemented as part of the distortion framework, though - it is different physics. See `this Jupyter notebook `_ for + it is different physics. See this `Jupyter notebook (ex5) `_ for example output. For F560W through F1000W this is a much more obvious effect than the subtle distortions. [`#209, `_, @shanosborne] - *Added new capabilities for modeling mirror moves of the JWST primary diff --git a/docs/requirements.txt b/docs/requirements.txt index f9554b00..24e15073 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -6,4 +6,6 @@ astropy-helpers astropy sphinx-astropy sphinx_issues --e git+https://github.com/mperrin/poppy.git#egg=poppy +graphviz +nbsphinx +-e git+https://github.com/spacetelescope/poppy.git#egg=poppy \ No newline at end of file diff --git a/docs/roman.rst b/docs/roman.rst index c9faee45..db376d96 100644 --- a/docs/roman.rst +++ b/docs/roman.rst @@ -176,6 +176,7 @@ Here we briefly summarize the key points, but see that for more detail. The RomanCoronagraph class has attributes for ``filter``, etc., like other instrument classes, but since these masks are designed to be used in specific combinations, a ``mode`` attribute exists that allows easy specification of all those attributes at once. For example, setting :: + >>> cor = roman.RomanCoronagraph() >>> cor.mode = "CHARSPC_F770" diff --git a/readthedocs.yml b/readthedocs.yml index 6ce39637..e951b63b 100644 --- a/readthedocs.yml +++ b/readthedocs.yml @@ -10,6 +10,8 @@ build: os: ubuntu-22.04 tools: python: "3.10" + apt_packages: + - graphviz # Build documentation in the docs/ directory with Sphinx sphinx: diff --git a/webbpsf/opds.py b/webbpsf/opds.py index fbc77fad..69e5f761 100644 --- a/webbpsf/opds.py +++ b/webbpsf/opds.py @@ -229,7 +229,7 @@ def as_fits(self, include_pupil=True): """Return the OPD as a fits.HDUList object Parameters - ----------- + ---------- include_pupil : bool Include the pupil mask as a FITS extension? """ @@ -268,7 +268,7 @@ def display_opd( """Draw on screen the perturbed OPD Parameters - ----------- + ---------- ax : matplotlib.Axes axes instance to display into. labelsegs : bool @@ -552,7 +552,7 @@ def estimated_Strehl(self, wavelength, verbose=True): """Compute an estimated Strehl given a wavelength in meters Parameters - ----------- + ---------- wavelength : float in meters verbose : bool @@ -878,7 +878,7 @@ def tilt(self, segment, tiltX=0.0, tiltY=0.0, tiltZ=0.0, unit='urad', display=Fa """Tilt/rotate a segment some angle around X, Y, or Z. Parameters - ----------- + ---------- segment : str Segment name, e.g. 'A1' tiltX, tiltY, tiltZ : floats @@ -933,7 +933,7 @@ def displace(self, segment, distX=0.0, distY=0.0, distZ=0.0, unit='micron', disp """Move a segment some distance in X, Y, and Z. Parameters - ----------- + ---------- segment : str Segment name, e.g. 'A1' distX, distY, distZ : floats @@ -1493,7 +1493,7 @@ def _get_hexike_coeffs_from_smif(self, dx=0.0, dy=0.0): dx, dy = field angles, in radians, from the OTE control point (nominally, NRCA3_FULL). Returns: - ---------- + -------- Hexike coefficients, in microns, for the first nine (9) coefficients, with PTT explicitly set to zero. """ @@ -1841,7 +1841,7 @@ def move_seg_local( which are distinct for each segment. Parameters - ----------- + ---------- segment : str Segment name, e.g. 'A1'. xtilt, ytilt, clocking : floats @@ -1975,7 +1975,7 @@ def move_seg_global( which are distinct for each segment. Parameters - ----------- + ---------- segment : str Segment name, e.g. 'A1'. Use 'SM' for the secondary mirror. xtilt, ytilt, clocking : floats @@ -2124,7 +2124,7 @@ def move_sm_local( PMSAs in terms of its local coordinate system, which this function handles behind the scenes. Parameters - ----------- + ---------- segment : str Segment name, e.g. 'A1'. Use 'SM' for the secondary mirror. xtilt, ytilt, clocking : floats @@ -2757,7 +2757,7 @@ def enable_adjustable_ote(instr): an instance of one of the WebbPSF instrument classes. Returns - -------- + ------- a modified copy of that instrument set up to use the LOM, and the associated instance of the LOM. @@ -2796,7 +2796,7 @@ def setup_image_array( Apply tilts to put the segments in an image array configuration. Parameters - ----------- + ---------- ote : OTE_Linear_Model_WSS instance The telescope model to be adjusted. This will be modified by this function. radius : float @@ -3318,7 +3318,7 @@ def get_coarse_blur_parameters( """Extract coarse blur center offset and convolution kernel from the Coarse Point sim time series Parameters - ----------- + ---------- pcsmodel : astropy.Table High resolution time series data from JWST ACS sims diff --git a/webbpsf/roman.py b/webbpsf/roman.py index 93ebe0f9..7f00272b 100644 --- a/webbpsf/roman.py +++ b/webbpsf/roman.py @@ -829,32 +829,29 @@ def lock_aberrations(self, aberration_path): containing the detector names, field point positions and Zernike values. The file should contain the following column names/values (comments in parentheses should not be included): - - sca (Detector number) - - wavelength (µm) - - field_point (field point number/ID for SCA and wavelength, - starts with 1) - - local_x (mm, local detector coords) - - local_y (mm, local detector coords) - - global_x (mm, global instrument coords) - - global_y (mm, global instrument coords) - - axis_local_angle_x (XAN) - - axis_local_angle_y (YAN) - - wfe_rms_waves (nm) - - wfe_pv_waves (waves) - - Z1 (Zernike phase NOLL coefficients) - - Z2 (Zernike phase NOLL coefficients) - - Z3 (Zernike phase NOLL coefficients) - - Z4 (Zernike phase NOLL coefficients) - . - . - . + - sca (Detector number) + - wavelength (µm) + - field_point (field point number/ID for SCA and wavelength, starts with 1) + - local_x (mm, local detector coords) + - local_y (mm, local detector coords) + - global_x (mm, global instrument coords) + - global_y (mm, global instrument coords) + - axis_local_angle_x (XAN) + - axis_local_angle_y (YAN) + - wfe_rms_waves (nm) + - wfe_pv_waves (waves) + - Z1 (Zernike phase NOLL coefficients) + - Z2 (Zernike phase NOLL coefficients) + - Z3 (Zernike phase NOLL coefficients) + - Z4 (Zernike phase NOLL coefficients) + - ... Please refer to the default aberration files for examples. If you have the WebbPSF data installed and defined, you can get the path to that file by running the following: - >>> from webbpsf import roman - >>> wfi = roman.WFI() - >>> print(wfi._aberration_files['imaging']) + >>> from webbpsf import roman + >>> wfi = roman.WFI() + >>> print(wfi._aberration_files['imaging']) Warning: You should not edit the default files! """ diff --git a/webbpsf/utils.py b/webbpsf/utils.py index 2b593d69..0c404062 100644 --- a/webbpsf/utils.py +++ b/webbpsf/utils.py @@ -117,7 +117,7 @@ def setup_logging(level='INFO', filename=None): own documentation. Parameters - ------------- + ---------- level : str Name of log output to show. Defaults to 'INFO', set to 'DEBUG' for more extensive messages, or to 'WARN' or 'ERROR' for fewer. @@ -126,7 +126,7 @@ def setup_logging(level='INFO', filename=None): just be displayed on screen. (Default: None) Examples - ----------- + -------- >>> webbpsf.setup_logging(filename='webbpsflog.txt') @@ -488,7 +488,7 @@ def measure_strehl(HDUlist_or_filename=None, ext=0, slice=0, center=None, displa use caching for perfect images? greatly speeds up multiple calcs w/ same config Returns - --------- + ------- strehl : float Strehl ratio as a floating point number between 0.0 - 1.0 @@ -580,7 +580,7 @@ def rescale_interpolate_opd(array, newdim): new size of the 2D square array (newdim x newdim) Returns - --------- + ------- newopd: new array interpolated to (newdim x newdim) """ diff --git a/webbpsf/webbpsf_core.py b/webbpsf/webbpsf_core.py index 8817aa1e..59bbcbd6 100644 --- a/webbpsf/webbpsf_core.py +++ b/webbpsf/webbpsf_core.py @@ -705,7 +705,7 @@ def psf_grid( User also has the option to save the grid as a fits.HDUlist object. Use - ---- + --- nir = webbpsf.NIRCam() nir.filter = "F090W" list_of_grids = nir.psf_grid(all_detectors=True, num_psfs=4) @@ -763,7 +763,7 @@ class JWInstrument(SpaceTelescopeInstrument): """Superclass for all JWST instruments Notable attributes - ------------------- + ------------------ telescope : name of telescope pupilopd : filename or FITS file object @@ -1317,7 +1317,7 @@ def interpolate_was_opd(self, array, newdim): new size of the 2D square array (newdim x newdim) Returns - --------- + ------- newopd: new array interpolated to (newdim x newdim) """ @@ -1393,7 +1393,7 @@ def _apply_jitter(self, result, local_options=None): superclass version of this function, in poppy.Instrument. Parameters - ----------- + ---------- result : fits.HDUList HDU list containing a point spread function local_options : dict, optional @@ -1604,29 +1604,32 @@ def load_wss_opd(self, filename, output_path=None, backout_si_wfe=True, verbose= This includes: - If necessary, downloading that OPD from MAST. Downloaded files are cached in $WEBBPSF_PATH/MAST_JWST_WSS_OPDs - - calling `import_wss_opd` to load the OPD from the FITS file and - perform some necessary format conversions + - calling `import_wss_opd` to load the OPD from the FITS file and perform some necessary format conversions - Subtract off the instrument WFE for the field point used in wavefront sensing, to get an - OTE-only wavefront. WebbPSF will separately add back in the SI WFE for the appropriate - field point, as usual. + OTE-only wavefront. WebbPSF will separately add back in the SI WFE for the appropriate + field point, as usual. - Subtract off the modeled field dependence term in the OTE WFE for the sensing field point, to get - an estimate of the OTE wavefront nominally at the master chief ray location (between the NIRCams). - WebbPSF will automatically add back on top of this the OTE field dependent WFE for the appropriate - field point. as usual. + an estimate of the OTE wavefront nominally at the master chief ray location (between the NIRCams). + WebbPSF will automatically add back on top of this the OTE field dependent WFE for the appropriate + field point. as usual. Parameters ---------- filename : str Name of OPD file to load + output_path : str Downloaded OPD are saved in this location. This option is convinient for STScI users using /grp/jwst/ote/webbpsf-data/. Default is $WEBBPSF_PATH/MAST_JWST_WSS_OPDs + backout_si_wfe : bool Subtract model for science instrument WFE at the sensing field point? Generally this should be true which is the default. + plot : bool Generate informative plots showing WFE, including the backout steps. Only works if backout_si_wfe is True. + save_ote_wfe : bool Save OTE-only WFE model? This is not needed for calculations in WebbPSF, but can be used to export OTE WFE models for use with other software. The file will be saved in the WEBBPSF_DATA_PATH directory @@ -1817,10 +1820,12 @@ def calc_datacube_fast(self, wavelengths, compare_methods=False, outfile=None, * for a substantial gain in speed at minimal reduction in accuracy for some use cases. ASSUMPTIONS: - 1) Assumes the wavefront error (OPD) and amplitude are independent of wavelength, such + + 1) Assumes the wavefront error (OPD) and amplitude are independent of wavelength, such that we can do the expensive propagation from sky through the optics to the exit pupil of NIRSpec *only once*, save that, and reuse the same exit pupil wavefront many times changing only the wavelength for just the last DFT step to the detector. + 2) Assumes we do not need the binned-to-detector-resolution nor distorted versions; we just want the oversampled PSF datacube at many wavelengths as fast as possible. (If the binned output is also desired, it can be computed post facto. @@ -1837,10 +1842,11 @@ def calc_datacube_fast(self, wavelengths, compare_methods=False, outfile=None, * of webbpsf for that mode, IF we also neglect the image plane stop around the IFU FOV. Parameters - ----------- + ---------- wavelengths : iterable of floats List or ndarray or tuple of floating point wavelengths in meters, such as you would supply in a call to calc_psf via the "monochromatic" option + compare_methods : bool If true, compute the PSF **BOTH WAYS**, and return both for comparisons. This is of course much slower. Default is False. This is retained for @@ -1848,7 +1854,7 @@ def calc_datacube_fast(self, wavelengths, compare_methods=False, outfile=None, * Returns - -------- + ------- a PSF datacube, normally (with compare_methods=False) A list of two PSF datacubes and two exit wavefront objects, if compare_methods is True @@ -3636,7 +3642,7 @@ def calc_or_load_PSF(filename, inst, overwrite=False, **kwargs): iterations. Parameters - ------------ + ---------- filename : str Filename possibly including path inst : JWInstrument @@ -3706,7 +3712,7 @@ def validate_coords(self, x, y): """Check if specified pixel coords are actually on the detector Parameters - ----------- + ---------- x, y : floats coordinates in pixels """ @@ -3726,12 +3732,12 @@ def pix2angle(self, xpix, ypix): See the pysiaf code for all the full details, or Lallo & Cox Tech Reports Parameters - ------------ + ---------- xpix, ypix : floats X and Y pixel coordinates, 0 <= xpix, ypix < detector_size Returns - -------- + ------- V2, V3 : floats V2 and V3 coordinates, in arcMINUTES Note that the astropy.units framework is used to return the result as a @@ -3756,7 +3762,7 @@ def segname(val): "B3-11" for any of the above inputs, and similarly for any of the other segments. Parameters - ------------ + ---------- val : string or int Something that can conceivably be the name or ID of a JWST PMSA. """