Skip to content

Commit

Permalink
Merge pull request #10 from brisvag/fix/exp_id_guessing
Browse files Browse the repository at this point in the history
Never leave xp_id empty
  • Loading branch information
brisvag authored Sep 15, 2023
2 parents aef2cc9 + e4db83f commit 0b77a19
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions cryohub/utils/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ class ParseError(RuntimeError):

# a list of commonly used base names for paths in regex form
common_name_regexes = (
r"^\w+\d+",
r"^\w+_\d+",
r"\d+",
r"^(\w+\d+).*\.",
r"^(\w+_\d+).*\.",
r"^(.*\d+).*\.",
r"^(.*?)\.",
)


Expand All @@ -26,7 +27,7 @@ def guess_name(string, name_regex=None):
and a list of regexes in order of priority
"""
if string is None:
return ""
return "NO_ID"
string = Path(string).stem
name_regex = listify(name_regex)
regexes = list(common_name_regexes)
Expand All @@ -37,7 +38,7 @@ def guess_name(string, name_regex=None):
return match.group(1)
return match.group(0)
else:
return ""
return "NO_ID"


def pad_to_3D(arr):
Expand Down

0 comments on commit 0b77a19

Please sign in to comment.