-
Notifications
You must be signed in to change notification settings - Fork 14
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
Add interface for setting project, crystal, and dataset names #157
Conversation
Codecov Report
@@ Coverage Diff @@
## main #157 +/- ##
=======================================
Coverage 98.45% 98.46%
=======================================
Files 43 43
Lines 1688 1695 +7
=======================================
+ Hits 1662 1669 +7
Misses 26 26
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this code would be cleaner and your tests more straightforward if the signature of to_gemmi
were changed to
def to_gemmi(
self,
skip_problem_mtztypes=False,
project_name="reciprocalspaceship",
crystal_name="reciprocalspaceship",
dataset_name="reciprocalspaceship",
):
I think strings are immutable, and this is okay to do. Let me know if I am being obtuse, and I will have another look.
I think that's a reasonable request. It certainly makes it more transparent what the default value will ultimately be. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that passing DataSet.to_gemmi
anything other than a string for {project,crystal,dataset}_name
should raise a ValueError
. Passing None
should probably not be silently corrected back to the default values in the signature. I think the tests should look for a ValueError
when None
is passed. I might be being overly picky.
I'm fine with that -- I agree that silently coercing a value of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that the methods DataSet.to_gemmi
and DataSet.write_mtz
should be the only places with default arguments for the various name strings. The functions in io
are not really meant to be called directly by users. I think it is good for them to have the names as required arguments. This way, if we ever decide to change the default names in the future, they only need to be updated at the top level.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i don't see any glaring issues here, and i like the solution.
This PR addresses #103 by adding an interface for setting the project, crystal, and dataset names in
DataSet.to_gemmi()
andDataSet.write_mtz()
. These names are then set in the MTZ file orgemmi.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.