Skip to content

Commit e1677f9

Browse files
committed
Fix failing tests
1 parent 51529d9 commit e1677f9

26 files changed

Lines changed: 2388 additions & 2386 deletions

environment_python_3.11.yml

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,28 @@ dependencies:
88
- pip
99
- python==3.11.13
1010
- pip:
11-
- asdf==4.5.0
12-
- astropy==7.1.0
11+
- asdf==5.3.0
12+
- astropy==7.2.0
1313
- astroquery==0.4.11
1414
- batman-package>=2.5.2
15-
- bokeh==3.8.0
16-
- crds==13.0.6
17-
- grismconf==1.51
18-
- h5py==3.14.0
15+
- bokeh==3.9.0
16+
- crds==13.1.6
17+
- grismconf>=1.60
18+
- h5py==3.16.0
1919
- hotsoss==0.1.10
20-
- ipython==9.6.0
21-
- jupyter==1.1.1
22-
- jwst==1.19.2
20+
- jwst==2.0.0
2321
- jwst-backgrounds==1.3.0
2422
- jwst_gtvt==1.1.1
25-
- lxml==6.0.2
26-
- matplotlib==3.10.7
23+
- lxml==6.1.0
24+
- matplotlib==3.10.9
2725
- nircam_gsim>=1.71
28-
- numpy==2.2.6
26+
- numpy==2.3.5
2927
- photutils==2.3.0
30-
- pysiaf==0.24.1
31-
- pytest==8.4.2
28+
- pysiaf>=0.25.1
29+
- pytest==9.0.3
3230
- pyyaml==6.0.3
33-
- scipy==1.16.2
34-
- sphinx==8.2.3
35-
- synphot==1.6.0
36-
- webbpsf==2.0.0
31+
- scipy==1.17.1
32+
- setuptools==81.0.0
33+
- sphinx==9.1.0
34+
- stpsf==2.2.0
35+
- synphot==1.7.0

environment_python_3.12.yml

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,28 @@ dependencies:
88
- pip
99
- python==3.12.11
1010
- pip:
11-
- asdf==4.5.0
12-
- astropy==7.1.0
11+
- asdf==5.3.0
12+
- astropy==7.2.0
1313
- astroquery==0.4.11
14-
- bokeh==3.8.0
15-
- crds==13.0.6
16-
- grismconf==1.51
17-
- h5py==3.14.0
14+
- batman-package>=2.5.2
15+
- bokeh==3.9.0
16+
- crds==13.1.6
17+
- grismconf>=1.60
18+
- h5py==3.16.0
1819
- hotsoss==0.1.10
19-
- ipython==9.6.0
20-
- jupyter==1.1.1
21-
- jwst==1.19.2
20+
- jwst==2.0.0
2221
- jwst-backgrounds==1.3.0
2322
- jwst_gtvt==1.1.1
24-
- lxml==6.0.2
25-
- matplotlib==3.10.7
23+
- lxml==6.1.0
24+
- matplotlib==3.10.9
2625
- nircam_gsim>=1.71
27-
- numpy==2.2.6
26+
- numpy==2.3.5
2827
- photutils==2.3.0
29-
- pysiaf==0.24.1
30-
- pytest==8.4.2
28+
- pysiaf>=0.25.1
29+
- pytest==9.0.3
3130
- pyyaml==6.0.3
32-
- scipy==1.16.2
33-
- sphinx==8.2.3
34-
- synphot==1.6.0
35-
- webbpsf==2.0.0
31+
- scipy==1.17.1
32+
- setuptools==81.0.0
33+
- sphinx==9.1.0
34+
- stpsf==2.2.0
35+
- synphot==1.7.0

mirage/psf/deployments.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
from astropy.io import fits
2222
import numpy as np
23-
import webbpsf
23+
import stpsf as webbpsf
2424

2525
from mirage.logging import logging_functions
2626
from mirage.utils.constants import LOG_CONFIG_FILENAME, STANDARD_LOGFILE_NAME

mirage/psf/psf_selection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737

3838
from astropy.io import fits
3939
import numpy as np
40-
from webbpsf.utils import to_griddedpsfmodel
40+
from stpsf.utils import to_griddedpsfmodel
4141

4242
from mirage.logging import logging_functions
4343
from mirage.utils.constants import NIRISS_PUPIL_WHEEL_FILTERS, NIRCAM_PUPIL_WHEEL_FILTERS, \

mirage/psf/segment_psfs.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626
from astropy.io import fits
2727
import numpy as np
2828
import pysiaf
29-
import webbpsf
30-
from webbpsf.gridded_library import CreatePSFLibrary
31-
from webbpsf.utils import to_griddedpsfmodel
29+
import stpsf
30+
from stpsf.gridded_library import CreatePSFLibrary
31+
from stpsf.utils import to_griddedpsfmodel
3232

