Skip to content
This repository has been archived by the owner on Dec 22, 2021. It is now read-only.

Fixed wrong ring_width calculation in Radial Average #412

Merged
merged 2 commits into from
Nov 22, 2017

Conversation

santisoler
Copy link
Member

The previous code computed the ring_width assuming that the elements of the kx and ky 2d arrays where ordered in a special way: the ky vary first.

This is not always true, mainly due to how we define the x, y arrays that we use to compute the kx and ky.

Now the code works independently how those arrays are ordered.

Checklist:

  • Make tests for new code (at least 80% coverage)
  • Create/update docstrings
  • Include relevant equations and citations in docstrings
  • Docstrings follow the style conventions
  • Code follows PEP8 style conventions
  • Code and docs have been spellchecked
  • Include new dependencies in doc/install.rst, environment.yml, ci/requirements.txt.
  • Documentation builds properly (run cd doc; make locally)
  • Changelog entry (leave for last to avoid conflicts)
  • First-time contributor? Add yourself to doc/contributors.rst (leave for last to avoid conflicts)

It depended on the order of the elements of the kx and ky 2d arrays.
@@ -591,7 +591,8 @@ def radial_average_spectrum(kx, ky, pds, max_radius=None, ring_width=None):
if max_radius is None:
max_radius = min(kx.max(), ky.max())
if ring_width is None:
ring_width = max(kx[1, 0], ky[0, 1])
ring_width = max(numpy.unique(kx)[numpy.unique(kx) > 0][0],
numpy.unique(ky)[numpy.unique(ky) > 0][0])
Copy link
Member

Choose a reason for hiding this comment

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

@santis19 thanks for the fix! I just noticed that the docstring is wrong. It describes data and shape when the function receives pds. Would you mind fixing this as well? Let me know and I'll merge the PR.

Copy link
Member Author

Choose a reason for hiding this comment

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

@leouieda, thanks for noticing it, it seems that I was more aware of the code than the documentation.
Now it's fixed. If you like how the new documentation is written, merge it!

@leouieda leouieda merged commit 95d0405 into fatiando:master Nov 22, 2017
@leouieda
Copy link
Member

Merged. Thanks!

@santisoler santisoler deleted the radial-average branch November 23, 2017 12:53
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants