-
Notifications
You must be signed in to change notification settings - Fork 3
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
Allow input image files to be numbered '0' #42
base: main
Are you sure you want to change the base?
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. |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possibly, I'm afraid I wouldn't know where to look.
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.
Aha, dxtbx.model.scan_helpers.template_regex
, I think this might do the trick!
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.
👍
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.