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

Photon counting #277

Merged
merged 33 commits into from
Feb 14, 2025
Merged

Photon counting #277

merged 33 commits into from
Feb 14, 2025

Conversation

kjl0025
Copy link
Contributor

@kjl0025 kjl0025 commented Dec 26, 2024

Describe your changes

Added a step function for photon counting frames. Also addressed some other minor issues. (This is the same as the PR I had into the main branch.)

Type of change

Please delete options that are not relevant (and this line).

  • New feature (non-breaking change which adds functionality)

Reference any relevant issues (don't forget the #)

#2 , #200 , #244

Checklist before requesting a review

  • I have linted my code
  • I have verified that all unit tests pass in a clean environment and added new unit tests, as needed
  • I have verified that all docstrings are properly formatted and added new documentation, as needed

@maxwellmb maxwellmb removed their request for review January 8, 2025 17:21
@semaphoreP
Copy link
Contributor

@kjl0025 can you finish filling out the DRP Test Definition row with your test description. It'll actually be helpful for my review to be able to read through the tests at a high level. (Rather than waiting to fill it out after PR review).

maxwellmb and others added 2 commits January 8, 2025 11:09
@kjl0025
Copy link
Contributor Author

kjl0025 commented Jan 9, 2025

Sure, just finished doing that.

Copy link
Contributor

@semaphoreP semaphoreP left a comment

Choose a reason for hiding this comment

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

Hi Kevin, thanks for putting this together. I put some comments throughout.

Some of the other e2e tests (e.g., test_astrom) are failing. I think it's because of the changes to Kgain requiring RN and RN_ERR. Can you fix them? One possibility while fixing them is editing the creation of Kgain so that RN and RN_ERR are things that get defined in it's __init__() function (so it's never missing, or it throws are error then). Given RN and RN_ERR are now required, it seems like good practice to force the definition of them there.

Happy to discuss other comments (I think some other moderate sized comments are to add some explicit flag to toggle between PC dark creation and PC dark subtraction in the step function, and to make sure your PC recipe goes all the way to the end of L2b processing).

@kjl0025
Copy link
Contributor Author

kjl0025 commented Jan 23, 2025

Alright, I think I've addressed all your comments. Should be good to go.

Copy link
Contributor

@semaphoreP semaphoreP left a comment

Choose a reason for hiding this comment

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

Hi Kevin, two small comments remaining (weird that only one got attached to this comment.. there's another one above). I also need to run the e2e tests myself to make sure they run now, but I will assume you fixed those issues.

Copy link
Contributor

@semaphoreP semaphoreP left a comment

Choose a reason for hiding this comment

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

Just ran the e2e tests and the input argument naming needs to be fixed in order for the batch pytest framework to run the e2e tests.

Can you also fix the conflict with mock?

@kjl0025
Copy link
Contributor Author

kjl0025 commented Feb 10, 2025

Should be good to go now.

@kjl0025
Copy link
Contributor Author

kjl0025 commented Feb 10, 2025

Oops, not yet. Fixing

Kevin Ludwick added 3 commits February 10, 2025 11:35
'ISPC' is not currently in any files; it will be added, though
With the addition of simulation of smearing, the tolerance needed to be increased slightly
Copy link
Contributor

@semaphoreP semaphoreP left a comment

Choose a reason for hiding this comment

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

Hi Kevin, just a few small changes in the code, to conform to some python best practices and hopefully avoid bugs in future development.

Additionally, it seems like header keywords for CMDGAIN and KGAIN have changed. Can you make a new issue to track that we should update these header keywords? I would strongly advocate not doing it in this PR so we can wrap up the last few things and merge!

elif image.pri_hdr['VISTYPE'] == "PUPILIMG":
recipe_filename = ["l1_to_l2a_nonlin.json", "l1_to_kgain.json"]
else:
recipe_filename = "l1_to_l2b.json"
if 'ISPC' in image.ext_hdr:
Copy link
Contributor

Choose a reason for hiding this comment

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

can this be an elif before the else above? I'd like to keep the logic clean (and easier to debug) using else statements whenever possible.

Copy link
Contributor

@semaphoreP semaphoreP left a comment

Choose a reason for hiding this comment

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

Sorry to keep dragging this out, but I want to make sure our logic on the walker has no gaps, to avoid bugs in the future.

recipe_filename = "l1_to_l2b_pc_dark.json"
elif len(unique_vals) > 1: # darks for noisemap creation
recipe_filename = "l1_to_l2a_noisemap.json"
elif len(unique_vals) == 1: # traditional darks
Copy link
Contributor

Choose a reason for hiding this comment

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

We shouldn't end on an if. We should turn this into an else or have an else below that raises an Exception.

Same for the 3 other places you have this structure.

Kevin Ludwick added 2 commits February 14, 2025 10:16
also set the number of frames in photon_count_e2e.py back to what it should be.  (I set the number of frames to 2 for quick testing.)
Copy link
Contributor

@semaphoreP semaphoreP left a comment

Choose a reason for hiding this comment

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

Looks good!

@semaphoreP semaphoreP merged commit 07f4f4d into develop Feb 14, 2025
1 check passed
@semaphoreP semaphoreP deleted the photon_counting branch February 14, 2025 21:56
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.

3 participants