Code Monkey home page Code Monkey logo

Comments (10)

santisoler avatar santisoler commented on May 27, 2024

cc @domfournier

from simpeg.

domfournier avatar domfournier commented on May 27, 2024

Hmm ok clearly the sign flip is not good. The idea of this function is to always return the complementary angle, exactly for the reason you've mentioned (i.e. two angles that are close to each other but in different quadrants). Coterminal is called after computing the gradient (normalized difference) between the angle values. But yea, the negative is no good. We should fix it directly on #1299

from simpeg.

jcapriot avatar jcapriot commented on May 27, 2024

Nice little catch, Fortunately I don't think it was causing any issues in the way that we were using it, as we calculated co-terminal angles AFTER doing a difference (not before) so the sign flip wouldn't have mattered.

from simpeg.

domfournier avatar domfournier commented on May 27, 2024

But it actually does, just by visual inspection of the example/03-magnetic/plot_inv_mag_MVI_Sparse_TreeMesh

This is the XY slice through the model - where the coterminal manners: (ignore the title, this is the spherical result)

Old (with -)
old

New (without -)
new

Really seems to improve getting smooth direction.

from simpeg.

jcapriot avatar jcapriot commented on May 27, 2024

That improvement just seems odd to me...
for reference here are the three methods that we've been talking about:
image

from simpeg.

jcapriot avatar jcapriot commented on May 27, 2024

The "modulus" is the most correct way of doing this, the current method will over-do angle differences larger than $2\pi$, but that shouldn't happen with how the inversion will reset angles larger than that. The proposed method is incorrect for angles beyond $\pi$, and the negative for those values is not taken into account in the derivative.

from simpeg.

jcapriot avatar jcapriot commented on May 27, 2024

Also, scary behavior here is that the coterminal calculation actually modifies it's argument in-place.

from simpeg.

domfournier avatar domfournier commented on May 27, 2024

Agree on the modulus, although angle > pi would never happen in the inversion since we always reproject on [-pi, pi].

from simpeg.

jcapriot avatar jcapriot commented on May 27, 2024

The angles themselves are always projected onto the interval $[-\pi,\pi]$, but it’s certainly possible the difference of two angles would then be on the interval of $[-2\pi,2\pi]$

from simpeg.

domfournier avatar domfournier commented on May 27, 2024

True

from simpeg.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.