You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: tutorials/spherex/spherex_psf.md
+12-5Lines changed: 12 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -135,18 +135,19 @@ print(spectral_image_url)
135
135
## 5. Read in a SPHEREx Cutout
136
136
137
137
Next, we use standard astropy tools to open the fits image and to read the different headers and data.
138
+
Transient read errors occur sometimes, so we'll catch those and retry a few times.
138
139
139
140
```{tip}
140
141
As we do below, you can use `hdul.info()` to print the list of FITS layers of the downloaded cutout.
141
142
```
142
143
143
144
```{code-cell} ipython3
144
-
Max number of times to retry transient read errors.
145
+
# Max number of times to retry transient read errors.
145
146
max_retries = 3
146
147
for attempt in range(max_retries):
147
148
try:
149
+
# Read the data.
148
150
with fits.open(spectral_image_url) as hdul:
149
-
hdul.info()
150
151
cutout_header = hdul['IMAGE'].header
151
152
psf_header = hdul['PSF'].header
152
153
cutout = hdul['IMAGE'].data
@@ -158,6 +159,12 @@ for attempt in range(max_retries):
158
159
time.sleep(10 * (attempt + 1))
159
160
```
160
161
162
+
Examine the header.
163
+
164
+
```{code-cell} ipython3
165
+
hdul.info()
166
+
```
167
+
161
168
The downloaded SPHEREx image cutout contains 5 FITS layers, which are described in the [SPHEREx Explanatory Supplement](https://irsa.ipac.caltech.edu/data/SPHEREx/docs/SPHEREx_Expsupp_QR.pdf).
162
169
We focus in this example on the extensions `IMAGE` and `PSF`.
163
170
We have already loaded their data as well as their header.
@@ -290,11 +297,11 @@ plt.show()
290
297
291
298
## 9. Using the SPHEREx PSF in Forward Modeling (e.g., Tractor)
292
299
293
-
The PSF returned by this notebook is oversampled relative to the native SPHEREx detector pixel grid.
300
+
The PSF returned by this notebook is oversampled relative to the native SPHEREx detector pixel grid.
294
301
This is intentional: the PSF is evaluated on a fine sub-pixel grid so that it can represent different intra-pixel source positions accurately.
295
302
296
-
Tools such as Tractor do not expect an oversampled PSF directly.
297
-
Instead, they require a PSF that is pixel-integrated at the native detector resolution and evaluated at the correct sub-pixel phase of the source.
303
+
Tools such as Tractor do not expect an oversampled PSF directly.
304
+
Instead, they require a PSF that is pixel-integrated at the native detector resolution and evaluated at the correct sub-pixel phase of the source.
298
305
If you pass the oversampled PSF directly into Tractor without resampling, the effective PSF width and normalization will be incorrect, which can lead to systematic differences relative to the SPHEREx Spectrophotometry Tool.
299
306
300
307
To use this PSF for forward modeling or fitting, you must:
0 commit comments