-
Notifications
You must be signed in to change notification settings - Fork 46
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 showing of model connectivity #996
Conversation
N.B. allows clearer view of what options do e.g. with and without
vs.
|
Does not show anything if Should we have a limit for e.g. > 20 experiments or something? Can see this being useful for indexing > 1 lattice across > 1 sweep though. Also welcome bikeshedding on |
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.
Probably a useful addition, but at a risk of making the output of dials.show
even more verbose than it already is (especially for multiple experiments, which is the intended use case of this PR). Perhaps it would be worth adding an option to switch it on/off (no strong opinion on the default)?
Could we add a test for this new output? I'm not sure that we have a multi-experiment test case for dials.show
- probably a gap in the existing test coverage.
command_line/show.py
Outdated
text.append("") | ||
text.append("Detector:") | ||
text.append(" " + " ".join([str(j) for j in range(len(detectors))])) | ||
for j, e in enumerate(experiments): |
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.
It might be better to use e.g. tabulate here instead of manually formatting the tables. We already use tabulate
in xia2, so it should be available in a dials installation.
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.
Don't know about tabulate
however sounds like a good thing so 100% on board.
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.
if you end up using dependencies in dials please add them explicitly to dials (ie. libtbx_config
) even if they are already available indirectly
command_line/show.py
Outdated
@@ -209,6 +209,8 @@ def run(args): | |||
) | |||
) | |||
|
|||
print(show_connectivity(experiments)) |
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.
Not strictly a comment on this review, but a reminder that we should probably convert dials.show
to use logging instead of print
.
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.
+1
command_line/show.py
Outdated
text.append("Detector:") | ||
text.append(" " + " ".join([str(j) for j in range(len(detectors))])) | ||
for j, e in enumerate(experiments): | ||
tmp = ["Experiment %d" % j] |
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 suspect if j >= 10
then it would mess up the table alignment - using tabulate
should alleviate this.
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.
Agreed.
Test case data added to #995 |
Added Re: tabulate; no idea; not learning but would very much welcome someone else dropping this in there modulo comments made by @Anthchirp re: dependencies |
|
command_line/show.py
Outdated
@@ -26,6 +27,9 @@ | |||
show_scan_varying = False | |||
.type = bool | |||
.help = "Whether or not to show the crystal at each scan point." | |||
show_experiment_has_model = False |
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.
Perhaps this would be a better parameter (and relevant function) name?
show_experiment_has_model = False | |
show_model_connectivity = False |
Am happy for anyone to take this one forward to close off :) |
test/command_line/test_show.py
Outdated
expt = location.join("indexed.expt").strpath | ||
result = procrunner.run(["dials.show", expt, "show_model_connectivity=True"]) | ||
assert not result.returncode and not result.stderr | ||
assert "Experiment / Models" in result.stdout |
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.
assert "Experiment / Models" in result.stdout | |
assert b"Experiment / Models" in result.stdout |
command_line/show.py
Outdated
if getattr(e, model) is m: | ||
row.append("X") | ||
else: | ||
row.append("/") |
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.
row.append("/") | |
row.append(".") |
my :bikeshed: contribution.
Call command line run() function directly instead of using procrunner.run().
X -> x / -> .
45171c8
to
4eaccaa
Compare
@graeme-winter I think
|
I think |
@dagewa |
@graeme-winter any comment on #996 (comment)? It seems that this essentially does the same thing as this PR, albeit in a different form. If this PR is merged, then I suggest that |
I will spin that out as a separate issue to follow up at some point in the indefinite future |
Shows how models are related to experiments e.g.
Seemed useful to me... make an option?