2626from astropy .io import fits
2727import numpy as np
2828import 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
3333import multiprocessing
3434import 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
0 commit comments