Skip to content

Commit

Permalink
Improve specificity further.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
dagewa committed Mar 17, 2024
1 parent c7aa87a commit 49feec8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/dxtbx/model/scan_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
r"([0-9]{2,12})\.(.*)",
r"(.*)\.([0-9]{2,12})_(.*)",
r"(.*)\.([0-9]{2,12})(.*)",
r"(.*)\.([0-9]{1,12})_(.*)",
r"(.*)\.([0-9]{1,12})([^0]*)_(.*)",
r"(.*)\.([0-9]{1})(.*)",
]

Expand All @@ -39,6 +39,10 @@ def template_regex(filename):
exten = "." + groups[0][::-1]
digits = groups[1][::-1]
prefix = groups[2][::-1] + joiners[j]
elif len(groups) == 4:
exten = "." + groups[0][::-1]
digits = groups[1][::-1]
prefix = groups[3][::-1] + joiners[j] + groups[2][::-1]

Check warning on line 45 in src/dxtbx/model/scan_helpers.py

View check run for this annotation

Codecov / codecov/patch

src/dxtbx/model/scan_helpers.py#L43-L45

Added lines #L43 - L45 were not covered by tests
else:
exten = ""
digits = groups[0][::-1]
Expand Down

0 comments on commit 49feec8

Please sign in to comment.