-
Notifications
You must be signed in to change notification settings - Fork 18
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
Handle image templates that don't use zero padding #705
Handle image templates that don't use zero padding #705
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #705 +/- ##
==========================================
+ Coverage 42.23% 42.26% +0.02%
==========================================
Files 187 187
Lines 16752 16784 +32
Branches 3193 3201 +8
==========================================
+ Hits 7075 7093 +18
- Misses 9031 9045 +14
Partials 646 646 |
Sorry, there's a bunch of extra commits in here. I think that's because I merged |
Improved specificity further by ensuring the new pattern is only matched when the image serial number does not start with zero. All tests are passing for me, but this code is knotty because not only are we using regexes, but were using reversed regexes 😱 |
e4026c5
to
45e88b2
Compare
…zero-padded incremental number.
for the case of non-zero padded indices that extend to multiple digits. Other use cases should still work the same way.
make a new template that includes the underscore character, as that appears to be part of the standard Rigaku CAP filename format.
The non-zero-padded template must not start with `0` in the image number, so add that to the template. Then there are 4 groups, so add a condition to handle this case separately.
45e88b2
to
7dee593
Compare
Finally got the CI all happy. Locally, dxtbx and DIALS tests all pass, as do xia2 tests run with Has anybody got any comments on this PR? |
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.
Looks sensible
I feel like we should have some test code where we pass a list of filenames and we get back a list which matches the behaviour, more as documentation for future developers than for actual testing.
I would ask that we comment in the change log how you would handle wanting to only open single digit files. I specifically wonder about wanting to dials.import template=foo_001#.cbf
say which may not do what you expect (though, probably would)
Note to self: one thing to check is what happens with non-zero-padded series that do not start with a single digit. For example:
|
Ok, seems to work fine. With files named
and with an explicit template:
both produce a 4-image sweep. |
…all the added code
Don't include the directory path in the regex, because a pattern starting with "C:\\Users" will result in: re.error: incomplete escape \U at position 2 Instead, only do the regex on the filename part.
Added test was useful: unearthed an error on Windows, now fixed 👍 I believe this is ready to go in. |
Update test command following cctbx/dxtbx#705
* Use a single `#` character in a filename template to represent a non-zero-padded incremental number.
Following the discussion in #646, a template with a single
#
character is used to expand to all image files with non-zero-padded sequential numbers.