Skip to content

Commit 366790c

Browse files
committed
Use mrc path function for tilts in tilt series
1 parent a7215c0 commit 366790c

File tree

1 file changed

+6
-27
lines changed

1 file changed

+6
-27
lines changed

src/murfey/server/feedback.py

Lines changed: 6 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
get_microscope,
5252
get_security_config,
5353
)
54-
from murfey.util.processing_params import default_spa_parameters
54+
from murfey.util.processing_params import default_spa_parameters, motion_corrected_mrc
5555
from murfey.util.tomo import midpoint
5656

5757
logger = logging.getLogger("murfey.server.feedback")
@@ -106,37 +106,16 @@ def get_all_tilts(tilt_series_id: int) -> List[str]:
106106
).all()
107107
if not complete_results:
108108
return []
109+
visit_name = complete_results[0][2].visit
109110
instrument_name = complete_results[0][2].instrument_name
110111
results = [r[0] for r in complete_results]
111112
machine_config = get_machine_config(instrument_name=instrument_name)[
112113
instrument_name
113114
]
114-
115-
def _mc_path(mov_path: Path) -> str:
116-
for p in mov_path.parts:
117-
if "-" in p and p.startswith(("bi", "nr", "nt", "cm", "sw")):
118-
visit_name = p
119-
break
120-
else:
121-
raise ValueError(f"No visit found in {mov_path}")
122-
visit_idx = Path(mov_path).parts.index(visit_name)
123-
core = Path(*Path(mov_path).parts[: visit_idx + 1])
124-
ppath = Path(mov_path)
125-
sub_dataset = "/".join(ppath.relative_to(core).parts[:-1])
126-
extra_path = machine_config.processed_extra_directory
127-
mrc_out = (
128-
core
129-
/ machine_config.processed_directory_name
130-
/ sub_dataset
131-
/ extra_path
132-
/ "MotionCorr"
133-
/ "job002"
134-
/ "Movies"
135-
/ str(ppath.stem + "_motion_corrected.mrc")
136-
)
137-
return str(mrc_out)
138-
139-
return [_mc_path(Path(r.movie_path)) for r in results]
115+
return [
116+
motion_corrected_mrc(Path(r.movie_path), visit_name, machine_config)
117+
for r in results
118+
]
140119

141120

142121
def get_job_ids(tilt_series_id: int, appid: int) -> JobIDs:

0 commit comments

Comments
 (0)