Allow input image files to be numbered '0'#42
Allow input image files to be numbered '0'#42benjaminhwilliams wants to merge 4 commits intomainfrom
Conversation
Allow input of the form 'image_0000.cbf', 'image_####.cbf:0:9', or similar. Add a test for the same. Allow passing py.path.local objects to Screen._import for ease of testing with the dials_data Pytest fixture.
|
DXTBX is separately broken for support of files numbered zero (cctbx/dxtbx#186), so these files will still be ignored and dropped from the DIALS spotfinding and integration routines, but at least this PR means screen19 doesn't throw a separate error. |
graeme-winter
left a comment
There was a problem hiding this comment.
To be clear, the scope of this PR is to prevent screen19 from failing if given foo_0000.cbf ... foo_0009.cbf however it will still fail in the underlying code, however our end user could then say foo_####.cbf:1:9 which would take frames 1...9 and then work.
Or have I got this wrong?
Reason I ask is this is the kind of information I may anticipate in a help string.
Otherwise the change set looks good 🙂
| image = int(parts[1].replace("#", "0")) | ||
| except IndexError: | ||
| template = parts[0] | ||
| root, number, extension = re.split(r"([0-9#]+)(?=\.\w)", f, 1) |
There was a problem hiding this comment.
et seq.
I am pretty sure general logic for this kind of thing already lives inside dxtbx somewhere which would support a more general range of filenames?
There was a problem hiding this comment.
Possibly, I'm afraid I wouldn't know where to look.
There was a problem hiding this comment.
Aha, dxtbx.model.scan_helpers.template_regex, I think this might do the trick!
With these changes, screen19 will be able to ingest the input as you describe. That is limit of these changes. It will not then fail in the underlying code. DIALS spotfinding and integration simply drop the problematic first image, which they try to label with index |
742c13a to
e0a879f
Compare
3ee2559 to
c66161c
Compare
image_0000.cbf,image_####.cbf:0:9, or similar.