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

Refactor of PBC distance functions #386

Merged
merged 8 commits into from
Jun 4, 2024

Conversation

w-k-jones
Copy link
Member

@w-k-jones w-k-jones commented Dec 7, 2023

Following on from #384 , I've carried out a more substantial refactoring of the PBC distance calculation functions. This includes improved validation of PBC keyword parameters, and optimisation of the calc_distance_coords_pbc to reduce the amount of work performed each time it is called. build_distance_function should now be the uniform way to create a PBC dist func across all routines

Change in performance of tracking with PBCs (for a 24x1200x3600 dataset):

No PBCs: 4.41 s ± 445 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
Pre-refactor: 52 s ± 4.26 s per loop (mean ± std. dev. of 7 runs, 1 loop each)
Post-refactor: 23.7 s ± 570 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
  • Have you followed our guidelines in CONTRIBUTING.md?
  • Have you self-reviewed your code and corrected any misspellings?
  • Have you written documentation that is easy to understand?
  • Have you written descriptive commit messages?
  • Have you added NumPy docstrings for newly added functions?
  • Have you formatted your code using black?
  • If you have introduced a new functionality, have you added adequate unit tests?
  • Have all tests passed in your local clone?
  • If you have introduced a new functionality, have you added an example notebook?
  • Have you kept your pull request small and limited so that it is easy to review?
  • Have the newest changes from this branch been merged?

@w-k-jones w-k-jones added the Refactor Code that doesn't intend to change the functionality, but instead refactor/clean up. label Dec 7, 2023
@w-k-jones w-k-jones self-assigned this Dec 7, 2023
@w-k-jones w-k-jones added this to the Version 1.5.3 milestone Dec 7, 2023
Copy link

github-actions bot commented Dec 7, 2023

Linting results by Pylint:

Your code has been rated at 8.72/10 (previous run: 8.72/10, +0.00)
The linting score is an indicator that reflects how well your code version follows Pylint’s coding standards and quality metrics with respect to the RC_v1.5.x branch.
A decrease usually indicates your new code does not fully meet style guidelines or has potential errors.

Copy link

codecov bot commented Dec 7, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 57.21%. Comparing base (08f84b2) to head (319d7a3).
Report is 214 commits behind head on RC_v1.5.x.

Additional details and impacted files
@@              Coverage Diff              @@
##           RC_v1.5.x     #386      +/-   ##
=============================================
+ Coverage      56.91%   57.21%   +0.29%     
=============================================
  Files             20       20              
  Lines           3440     3459      +19     
=============================================
+ Hits            1958     1979      +21     
+ Misses          1482     1480       -2     
Flag Coverage Δ
unittests 57.21% <100.00%> (+0.29%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@freemansw1 freemansw1 self-requested a review January 17, 2024 19:49
Copy link
Member

@freemansw1 freemansw1 left a comment

Choose a reason for hiding this comment

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

Thanks for doing this refactor, @w-k-jones. Looks good to me.

Copy link
Collaborator

@harrietgilmour harrietgilmour left a comment

Choose a reason for hiding this comment

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

This all looks good - thanks @w-k-jones! Should be ready to merge now

@w-k-jones w-k-jones merged commit 8e7557c into tobac-project:RC_v1.5.x Jun 4, 2024
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Refactor Code that doesn't intend to change the functionality, but instead refactor/clean up.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants