Skip to content

Kcwi dec 2024 weights - #2149

Open
rcooke-ast wants to merge 17 commits into
kcwi_dec_2024from
kcwi_dec_2024_weights
Open

Kcwi dec 2024 weights#2149
rcooke-ast wants to merge 17 commits into
kcwi_dec_2024from
kcwi_dec_2024_weights

Conversation

@rcooke-ast

Copy link
Copy Markdown
Collaborator

An extension to the sequence of PRs related to #1929. In this PR, I have:

  • Added weights as an optional parameter to weighted_combine() (and propagated changes).
  • Moved the combination of datacubes in coadd3d.run() to a new routine. The code flow is largely unchanged, but I made some modifications (moved some bits outside of a for loop that didn't need to be updated every loop).
  • Added a save_separate parameter to output individual datacubes (on the final combined WCS) if requested. Previously this was output by default.

Dev-suite is running on the cloud, but the relevant parts pass on my machine. There is a related dev-suite PR.

@rcooke-ast

Copy link
Copy Markdown
Collaborator Author

Tests pass...
image

@kbwestfall kbwestfall added this to the v2.1.0 milestone Jun 12, 2026
Base automatically changed from kcwi_dec_2024_WCS to kcwi_dec_2024_rjc2 July 29, 2026 14:35
@kbwestfall
kbwestfall changed the base branch from kcwi_dec_2024_rjc2 to kcwi_dec_2024 July 29, 2026 14:39
@kbwestfall kbwestfall added the Spectrograph Specific Changes related to maintaining / improving the functionality of an existing PypeIt spectrograph label Jul 29, 2026

@kbwestfall kbwestfall left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very minor comments. The only actual change requested is related to a docstring. I'll make this change myself.

# required by the function but not used
gpm_stack, sigma_clip=self.par['clip'],
gpm_stack,
weights=None,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding weights to the function call isn't necessary, right? I assume this is mostly included just to make clear to a developer that the stack is unweighted?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's correct. I think it's a bit strange that we have a function called weighed_combine() where the weights are not currently being used, so just being explicit (and to make sure this remains supported the way it was originally intended in case the defaults change somewhere down the line.

= combine.weighted_combine([img_stack, scl_stack], # images to stack
[rn2img_stack, basev_stack], # variances to stack
gpm_stack, sigma_clip=self.par['clip'],
gpm_stack, weights=None, sigma_clip=self.par['clip'],

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above :-) Happy to remove these, if preferred.

Comment thread pypeit/coadd3d.py Outdated
# or one can use the single pixel computation (extended sources) in compute_weights.
# 6. Re-combined the cubes using these weights, again performing the final round of sigma clipping
# 7. Write out the individual cubes with their sigma clipped pixels masked (?)
# 8. Write out the final combined cube.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume this is still a "TODO"? I'd prefer we move the comments out of the docstring, or actually use docstring syntax.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Spectrograph Specific Changes related to maintaining / improving the functionality of an existing PypeIt spectrograph

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants