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

Bugfix in grid spacing #400

Merged
merged 4 commits into from
Feb 28, 2024
Merged

Conversation

fsenf
Copy link
Member

@fsenf fsenf commented Jan 23, 2024

Description

I found a bug in the get_spacing functionality and fixed it.

Problem: If x is storing in ascending and y in descending order (and vice versa), than the grid spacing increment subtract eachother - which is not wanted.

Solution: used the absolute value

Extension:

  • also added a new keyword average_type to allow to switch between averaging strategies
  • implemented geometric mean which more appropriate in my view

Checklist

  • 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?

Cheers, Fabian.

PS: should be very easy to review and merge back

@fsenf fsenf added bug Code that is failing or producing the wrong result enhancement Addition of new features, or improved functionality of existing features labels Jan 23, 2024
@fsenf fsenf added this to the Version 1.5.3 milestone Jan 23, 2024
Copy link

github-actions bot commented Jan 23, 2024

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 Jan 23, 2024

Codecov Report

Attention: Patch coverage is 62.50000% with 3 lines in your changes are missing coverage. Please review.

Project coverage is 56.88%. Comparing base (2e4c9d0) to head (dac29e8).
Report is 9 commits behind head on RC_v1.5.x.

Files Patch % Lines
tobac/utils/general.py 62.50% 3 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##           RC_v1.5.x     #400      +/-   ##
=============================================
- Coverage      56.91%   56.88%   -0.04%     
=============================================
  Files             20       20              
  Lines           3440     3444       +4     
=============================================
+ Hits            1958     1959       +1     
- Misses          1482     1485       +3     
Flag Coverage Δ
unittests 56.88% <62.50%> (-0.04%) ⬇️

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.

Copy link
Member

@w-k-jones w-k-jones 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 catching this @fsenf ! I fixed another bug where the y coordinate was being used for both x and y differences, and change the keyword average_type to average_method to be more in line with other keywords for specifying what approach to use

@fsenf
Copy link
Member Author

fsenf commented Feb 28, 2024

@JuliaKukulies : I selected you as 2nd reviewer. Is this fine for you?

tobac/utils/general.py Outdated Show resolved Hide resolved
tobac/utils/general.py Show resolved Hide resolved
@JuliaKukulies
Copy link
Member

@JuliaKukulies : I selected you as 2nd reviewer. Is this fine for you?

Looks good to me, @fsenf! I have a minor question/suggestion, but tested the code and am fine to merge this PR right away as well! Thanks for fixing this!

@fsenf fsenf merged commit d1f181b into tobac-project:RC_v1.5.x Feb 28, 2024
21 checks passed
@fsenf fsenf deleted the bugfix-in-grid-spacing branch February 28, 2024 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Code that is failing or producing the wrong result enhancement Addition of new features, or improved functionality of existing features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants