Skip to content

Commit

Permalink
Merge pull request #64 from PhangsTeam/cross-corr-get-wcs-adjust
Browse files Browse the repository at this point in the history
Add cross-correlation to get_wcs_adjust_step.py
  • Loading branch information
low-sky committed Mar 20, 2024
2 parents e0b6017 + 850f804 commit 1834ae9
Show file tree
Hide file tree
Showing 10 changed files with 691 additions and 190 deletions.
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
1.1.1 (Unreleased)
==================

- Fix bug in ``astrometric_align_step`` if first pass of alignment succeeds but second
fails
- Add cross-correlation option to ``get_wcs_adjust_step``, which uses ``spacepylot``
- Add control over reproject functions, can be ``reproject_interp`` (default), ``reproject_exact``,
or ``reproject_adaptive``. For MIRI, ``reproject_exact`` may work better. This applies to ``anchoring_step``,
``astrometric_align_step``, ``level_match_step``, ``multi_tile_destripe_step``, ``psf_matching_step``, and
Expand Down
3 changes: 3 additions & 0 deletions config/3707/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ jwst_parameters.bkg_subtract.sigma = 1.5

[parameters.get_wcs_adjust]

method.nircam = "tweakreg"
method.miri = "cross_corr"

bands = [
'F300M',
'F770W',
Expand Down
3 changes: 3 additions & 0 deletions docs/steps/get_wcs_adjust.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ shift per-visit (since JWST cycles between filters), and apply that shift to all
that taking a long NIRCam band that is ideally stellar dominated (i.e. F300M) works best for NIRCam, and a shorter
wavelength, non-PAH-dominated MIRI band (i.e. F1000W) is ideal for MIRI.

By default, this step uses tweakreg, but can also be swapped out for cross-correlation via optical flow. This may be
more optimal if you don't have any point source dominated wavebands, such as if you only have F770W, for instance.

---
API
---
Expand Down
6 changes: 6 additions & 0 deletions pjpipe/astrometric_align/astrometric_align_step.py
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,12 @@ def tweakreg_align(
except ValueError:
log.warning("No catalog matches found. Defaulting to no shift")

# Reset everything to avoid crashes
wcs_aligned_fit = None
xoffset, yoffset = 0, 0
shift = np.array([0, 0])
matrix = np.array([[1, 0], [0, 1]])

target_wcs_corrected = copy.deepcopy(target_wcs_corrector_orig)

# Put the correction in and properly update header.
Expand Down
Loading

0 comments on commit 1834ae9

Please sign in to comment.