rs-station / reciprocalspaceship

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

Add interface for setting project, crystal, and dataset names #157

Closed JBGreisman closed 2 years ago

JBGreisman commented 2 years ago

This PR addresses #103 by adding an interface for setting the project, crystal, and dataset names in DataSet.to_gemmi() and DataSet.write_mtz(). These names are then set in the MTZ file or gemmi.Mtz object.

This can be useful for record keeping, allowing custom titles in MTZ files that can be read by other programs.

These names default to "reciprocalspaceship" -- if these new arguments are left unset, a user will have the same behavior as before.

codecov-commenter commented 2 years ago

Codecov Report

Merging #157 (97124c4) into main (79a28fb) will increase coverage by 0.00%. The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main     #157   +/-   ##
=======================================
  Coverage   98.45%   98.46%           
=======================================
  Files          43       43           
  Lines        1688     1695    +7     
=======================================
+ Hits         1662     1669    +7     
  Misses         26       26           
Flag Coverage Δ
unittests 98.46% <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/dataset.py 98.03% <100.00%> (ø)
reciprocalspaceship/io/mtz.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 79a28fb...97124c4. Read the comment docs.

JBGreisman commented 2 years ago

I think that's a reasonable request. It certainly makes it more transparent what the default value will ultimately be.

JBGreisman commented 2 years ago

I'm fine with that -- I agree that silently coercing a value of None to "reciprocalspaceship" is a bit surprising from an interface perspective. The docstrings certainly specify that the values take str, so I think it's reasonable to raise a ValueError for anything else.