rs-station / reciprocalspaceship

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

Fixed `read_precognition()` as per #135 and updated tests #136

Closed dennisbrookner closed 2 years ago

dennisbrookner commented 2 years ago

Accomplished all of the changes mentioned in #135 . Two outstanding thoughts:

Also, as best I can tell, this is the first "warning" in reciprocalspaceship. If some mechanism other than the built-in warnings module is preferable, let me know.

codecov-commenter commented 2 years ago

Codecov Report

Merging #136 (ea26024) into main (aca17c9) will increase coverage by 0.00%. The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #136   +/-   ##
=======================================
  Coverage   98.67%   98.67%           
=======================================
  Files          41       41           
  Lines        1583     1590    +7     
=======================================
+ Hits         1562     1569    +7     
  Misses         21       21           
Flag Coverage Δ
unittests 98.67% <100.00%> (+<0.01%) :arrow_up:

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

Impacted Files Coverage Δ
reciprocalspaceship/io/precognition.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 aca17c9...ea26024. Read the comment docs.

kmdalton commented 2 years ago

Jack will reply later, but imo type checks should live in the cellify decorator which is called by the setter.

dennisbrookner commented 2 years ago

Jack will reply later, but imo type checks should live in the cellify decorator which is called by the setter.

Yeah, Jack slacked me about this as well. Makes sense, I'll take that out.

JBGreisman commented 2 years ago

As mentioned above, the setter methods for DataSet.cell and DataSet.spacegroup implicitly handle all the type checking and coercion to gemmi objects. These use the @spacegroupify and @cellify decorators to ensure that all the relevant type-checking is handled in one place. This change was made in #94.

As such, this looks good -- when the DataSet attributes are set any necessary checks/conversion to gemmi objects will be done.