Skip to content

CoAdd2D now correctly uses manually extracted objects for offsets/weights#2092

Draft
tbowers7 wants to merge 3 commits intopypeit:developfrom
tbowers7:coadd2d_manual
Draft

CoAdd2D now correctly uses manually extracted objects for offsets/weights#2092
tbowers7 wants to merge 3 commits intopypeit:developfrom
tbowers7:coadd2d_manual

Conversation

@tbowers7
Copy link
Collaborator

@tbowers7 tbowers7 commented Mar 21, 2026

TODO: Clean up the description...

In concert with the Coadd2DPar user_obj_ids, this PR corrects the CoAdd2D code to pay attention to manually extracted objects when computing offsets and weights.

Previously, the coadd2d process would do a full-on object finding, crashing if one of the input frames did not detect objects above the required S/N level. Even if the user_obj_ids parameter was passed in, the coaddition would not pay attention to the desired object.

This PR checks for the presence of user_obj_ids and essentially performs a manual extraction at the location of the requested objects from this parameter for the purposes of computing offsets and weights only.

In the final coadded frame, the object-finding follows the existing paradigm.

In a couple of places, dictionaries were replaced with either @dataclass objects or numpy arrays for clarity.


Tests to follow.

In the Coadd2d process, the input images are rebinned and an attempt is
made to refind objects.  If the coadd is being done with very low-signal
objects, it should be possible to manually extract objects at pre-defined
locations and bypass the automated object finding.

This is the first step in this direction.

	modified:   pypeit/coadd2d.py
	modified:   pypeit/core/coadd.py
	modified:   pypeit/flatfield.py
	modified:   pypeit/par/parset.py
	modified:   pypeit/par/pypeitpar.py
For code development, add TEST logging level, between INFO and WARNING.
The combination of manual extraction of individual frames and use of the
[coadd2d][user_obj_ids] parameter now correctly sets the offets and
weights for the desired objects.  This allows for manually extracted
objects to be correctly coadded even when the object drifts along the
slit during a series of exposures.

	modified:   pypeit/coadd2d.py
	modified:   pypeit/core/coadd.py
	modified:   pypeit/core/findobj_skymask.py
	modified:   pypeit/manual_extract.py
@tbowers7 tbowers7 marked this pull request as draft March 21, 2026 03:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant