From 66033032d9113c2b6e8954b8216b04e697df82aa Mon Sep 17 00:00:00 2001 From: Robel Geda Date: Fri, 23 Jul 2021 04:02:14 -0400 Subject: [PATCH 1/8] add prism and grism to wfirst --- webbpsf/wfirst.py | 228 ++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 201 insertions(+), 27 deletions(-) diff --git a/webbpsf/wfirst.py b/webbpsf/wfirst.py index dc400871..0bb4c3c2 100644 --- a/webbpsf/wfirst.py +++ b/webbpsf/wfirst.py @@ -11,15 +11,21 @@ import os.path import poppy import numpy as np -from . import webbpsf_core -from scipy.interpolate import griddata + +from scipy.interpolate import griddata, RegularGridInterpolator from astropy.io import fits import astropy.units as u import logging +from . import webbpsf_core +from .optics import _fix_zgrid_NaNs + + _log = logging.getLogger('webbpsf') import pprint +GRISM_FILTER = 'G150' +PRISM_FILTER = 'P120' class WavelengthDependenceInterpolator(object): """WavelengthDependenceInterpolator can be configured with @@ -158,8 +164,7 @@ def get_aberration_terms(self, wavelength): assert len(aberration_array.shape) == 2, "computed aberration array is not 2D " \ "(inconsistent number of Zernike terms " \ "at each point?)" - - field_position = tuple(np.clip(self.field_position, 4, 4092)) + field_position = tuple(self.field_position) coefficients = griddata( np.asarray(field_points), np.asarray(aberration_terms), @@ -167,7 +172,38 @@ def get_aberration_terms(self, wavelength): method='linear' ) if np.any(np.isnan(coefficients)): - raise RuntimeError("Could not get aberrations for input field point") + # FIND TWO CLOSEST INPUT GRID POINTS: + dist = [] + corners = field_points[1:] # use only the corner points + for i, ip in enumerate(corners): + dist.append(np.sqrt(((ip[0] - field_position[0]) ** 2) + ((ip[1] - field_position[1]) ** 2))) + min_dist_indx = np.argsort(dist)[:2] # keep two closest points + # DEFINE LINE B/W TWO POINTS, FIND ORTHOGONAL LINE AT POINT OF INTEREST, + # AND FIND INTERSECTION OF THESE TWO LINES. + x1, y1 = corners[min_dist_indx[0]] + x2, y2 = corners[min_dist_indx[1]] + dx = x2 - x1 + dy = y2 - y1 + a = (dy * (field_position[1] - y1) + dx * (field_position[0] - x1)) / (dx * dx + dy * dy) + closest_interp_point = (x1 + a * dx, y1 + a * dy) + # INTERPOLATE ABERRATIONS TO CLOSEST INTERPOLATED POINT: + coefficients = griddata( + np.asarray(field_points), + np.asarray(aberration_terms), + closest_interp_point, + method='linear') + # IF CLOSEST INTERPOLATED POINT IS STILL OUTSIDE THE INPUT GRID, + # THEN USE NEAREST GRID POINT INSTEAD: + if np.any(np.isnan(coefficients)): + coefficients = aberration_terms[min_dist_indx[0] + 1] + _log.warn("Attempted to get aberrations at field point {} which is outside the range " + "of the reference data; approximating to nearest input grid point".format(field_position)) + else: + _log.warn("Attempted to get aberrations at field point {} which is outside the range " + "of the reference data; approximating to nearest interpolated point {}".format( + field_position, closest_interp_point)) + assert not np.any(np.isnan(coefficients)), "Could not compute aberration " \ + "at field point {}".format(field_position) if self._omit_piston_tip_tilt: _log.debug("Omitting piston/tip/tilt") coefficients[:3] = 0.0 # omit piston, tip, and tilt Zernikes @@ -267,7 +303,7 @@ def detector_position(self, position): def _get_aberrations(self): """Get the OpticalElement that applies the field-dependent - optical aberrations. (Called in _get_optical_system.)""" + optical aberrations. (Called in get_optical_system.)""" return self._detectors[self._detector] def _get_fits_header(self, result, options): @@ -302,7 +338,7 @@ def __init__(self): self._masked_pupil_path = None # List of filters that need the masked pupil - self._masked_filters = ['F184'] + self._masked_filters = ['F184', GRISM_FILTER] # Flag to en-/disable automatic selection of the appropriate pupil_mask self.auto_pupil = True @@ -459,27 +495,36 @@ class WFI(WFIRSTInstrument): def __init__(self): """ Initiate WFI - - Parameters - ----------- - set_pupil_mask_on : bool or None - Set to True or False to force using or not using the cold pupil mask, - or to None for the automatic behavior. """ - pixelscale = 110e-3 # arcsec/px, WFIRST-AFTA SDT report final version (p. 91) + # pixel scale is from WFIRST-AFTA SDT report final version (p. 91) + # https://wfirst.ipac.caltech.edu/sims/Param_db.html + pixelscale = 110e-3 # arcsec/px # Initialize the pupil controller self._pupil_controller = WFIPupilController() + # Initialize the aberrations for super().__init__ + self._aberrations_files = {} + self._is_custom_aberrations = False + self._current_aberrations_file = "" + super(WFI, self).__init__("WFI", pixelscale=pixelscale) self._pupil_controller.set_base_path(self._datapath) self.pupil_mask_list = self._pupil_controller.pupil_mask_list + # Define defualt aberration files for WFI modes + self._aberrations_files = { + 'imaging': os.path.join(self._datapath, 'wim_zernikes_cycle8.csv'), + 'prism': os.path.join(self._datapath, 'wim_zernikes_cycle8_prism.csv'), + 'grism': os.path.join(self._datapath, 'wim_zernikes_cycle8_grism.csv'), + 'custom': None, + } + + # Load default detector from aberration file self._detector_npixels = 4096 - self._detectors = _load_wfi_detector_aberrations(os.path.join(self._datapath, 'wim_zernikes_cycle8.csv')) - assert len(self._detectors.keys()) > 0 + self._load_detector_aberrations(self._aberrations_files[self.mode]) self.detector = 'SCA01' self.opd_list = [ @@ -487,6 +532,25 @@ def __init__(self): ] self.pupilopd = self.opd_list[-1] + def _load_detector_aberrations(self, path): + """ + Helper function that, given a path to a file containing detector aberrations, loads the Zernike values and + populates the class' dictator list with `FieldDependentAberration` detectors. This function achieves this by + calling the `webbpsf.wfirst._load_wfi_detector_aberrations` function. + + Users should use the `override_aberrations` function to override current aberrations. + + Parameters + ---------- + path : string + Path to file containing detector aberrations + """ + detectors = _load_wfi_detector_aberrations(path) + assert len(detectors.keys()) > 0 + + self._detectors = detectors + self._current_aberrations_file = path + def _validate_config(self, **kwargs): """Validates that the WFI is configured sensibly @@ -518,21 +582,13 @@ def pupil(self, value): def pupil_mask(self): return self._pupil_controller.pupil_mask - @WFIRSTInstrument.filter.setter - def filter(self, value): - value = value.upper() # force to uppercase - if value not in self.filter_list: - raise ValueError("Instrument %s doesn't have a filter called %s." % (self.name, value)) - self._filter = value - self._pupil_controller.validate_pupil(self.filter) - @pupil_mask.setter def pupil_mask(self, name): """ Set the pupil mask Parameters - ------------ + ---------- name : string Name of setting. Settings: @@ -556,6 +612,124 @@ def _unmasked_pupil_path(self): def _masked_pupil_path(self): return self._pupil_controller._masked_pupil_path + def _get_filter_mode(self, wfi_filter): + """ + Given a filter name, return the WFI mode + + Parameters + ---------- + wfi_filter : string + Name of WFI filter + + Returns + ------- + mode : string + Returns 'imaging', 'grism' or 'prism' depending on filter. + + Raises + ------ + ValueError + If the input filter is not found in the WFI filter list + """ + + wfi_filter = wfi_filter.upper() + if wfi_filter == GRISM_FILTER: + return 'grism' + elif wfi_filter == PRISM_FILTER: + return 'prism' + elif wfi_filter in self.filter_list: + return 'imaging' + else: + raise ValueError("Instrument %s doesn't have a filter called %s." % (self.name, wfi_filter)) + + @property + def mode(self): + """Current WFI mode""" + return self._get_filter_mode(self.filter) + + @mode.setter + def mode(self, value): + """Mode is set by changing filters""" + raise AttributeError("WFI mode cannot be directly specified; WFI mode is set by changing filters.") + + def override_aberrations(self, aberrations_path): + """ + This function loads user provided aberrations from a file and locks this instrument + to only use the provided aberrations (even if the filter or mode change). + To release the lock and load the default aberrations, use the `reset_override_aberrations` function. + To load new user provided aberrations, simply call this function with the new path. + + To load custom aberrations, please provide a csv file 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 (filed 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 aberrations 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 wfirst + >>> wfi = wfirst.WFI() + >>> print(wfi._aberrations_files["imaging"]) + + Warning: You should not edit the default files! + """ + self._load_detector_aberrations(aberrations_path) + self._aberrations_files['custom'] = aberrations_path + self._is_custom_aberrations = True + + def reset_override_aberrations(self): + """Release detector aberrations override and load defaults""" + aberrations_path = self._aberrations_files[self.mode] + self._load_detector_aberrations(aberrations_path) + self._aberrations_files['custom'] = None + self._is_custom_aberrations = False + + @WFIRSTInstrument.filter.setter + def filter(self, value): + + # Update Filter + # ------------- + value = value.upper() # force to uppercase + + if value not in self.filter_list: + raise ValueError("Instrument %s doesn't have a filter called %s." % (self.name, value)) + + self._filter = value + + # Update Aberrations + # ------------------ + # Check if _aberrations_files has been initiated (not empty) and if aberrations are locked by user + if self._aberrations_files and not self._is_custom_aberrations: + + # Identify aberrations file for new mode + mode = self._get_filter_mode(self._filter) + aberrations_file = self._aberrations_files[mode] + + # If aberrations are not already loaded for the new mode, + # load and replace detectors using the new mode's aberrations file. + if not os.path.samefile(self._current_aberrations_file, aberrations_file): + self._load_detector_aberrations(aberrations_file) + + # Update Pupil + # ------------ + self._pupil_controller.validate_pupil(self._filter) + class CGI(WFIRSTInstrument): """ @@ -813,7 +987,7 @@ def _addAdditionalOptics(self, optsys, oversample=4): def _get_aberrations(self): """Get the OpticalElement that applies the field-dependent - optical aberrations. (Called in _get_optical_system.)""" + optical aberrations. (Called in get_optical_system.)""" return None def _get_fits_header(self, result, options): @@ -843,4 +1017,4 @@ def _get_fits_header(self, result, options): result[0].header.set('PUPLSCAL', lyotstop_hdr['PUPLSCAL'], comment='Lyot stop pixel scale in m/pixel') result[0].header.set('PUPLDIAM', lyotstop_hdr['PUPLDIAM'], - comment='Lyot stop array size, incl padding.') + comment='Lyot stop array size, incl padding.') \ No newline at end of file From f93c5faff80baec466d183c82a90b4d4b10978fe Mon Sep 17 00:00:00 2001 From: Robel Geda Date: Fri, 23 Jul 2021 04:03:05 -0400 Subject: [PATCH 2/8] add tests for prism and grism --- webbpsf/tests/test_wfirst.py | 60 ++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/webbpsf/tests/test_wfirst.py b/webbpsf/tests/test_wfirst.py index 3271f404..3abd6946 100644 --- a/webbpsf/tests/test_wfirst.py +++ b/webbpsf/tests/test_wfirst.py @@ -1,8 +1,11 @@ import os +import numpy as np import pytest from webbpsf import wfirst, measure_fwhm from numpy import allclose +GRISM_FILTER = wfirst.GRISM_FILTER +PRISM_FILTER = wfirst.PRISM_FILTER MASKED_FLAG = "FULL_MASK" UNMASKED_FLAG = "RIM_MASK" AUTO_FLAG = "AUTO" @@ -190,8 +193,51 @@ def _test_filter_pupil(filter_name, expected_pupil): _test_filter_pupil('F062', wfi._unmasked_pupil_path) _test_filter_pupil('F158', wfi._unmasked_pupil_path) _test_filter_pupil('F146', wfi._unmasked_pupil_path) + _test_filter_pupil(PRISM_FILTER, wfi._unmasked_pupil_path) _test_filter_pupil('F184', wfi._masked_pupil_path) + _test_filter_pupil(GRISM_FILTER, wfi._masked_pupil_path) + + +def test_swapping_modes(wfi=None): + if wfi is None: + wfi = wfirst.WFI() + + tests = [ + # [filter, mode, pupil_file] + ['F062', 'imaging', wfi._unmasked_pupil_path], + ['F184', 'imaging', wfi._masked_pupil_path], + [PRISM_FILTER, 'prism', wfi._unmasked_pupil_path], + [GRISM_FILTER, 'grism', wfi._masked_pupil_path], + ] + + for test_filter, test_mode, test_pupil in tests: + wfi.filter = test_filter + assert wfi.filter == test_filter + assert wfi.mode == test_mode + assert wfi._current_aberrations_file == wfi._aberrations_files[test_mode] + assert wfi.pupil == test_pupil + + +def test_custom_aberrations(): + wfi = wfirst.WFI() + + # Use grism aberrations_file for testing + test_aberrations_file = wfi._aberrations_files['grism'] + + # Test override + # ------------- + wfi.override_aberrations(test_aberrations_file) + + for filter in wfi.filter_list: + wfi.filter = filter + assert wfi._current_aberrations_file == test_aberrations_file, "Filter change caused override to fail" + + # Test Release Override + # --------------------- + wfi.reset_override_aberrations() + assert wfi._aberrations_files['custom'] is None, "Custom aberrations file not deleted on override release." + test_swapping_modes(wfi) def test_WFI_limits_interpolation_range(): wfi = wfirst.WFI() @@ -236,6 +282,20 @@ def test_WFI_limits_interpolation_range(): "Aberration outside wavelength range did not return closest value." ) + # Test border pixels that are outside of the ref data + # As of cycle 8 and 9, (4, 4) is the first pixel so we + # check if (0, 0) is approximated to (4, 4) via nearest point + # approximation: + + det.field_position = (0, 0) + coefficients_outlier = det.get_aberration_terms(1e-6) + + det.field_position = (4, 4) + coefficients_data = det.get_aberration_terms(1e-6) + + assert np.allclose(coefficients_outlier, coefficients_data), "nearest point extrapolation " \ + "failed for outlier field point" + def test_CGI_detector_position(): """ Test existence of the CGI detector position etc, and that you can't set it.""" cgi = wfirst.CGI() From fe345ea281783f89e66aa94343b2835ab599be47 Mon Sep 17 00:00:00 2001 From: Robel Geda Date: Fri, 23 Jul 2021 04:08:59 -0400 Subject: [PATCH 3/8] add CI changes from #455 --- .github/workflows/ci_workflows.yml | 81 +++++++++++++++++++++++++++ .github/workflows/publish-to-pypi.yml | 26 +++++++++ .travis.yml | 71 ----------------------- README.rst | 14 +++-- 4 files changed, 116 insertions(+), 76 deletions(-) create mode 100644 .github/workflows/ci_workflows.yml create mode 100644 .github/workflows/publish-to-pypi.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/ci_workflows.yml b/.github/workflows/ci_workflows.yml new file mode 100644 index 00000000..0d50a59d --- /dev/null +++ b/.github/workflows/ci_workflows.yml @@ -0,0 +1,81 @@ +name: CI + +on: [push, pull_request] + +jobs: + tests: + name: ${{ matrix.name }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + include: + + - name: Coverage test in Python 3 + os: ubuntu-latest + python: 3.8 + toxenv: py38-poppydev-pysiafdev-cov + + - name: Check for Sphinx doc build errors + os: ubuntu-latest + python: 3.8 + toxenv: docbuild + + - name: Try Astropy development version + os: ubuntu-latest + python: 3.8 + toxenv: py38-astropydev-test + + - name: Try latest versions of all dependencies + os: ubuntu-latest + python: 3.8 + toxenv: py38-latest-test + + - name: Try minimum supported versions + os: ubuntu-latest + python: 3.6 + toxenv: py36-legacy36-test + + - name: Try released POPPY and PySIAF + os: ubuntu-latest + python: 3.7 + toxenv: py37-stable-test + continue-on-error: 'true' + + steps: + - name: Checkout code + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Set up Python ${{ matrix.python }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python }} + + - name: Install Python dependencies + 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/qcptcokkbx7fgi3c00w2732yezkxzb99.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 + + - name: Check conda info + run: conda info + + - name: Run tests + if: matrix.continue-on-error == null + 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@v1 + with: + file: ./coverage.xml diff --git a/.github/workflows/publish-to-pypi.yml b/.github/workflows/publish-to-pypi.yml new file mode 100644 index 00000000..306a8bcc --- /dev/null +++ b/.github/workflows/publish-to-pypi.yml @@ -0,0 +1,26 @@ +name: Publish to PyPI + +on: + release: + types: [released] + +jobs: + build: + name: Publish release to PyPI + env: + PYPI_USERNAME_STSCI_MAINTAINER: ${{ secrets.PYPI_USERNAME_STSCI_MAINTAINER }} + PYPI_PASSWORD_STSCI_MAINTAINER: ${{ secrets.PYPI_PASSWORD_STSCI_MAINTAINER }} + PYPI_USERNAME_OVERRIDE: ${{ secrets.PYPI_USERNAME_OVERRIDE }} + PYPI_PASSWORD_OVERRIDE: ${{ secrets.PYPI_PASSWORD_OVERRIDE }} + PYPI_TEST: ${{ secrets.PYPI_TEST }} + INDEX_URL_OVERRIDE: ${{ secrets.INDEX_URL_OVERRIDE }} + runs-on: ubuntu-latest + steps: + + # Check out the commit containing this workflow file. + - name: checkout repo + uses: actions/checkout@v2 + + - name: custom action + uses: spacetelescope/action-publish_to_pypi@master + id: custom_action_0 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index febed66e..00000000 --- a/.travis.yml +++ /dev/null @@ -1,71 +0,0 @@ -language: c - -# Setting sudo to false opts in to Travis-CI container-based builds. -sudo: false - - -env: - global: - - TOXENV='' - - TOXARGS='' - - TOXPOSARGS='' - - - TOX_CMD='tox --' - - TOX_ARGS='' - -matrix: - - include: - # do the actual tests against dev version of POPPY - - # Do a coverage test in Python 3. - - env: TOXENV='py38-poppydev-pysiafdev-cov' - - # Check for Sphinx doc build errors - - env: TOXENV='docbuild' TOX_ARGS='' - - # Try Astropy development version - - env: TOXENV='py38-astropydev-test' - - # Try minimum supported versions - - env: TOXENV='py36-legacy36-test' - - # Try released POPPY - - env: TOXENV='py37-stable-test' - - allow_failures: - # Released POPPY and/or pySIAF may be missing new functionality used by dev WebbPSF - - env: TOXENV='py37-stable-test' - -install: - - git clone git://github.com/astropy/ci-helpers.git - - source ci-helpers/travis/setup_conda.sh - - pip install tox tox-conda>=0.2 - - pip install --user codecov - -before_script: - # Get WebbPSF data files (just a subset of the full 250 MB!) and set up environment variable - - wget https://stsci.box.com/shared/static/qcptcokkbx7fgi3c00w2732yezkxzb99.gz -O /tmp/minimal-webbpsf-data.tar.gz - - tar -xzvf /tmp/minimal-webbpsf-data.tar.gz - - export WEBBPSF_PATH="${TRAVIS_BUILD_DIR}/webbpsf-data" - -script: - - conda info - - $TOX_CMD $TOX_ARGS - -after_success: - - codecov - -notifications: - email: - - mperrin@stsci.edu - -deploy: - provider: pypi - username: "__token__" - password: - secure: McRW3+IUUn8m/wp/wop3tQax+pAgPhfaiDejbpQrQDMxWo2Uanyy/kcp7MO1MWeItmf/rPCcy3/LKD4EYG4/RU4rSrn/NjV8luYsM89Sti8vAmZ9yiC5u1mDLb0pknWt0KiL8se7pHz2myhg6ddkou44cYk3O9f8a6q/frygXExeOn7fsiZQCGX+PdyJQGVFnoOosHPRKk8kAXr2vlg+mBpEnGt+Pd2KorqIaz4Co6IaTE3VDf+Zo9mbiOsgY8CYbOhH0a3u3U5l12qUmCeQPw7+guJcy0zlBieiEjUB6aPN0VotRaLidc12N/pqZ0hXVVwgB/XKq0JJrECfsNQIxGDZCfKeadcwlFCiEki/zvvH7f2E5fuA4rAAej77tZC3AJXUxpBobv9Eed+MoLZCYq7F74CCuX6MbqUmoTtZdG75uRUfFf/mcTe3dy4cCuIrJG06/I+M0IUdyfCsFkE7HoXiSGJPcSvUsdI+lCyXYZC5l6d02n/v6rz8QTrQAbrveh5VSArj2XQCvNa0YiBz54eIzr9Fe3UQmVw8wlRdmNOcDo0LejwDYL44mm6MbX2VyPFyGqPRbe+NSSPC/LHdBCGEQX01HkmV3kmLFXnSIzpIbjJRzl+dRvN7CVSS3XL8efwPvqsmXReK+VnZ9IzMvYWboK1Bg4/Ri5PRSMKCWhc= - on: - branch: stable - tags: true - skip_existing: true diff --git a/README.rst b/README.rst index 8a78cc8e..75f34c79 100644 --- a/README.rst +++ b/README.rst @@ -7,13 +7,17 @@ WebbPSF: Simulated Point Spread Functions for the James Webb and Nancy Grace Rom :target: https://pypi.python.org/pypi/webbpsf :alt: Badge showing current released PyPI version -.. image:: https://travis-ci.org/spacetelescope/webbpsf.svg?branch=master - :target: https://travis-ci.org/spacetelescope/webbpsf - :alt: Badge showing continuous integration test status +.. image:: https://github.com/spacetelescope/webbpsf/workflows/CI/badge.svg?branch=develop + :target: https://github.com/spacetelescope/webbpsf/actions + :alt: Github Actions CI Status .. image:: https://codecov.io/gh/spacetelescope/webbpsf/branch/master/graph/badge.svg :target: https://codecov.io/gh/spacetelescope/webbpsf +.. |Documentation Status| image:: https://img.shields.io/readthedocs/webbpsf/latest.svg?logo=read%20the%20docs&logoColor=white&label=Docs&version=latest + :target: https://webbpsf.readthedocs.io/en/latest/ + :alt: Documentation Status + .. image:: https://img.shields.io/badge/ascl-1504.007-blue.svg?colorB=262255 :target: http://ascl.net/1504.007 @@ -22,7 +26,7 @@ flagship infrared space telescope. WebbPSF can simulate images for any of the four science instruments plus the fine guidance sensor, including both direct imaging and coronagraphic modes. -WebbPSF also supports simulating PSFs for the upcoming Nancy Grace Roman Space Telescope (formerly WFIRST), +WebbPSF also supports simulating PSFs for the upcoming WFIRST, including its Wide Field Instrument and a preliminary version of the Coronagraph Instrument. Developed by Marshall Perrin, Joseph Long, Neil Zimmerman, Robel Geda, Shannon @@ -33,4 +37,4 @@ Documentation can be found online at https://webbpsf.readthedocs.io WebbPSF requires input data for its simulations, including optical path difference (OPD) maps, filter transmission curves, and coronagraph Lyot mask shapes. These data files are not included in this source distribution. -Please see the documentation to download the required data files. +Please see the documentation to download the required data files. \ No newline at end of file From 89f48fc00e00fb5e8e780ec94120a1e90c0b0da5 Mon Sep 17 00:00:00 2001 From: Robel Geda Date: Fri, 23 Jul 2021 04:11:02 -0400 Subject: [PATCH 4/8] point to poppy==0.9.2 and remove develop test --- .github/workflows/ci_workflows.yml | 5 ----- setup.cfg | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/ci_workflows.yml b/.github/workflows/ci_workflows.yml index 0d50a59d..292b223e 100644 --- a/.github/workflows/ci_workflows.yml +++ b/.github/workflows/ci_workflows.yml @@ -26,11 +26,6 @@ jobs: python: 3.8 toxenv: py38-astropydev-test - - name: Try latest versions of all dependencies - os: ubuntu-latest - python: 3.8 - toxenv: py38-latest-test - - name: Try minimum supported versions os: ubuntu-latest python: 3.6 diff --git a/setup.cfg b/setup.cfg index 187364f2..039cb0bd 100644 --- a/setup.cfg +++ b/setup.cfg @@ -25,7 +25,7 @@ install_requires = matplotlib>=2.0.0 astropy>=3.0.0 photutils>=0.6.0 - poppy>=0.9.1 + poppy==0.9.2 jwxml>=0.3.0 pysiaf>=0.9.0 python_requires = >=3.6 From 72dbc7cb9f4a68d58ae87d6cc5fc64836d75440b Mon Sep 17 00:00:00 2001 From: Robel Geda Date: Fri, 23 Jul 2021 04:24:31 -0400 Subject: [PATCH 5/8] update tox.ini --- README.rst | 2 +- tox.ini | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/README.rst b/README.rst index 75f34c79..43571a3a 100644 --- a/README.rst +++ b/README.rst @@ -26,7 +26,7 @@ flagship infrared space telescope. WebbPSF can simulate images for any of the four science instruments plus the fine guidance sensor, including both direct imaging and coronagraphic modes. -WebbPSF also supports simulating PSFs for the upcoming WFIRST, +WebbPSF also supports simulating PSFs for the upcoming Nancy Grace Roman Space Telescope (formerly WFIRST), including its Wide Field Instrument and a preliminary version of the Coronagraph Instrument. Developed by Marshall Perrin, Joseph Long, Neil Zimmerman, Robel Geda, Shannon diff --git a/tox.ini b/tox.ini index d7c1f884..387491c6 100644 --- a/tox.ini +++ b/tox.ini @@ -1,7 +1,7 @@ [tox] envlist = py{36,37,38}-test - py{36,37,38}-{poppydev,pysiafdev,astropydev,stable}-test + py{36,37,38}-{poppydev,pysiafdev,astropydev,latest,stable}-test py36-legacy36-test py{36,37,38}-{poppydev,pysiafdev}-cov @@ -9,11 +9,12 @@ envlist = passenv = * deps = pytest - jwxml - poppydev,legacy36,astropydev: git+https://github.com/spacetelescope/poppy.git#egg=poppy + poppydev,legacy36,astropydev,latest: git+https://github.com/spacetelescope/poppy.git#egg=poppy pysiafdev,legacy36,astropydev: git+https://github.com/spacetelescope/pysiaf.git#egg=pysiaf - legacy36: numpy==1.16.* + legacy36: numpy==1.17.* astropydev: git+git://github.com/astropy/astropy + poppydev: synphot + latest: -rrequirements.txt stable: poppy stable: pysiaf cov: pytest-astropy @@ -55,4 +56,4 @@ description = check package code style deps = pycodestyle commands = - pycodestyle webbpsf + pycodestyle webbpsf \ No newline at end of file From 46c0efc74f451e89f1528d58e0a794b52d7adce7 Mon Sep 17 00:00:00 2001 From: Robel Geda Date: Fri, 23 Jul 2021 04:42:08 -0400 Subject: [PATCH 6/8] update relnotes.rst for 0.9.2 --- docs/relnotes.rst | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/docs/relnotes.rst b/docs/relnotes.rst index 175c86a9..2365abf6 100644 --- a/docs/relnotes.rst +++ b/docs/relnotes.rst @@ -30,6 +30,33 @@ Road Map for Future Releases Version History and Change Log ------------------------------- +Version 0.9.2 +============= +*2021 July 23* + +This release only improves a subset of WFIRST functionality; additional improvements to both WFIRST (including renaming to Roman) and JWST models will be at the upcoming 1.0.0 major release. + +**WFIRST Improvements** + +- New Grism and Prism filters: [:pr:`416`, :pr:`471`, :user:`robelgeda`] + - `GRISM_FILTER = 'G150'` + - `PRISM_FILTER = 'P120'` +- Changing filters to `G150` or `P120` changes the mode of the WFI and the aberrations files (unless there is a user aberrations override) [:pr:`416`, :pr:`471`, :user:`robelgeda`] +- New `WFI.mode`: Class property that returns the current mode of the WFI instance by passing the current filter to `WFI. _get_filter_mode`. WFI modes are: [:pr:`416`, :pr:`471`, :user:`robelgeda`] + - Imaging + - Grism + - Prisim +- New `WFI.override_aberrations(aberrations_path)`: Overrides and locks the current aberrations with aberrations at `aberrations_path`. Lock means changing the filter/mode has no effect on the aberrations. [:pr:`416`, :pr:`471`, :user:`robelgeda`] +- New `WFI.reset_override_aberrations()`: Releases `WFI.override_aberrations` lock and start using the default aberrations. [:pr:`416`, :pr:`471`, :user:`robelgeda`] +- New Tests for mode and filter switching. [:pr:`416`, :pr:`471`, :user:`robelgeda`] +- New Field point nearest point approximation (extrapolation). [:pr:`416`, :pr:`471`, :user:`robelgeda`] + +**Software and Package Infrastructure Updates:** + +- This minor release uses CircleCI and removes TravisCI. [:pr:`455`, :user:`shanosborne`, :pr:`471`, :user:`robelgeda`] + +-------- + Version 0.9.1 ============= *2020 June 22* From bae55b8ae2f6397a358e5b35dacd682b32f6957c Mon Sep 17 00:00:00 2001 From: Robel Geda Date: Fri, 23 Jul 2021 04:42:51 -0400 Subject: [PATCH 7/8] update CI data url to point to 0.9.2 --- .github/workflows/ci_workflows.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_workflows.yml b/.github/workflows/ci_workflows.yml index 292b223e..f7cdca62 100644 --- a/.github/workflows/ci_workflows.yml +++ b/.github/workflows/ci_workflows.yml @@ -53,7 +53,7 @@ jobs: - 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/qcptcokkbx7fgi3c00w2732yezkxzb99.gz -O /tmp/minimal-webbpsf-data.tar.gz + wget https://stsci.box.com/shared/static/r7k2m3ruxb7a7a7t172epr4kq5ibmo78.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 From e95b20d12454aff9fad4777d05e1edac134fc166 Mon Sep 17 00:00:00 2001 From: Marshall Perrin Date: Fri, 23 Jul 2021 13:31:46 -0400 Subject: [PATCH 8/8] Update relnotes.rst --- docs/relnotes.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/relnotes.rst b/docs/relnotes.rst index 2365abf6..0fd4b8c6 100644 --- a/docs/relnotes.rst +++ b/docs/relnotes.rst @@ -53,7 +53,7 @@ This release only improves a subset of WFIRST functionality; additional improvem **Software and Package Infrastructure Updates:** -- This minor release uses CircleCI and removes TravisCI. [:pr:`455`, :user:`shanosborne`, :pr:`471`, :user:`robelgeda`] +- This release uses Github Actions CI and removes TravisCI. [:pr:`455`, :user:`shanosborne`, :pr:`471`, :user:`robelgeda`] --------