Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add plane fitting to level_match_step.py #67

Merged
merged 1 commit into from
Jun 18, 2024

Conversation

thomaswilliamsastro
Copy link
Collaborator

This PR hugely extends the level_match capabilities to also allow for simple 2D planes as well as just a constant offset. This seems to be necessary in some cases, for reasons currently unclear.

The type of fitting can be specified at each stage via the new parameters:

  • fit_type_dithers = "level"
  • fit_type_recombine_lyot = "level+slope"
  • fit_type_mosaic_tiles = "level+slope"
    where the options are "level" (constant offset), and "level+slope" (plane)

When matching mosaic tiles, we need to define a reference image which we assume to be completely flat and edit other corrections relative to that. We either use the tile taken closest in time to the backgrounds (if they exist), or the one with maximal overlap between the tileset. As such, the lv2 step has been expanded slightly to include information on when the nearest background to the science observation was taken to make that easier

For now, this is a draft while we run through testing. Obvious test cases are NGC1792 and NGC253 where the level matching currently isn't great, but there may be others lurking

@thomaswilliamsastro
Copy link
Collaborator Author

Noticing some issues with NIRCam shorts. I'll poke into it

@thomaswilliamsastro
Copy link
Collaborator Author

@rchwn @low-sky Ready for testing and review! There's some changes in the level_match config for inspiration if you want to play around. I ran through the full NGC2566 stack which was catastrophically crashing last time and now works fine

- Also adds in metadata about background offset times at the lv2 stage

- Also adds in option to combine the NIRCam short chips before any mosaic level matching

- Fixes bugs

- Updates various package versions
"lmfit>=1.2.2",
"matplotlib>=3.8.2",
"numpy>=1.26.4",
"numpy>=1.26.4,<2",
Copy link
Contributor

Choose a reason for hiding this comment

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

uh oh.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

it might be fine to go higher, but it caused a crash on the RTD compile so I've limited it for now. Be good to review these versions soon, since JWST has just moved up to supporting numpy v2

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

wait no, I'm wrong, they're currently also pinned <2

@thomaswilliamsastro thomaswilliamsastro marked this pull request as ready for review June 18, 2024 15:52
@thomaswilliamsastro thomaswilliamsastro merged commit dc4b11f into main Jun 18, 2024
8 checks passed
@thomaswilliamsastro thomaswilliamsastro deleted the plane-fit-level-match branch June 18, 2024 15:52
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.

None yet

2 participants