rs-station / reciprocalspaceship

Tools for exploring reciprocal space
https://rs-station.github.io/reciprocalspaceship/
MIT License
29 stars 13 forks source link

Adding a Stats Module and Multiplicity Calculator #60

Closed kmdalton closed 3 years ago

kmdalton commented 3 years ago

This branch attempts to address #59 . In this commit I have added a new rs.stats module. This contains a function for computing the multiplicity of a set of miller indices under a given a cell and spacegroup. One can cheaply get the completeness from the output of this function. I have also added tests, and two new methods to rs.utils in order to support stats. Since this is a fairly substantial change, I'm going to request that @JBGreisman do a thorough code review.

codecov-commenter commented 3 years ago

Codecov Report

Merging #60 (1232672) into main (9913ca8) will increase coverage by 0.03%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #60      +/-   ##
==========================================
+ Coverage   98.72%   98.75%   +0.03%     
==========================================
  Files          37       38       +1     
  Lines        1488     1529      +41     
==========================================
+ Hits         1469     1510      +41     
  Misses         19       19              
Flag Coverage Δ
unittests 98.75% <100.00%> (+0.03%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
reciprocalspaceship/utils/__init__.py 100.00% <100.00%> (ø)
reciprocalspaceship/utils/asu.py 100.00% <100.00%> (ø)
reciprocalspaceship/utils/cell.py 100.00% <100.00%> (ø)
reciprocalspaceship/utils/stats.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 9913ca8...1232672. Read the comment docs.

kmdalton commented 3 years ago

This function is maybe too useful to be totally hidden away as a private method. I am happy to move it to utils at your discretion. I think if we do move it to utils, it should not return a DataSet. Rather, it should return an n x 3 array of miller indices and an n array of ints or floats.

Let me know what you want to do. I'm happy to do whatever. For me the most useful things in this PR are the generate_* functions I added. I'm happy as long as those are not contentious.

kmdalton commented 3 years ago

okay -- i moved redundancy.py into utils/stats.py. I cleaned up the imports and tests.

kmdalton commented 3 years ago

Okay. I will merge this.

kmdalton commented 3 years ago

Oops -- accidentally closed this. When I meant to merge. Nothing to see here, please move along...