Skip to content

Commit 7b93956

Browse files
authored
better WCS defaults (#274)
1 parent d617396 commit 7b93956

3 files changed

Lines changed: 22 additions & 5 deletions

File tree

docs/0-example.ipynb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,8 @@
169169
"metadata": {},
170170
"source": [
171171
"If only one observation is given (as above), we assume that bands and pixel locations are identical between the model and the observation. Because we have ground-based images, we need to account for different PSFs in each band, which means the model frame needs to define a reference PSF that is sufficiently narrow. Our default is a minimal Gaussian PSF that is barely well-sampled (standard deviation of 0.7 pixels) as the PSF reference.\n",
172-
"If other properties of the model frame are desired, they can be provided to {py:func}`scarlet2.Frame.from_observations`.\n",
172+
"Because we didn't provide a WCS for the observation, the code will automatically create a dummy WCS with a 1-arcsec pixel scale and an intentionally unsual pseudo-Euclidean Carée projection.\n",
173+
"If the model frame should have other properties, they can be overwritten through arguments to {py:func}`scarlet2.Frame.from_observations`.\n",
173174
"\n",
174175
"But what's the point of the model frame? Why is it needed at all?\n",
175176
"\n",

docs/0-quickstart.ipynb

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@
119119
"id": "8",
120120
"metadata": {},
121121
"source": [
122-
"As you can see, the frame contains the size of the data array, [WCS information](https://docs.astropy.org/en/latest/wcs/index.html) on what area of the sky is being described (it's trivial here: RA/DEC = 0,0), and the description of the channels in the observation.\n",
122+
"As you can see, the frame contains the size of the data array, [WCS information](https://docs.astropy.org/en/latest/wcs/index.html) on what area of the sky is being described (it's a dummy here: RA/DEC = (180,0) with 1 arcsec resolution), and the list of channels in the observation.\n",
123123
"\n",
124124
"In _scarlet2_, we use the term \"channel\" for any dimension that is not in the plane of the sky. It could be photometric bands (like the three bands in this example), spectroscopic wavelengths, and/or [time](howto/timedomain). I's the third axis of the image cube.\n",
125125
"\n",
@@ -412,9 +412,22 @@
412412
}
413413
],
414414
"metadata": {
415+
"kernelspec": {
416+
"display_name": "Python 3 (ipykernel)",
417+
"language": "python",
418+
"name": "python3"
419+
},
415420
"language_info": {
421+
"codemirror_mode": {
422+
"name": "ipython",
423+
"version": 3
424+
},
425+
"file_extension": ".py",
426+
"mimetype": "text/x-python",
416427
"name": "python",
417-
"version": "3.10.0"
428+
"nbconvert_exporter": "python",
429+
"pygments_lexer": "ipython3",
430+
"version": "3.10.14"
418431
}
419432
},
420433
"nbformat": 4,

src/scarlet2/frame.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -402,8 +402,11 @@ def _wcs_default(shape):
402402
shape_ = shape[-2:][::-1] # x/y
403403
wcs = astropy.wcs.WCS(naxis=2)
404404
wcs._naxis = shape_
405-
wcs.wcs.ctype = ["RA---TAN", "DEC--TAN"]
406-
wcs.wcs.crpix = jnp.array((shape_[0] // 2, shape_[1] // 2)) + 1 # 1-based pixel coordinates
405+
wcs.wcs.crpix = [shape_[0] // 2 + 1, shape_[1] // 2 + 1] # 1-based pixel coordinates
406+
wcs.wcs.ctype = ["RA---CAR", "DEC--CAR"] # Pseudo-Euclidean
407+
wcs.wcs.crval = [180.0, 0.0] # Avoid wrapping at RA=0, Dec=0 for Caree
408+
wcs.wcs.cdelt = [-0.000278, 0.000278] # 1 arcsec/pixel
409+
wcs.wcs.cunit = ["deg", "deg"]
407410
return wcs
408411

409412

0 commit comments

Comments
 (0)