Skip to content

Commit

Permalink
Merge pull request #584 from mperrin/release_1.1_prep
Browse files Browse the repository at this point in the history
Release 1.1 prep
  • Loading branch information
ojustino authored Sep 20, 2022
2 parents 951184e + 3043539 commit c324bc0
Show file tree
Hide file tree
Showing 11 changed files with 370 additions and 250 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci_workflows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ jobs:
run: pip install tox tox-conda>=0.2

- name: Get WebbPSF Data
run: | # Get WebbPSF data files (just a subset of the full 250 MB!) and set up environment variable
wget https://stsci.box.com/shared/static/ftj8esrt0apzbnff8j6m5kseii2jzy9e.gz -O /tmp/minimal-webbpsf-data.tar.gz
run: | # Get WebbPSF data files (just a subset of the full dataset!) and set up environment variable
wget https://stsci.box.com/shared/static/963l3m4hcrpc29bqxq68ilcsfgfqwiyc.gz -O /tmp/minimal-webbpsf-data.tar.gz
tar -xzvf /tmp/minimal-webbpsf-data.tar.gz
echo "WEBBPSF_PATH=${{github.workspace}}/webbpsf-data" >> $GITHUB_ENV
Expand Down
26 changes: 2 additions & 24 deletions dev_utils/make-minimal-datafiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,30 +29,8 @@
os.chdir(WORKING_DIR)
subprocess.call("tar xvzf "+inputfile, shell=True)

print("#### Trimming to only one OPD file per instrument ####")
for instr in insts:
files = glob.glob(os.path.join(WORKING_DIR, 'webbpsf-data', instr, "OPD", "*.fits.gz"))
files.sort()
print(instr, files)

# just save the lowest alphabetically of each of them
for file_to_delete in files[1:]:
print("Deleting "+file_to_delete)
os.remove(file_to_delete)

print("Trimming to only 1 datacube slice: "+files[0])

f0 = fits.open(files[0])
f0[0].data = f0[0].data[0]
f0.writeto(files[0], overwrite=True)
f0.close()

# Do the same for the Rev AA OTE OPD
ote_fn = os.path.join(WORKING_DIR, 'webbpsf-data','JWST_OTE_OPD_RevAA_prelaunch_predicted.fits.gz')
f0 = fits.open(ote_fn)
f0[0].data = f0[0].data[0]
f0.writeto(ote_fn, overwrite=True)
f0.close()
# Remove this for >= 1.1.0:
os.remove(os.path.join(WORKING_DIR, 'webbpsf-data','JWST_OTE_OPD_RevAA_prelaunch_predicted.fits.gz'))


print("#### Removing extra optional pupil files ####")
Expand Down
77 changes: 32 additions & 45 deletions docs/available_opds.rst
Original file line number Diff line number Diff line change
@@ -1,48 +1,35 @@
Appendix: Available Optical Path Difference (OPD) files
================================================================

.. warning::

This page documents the _pre-flight_ models for JWST wavefronts. These models are now happily obsolete, and can be replaced by
`actual measured in-flight wavefronts <https://webbpsf.readthedocs.io/en/latest/jwst_measured_opds.html>`_.

For each of the five instruments (four SIs plus FGS) there are three provided OPD files. These represent wavefronts as follows:

1. The OTE and ISIM intrinsic WFE
2. The above, plus a slight defocus to blur the image slightly to approximate image motion.
3. The above #2, plus additional WFE due to SI internal optics.

The latter is the largest WFE, and is the default file used in simulations unless another is explicitly chosen. For NIRCam only there is a second, duplicate set of these files with slightly improved WFE based on an optimistic case scenario for instrument and telescope alignment.

The provided OPDs are based on the observatory design requirements, and were developed for the Mission Critical Design Review. The represent the nominal case of performance for JWST, and have not yet been updated with as-built details of mirror surface figures, etc. We intend to make updated OPD files available once suitable reference data have been provided to STScI. For now, see `Lightsey et al. 2014 <http://adsabs.harvard.edu/abs/2014SPIE.9143E..04L>`_ for recent predictions of JWST's likely performance

Note that the trick of adding some (nonphysical) defocus to blur out the PSF is computationally easy and rapid, but does not give a high fidelity
representation of the true impact of image jitter. This is particularly true for coronagraphic observations. Future versions of WebbPSF will likely
provide higher fidelity jitter models.

The units of the supplied OPD files are wavefront error in microns.

.. table:: Rev V OPDs

