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 a minimalistic implementation of Euler Deconvolution #268
Comments
Hi @dragger21! Thanks for opening this issue! Adding an Euler deconvolution implementation is in our future plans for Harmonica. |
Well, to start it would be great to have a minimalistic implementation: only the inversion solution, no moving windows and all that. This should be less work to code and can then be used as a basis for more elaborate methods. @dragger21 would be interested in implementing this? We're always happy to have more people involved in development 🙂 |
To @leouieda and @santisoler, I'm sorry for the late reply. I think that is very interesting to minimise implementation! I actually very interested to implement this in your code. I feel very happy to be involved in the development. |
@dragger21 no worries, we're all busy and can relate to taking a while to respond 🙂 We'd be glad to have you involved in the development 🎉 The moving window strategy is a way to try to deal with multiple sources (in my opinion, it kind of fails to do so but that is for another discussion). But it's not intrinsic to the method and really not required if you have already isolated the target anomaly. If there is 1 anomaly in your data, it's actually worse if you do a moving window because the solutions for most windows are completely meaningless (as Alan Reid himself pointed out in several papers). From a coding perspective, this is what I had in mind:
So to get started, I would recommend implementing step 1 only. We can later add windows etc on top of this. It helps to break down the coding work into smaller tasks like this because:
|
What I had in mind for the class EulerDeconv:
"""
...
"""
def __init__(self, structural_index):
self.structural_index = structural_index
# The estimated parameters. Start them with None
self.location_ = None
self.base_level_ = None
def fit(self, coordinates, data):
# This function runs the inversion on the input data
# data = (field, east_deriv, north_deriv, up_deriv)
self.location_ = the estimated location
self.base_level_ = the estimated base level This class runs the inversion and stores the estimated source position and base level. It would be used like this: # Load some data. I'm assuming that they've been projected already.
data = pandas.read_csv("some-data-file.csv")
# Calculate derivatives with equivalent sources
eqs = hm.EquivalentSources(depth=..., damping=...)
eqs.fit((data.easting, data.northing, data.height), data.total_field_anomaly)
delta = 1 # finite difference step in meters
data["east_deriv"] = (
eqs.predict((data.easting + delta, data.northing, data.height))
- eqs.predict((data.easting - delta, data.northing, data.height))
) / 2 * delta
data["north_deriv"] = (
eqs.predict((data.easting, data.northing + delta, data.height))
- eqs.predict((data.easting, data.northing - delta, data.height))
) / 2 * delta
data["up_deriv"] = (
eqs.predict((data.easting, data.northing, data.height + delta))
- eqs.predict((data.easting, data.northing, data.height))
) / delta
# Run Euler deconvolution. Let's say the data is a dipole anomaly of an intrusion.
euler = hm.EulerDeconv(structural_index=3)
euler.fit(
coordinates=(data.easting, data.northing, data.height),
data=(data.total_field_anomaly, data.east_deriv, data.north_deriv, data.up_deriv),
)
print(euler.location_)
print(euler.base_level_) |
I apologize again for the long reply. Thanks for the insight, Leo & Santiago. I'm trying to seek and simplify the code as soon as possible. I'll notify you later. |
@dragger21 no rush! Please reach out if you need any help |
Has there been any progress made on adding Euler Deconvolution to Harmonica yet? I'm interested in using it to run this example, but since I have Python 3.10, I'm out of luck at the moment: https://legacy.fatiando.org/gallery/gravmag/euler_moving_window.html |
bump, any progress on this? |
Greetings from Indonesia.
Bringing the Euler Deconvolution back like in previous version (Python 2.7) should be interesting. It can predict/detect the depth of source anomaly in potential field (like gravity and magnetic).
The text was updated successfully, but these errors were encountered: