Skip to content

Commit 40c3d34

Browse files
committed
Update docs, add RA/Dec keywords
1 parent 24f830e commit 40c3d34

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
lines changed

astrocut/asdf_cutout.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,9 @@ def fits_cutouts(self) -> List[fits.HDUList]:
158158
primary_hdu = fits.PrimaryHDU()
159159
primary_hdu.header.extend([('ORIGIN', 'STScI/MAST', 'institution responsible for creating this file'),
160160
('DATE', str(date.today()), 'file creation date'),
161-
('PROCVER', __version__, 'software version')])
161+
('PROCVER', __version__, 'software version'),
162+
('RA_OBJ', self._coordinates.ra.value, 'right ascension of cutout center (deg)'),
163+
('DEC_OBJ', self._coordinates.dec.value, 'declination of cutout center (deg)')])
162164

163165
# Build ImageHDU with cutout data and WCS
164166
image_hdu = fits.ImageHDU(data=cutout.data, header=cutout.wcs.to_header(relax=True))

astrocut/tests/test_asdf_cutout.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -423,11 +423,12 @@ def test_asdf_cutout_stdatamodels(test_images, center_coord, cutout_size, is_ins
423423
patch_dict = {'stdatamodels': mock_stdatamodels}
424424

425425
with patch.dict('sys.modules', patch_dict):
426-
with pytest.warns(ModuleWarning, match=warn_msg):
427-
cutout = ASDFCutout(test_images, center_coord, cutout_size)
428-
fits_cutouts = cutout.fits_cutouts
429-
assert cutout._can_embed_asdf_in_fits is False
430-
assert len(fits_cutouts[0]) == 2 # primary + cutout HDU only
426+
with patch('sys.version_info', (3, 11, 0)):
427+
with pytest.warns(ModuleWarning, match=warn_msg):
428+
cutout = ASDFCutout(test_images, center_coord, cutout_size)
429+
fits_cutouts = cutout.fits_cutouts
430+
assert cutout._can_embed_asdf_in_fits is False
431+
assert len(fits_cutouts[0]) == 2 # primary + cutout HDU only
431432

432433

433434
def test_asdf_cutout_python_version(test_images, center_coord, cutout_size):

docs/astrocut/index.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,9 @@ The ``asdf_cutouts`` attribute is a list of cutouts as `~asdf.AsdfFile` objects,
163163
>>> cutout_fits.info() #doctest: +SKIP
164164
Filename: (No file associated with this HDUList)
165165
No. Name Ver Type Cards Dimensions Format
166-
0 PRIMARY 1 PrimaryHDU 25 (25, 25) float32
166+
0 PRIMARY 1 PrimaryHDU 11 ()
167+
1 CUTOUT 1 ImageHDU 67 (25, 25) float32
168+
2 ASDF 1 BinTableHDU 13 1R x 1C ['36470B']
167169
168170
To write the cutouts and their metadata to ASDF files, use the `~astrocut.ASDFCutout.write_as_asdf` method. This method returns a list of paths to the
169171
cutout ASDF files.
@@ -191,7 +193,9 @@ cutout FITS files.
191193
... hdul.info() #doctest: +SKIP
192194
Filename: r0099101001001001001_F158_visit_r274dp63x31y81_i2d_269.6970000_66.0450000_25-x-25_astrocut.fits
193195
No. Name Ver Type Cards Dimensions Format
194-
0 PRIMARY 1 PrimaryHDU 27 (25, 25) float32
196+
0 PRIMARY 1 PrimaryHDU 11 ()
197+
1 CUTOUT 1 ImageHDU 67 (25, 25) float32
198+
2 ASDF 1 BinTableHDU 13 1R x 1C [36470B]
195199
196200
By default, the cutouts are written to the current working directory. You can specify a different output directory using the ``output_dir`` parameter
197201
in either of the write functions.

0 commit comments

Comments
 (0)