-
Notifications
You must be signed in to change notification settings - Fork 69
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
Add variable density tesseroids #269
Conversation
Refactor tesseroid code by moving some functions to a new _tesseroid_utils.py file. Create a new _tesseroid_variable_density.py file with density-based discretization functions and with a gauss_legendre_quadrature function that works with variable density. Add new forward modelling functions for variable density tesseroids only. Add new example that makes use of variable density tesseroids.
The density function should be njit decorated by the user before passing it into `tesseroid_gravity`.
I'm adding this comment in order to leave a record of experiences during this implementation. Using the
|
@leouieda I think this is a good start. As always with tesseroids, I'm sure we will encounter some bugs or things to improve in the future. Let me know what do you think about the current status of this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@santisoler this looks really good! The tesseroid code is quite complex but there is no good way around it I guess. The only thing I noticed is the missing introductory text in the gallery example. That could be added in another PR as well to get this merged sooner.
Replace jit for njit decorator on example.
Thanks for the review @leouieda! I've added the introductory text and also changed the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! It's awesome to finally have this in here 🙂
Add an implementation of the density-based discretization algorithm. Duplicate
the
jit_tesseroid_gravity
and thegauss_legendre_quadrature
functions totake a callable
density
argument. Reorganize the old and new tesseroid code,moving some functions to private files. The dispatcher function chooses which
algorithm to use: constant density or variable density, serial or parallel. The
density-based discretization algorithm was modified to use the
scipy.optimize.minimize_scalar
function to compute minimum and maximumdensity values for normalization, and for computing the maximum absolute
difference. The
density
argument should be a function decorated withnumba.njit
: we set this requirement to improve performance of the method. Addexample and test functions for the new feature. Add
scipy
as a dependency forHarmonica.
Fixes #82
TODO:
Reminders:
make format
andmake check
to make sure the code follows the style guide.doc/api/index.rst
and the base__init__.py
file for the package.AUTHORS.md
file (if you haven't already) in case you'd like to be listed as an author on the Zenodo archive of the next release.