Skip to content

Add a class that implements Euler Inversion for source location#660

Open
leouieda wants to merge 14 commits intomainfrom
euler-inversion
Open

Add a class that implements Euler Inversion for source location#660
leouieda wants to merge 14 commits intomainfrom
euler-inversion

Conversation

@leouieda
Copy link
Copy Markdown
Member

@leouieda leouieda commented Apr 2, 2026

The EulerInversion class implements the method, which is much less sensitive to noise in the data and interfering sources. It can estimate the integer structural index as well, though a known value can also be given. The class only implements fitting data in a single window (moving window approaches will come later). The initial estimate for the non-linear process is the Euler Deconvolution result.

@leouieda
Copy link
Copy Markdown
Member Author

leouieda commented Apr 2, 2026

TODO:

  • Finish docstrings

@leouieda
Copy link
Copy Markdown
Member Author

leouieda commented Apr 2, 2026

The coverage is not 100% because the test for Euler Inversion is too easy and the initial solution is already too close to the truth so the main loop doesn't execute. Gonna need a different test that the deconvolution fails.

@leouieda leouieda marked this pull request as draft April 2, 2026 18:25
@leouieda leouieda marked this pull request as ready for review April 6, 2026 22:26
@leouieda leouieda requested review from mdtanker and santisoler April 6, 2026 22:26
@leouieda
Copy link
Copy Markdown
Member Author

leouieda commented Apr 6, 2026

@santisoler @mdtanker finished this implementation. It's still for a single window but it's the building blocks for windowed version to come later on. Any thoughts?

Copy link
Copy Markdown
Member

@santisoler santisoler left a comment

Choose a reason for hiding this comment

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

It looks great, @leouieda! I just left a few minor suggestions to the docs.

Since we have this admonition that tell users that a structural_index of zero is not yet supported, shouldn't we raise an error if the user passes such value to the EulerDeconvolution and the EulerInversion? Also, wouldn't it make sense to also check if it's an integer between 1 and 3? Or do we prefer to leave the possibility to pass greater integers or even floats to it?

@leouieda leouieda added this to the v0.8.0 milestone Apr 8, 2026
Co-authored-by: Santiago Soler <santisoler@fastmail.com>
@leouieda
Copy link
Copy Markdown
Member Author

leouieda commented Apr 9, 2026

shouldn't we raise an error if the user passes such value to the EulerDeconvolution and the EulerInversion?

We should. Good check! Otherwise the error is gonna come from a singular matrix in the inverse calculation which is not obvious.

Also, wouldn't it make sense to also check if it's an integer between 1 and 3?

Not really since it's fine if it's a float like 1.0. It's not gonna cause an error for people to pass fractional values like 1.5 but it's just not physically meaningful. The range of 1-3 is also not fixed and can vary depending on the potential field used. Magnetic gradients for example will probably correspond to SI=4 for dipoles (didn't check the math but I think that's what it would come out to).

I made some changes to allow users to pass in the sequence of values we test instead of hard coding that.

@leouieda
Copy link
Copy Markdown
Member Author

leouieda commented Apr 9, 2026

@santisoler done!

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.

2 participants