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

Forward modelling for point masses in Cartesian coordiantes #71

Merged
merged 24 commits into from
Jul 24, 2019

Conversation

santisoler
Copy link
Member

Extend point_mass_gravity() to compute gravitational fields of point masses in Cartesian
coordinates. Add needed Numba jitted kernel functions in Cartesian coordinates. Add
coordinate_system argument to point_mass_gravity(). Add tests for the extended feature.

Fixes #48

Reminders

  • Run make format and make check to make sure the code follows the style guide.
  • Add tests for new features or tests that would have caught the bug that you're fixing.
  • Add new public functions/methods/classes to doc/api/index.rst.
  • Write detailed docstrings for all functions/methods.
  • If adding new functionality, add an example to the docstring, gallery, and/or tutorials.

Add kernel functions for computing gravitational fields of point masses
in Cartesian coordinates.
Add coordinate_system argument to point_mass_gravity().
Add tests for the extended feature.
@santisoler
Copy link
Member Author

@leouieda Could you take a quick look at this. Specially to the design of the extended point_mass_gravity() function. I'm not quite sure about the dictionaries I defined, so I wanted to have a second opinion.

I added some functions to compute distances in Cartesian coordinates inside forward/point_mass.py. I intend to move them as proposed in #69.

If you can't find time to review it, let me know. I think the main issues that can live here are related with design, so maybe I could merge it and we can discuss it afterwards when you have time.

@santisoler santisoler requested a review from leouieda July 17, 2019 18:15
@leouieda
Copy link
Member

Looks good! It would be good to have a gallery example as well to visually verify that the results are correct. Maybe one with 2 masses at different depths with opposite densities?

@santisoler
Copy link
Member Author

Thanks for the quick review @leouieda. I've added a simple example as you proposed. If you like it, feel free to merge this.

Copy link
Member

@leouieda leouieda left a comment

Choose a reason for hiding this comment

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

@santisoler really good! I like this new API. I made a few suggestions for the recipe.

examples/forward/point_mass.py Outdated Show resolved Hide resolved
examples/forward/point_mass.py Show resolved Hide resolved
examples/forward/point_mass.py Outdated Show resolved Hide resolved
examples/forward/point_mass.py Outdated Show resolved Hide resolved
examples/forward/point_mass.py Outdated Show resolved Hide resolved
examples/forward/point_mass.py Outdated Show resolved Hide resolved
def point_mass_gravity(coordinates, points, masses, field, dtype="float64"):
def point_mass_gravity(
coordinates, points, masses, field, coordinate_system="cartesian", dtype="float64"
):
"""
Compute gravitational fields of a point mass on spherical coordinates.
Copy link
Member

Choose a reason for hiding this comment

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

It would be good to elaborate a bit more on the docstring (citation, definitions, equations [?]).

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, absolutely! I tend to forget to do it because I know where I'm getting the equations from, but I really appreciate finding math on the docstrings when I try to use a new library or function.

Copy link
Member Author

Choose a reason for hiding this comment

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

I added some math and references. I think we must make clearer that the third coordinate in Cartesian system is pointing downwards.

Copy link
Member Author

Choose a reason for hiding this comment

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

The warning mentioned above should be enough for making it very clear.

@santisoler
Copy link
Member Author

@leouieda Would you mind taking a final look at this? If you agree with the new variable name and don't have any other suggestion, I think this is ready to be merged.

@leouieda
Copy link
Member

@santisoler this is great! I love that docstring! Made a few corrections to the text but once these are done feel free to merge!

@santisoler
Copy link
Member Author

Thanks for the review @leouieda! I like how it looks, so I'll merge it right away!

@santisoler santisoler merged commit 16c58fe into master Jul 24, 2019
@santisoler santisoler deleted the point-mass-cartesian branch July 24, 2019 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Point masses gravity computation on Cartesian coordinates
2 participants