Skip to content

Commit 48adba8

Browse files
committed
Replace '_is_manual_autotem' with '_get_project_name'
1 parent 8b6fcac commit 48adba8

1 file changed

Lines changed: 14 additions & 9 deletions

File tree

  • src/murfey/client/contexts

src/murfey/client/contexts/fib.py

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -182,18 +182,19 @@ def _parse_boolean(text: str):
182182
)
183183

184184

185-
def _is_manual_autotem(file_path: Path):
185+
def _get_project_name(file_path: Path):
186186
"""
187-
Checks if the file being analysed belongs to a manual AutoTEM project.
188-
Manual AutoTEM projects are stored in project folders that start with 'AutoTEM_'.
187+
Get the project name from the file path. This is used in manual AutoTEM
188+
workflows to identify the folder containing the images and site metadata
189+
to register.
189190
"""
190191
try:
191192
autotem_idx = file_path.parts.index("autotem")
192193
project_dir = file_path.parents[-(autotem_idx + 2)]
193-
return project_dir.stem.startswith("AutoTEM_")
194+
return project_dir.stem
194195
except Exception:
195196
logger.error(
196-
f"Error checking if file {file_path} belongs to a manual AutoTEM project:",
197+
f"Error extracting project name from file path {file_path}:",
197198
exc_info=True,
198199
)
199200
return None
@@ -263,12 +264,16 @@ def post_transfer(
263264
# AutoTEM
264265
# -----------------------------------------------------------------------------
265266
if self._acquisition_software == "autotem":
266-
# Apply different logic depending of whether it's auto/manual AutoTEM
267-
if (is_manual_autotem := _is_manual_autotem(transferred_file)) is None:
267+
# Extract project name from file path
268+
project_name = _get_project_name(transferred_file)
269+
270+
# Handle file based on extracted project name
271+
if project_name is None:
268272
# Skip processing file if the check fails
269273
return None
270-
elif is_manual_autotem:
271-
# Logic for handling manual AutotTEM will evenutlaly go here
274+
# Manual AutoTEM folders start with
275+
elif project_name.startswith("AutoTEM_"):
276+
# Logic for handling manual AutoTEM will eventually go here
272277
return None
273278
else:
274279
# Extract metadata from fully automated AutoTEM projects

0 commit comments

Comments
 (0)