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

cosym fix np.random.seed #1621

Merged
merged 2 commits into from
Mar 5, 2021
Merged

cosym fix np.random.seed #1621

merged 2 commits into from
Mar 5, 2021

Conversation

rjgildea
Copy link
Contributor

@rjgildea rjgildea commented Mar 4, 2021

Fix occassional test failure by also setting np.random.seed

Fix occassional test failure by also setting np.random.seed
@codecov
Copy link

codecov bot commented Mar 4, 2021

Codecov Report

Merging #1621 (18d507f) into main (44002fb) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main    #1621   +/-   ##
=======================================
  Coverage   66.60%   66.60%           
=======================================
  Files         614      614           
  Lines       68748    68750    +2     
  Branches     9571     9571           
=======================================
+ Hits        45789    45791    +2     
+ Misses      21029    21028    -1     
- Partials     1930     1931    +1     

Copy link
Member

@dagewa dagewa left a comment

Choose a reason for hiding this comment

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

Tests pass for me on Windows 👍

Copy link
Contributor

@graeme-winter graeme-winter left a comment

Choose a reason for hiding this comment

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

Just what was needed - this is (again) one of those tests which seems RNG dependent - thanks for the fix. To state obvious, it worked for me (but then it would, right?)

if seed is not None:
flex.set_random_seed(seed)
random.seed(seed)
np.random.seed(seed)
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@rjgildea
Copy link
Contributor Author

rjgildea commented Mar 5, 2021

this is (again) one of those tests which seems RNG dependent

Yes - by definition the cosym procedure is dependent on a random number generator as it is used to generate random starting coordinates for the procedure:

coords = np.random.rand(NN * n_sym_ops * self.target.dim)

In the command line script all the potentially relevant random seeds (random, flex.random, np.random) are set. Setting np.random.seed also in the tests was an oversight in the recent flex -> numpy conversion.

@rjgildea rjgildea merged commit a8710a8 into main Mar 5, 2021
@rjgildea rjgildea deleted the cosym-fix-np.random.seed branch March 5, 2021 09:48
rjgildea added a commit to xia2/xia2 that referenced this pull request Mar 23, 2021
This meant that the post-scaling cos-angle clustering would vary
between runs.

See also dials/dials#1621
rjgildea added a commit to xia2/xia2 that referenced this pull request Mar 24, 2021
* Fix np.random.seed for xia2.multiplex

This meant that the post-scaling cos-angle clustering would vary
between runs.

See also dials/dials#1621

* Use d_min cutoff from scaling for cluster analysis

This probably gives more meaningful results than using all data to
the edges of the data, and also makes the reported cluster completeness
comparable to that reported after scaling.

* Use proteinase_k fixture

Gets the lists of experiment and reflection files, and removes
any .refl files after a test has completed.
ndevenish pushed a commit to xia2/xia2 that referenced this pull request Mar 24, 2021
* Fix np.random.seed for xia2.multiplex

This meant that the post-scaling cos-angle clustering would vary
between runs.

See also dials/dials#1621

* Use d_min cutoff from scaling for cluster analysis

This probably gives more meaningful results than using all data to
the edges of the data, and also makes the reported cluster completeness
comparable to that reported after scaling.

* Use proteinase_k fixture

Gets the lists of experiment and reflection files, and removes
any .refl files after a test has completed.
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

4 participants