========================= ========== ======= ======================== ========================== =======
File Instrument RMS WFE Includes OTE + ISIM OPD? Image motion (as defocus)? SI OPD?
========================= ========== ======= ======================== ========================== =======
OPD_RevV_fgs_150.fits FGS 150.0 Yes No No
OPD_RevV_fgs_163.fits FGS 163.0 Yes Yes No
OPD_RevV_fgs_186.fits FGS 186.0 Yes Yes Yes
OPD_RevV_miri_204.fits MIRI 204.0 Yes No No
OPD_RevV_miri_220.fits MIRI 220.0 Yes Yes No
OPD_RevV_miri_421.fits MIRI 421.0 Yes Yes Yes
OPD_RevV_nircam_115.fits NIRCam 115.0 Yes, optimistic case No No
OPD_RevV_nircam_123.fits NIRCam 123.0 Yes No No
OPD_RevV_nircam_132.fits NIRCam 132.0 Yes, optimistic case Yes No
OPD_RevV_nircam_136.fits NIRCam 136.0 Yes Yes No
OPD_RevV_nircam_150.fits NIRCam 150.0 Yes, optimistic case Yes Yes
OPD_RevV_nircam_155.fits NIRCam 155.0 Yes Yes Yes
OPD_RevV_nirspec_125.fits NIRSpec 125.0 Yes No No
OPD_RevV_nirspec_145.fits NIRSpec 145.0 Yes Yes No
OPD_RevV_nirspec_238.fits NIRSpec 238.0 Yes Yes Yes
OPD_RevV_niriss_144.fits NIRISS 144.0 Yes No No
OPD_RevV_niriss_162.fits NIRISS 162.0 Yes Yes No
OPD_RevV_niriss_180.fits NIRISS 180.0 Yes Yes Yes
========================= ========== ======= ======================== ========================== =======

On-Orbit OPD Measurements
-------------------------

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.

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 <https://webbpsf.readthedocs.io/en/latest/jwst_measured_opds.html>`_ based on the date of
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
`actual measured in-flight wavefronts <https://webbpsf.readthedocs.io/en/latest/jwst_measured_opds.html>`_.


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<https://webbpsf.readthedocs.io/en/v0.9.0/available_opds.html>`_.

4 changes: 2 additions & 2 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ 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-1.0.0.tar.gz <https://stsci.box.com/shared/static/34o0keicz2iujyilg4uz617va46ks6u9.gz>`_ [approx. 280 MB]
2. Untar ``webbpsf-data-1.0.0.tar.gz`` into a directory of your choosing.
1. Download the following file: `webbpsf-data-1.1.0.tar.gz <https://stsci.box.com/shared/static/ntb71b3uusf1kzgf9bss0hzbreoja5gg.gz>`_ [approx. 80 MB]
2. Untar ``webbpsf-data-1.1.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
Expand Down
19 changes: 14 additions & 5 deletions docs/relnotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,25 @@ Version History and Change Log

Version 1.1.0
=============
*2022 July Sometime*
*2022 September 20*

*First release with JWST in flight optical performance!* Preliminary updates and tools added just after completion of commissioning.
*First release with JWST in flight optical performance!* Updates and tools added after completion of commissioning.

Note, this release requires updating your WebbPSF data files to version 1.1.0. See :ref:`here <data_install>` .

**James Webb Space Telescope OTE model improvements**:

