Skip to content

Commit 31d2335

Browse files
emoltertaylorbell57
authored andcommitted
JP-3686: Test using source catalog output as tweakreg abs_refcat (spacetelescope#9301)
1 parent b403ba1 commit 31d2335

File tree

4 files changed

+31
-10
lines changed

4 files changed

+31
-10
lines changed

changes/9301.tweakreg.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Update docs to clarify format of tweakreg catalogs

docs/jwst/tweakreg/README.rst

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -135,25 +135,22 @@ measured sources in the combined field-of-view of the set of input
135135
images. This catalog is generated from the catalogs available
136136
through the `STScI MAST Catalogs`_ and has the ability to account
137137
for proper motion to a given epoch. The epoch is computed from the observation date and time
138-
of the input data.
138+
of the input data. If ``abs_refcat`` is set to a path to an existing
139+
file, i.e., a user-supplied external reference catalog,
140+
then the catalog will be read from that file. The catalog must be readable
141+
into an :py:meth:`~astropy.table.Table` object and contain either
142+
``'RA'`` and ``'DEC'`` columns (in degrees) or an Astropy-readable ``sky_centroid``.
143+
An optional column in the catalog is the ``'weight'`` column, which when present,
144+
will be used in fitting.
139145

140146
.. _STScI MAST Catalogs: https://outerspace.stsci.edu/display/MASTDATA/Catalog+Access
141147

142148
The combined source catalog derived in the first step
143149
then gets cross-matched and fit to this astrometric reference catalog.
144-
The pipeline initially supports fitting to the
145-
GAIADR3 catalog, with the option to select the GAIADR2 or GAIADR1 instead.
146150
The results of this one fit then gets back-propagated to all the
147151
input images to align them all to the astrometric reference frame while
148152
maintaining the relative alignment between the images.
149153

150-
For this part of alignment, instead of 'GAIADR1', 'GAIADR2', or 'GAIADR3', users can
151-
supply an external reference catalog by providing a path to an existing
152-
file. A user-supplied catalog must contain ``'RA'`` and ``'DEC'`` columns
153-
indicating reference source world coordinates (in degrees). An optional column
154-
in the catalog is the ``'weight'`` column, which when present, will be used
155-
in fitting. The catalog must be in a format automatically recognized by
156-
:py:meth:`~astropy.table.Table.read`.
157154

158155
Grouping
159156
--------
@@ -212,6 +209,10 @@ The ``tweakreg`` step has the following optional arguments:
212209
(Default= `'ecsv'`)
213210

214211
* ``catfile``: Name of the file with a list of custom user-provided catalogs.
212+
The file must contain a two-column list of format
213+
``<input file name> <catalog file name>`` with one entry per input filename
214+
in the input association.
215+
This parameter has no effect if ``use_custom_catalogs`` is `False`.
215216
(Default= `''`)
216217

217218
* ``bkg_boxsize``: A positive `int` indicating the background mesh box size

jwst/regtest/test_nircam_align_to_gaia.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
from stdatamodels.jwst import datamodels
66
from jwst.stpipe import Step
7+
from jwst.tweakreg import TweakRegStep
78

89

910
@pytest.fixture(scope="module")
@@ -40,3 +41,20 @@ def test_tweakreg_with_gaia(run_image3pipeline, rtdata_module, root):
4041

4142
assert_allclose(ra, ra_truth)
4243
assert_allclose(dec, dec_truth)
44+
45+
46+
@pytest.mark.bigdata
47+
def test_sourcecat_as_abs_refcat(run_image3pipeline, rtdata_module):
48+
"""
49+
Test that source catalog output is compatible with tweakreg.
50+
51+
Some workflows require using source catalog step output as the
52+
absolute reference catalog for tweakreg. This test ensures that
53+
this is possible. This is not nircam-specific, but is included here
54+
to avoid adding an additional test run through image3.
55+
"""
56+
rtdata = rtdata_module
57+
rtdata.output = "LMC_F277W_modA_dither_mosaic_cat.ecsv" # output from source catalog step
58+
rtdata.get_asn("nircam/image/level3_F277W_3img_asn.json")
59+
60+
TweakRegStep.call(rtdata.input, abs_refcat = rtdata.output)

jwst/tweakreg/tweakreg_step.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,7 @@ def process(self, input_data):
297297
# absolute alignment to the reference catalog
298298
# can (and does) occur after alignment between groups
299299
if align_to_abs_refcat:
300+
self.log.info(f"Aligning to absolute reference catalog: {self.abs_refcat}")
300301
with images:
301302
ref_image = images.borrow(0)
302303
try:

0 commit comments

Comments
 (0)