Git Product home page Git Product logo

Comments (7)

pariterre avatar pariterre commented on June 6, 2024

This is not supposed to work :

def test_rt_mean(rt, seq="xyz"):
    rt_mean = Rototrans.from_averaged_rototrans(rt)

    angles_mean = Angles.from_rototrans(rt_mean, seq).isel(time=0)
    angles_mean_ref = Angles.from_rototrans(rt, seq).mean(dim="time")

    np.testing.assert_array_almost_equal(angles_mean, angles_mean_ref, decimal=2)

If it was that easy to mean a matrix, we would not need to have a proper function.
The reason the first one works, is by chance (probably that using random directly from Euler creates matrices that are near from each other).

The intended behavior is that meaning the angles is not equal to meaning the matrices

from pyomeca.

pariterre avatar pariterre commented on June 6, 2024

And the reason they behave differently, which seems surprising at first, is that

angles = Angles(np.random.rand(*size))

does not produce the same as this:

Angles.from_random_data(distribution, size=(3, 1, size[-1]), **kwargs)

which is in the from_random_data from Rototrans

from pyomeca.

romainmartinez avatar romainmartinez commented on June 6, 2024

This is not supposed to work.

I made the implementation based on this test. What is the difference here?

from pyomeca.

romainmartinez avatar romainmartinez commented on June 6, 2024

And the reason they behave differently, which seems surprising at first, is that
does not produce the same as this:

Yes, I am aware of that, but in the end it's just random angles and it should work both ways?

from pyomeca.

pariterre avatar pariterre commented on June 6, 2024

As I said, meaning Euler angles will get wronger as angles grow.

angles = Angles(np.random.rand(*size))
np.min(angles, axis=2)
np.max(angles, axis=2)

will return values between 0-1 while the random constructor of Rototrans:

angles = Angles.from_random_data(distribution, size=(3, 1, size[-1]))
np.min(angles, axis=2)
np.max(angles, axis=2)

will return values apparently ranging from -20 to 20 (from a quick simulation I made printing the values).

from pyomeca.

romainmartinez avatar romainmartinez commented on June 6, 2024

Ah ok gotcha @pariterre!
The cumsum in the from_random_data increases the angles too much.

So, as I understand it, our implementation may be good but not the test?

from pyomeca.

pariterre avatar pariterre commented on June 6, 2024

That is correct. I don't think there is error in the implementation, but the test won't work as is... A test with know values would do the trick or to use the first implementation (with much smaller angles)

from pyomeca.

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.