* Add feature to use measured OPDs from wavefront sensing in flight. See :doc:`jwst_measured_opds`.
* Updated default line-of-sight jitter for JWST observations to 1 milliarcsecond instead of 6 (1 sigma per axis).
* Add feature to use measured OPDs from wavefront sensing in flight, including retrieval from MAST. See :doc:`jwst_measured_opds`. (:pr:`556`, :pr:`559`, :pr:`560`, :pr:`571` by :user:`mperrin; :pr:`563` by :user:`rcooper295`; :pr:`579` by :user:`obi-wan76`)
* Add functions to trend and display wavefronts over time. See :doc:`jwst_measured_opds`.
* Updated default line-of-sight jitter for JWST observations to 1 milliarcsecond instead of 6 (1 sigma per axis).
* Updated default OPD to be an actual measured on-orbit OPD from early in cycle 1 science operations.

**Software and Package Infrastructure Updates:**

More updates to come - this is a first pass.
* Add support for Python 3.10; drop support for Python 3.7 (:pr:`549` by :user:`shanosborne`)
* Fixes to a few minor plotting bugs (:pr:`537` by :user:`shanosborne`; :pr:`581`, :pr:`582` by :user:`mperrin`)
* Thanks to :user:`jsoref` for contributing :pr:`520` with spelling corrections, and :user:`NaincyKumariKnoldus` for fixing a bad link in the docs.
* Add unit test for the coronagraph mask shift option (:pr:`578` by :user:`mperrin`)


Version 1.0.0
Expand Down
466 changes: 307 additions & 159 deletions notebooks/WebbPSF_tutorial.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion webbpsf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class UnsupportedPythonError(Exception):
# 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, 0, 0)
DATA_VERSION_MIN = (1, 1, 0)


class Conf(_config.ConfigNamespace):
Expand Down
4 changes: 2 additions & 2 deletions webbpsf/jupyter_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def show_notebook_interface(instrumentname):
instrument = roman.WFI()
show_notebook_interface_wfi(instrument)
else:
instrument = webbpsf_core.Instrument(instrumentname)
instrument = webbpsf_core.instrument(instrumentname)
show_notebook_interface_jwst(instrument)


Expand Down Expand Up @@ -236,7 +236,7 @@ def show_notebook_interface_jwst(instrument):


if isinstance(instrument, str):
instrument = Instrument(instrument)
instrument = instrument(instrument)

try:
import synphot
Expand Down
2 changes: 0 additions & 2 deletions webbpsf/mast_wss.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
### Login and authentication

service = 'Mast.Jwst.Filtered.Wss'
mast_login_ok = None


def mast_retrieve_opd(filename, output_path=None, verbose=False, redownload=False):
Expand All @@ -39,7 +38,6 @@ def mast_retrieve_opd(filename, output_path=None, verbose=False, redownload=Fals
print(f"Found OPD file previously downloaded: {filename}")
return output_filename

mast_wss_login()
data_uri = f'mast:JWST/product/{filename}'

# Download the file
Expand Down
14 changes: 7 additions & 7 deletions webbpsf/trending.py
Original file line number Diff line number Diff line change
Expand Up @@ -890,12 +890,16 @@ def basic_show_image(image, ax, vmax=.3, nanmask=1):
color='C1', ls='-', label='Observatory WFE at NIRCam NRCA3')
axes[0].plot_date(dates_array.plot_date, rms_ote * 1e9,
color='C0', ls='-', label='Telescope WFE')
axes[0].legend(loc='lower right')

for ax in axes:
for corr_date in correction_times:
ax.axvline(corr_date.plot_date, color='darkgreen', ls='--', alpha=0.5)

#axes[0].axhline(59, ls=":", color='gray')
#axes[0].axhline(80, ls=":", color='gray')
axes[0].fill_between( [start_date.plot_date - 0.5, end_date.plot_date + 0.5],
[59,59], [80, 80], color='blue', alpha=0.08, label='Wavefront control target range')
axes[0].legend(loc='lower right')

axes[0].set_ylim(0, 150)
axes[0].set_ylabel("Wavefront Error\n[nm rms]", fontsize=fs, fontweight='bold')
axes[0].set_xticklabels([])
Expand All @@ -916,15 +920,11 @@ def basic_show_image(image, ax, vmax=.3, nanmask=1):
axes[1].plot_date(dates_array.plot_date, ees_at_rad-median_ee, ls='-', color=color,
label=f"$\Delta$EE within {ee_rad:.2f} arcsec ({ee_npix} pix)")

#axes[1].axhline(np.median(ees_at_rad), color=f'C{i}', ls=':')
#axes[1].fill_between(dates_array.plot_date, np.median(ees_at_rad * 0.97), np.median(ees_at_rad) * 1.03,
# color=f'C{i}',
# ls=':', alpha=0.1, label=f"Median EE({ee_rad:.2f}) ± 3%")
axes[1].text(0.01, 0.75-i*0.12, f'Median EE within {ee_rad:.2f} arcsec = {median_ee:.3f}', color=color,
fontweight='bold',
transform=axes[1].transAxes)

axes[1].fill_between(dates_array.plot_date, -0.03, 0.03, color='gray', alpha=0.1)
axes[1].fill_between( [start_date.plot_date - 0.5, end_date.plot_date + 0.5], -0.03, 0.03, color='gray', alpha=0.1, label="±3% change (stability requirement)")
axes[1].set_xlabel("Date", fontsize=fs, fontweight='bold')
axes[1].set_ylabel(f"Change in \nEncircled Energy\n{instrument} {filter}", fontsize=fs, fontweight='bold')
axes[1].set_ylim(0.5, 1.0)
Expand Down
2 changes: 1 addition & 1 deletion webbpsf/webbpsf_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,7 @@ def __init__(self, *args, **kwargs):
raise RuntimeError("No pupil OPD files found for {name} in {path}".format(name=self.name, path=opd_path))

self.opd_list.sort()
self.pupilopd = self.opd_list[0] # should be JWST_OTE_OPD_RevAA_prelaunch_predicted.fits.gz, or the ungzipped version if present
self.pupilopd = 'JWST_OTE_OPD_cycle1_example_2022-07-30.fits' # Default is now an on-orbit measured example OPD

self.pupil = os.path.abspath(os.path.join(
self._WebbPSF_basepath,
Expand Down

0 comments on commit c324bc0

Please sign in to comment.