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

[Review Needed]Pytest Style TestEncore #1609

Merged
merged 8 commits into from Sep 3, 2017

Conversation

utkbansal
Copy link
Member

Fixes #

Changes made in this Pull Request:

PR Checklist

  • Tests?
  • Docs?
  • CHANGELOG updated?
  • Issue raised/referenced?

@utkbansal
Copy link
Member Author

@kain88-de @jbarnoud @richardjgowers Review please.

result_value = results[0, 1]
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 " \
Copy link
Member

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

result_value = results[0,1]
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. " \
Copy link
Member

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" \
Copy link
Member

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)
Copy link
Member

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)
Copy link
Member

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.

Copy link
Member

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
Copy link
Member

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

@utkbansal utkbansal changed the title [WIP]Pytest Style TestEncore [Review Needed]Pytest Style TestEncore Aug 24, 2017
@utkbansal
Copy link
Member Author

@kain88-de I've used transfer_to_memory. Anything else needed here?

template = mda.Universe(
template.filename,
np.copy(template.trajectory.timeseries(format='fac')[::5, :, :]),
format=mda.coordinates.memory.MemoryReader)
Copy link
Member

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')),
Copy link
Member

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.

Copy link
Member Author

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.

@kain88-de kain88-de merged commit 49aaf08 into MDAnalysis:develop Sep 3, 2017
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.

None yet

2 participants