Skip to content

Commit 910cf44

Browse files
committed
Restructure/rename the workflow
1 parent 220d111 commit 910cf44

3 files changed

Lines changed: 17 additions & 15 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ TomographyMetadataContext = "murfey.client.contexts.tomo_metadata:TomographyMeta
125125
"spa.ctf_estimated" = "murfey.workflows.spa.ctf_estimation:ctf_estimated"
126126
"spa.flush_spa_preprocess" = "murfey.workflows.spa.flush_spa_preprocess:flush_spa_preprocess"
127127
"spa.motion_corrected" = "murfey.workflows.spa.motion_correction:motion_corrected"
128-
"sxt.process_tilt_series" = "murfey.workflows.sxt.process_sxt_tilt_series:process_sxt_tilt_series"
128+
"sxt.process_tilt_series" = "murfey.workflows.sxt.process_sxt_tilt_series:run"
129129

130130
[tool.setuptools]
131131
package-dir = {"" = "src"}

src/murfey/client/contexts/sxt.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def _find_reference(txrm_file: Path) -> Path | None:
5252
)[0]
5353
)
5454
if mosaic_size == 0:
55-
logger.info(f"Found reference {ref_option}")
55+
logger.info(f"Found reference {ref_option.name}")
5656
return Path(ref_option.full_path)
5757
logger.warning(f"No reference found for {txrm_file}")
5858
return None

src/murfey/workflows/sxt/process_sxt_tilt_series.py

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
from pydantic import BaseModel
55
from sqlmodel import select
6+
from sqlmodel.orm.session import Session as SQLModelSession
67
from werkzeug.utils import secure_filename
78

89
from murfey.server import _transport_object
@@ -35,7 +36,7 @@ def process_sxt_tilt_series(
3536
visit_name: str,
3637
session_id: MurfeySessionID,
3738
tilt_series_info: SXTTiltSeriesInfo,
38-
murfey_db: Session,
39+
murfey_db: SQLModelSession,
3940
) -> dict[str, bool]:
4041
tilt_series_query = murfey_db.exec(
4142
select(TiltSeries)
@@ -82,30 +83,22 @@ def process_sxt_tilt_series(
8283
instrument_name
8384
]
8485

86+
# Find the visit folder and any subfolders needed
8587
parts = [secure_filename(p) for p in Path(tilt_series_info.txrm).parts]
8688
visit_idx = parts.index(visit_name)
8789
core = Path(*Path(tilt_series_info.txrm).parts[: visit_idx + 1])
8890
ppath = Path(
8991
"/".join(secure_filename(p) for p in Path(tilt_series_info.txrm).parts)
9092
)
91-
sub_dataset = "/".join(ppath.relative_to(core).parts[:-1])
92-
extra_path = machine_config.processed_extra_directory
93-
stack_file = (
94-
core
95-
/ machine_config.processed_directory_name
96-
/ sub_dataset
97-
/ extra_path
98-
/ "Tomograms"
99-
/ f"{tilt_series.tag}_stack.mrc"
100-
)
101-
stack_file.parent.mkdir(parents=True, exist_ok=True)
93+
sub_dataset = "/".join(ppath.relative_to(core).parts[1:-1])
10294

10395
# Loop over all processing jobs, and send the alignment recipe for it
10496
for recipe_ids in collected_ids:
105-
# Stack file path needs to contain both recipe name and tilt series anem
97+
# Stack file path needs to contain both recipe name and tilt series name
10698
stack_file = (
10799
core
108100
/ machine_config.processed_directory_name
101+
/ sub_dataset
109102
/ tilt_series.tag
110103
/ recipe_ids[2].recipe
111104
/ "Tomograms"
@@ -143,3 +136,12 @@ def process_sxt_tilt_series(
143136
murfey_db.add(tilt_series)
144137
murfey_db.commit()
145138
return {"success": True}
139+
140+
141+
def run(message: dict, murfey_db: SQLModelSession) -> dict[str, bool]:
142+
return process_sxt_tilt_series(
143+
message["visit_name"],
144+
message["session_id"],
145+
SXTTiltSeriesInfo(**message["tilt_series_info"]),
146+
murfey_db,
147+
)

0 commit comments

Comments
 (0)