tobac icon indicating copy to clipboard operation
tobac copied to clipboard

Refactor of PBC distance functions

Open w-k-jones opened this issue 1 year ago • 2 comments

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)
  • [x] Have you followed our guidelines in CONTRIBUTING.md?
  • [x] Have you self-reviewed your code and corrected any misspellings?
  • [x] Have you written documentation that is easy to understand?
  • [x] Have you written descriptive commit messages?
  • [x] Have you added NumPy docstrings for newly added functions?
  • [x] Have you formatted your code using black?
  • [x] If you have introduced a new functionality, have you added adequate unit tests?
  • [x] Have all tests passed in your local clone?
  • [x] If you have introduced a new functionality, have you added an example notebook?
  • [x] Have you kept your pull request small and limited so that it is easy to review?
  • [x] Have the newest changes from this branch been merged?

w-k-jones avatar Dec 07 '23 16:12 w-k-jones

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.

github-actions[bot] avatar Dec 07 '23 16:12 github-actions[bot]

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

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%) :arrow_up:

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

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Dec 07 '23 16:12 codecov[bot]