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

Avoid duplicate code in downchunking #180

Merged
merged 8 commits into from
Apr 2, 2024
Merged

Avoid duplicate code in downchunking #180

merged 8 commits into from
Apr 2, 2024

Conversation

mhliu0001
Copy link
Contributor

In the previous code, the compute function for downchunking plugins (S2PhotonPropagationBase, PMTResponseAndDAQ) has some duplicate code. While I understand this is because the chunking start/end times are different, it can be avoided by defining a function compute_chunk, and calling it to calculate the data in each chunk.

This PR should not alter the behavior of fuse and should be purely cosmetic. If the simulation results change, please let me know.

@coveralls
Copy link

coveralls commented Mar 27, 2024

Pull Request Test Coverage Report for Build 8522125034

Details

  • 12 of 14 (85.71%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.6%) to 68.291%

Changes Missing Coverage Covered Lines Changed/Added Lines %
fuse/plugins/detector_physics/s2_photon_propagation.py 6 7 85.71%
fuse/plugins/pmt_and_daq/pmt_response_and_daq.py 6 7 85.71%
Totals Coverage Status
Change from base Build 8522077963: 0.6%
Covered Lines: 1822
Relevant Lines: 2668

💛 - Coveralls

@mhliu0001
Copy link
Contributor Author

mhliu0001 commented Mar 27, 2024

I don't understand why the 3.9 test passes while the 3.10 test timeout... Maybe it is because the test uses a random instruction, and the instructions have very high energy. Something is wrong with the new code. I will check.

I think the tests failed because of the slow database download. I tried reverting to the main branch and still got a timeout. We should try again later.

@mhliu0001 mhliu0001 marked this pull request as draft March 27, 2024 19:36
@mhliu0001 mhliu0001 marked this pull request as ready for review March 27, 2024 20:26
@HenningSE
Copy link
Collaborator

Thanks for opening this @mhliu0001, It make a lot of sense to clean up the code in these plugins! I will try to find time next week to check it!

@mhliu0001
Copy link
Contributor Author

Now the tests have passed.

Copy link
Collaborator

@HenningSE HenningSE left a comment

Choose a reason for hiding this comment

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

Looking good! I ran the code and the results did not change (as expected). The code in the compute method is also cleaner now. I will bump the plugin versions as we changed the compute method and then merge this PR.

@HenningSE HenningSE merged commit 8bfd416 into main Apr 2, 2024
4 checks passed
@HenningSE HenningSE deleted the chunking branch April 2, 2024 11: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.

3 participants