8000 Initial commits for geomstats module by ninamiolane · Pull Request #1 · geomstats/geomstats · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Initial commits for geomstats module #1

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

Merged
merged 13 commits into from
Jan 9, 2018
Merged

Initial commits for geomstats module #1

merged 13 commits into from
Jan 9, 2018

Conversation

ninamiolane
Copy link
Collaborator

No description provided.

@ninamiolane ninamiolane requested a review from johmathe November 1, 2017 00:19
Compute the group inverse in SE(3).

Formula:
TODO(nina).
Copy link
Collaborator

Choose a reason for hiding this comment

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

remove

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I added the formula :)

from the identity to transfo in the Lie group SE(3).

Formula:
TODO(nina).
Copy link
Collaborator

Choose a reason for hiding this comment

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

syntax: TODO(nina): add formula

return prod_transfo


def jacobian_translation(transfo, left_or_right='left'):
Copy link
Collaborator

Choose a reason for hiding this comment

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

what about direction instead of left_or_right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Left or Right is the actual mathematical term: it comes from the left- or right- translations associated to the group composition resp. by the left- or the right-.

Copy link
Collaborator

Choose a reason for hiding this comment

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

cool thanks for the clarification

jacobian[3:, 3:] = np.eye(3)

else:
raise ValueError('\'left_or_right\' needs \'left\' or \'right\'')
Copy link
Collaborator

Choose a reason for hiding this comment

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

you should probably do the argument checking at the beginning:

assert left_or_right in ('left', 'right')

return tangent_vector


# --- Riemannian
Copy link
Collaborator

Choose a reason for hiding this comment

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

comment is kinda useless. if you really want to make it clear that these are specific, maybe put this in a riemannian.py file? more of a nit though

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, actually when I told you that I wanted to factorize code this is because the code on riemannian is general across rotations and rigid transformations. So I will indeed create a separate file riemannian.py and I want to use OO code for lie groups to use the riemannian functions.

I'll only delete the comments for now.

Copy link
Collaborator

Choose a reason for hiding this comment

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

you can add a todo if you want

visualization.py Outdated
import rotations


class Arrow3D():
Copy link
Collaborator

Choose a reason for hiding this comment

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

awesome!!

visualization.py Outdated
from matplotlib import pyplot as plt
from mpl_toolkits.mplot3d import Axes3D

# import rigid_transformations
Copy link
Collaborator

Choose a reason for hiding this comment

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

leftover comment

visualization.py Outdated
@@ -0,0 +1,78 @@
"""Visualization for Geometric Statistics."""

# import pylab
Copy link
Collaborator

Choose a reason for hiding this comment

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

leftover comment

visualization.py Outdated
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
trihedron.draw(ax, **kwargs)
plt.show()
Copy link
Collaborator

Choose a reason for hiding this comment

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

you may also want to return a figure instead of showing here. And then ppl can use the figure how they see fit (like save it etc.)

visualization.py Outdated
return trihedron


def plot_trihedron(trihedron, **kwargs):
Copy link
Collaborator

Choose a reason for hiding this comment

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

kinda hate kwargs... At the very least say which function you're passing the kwards too. Something like

plot_trihedron(trihedron, **draw_kwargs)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You advice not to use them in general? Isn't it tedious to copy-paste all plotting parameters from fn to fn?

@@ -0,0 +1,78 @@
"""Unit tests for rigid_transformations module."""
Copy link
Collaborator

Choose a reason for hiding this comment

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

so the canonical syntax for tests is:

in the same directory, create a file that starts with the module that you want to test and suffix _test.py

this will work with self discovery for the unit test library

Copy link
Collaborator Author
@ninamiolane ninamiolane Nov 23, 2017

Choose a reason for hiding this comment

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

Actually, it does not work with self discovery but test_[module name].py works. I.e. prefix instead of suffix.


rot_vec_3 = 11 * np.pi * np.array([1., 2., 3.])
rot_vec_3 = rotations.regularize_rotation_vector(rot_vec_3)
fact = 0.84176874548664671 * np.pi / np.sqrt(14)
Copy link
Collaborator

Choose a reason for hiding this comment

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

where does this constant come from? can you be a bit more clear into the kind of things you're testing here?? Even though I usually hate comments, in unit tests it's fine.

all_transfos = [transfo_1, transfo_2, transfo_3, transfo_4]
i_debug = 1
for transfo in all_transfos:
print('at i=%d' % i_debug)
Copy link
Collaborator

Choose a reason for hiding this comment

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

so one tip for this test: here you rely on 2 things for the test to pass: your regularization function and your transformation function. I would recommend not relying on the regularization for testing your transformation - or this is not a unit test and it makes debugging harder.

@ninamiolane
Copy link
Collaborator Author

I wrote more and (hopefully) cleaner unit tests.

I kept the unit tests that use several functions, as I want to test not only the code, but also the maths.

@johmathe johmathe merged commit 9928c7e into empty Jan 9, 2018
@ninamiolane ninamiolane deleted the review branch January 9, 2018 09:32
ninamiolane pushed a commit that referenced this pull request Sep 6, 2019
alebrigant added a commit that referenced this pull request Jan 14, 2020
ninamiolane pushed a commit that referenced this pull request Jan 14, 2020
ninamiolane pushed a commit that referenced this pull request Jan 14, 2020
ninamiolane pushed a commit that referenced this pull request Jan 15, 2020
ninamiolane pushed a commit that referenced this pull request Jan 15, 2020
ninamiolane pushed a commit that referenced this pull request Jan 15, 2020
Update to version of jan 14 2020
ninamiolane pushed a commit that referenced this pull request Apr 30, 2021
ninamiolane added a commit that referenced this pull request Aug 19, 2021
Sync with upstream master
ninamiolane pushed a commit that referenced this pull request Sep 6, 2021
luisfpereira added a commit that referenced this pull request Nov 3, 2023
backend: Added "endpoint" support to linspace #1
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
0