-
Notifications
You must be signed in to change notification settings - Fork 749
[Review Needed]Pytest Style TestEncore #1609
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
Conversation
|
@kain88-de @jbarnoud @richardjgowers Review please. |
| min_bound = 1E5 | ||
| self.assertGreater(result_value, min_bound, | ||
| msg="Unexpected value for Harmonic Ensemble Similarity: {0:f}. Expected {1:f}.".format(result_value, min_bound)) | ||
| assert result_value >= min_bound, "Unexpected value for Harmonic " \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is equivalent with self.assertGreaterEqual and not a pure greater cheak
| upper_bound = 0.6 | ||
| self.assertLess(result_value, upper_bound, | ||
| msg="Unexpected value for Dim. reduction Ensemble Similarity: {0:f}. Expected {1:f}.".format(result_value, upper_bound)) | ||
| assert result_value <= upper_bound, "Unexpected value for Dim. " \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not a self.assertLess remove the equal sign.
| np.copy(cls.ens2_template.trajectory.timeseries(format='fac')[::5, :, :]), | ||
| assert average <= average_upper_bound, "Unexpected average value for " \ | ||
| "bootstrapped samples in Dim. reduction Ensemble similarity" | ||
| assert stdev <= stdev_upper_bound, "Unexpected standard deviation for" \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see comment above for both asserts
| distances += YY | ||
| np.maximum(distances, 0, out=distances) | ||
| distances.flat[::distances.shape[0] + 1] = 0.0 | ||
| dimension = len(distances) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these should be in a fixture since arrays are not necessarily constant.
| template = mda.Universe( | ||
| template.filename, | ||
| np.copy(template.trajectory.timeseries(format='fac')[::5, :, :]), | ||
| format=mda.coordinates.memory.MemoryReader) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think transfer_to_memory has a step argument now that you can use instead of this trick.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you still not use the step argument of transfer_to_memory here?
| distances += XX | ||
| distances += YY | ||
| np.maximum(distances, 0, out=distances) | ||
| distances.flat[::distances.shape[0] + 1] = 0.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all this setup code should be in a fixture for distance_matrix. It's he only one that uses this. I also don't see the use for the fixture of dimensions
|
@kain88-de I've used |
| template = mda.Universe( | ||
| template.filename, | ||
| np.copy(template.trajectory.timeseries(format='fac')[::5, :, :]), | ||
| format=mda.coordinates.memory.MemoryReader) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you still not use the step argument of transfer_to_memory here?
| template.transfer_to_memory(step=5) | ||
| template = mda.Universe( | ||
| template.filename, | ||
| np.copy(template.trajectory.timeseries(format='fac')), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you know what this statement is doing? After using transfer to memory this shouldn't be necessary anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think I have a real understanding of that statement.
Fixes #
Changes made in this Pull Request:
PR Checklist