Skip to content

Commit

Permalink
Merge pull request #779 from BradleySappington/fix_CI
Browse files Browse the repository at this point in the history
Fix ci failures and update latest/min versions
  • Loading branch information
obi-wan76 authored Dec 14, 2023
2 parents b45e76f + b99e0d0 commit 3c86f1d
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 21 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ dependencies = [
"scipy>=1.5.0",
"matplotlib>=3.2.0",
"astropy>=5.1.0",
"photutils>=1.0.0",
"photutils>=1.10.0",
"poppy>=1.0.0",
"pysiaf>=0.19.1",
"soc_roman_tools>=0.1.0",
Expand Down
14 changes: 7 additions & 7 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
astropy==5.3.4
ipython==8.17.2
matplotlib==3.8.1
numpy==1.26.1
photutils==1.9.0
astropy==6.0.0
ipython==8.18.1
matplotlib==3.8.2
numpy==1.26.2
photutils==1.10.0
poppy>=1.0.0
pysiaf==0.21.0
scipy==1.11.3
synphot==1.2.1
scipy==1.11.4
synphot==1.3.post0
astroquery==0.4.6
9 changes: 5 additions & 4 deletions webbpsf/gridded_library.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
from collections import OrderedDict
import itertools
import os
from collections import OrderedDict

import astropy.convolution
import numpy as np
from astropy.io import fits
from astropy.nddata import NDData
import numpy as np
import poppy

import poppy
import webbpsf.detectors


Expand Down Expand Up @@ -399,7 +399,8 @@ def create_grid(self):
model_list.append(model)

if self.save is True:
self.writeto(psf_arr, meta, det)
# model.data is sorted with xygrid, psf_arr is not. Store the sorted data
self.writeto(model.data, meta, det)

# If only 1 detector, only return that 1 object. Else, return list of objects
if len(self.detector_list) == 1:
Expand Down
16 changes: 7 additions & 9 deletions webbpsf/tests/test_psfgrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def test_compare_to_calc_psf_oversampled():

# Pull one of the PSFs out of the grid
psfnum = 1
loc = grid.meta["grid_xypos"][psfnum]
loc = grid.grid_xypos[psfnum]
locy = int(float(loc[1]) - 0.5)
locx = int(float(loc[0]) - 0.5)
gridpsf = grid.data[psfnum, :, :]
Expand Down Expand Up @@ -68,7 +68,7 @@ def test_compare_to_calc_psf_detsampled():

# Pull one of the PSFs out of the grid
psfnum = 1
loc = grid.meta["grid_xypos"][psfnum]
loc = grid.grid_xypos[psfnum]
locy = int(float(loc[1]))
locx = int(float(loc[0]))
gridpsf = grid.data[psfnum, :, :]
Expand Down Expand Up @@ -142,8 +142,8 @@ def test_one_psf():
scalefactor = oversample**2 # normalization as used internally in GriddedPSFModel; see #302


assert grid1.meta["grid_xypos"] == [(1023, 1023)], "Center position not as expected" # the default is the center of the NIS aperture
assert grid2.meta["grid_xypos"] == [(10, 0)], "Corner position not as expected" # it's in (x,y)
assert np.all(grid1.grid_xypos == [[1023, 1023]]), "Center position not as expected" # the default is the center of the NIS aperture
assert np.all(grid2.grid_xypos == [(10, 0)]), "Corner position not as expected" # it's in (x,y)
# check for near-equality of the PSFs computed both ways,
# but ignore the outer few pixels rows and columns, for which boundary wrapping leads to imperfect equality
# depending on the order of the convolutions. Ignore 2 rows/cols on either side based on oversample value
Expand Down Expand Up @@ -209,7 +209,7 @@ def test_saving(tmpdir):
# Check meta data
model = utils.to_griddedpsfmodel(infile)
assert model.meta.keys() == grid.meta.keys()
assert model.meta["grid_xypos"] == grid.meta["grid_xypos"]
assert np.all(model.grid_xypos == grid.grid_xypos)
assert model.meta["oversampling"] == grid.meta["oversampling"]

# Remove temporary directory
Expand Down Expand Up @@ -249,7 +249,7 @@ def test_wfi():

# Pull one of the PSFs out of the grid
psfnum = 1
loc = grid.meta["grid_xypos"][psfnum]
loc = grid.grid_xypos[psfnum]
locy = int(float(loc[1])-0.5)
locx = int(float(loc[0])-0.5)
gridpsf = grid.data[psfnum, :, :]
Expand All @@ -263,6 +263,4 @@ def test_wfi():

# Compare to make sure they are in fact the same PSF
assert gridpsf.shape == calcpsf.shape, "Shape mismatch"
assert np.allclose(gridpsf, convpsf*scalefactor), "Data values not as expected"


assert np.allclose(gridpsf, convpsf*scalefactor), "Data values not as expected"

0 comments on commit 3c86f1d

Please sign in to comment.