Skip to content
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

Procrustes basics #4

Merged
merged 58 commits into from
Dec 24, 2018
Merged

Procrustes basics #4

merged 58 commits into from
Dec 24, 2018

Conversation

vaipatel
Copy link
Owner

Implemented bare minimum procrustes alignment code, with some tests and doc.

1. Stop ignoring our procrustes code in .gitignore.
2. Use GitHub Flow, not GitFlow, to kick things off, contrary to my comment in .gitignore.
3. Intro code to perform basic procrustes operations like
3.i. calculate the centroid, centroid size
3.ii. re(m)position, re(m)scale
3.iii. optimally rotate a lmk set to another
3.iv. perform opa to optimally move, scale and rotate one lmk set wrt another
Turns out prepending morphops before the module name was not necessary. See [Adding Additional Files](https://python-packaging.readthedocs.io/en/latest/minimal.html#adding-additional-files) on [python-packaging](https://python-packaging.readthedocs.io). Good to read docs.
Check position and scale related operations to kick things off.
Here by "procrustes algo" I mean somewhat complex operations on two or more input lmksets. So rotate, opa, gpa.

I'm using a helper, not sure if this will play well with packaging. Felt needed because dimensions of private vars were getting screwed up at test time.
I thought this the target centroid for some odd reason. It is (rather plainly) the difference between the centroids of the target and the scaled+rotated/reflected source.
I imagine I'll be needing little things like transposing all matrices in a 3d tensor all over the place. Not sure if this is the best way to refactor this code, but probably good enough for now.
…x check in transpose

Getting confused here, but I think it's good to name the file lmk_util since we're writing math that assumes the data is a set of landmarks (typically with 2 or 3 coords).
…ric.

This will avoid warnings about sorting complex numbers because occasionally the general eigendecomp produces complex valued entities, even if the imaginary parts are always 0.
This shouldn't matter because we are just uniformly scaling everything by -1 which has abs value 1. That is, this should not make a difference to the ssq or anything else.
…st iteration.

I'm thinking that if it did go up, we would want to continue the rotation+scaling a little longer.
I throw a warning to the user if they've specified do_project alongside do_scaling. The 1999 paper assumes that all shapes are of unit size,
which makes sense if they are to be on a unit sphere. The reference X_c is actually not assumed to be of unit size, although a note suggests
that it is almost always the case.
Make sure to escape because the match performed by pytest raises is a regex match.
See pytest-dev/pytest#3855 (comment)
For eg, without the excepn, if we pass a 1-D tensor like a list to num lmks, it will just calculate X.shape[-1] and give back the length of the list.
Had to write a custom exception class to raise from inside read funcs. Not sure if I'm doing it correct tho.
Taking care to satisfy numpy docstring needs.
Intermittent committing to save work.
Committing to save work.
Including __init__.py
…buid

I'm following this article on sphinx -
https://wwoods.github.io/2016/06/09/easy-sphinx-documentation-without-the-boilerplate/

I still can't get a list of functions in the sidebar but this might be okay to get started.
This is probably not the best way to declare the version.
Might be better to put it in a MANIFEST.in and reference it from both setup.py and the code.
… contents

Have no evidence that using a helper like that is best_practice, but it's what I could think of
to not have to repeat version extracting code.
@vaipatel vaipatel merged commit a4a182a into master Dec 24, 2018
@vaipatel vaipatel deleted the procrustes_basics branch December 27, 2018 22:55
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.

1 participant