|
58 | 58 | TiltSeries, |
59 | 59 | ) |
60 | 60 | from murfey.util.models import ProcessingParametersSPA, ProcessingParametersTomo |
61 | | -from murfey.util.processing_params import default_spa_parameters |
| 61 | +from murfey.util.processing_params import default_spa_parameters, motion_corrected_mrc |
62 | 62 | from murfey.util.tomo import midpoint |
63 | 63 |
|
64 | 64 | logger = getLogger("murfey.server.api.workflow") |
@@ -365,26 +365,7 @@ async def request_spa_preprocessing( |
365 | 365 | machine_config = get_machine_config(instrument_name=instrument_name)[ |
366 | 366 | instrument_name |
367 | 367 | ] |
368 | | - parts = [secure_filename(p) for p in Path(proc_file.path).parts] |
369 | | - visit_idx = parts.index(visit_name) |
370 | | - core = Path("/") / Path(*parts[: visit_idx + 1]) |
371 | | - ppath = Path("/") / Path(*parts) |
372 | | - if machine_config.process_multiple_datasets: |
373 | | - sub_dataset = ppath.relative_to(core).parts[0] |
374 | | - else: |
375 | | - sub_dataset = "" |
376 | | - extra_path = machine_config.processed_extra_directory |
377 | | - mrc_out = ( |
378 | | - core |
379 | | - / machine_config.processed_directory_name |
380 | | - / sub_dataset |
381 | | - / extra_path |
382 | | - / "MotionCorr" |
383 | | - / "job002" |
384 | | - / "Movies" |
385 | | - / ppath.parent.relative_to(core / sub_dataset) |
386 | | - / str(ppath.stem + "_motion_corrected.mrc") |
387 | | - ) |
| 368 | + mrc_out = motion_corrected_mrc(Path(proc_file.path), visit_name, machine_config) |
388 | 369 | try: |
389 | 370 | collected_ids = db.exec( |
390 | 371 | select(DataCollectionGroup, DataCollection, ProcessingJob, AutoProcProgram) |
@@ -488,7 +469,8 @@ async def request_spa_preprocessing( |
488 | 469 | _transport_object.send("processing_recipe", zocalo_message) |
489 | 470 | else: |
490 | 471 | logger.error( |
491 | | - f"Pe-processing was requested for {sanitise(ppath.name)} but no Zocalo transport object was found" |
| 472 | + f"Pre-processing was requested for {sanitise(Path(proc_file.path).name)} " |
| 473 | + "but no Zocalo transport object was found" |
492 | 474 | ) |
493 | 475 | return proc_file |
494 | 476 |
|
@@ -643,26 +625,7 @@ async def request_tomography_preprocessing( |
643 | 625 | machine_config = get_machine_config(instrument_name=instrument_name)[ |
644 | 626 | instrument_name |
645 | 627 | ] |
646 | | - parts = [secure_filename(p) for p in Path(proc_file.path).parts] |
647 | | - visit_idx = parts.index(visit_name) |
648 | | - core = Path("/") / Path(*parts[: visit_idx + 1]) |
649 | | - ppath = Path("/") / Path(*parts) |
650 | | - if machine_config.process_multiple_datasets: |
651 | | - sub_dataset = ppath.relative_to(core).parts[0] |
652 | | - else: |
653 | | - sub_dataset = "" |
654 | | - extra_path = machine_config.processed_extra_directory |
655 | | - mrc_out = ( |
656 | | - core |
657 | | - / machine_config.processed_directory_name |
658 | | - / sub_dataset |
659 | | - / extra_path |
660 | | - / "MotionCorr" |
661 | | - / "job002" |
662 | | - / "Movies" |
663 | | - / str(ppath.stem + "_motion_corrected.mrc") |
664 | | - ) |
665 | | - mrc_out = Path("/".join(secure_filename(p) for p in mrc_out.parts)) |
| 628 | + mrc_out = motion_corrected_mrc(Path(proc_file.path), visit_name, machine_config) |
666 | 629 |
|
667 | 630 | recipe_name = machine_config.recipes.get("em-tomo-preprocess", "em-tomo-preprocess") |
668 | 631 |
|
@@ -733,7 +696,8 @@ async def request_tomography_preprocessing( |
733 | 696 | _transport_object.send("processing_recipe", zocalo_message) |
734 | 697 | else: |
735 | 698 | logger.error( |
736 | | - f"Pe-processing was requested for {sanitise(ppath.name)} but no Zocalo transport object was found" |
| 699 | + f"Pre-processing was requested for {sanitise(Path(proc_file.path).name)} " |
| 700 | + f"but no Zocalo transport object was found" |
737 | 701 | ) |
738 | 702 | return proc_file |
739 | 703 | else: |
|
0 commit comments