Skip to content

Commit

Permalink
Merge pull request #471 from spacetelescope/develop-0.9.2
Browse files Browse the repository at this point in the history
Release 0.9.2
  • Loading branch information
mperrin committed Jul 23, 2021
2 parents cd203a9 + e95b20d commit fcba240
Show file tree
Hide file tree
Showing 9 changed files with 405 additions and 108 deletions.
76 changes: 76 additions & 0 deletions .github/workflows/ci_workflows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
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 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/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
- 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
26 changes: 26 additions & 0 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
@@ -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
71 changes: 0 additions & 71 deletions .travis.yml

This file was deleted.

12 changes: 8 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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.
27 changes: 27 additions & 0 deletions docs/relnotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 release uses Github Actions CI and removes TravisCI. [:pr:`455`, :user:`shanosborne`, :pr:`471`, :user:`robelgeda`]

--------

Version 0.9.1
=============
*2020 June 22*
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 6 additions & 5 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
[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

[testenv]
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
Expand Down Expand Up @@ -55,4 +56,4 @@ description = check package code style
deps =
pycodestyle
commands =
pycodestyle webbpsf
pycodestyle webbpsf
60 changes: 60 additions & 0 deletions webbpsf/tests/test_wfirst.py
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit fcba240

Please sign in to comment.