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
+49-29Lines changed: 49 additions & 29 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,18 +22,18 @@ kernelspec:
22
22
+++
23
23
24
24
```{warning}
25
-
In the SPHEREx spectral image versions prior to XXXX, there was a missmatch between the spatial layout of the PSF zones and the the indexing of the PSF zones in the header. This has now been fixed in versions post XXXX.
26
-
However, users using the old versions will need to implement and extra step (described below in Section 5) to update the image header.
25
+
In the SPHEREx spectral image versions prior or equal to 6.5.5, there was a missmatch between the spatial layout of the PSF zones and the the indexing of the PSF zones in the image header. This has now been fixed in versions post 6.5.5.
26
+
However, users using the old versions will need to implement and extra step (described below in Section 5.1) to update the image header.
27
27
28
-
For more information, see the following webpage: [PSF Erratum](WEBPAGE)
28
+
For more information about these changes, see the following webpage: [PSF Erratum](WEBPAGE)
29
29
```
30
30
31
31
+++
32
32
33
33
## 1. Learning Goals
34
34
35
35
* Determine how pixels in a SPHEREx cutout map to the pixels in the parent SPHEREx spectral image.
36
-
* Understand the structure of the PSF extension in a SPHEREx cutout (which is the same as the PSF extension in the parent spectral image)
36
+
* Understand the structure of the PSF extension in a SPHEREx cutout (which is the same as the PSF extension in the parent spectral image).
37
37
* Learn how to tell which version of the SPHEREx spectral image you are looking at, and how to interpret this information to obtain the correct PSF extension for the SPHEREx spectral images.
38
38
* Learn which plane in a SPHEREx cutout PSF extension cube most accurately describes the coordinates you are interested in.
39
39
@@ -70,6 +70,7 @@ import re
70
70
import time
71
71
import urllib.error
72
72
import copy
73
+
from packaging.version import Version
73
74
74
75
import astropy.units as u
75
76
import matplotlib.pyplot as plt
@@ -171,7 +172,7 @@ for attempt in range(max_retries):
171
172
time.sleep(10 * (attempt + 1))
172
173
```
173
174
174
-
Examine the header.
175
+
Let's examine the HDU list info.
175
176
176
177
```{code-cell} ipython3
177
178
hdul.info()
@@ -215,24 +216,46 @@ The goal of this tutorial now is to find the PSF corresponding to our input coor
215
216
+++
216
217
217
218
```{warning}
218
-
In the SPHEREx spectral image versions prior to XXXX, there was a missmatch between the spatial layout of the PSF zones and the the indexing of the PSF zones in the header. This has now been fixed in versions post XXXX.
219
+
In the SPHEREx spectral image versions prior or equal to 6.5.5, there was a missmatch between the spatial layout of the PSF zones and the the indexing of the PSF zones in the image header. This has now been fixed in versions post 6.5.5.
219
220
220
-
For more information, see the following webpage: [PSF Erratum](WEBPAGE)
221
+
For more information about these changes, see the following webpage: [PSF Erratum](WEBPAGE)
221
222
222
223
**Users using the old versions will need to implement and extra step (described below) to update the image header.**
223
224
```
224
225
225
-
Let's first check if a header update is necessary. We can do that by checking the `VERSION` keyword in the header.
226
+
Let's first check here if a header update is necessary. We can do that by printing the `VERSION` keyword in the header.
227
+
228
+
For comparisons versions, we can use the Python-internal `Version()` function from the `packaging.version` package. However, since reprocessed images can have version names such as `6.5.4-001` (which are superior to `6.5.4`, for example), we have to write a little wrapper function such that `Version()` can interpret these correctly.
229
+
230
+
```{code-cell} ipython3
231
+
def parse_version(v):
232
+
'''
233
+
Parses versions correctly such that "6.5.4-001" is later than "6.5.5".
print("PSF header needs to be updated! -> Go to Section 5.1 :(")
250
+
else:
251
+
print("PSF header is already up-to-date! -> Proceed to Section 6 :)")
229
252
```
230
253
231
-
If the version of the SPHEREx spectral image is less than `6.4`, we will have to update the header. This is explained in Section 5.1. If the version is later than `6.4`, the header is already updated and the PSF issue is fixed. In this case, proceed to Section 6 directly.
254
+
If the version of the SPHEREx spectral image is less or equal than `6.5.5`, we will have to update the header. This is explained in Section 5.1. If the version is later than `6.5.5`, the header is already updated and the PSF issue is fixed. In this case, proceed to Section 6 directly.
232
255
233
256
+++
234
257
235
-
### 5.1 Updating Old SPHEREx Spectral Image Data (`VERSIONS` < XXX)
258
+
### 5.1 Updating Old SPHEREx Spectral Image Data (if version is $\leq$ 6.5.5)
0 commit comments