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

Feature: adding helper functions from SLAC #19

Merged
merged 71 commits into from
Dec 11, 2021

Conversation

jedyeo
Copy link
Collaborator

@jedyeo jedyeo commented Nov 23, 2021

@calhep @thisTyler @arjunsingh3600

This file contains some functions from the slac codebase that helps with the processing of particles. Tests won't cover this code yet but once we get the wrapper merged in (still cleaning that up) then we should be good.

Copy link
Contributor

@ninamiolane ninamiolane left a comment

Choose a reason for hiding this comment

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

Thank you for this PR! Great work!

High-level comments before I take another look:

  • We absolutely need good docstrings: these are primordial for other users (including code reviewers) to understand what you are doing -- without spending 1 hour on it. If a user needs to spend more than 20 minutes to understand 10 lines of code, they will leave and go to another package.
  • We also really need unit-tests. @jedyeo you said that you would put the tests once the wrapper is merged in, but we do not need the wrapper for the unit tests associated to this PR. Unit tests test one simple function at a time, they do not test the whole pipeline. We need test functions such as: test_mrc2data, test_data_and_dic_2_hdf5, etc, i.e. we need one test function per function implemented. This is why they are called "unit".
  • It is not good practice to put many functions in a file called "helper.py", because "helper.py" does not say much about what is inside. some companies forbid the use of filenames such as utils.py or helpers.py just because people put everything in them. Please divide the code into io.py (for changing formats and write/load data) and math.py (for operations on rotations) files at least.

Could you address these? Then I can have a look at the code itself. Thank you!

simSPI/helpers.py Outdated Show resolved Hide resolved
simSPI/helpers.py Outdated Show resolved Hide resolved
simSPI/helpers.py Outdated Show resolved Hide resolved
simSPI/crd.py Outdated Show resolved Hide resolved
simSPI/crd.py Outdated


def rotation_matrix_to_euler_angles(R):
"""Compute Euler angles given a rotation matrix.
Copy link
Contributor

Choose a reason for hiding this comment

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

do you know what representation is assumed? ZYZ, ZXZ, etc.

https://en.wikipedia.org/wiki/Euler_angles#Rotation_matrix

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

XYZ

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for your answer. This should go in the docstring.

simSPI/fov.py Outdated Show resolved Hide resolved
simSPI/fov.py Outdated Show resolved Hide resolved
simSPI/fov.py Outdated Show resolved Hide resolved
simSPI/fov.py Outdated
Relative path to file containing topological information of particle
"""
traj = md.load(filename)
atom_indices = traj.topology.select("name CA or name P")
Copy link
Contributor

Choose a reason for hiding this comment

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

can the user select all atoms, or are just the alpha carbons selected. Some tests that use the same atoms type (not realistic with real proteins) would be good to ensure what atoms are actually giving turned in to an image.

Copy link
Member

Choose a reason for hiding this comment

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

sorry did not notice this comment last time @geoffwoollard . I should not have hard-coded that in my notebooks in the past - this was only meant to deal with ribosomes in a reasonable amount of time. Ideally, you'd like the selection to be defined by the user - and by default all atoms should be selected.

simSPI/fov.py Outdated Show resolved Hide resolved
simSPI/fov.py Outdated Show resolved Hide resolved
simSPI/helpers.py Outdated Show resolved Hide resolved
simSPI/helpers.py Outdated Show resolved Hide resolved
Copy link
Contributor

@geoffwoollard geoffwoollard left a comment

Choose a reason for hiding this comment

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

You need to have tests for basically every function. That way the automatic tests tell you where exactly something is failing. And you can also tests multiple expected inputs (big, small, etc).

Have a look at the tests for some of the code base. Then get writing and his that 90% and get those green checks!

simSPI/crd.py Outdated Show resolved Hide resolved
Copy link
Member

@fredericpoitevin fredericpoitevin left a comment

Choose a reason for hiding this comment

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

I have added a few comments, but please first address Nina's concern about tests. Great work already everyone!!!

simSPI/crd.py Outdated Show resolved Hide resolved
simSPI/crd.py Outdated Show resolved Hide resolved
simSPI/fov.py Outdated Show resolved Hide resolved
simSPI/fov.py Outdated Show resolved Hide resolved
@jedyeo
Copy link
Collaborator Author

jedyeo commented Dec 11, 2021

@fredericpoitevin i changed the convention to ZYZ!

Copy link
Contributor

@geoffwoollard geoffwoollard left a comment

Choose a reason for hiding this comment

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

let's push this PR through and see how things come together with the unit tests with the other PRs compSPI/ioSPI#24 #32

If there are anymore issues that came up with future TODOs, I suggest you make issues of them so the ideas don't get lost track of

@arjunsingh3600 arjunsingh3600 merged commit 5e0792d into master Dec 11, 2021
@fredericpoitevin
Copy link
Member

@jedyeo I think you changed to "zyz" not "ZYZ", right?

@geoffwoollard looks like tests are not passing...

@arjunsingh3600
Copy link
Collaborator

@fredericpoitevin to address the failed tests, would it be better to revert the PR or to create a new PR addressing the tests?

@jedyeo
Copy link
Collaborator Author

jedyeo commented Dec 13, 2021

@fredericpoitevin to address the failed tests, would it be better to revert the PR or to create a new PR addressing the tests?

create new pr is best move imho, unless someone thinks otherwise

@fredericpoitevin
Copy link
Member

fredericpoitevin commented Dec 13, 2021

@jedyeo and @arjunsingh3600 @geoffwoollard I'm not sure I agree. Would have been preferable to fix things in this PR prior merging. Now the problem will spread to other branches being created before it is solved.

@arjunsingh3600
Copy link
Collaborator

@fredericpoitevin I've created a revert PR request here. This should remove the code from the main branch while I push the test fixes.

@fredericpoitevin
Copy link
Member

Thanks @arjunsingh3600 great initiative!
Right now I am going to merge this "new" revert PR #39
Then you can open a new PR that would essentially replicate what this "old" buggy PR #19 was; and we can work on addressing the problems from there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

7 participants