Skip to content

Commit

Permalink
Catch errors if tilt angle cannot be found
Browse files Browse the repository at this point in the history
  • Loading branch information
stephen-riggs committed Aug 13, 2024
1 parent f2a0ab1 commit 93e31c9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/cryoemservices/util/slurm_submission.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ def slurm_submission(
slurm_config["environment"] = {"USER": user, "HOME": user_home} # type: ignore
else:
slurm_config["environment"] = [
f"USER: {user}",
f"HOME: {user_home}",
f"USER={user}",
f"HOME={user_home}",
] # type: ignore

# Add slurm partition and cluster preferences if given
Expand Down
10 changes: 9 additions & 1 deletion src/cryoemservices/util/tomo_output_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,32 @@ def _find_angle_index(split_name: List[str]) -> int:
for i, part in enumerate(split_name):
if "." in part:
return i
return 0
return -1


def _get_tilt_angle_v5_12(p: Path) -> str:
split_name = p.name.split("_")
angle_idx = _find_angle_index(split_name)
if angle_idx == -1:
return "0.0"
return split_name[angle_idx]


def _get_tilt_number_v5_12(p: Path) -> str:
split_name = p.name.split("_")
angle_idx = _find_angle_index(split_name)
try:
int(split_name[angle_idx - 1])
except ValueError:
return "0"
return split_name[angle_idx - 1]


def _get_tilt_name_v5_12(p: Path) -> str:
split_name = p.name.split("_")
angle_idx = _find_angle_index(split_name)
if angle_idx == -1:
return p.name
return "_".join(split_name[: angle_idx - 1])


Expand Down

0 comments on commit 93e31c9

Please sign in to comment.