3333
import multiprocessing
3434
import functools
@@ -56,7 +56,7 @@ def _generate_psfs_for_one_segment(inst, ote, segment_tilts, out_dir, boresight,
5656

5757
i_segment = i + 1
5858

59-
segname = webbpsf.webbpsf_core.segname(i_segment)
59+
segname = stpsf.stpsf_core.segname(i_segment)
6060
logger.info('GENERATING SEGMENT {} DATA'.format(segname))
6161

6262
det_filt_match = False
@@ -76,12 +76,12 @@ def _generate_psfs_for_one_segment(inst, ote, segment_tilts, out_dir, boresight,
7676
inst.detector = det
7777

7878
# Restrict the pupil to the current segment
79-
pupil = webbpsf.webbpsf_core.one_segment_pupil(i_segment)
79+
pupil = stpsf.stpsf_core.one_segment_pupil(i_segment)
8080
ote.amplitude = pupil[0].data
8181
inst.pupil = ote
8282

8383
# Determine normalization factor - what fraction of total pupil is in this one segment?
84-
full_pupil = fits.getdata(os.path.join(webbpsf.utils.get_webbpsf_data_path(), 'jwst_pupil_RevW_npix1024.fits.gz'))
84+
full_pupil = fits.getdata(os.path.join(stpsf.utils.get_stpsf_data_path(), 'jwst_pupil_RevW_npix1024.fits.gz'))
8585
pupil_fraction_for_this_segment = pupil[0].data.sum() / full_pupil.sum()
8686

8787
# Generate the PSF grid
@@ -192,9 +192,9 @@ def generate_segment_psfs(ote, segment_tilts, out_dir, filters=['F212N', 'F480M'
192192

193193
# Create webbpsf NIRCam instance
194194
if instrument.lower() == 'nircam':
195-
inst = webbpsf.NIRCam()
195+
inst = stpsf.NIRCam()
196196
elif instrument.lower() == 'fgs':
197-
inst = webbpsf.FGS()
197+
inst = stpsf.FGS()
198198
else:
199199
raise ValueError(f'Unsupported instrument: {instrument}')
200200

@@ -455,7 +455,7 @@ def get_segment_offset(segment_number, detector, library_list):
455455
# between different OTE pose terms into optical tip and tilt. In particular, this is needed for
456456
# accurate modeling of radial translation corrections when using incoherent PSF calculations.
457457
if f'S{segment_number:02d}XTILT' in header:
458-
hexike_to_arcsec = 206265/webbpsf.constants.JWST_SEGMENT_RADIUS
458+
hexike_to_arcsec = 206265/stpsf.constants.JWST_SEGMENT_RADIUS
459459
# recall that Hexike tilt _around the X axis_ produces an offset _into Y_, and vice versa.
460460
x_arcsec = np.float64(header[f'S{segment_number:02d}YTILT'] * hexike_to_arcsec)
461461
# also recall coord flip of Y axis from OTE L.O.M in entrance pupil to exit pupil

mirage/psf/soss_trace.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ def generate_SOSS_psfs(filt):
194194
The filter to use, ['CLEAR', 'F277W']
195195
"""
196196
try:
197-
import webbpsf
197+
import stpsf as webbpsf
198198

199199
except ImportError:
200200
raise ("Could not import `webbpsf` package. Functionality limited. Generating dummy file.")

mirage/psf/tools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from astropy.modeling.models import Gaussian2D
1111
import numpy as np
1212
from photutils.datasets import load_irac_psf
13-
import webbpsf
13+
import stpsf as webbpsf
1414

1515
from mirage.psf.psf_selection import get_psf_wings
1616
from mirage.utils.siaf_interface import get_instance

mirage/seed_image/catalog_seed_image.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4572,7 +4572,7 @@ def locate_ghost(self, pixel_x, pixel_y, count_rate, magnitude_system, source_ro
45724572
NIRISS_GHOST_GAP_FILE,
45734573
log_skipped_filters=log_skipped_filters
45744574
)
4575-
if isinstance(ghost_pixelx, np.float):
4575+
if isinstance(ghost_pixelx, float):
45764576
if not np.isfinite(ghost_pixelx):
45774577
return np.nan, np.nan, np.nan, np.nan, np.nan
45784578

mirage/seed_image/get_psf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*** NOT CURRENTLY IN USE ****
44
'''
55

6-
import webbpsf
6+
import stpsf as webbpsf
77

88

99
def create_commissioning_psf(params):

mirage/utils/backgrounds.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ def low_medium_high_background_value(ra, dec, background_level, filter_waves, fi
302302
# Convert from MJy/sr to e-/sec/pixel
303303
pixelarea = siaf_info.XSciScale * u.arcsec * siaf_info.YSciScale * u.arcsec
304304
photon_total = PRIMARY_MIRROR_AREA * (filt_bkgd * u.MJy / u.sr) * (1. / PLANCK) * 1.e-20 * pixelarea.to(u.sr) / (filter_waves * u.micron)
305-
bsigs[i] = np.trapz(photon_total.value, x=filter_waves)
305+
bsigs[i] = np.trapezoid(photon_total.value, x=filter_waves)
306306

307307
# Now sort and determine the low/medium/high levels
308308
low, medium, high = find_low_med_high(bsigs)

0 commit comments

Comments
 (0)