Skip to content

Commit ff2c2bd

Browse files
committed
Fix compatibility with latest AreTomo version 1.1.2
1 parent e3bc2b0 commit ff2c2bd

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

src/pyp/align/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5194,7 +5194,7 @@ def align_tilt_series(name, parameters, rotation=0):
51945194
-AlignZ {specimen_thickness} \
51955195
{reconstruct_option} \
51965196
-TiltCor {tilt_offset_option} \
5197-
-OutImod 1 {patches} \
5197+
-OutImod 2 {patches} \
51985198
-Gpu {get_gpu_id()}"
51995199
[ output, error ] = run_shell_command(command, verbose=parameters["slurm_verbose"])
52005200

src/pyp/merge/core.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from pyp import utils
1313
from pyp.analysis import plot
1414
from pyp.inout.image import mrc
15+
from pyp.inout.image.core import get_image_dimensions
1516
from pyp.inout.utils import pyp_edit_box_files as imod
1617
from pyp.merge import weights as pyp_weights
1718
from pyp.system import project_params
@@ -315,10 +316,25 @@ def reconstruct_tomo(parameters, name, x, y, binning, zfact, tilt_options, force
315316
if not parameters["tomo_rec_aretomo_sart"]:
316317
reconstruct_option = "-Wbp 1"
317318

319+
# the new version of AreTomo2 apparently need the alignments
320+
if not os.path.exists(f"{name}.aln"):
321+
tilt_angles = np.loadtxt(f"{name}.tlt",ndmin=2)
322+
tilt_order = np.loadtxt(f"{name}.order",ndmin=2)
323+
x, y, z = get_image_dimensions(f"{name}.ali")
324+
with open(f"{name}.aln",'w') as f:
325+
f.write("# AreTomo Alignment / Priims bprmMn)\n")
326+
f.write(f"# RawSize = {x} {y} {z}\n")
327+
f.write(f"# NumPatches = 0\n")
328+
f.write(f"# SEC ROT GMAG TX TY SMEAN SFIT SCALE BASE TILT\n")
329+
for tilt, order in zip(tilt_angles, tilt_order):
330+
# 0 00.0000 1.00000 1493.353 -740.186 1.00 1.00 1.00 0.00 -60.00
331+
f.write("%5d%11.4f%11.5f%11.3f%11.3f%9.2f%9.2f%9.2f%9.2f%9.2f\n" % (order,0,1,0,0,1,1,1,0,tilt))
332+
318333
command = f"{get_aretomo_path()} \
319334
-InMrc {name}.ali \
320335
-OutMrc {name}.rec \
321336
-AngFile {name}.tlt \
337+
-AlnFile {name}.aln \
322338
-VolZ {int(1.0 * thickness)} \
323339
-OutBin {binning} \
324340
-DarkTol {parameters['tomo_ali_aretomo_dark_tol']} \

src/pyp/preprocess/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ def read_tilt_series(
312312
try:
313313
shutil.copy2(rawtlt, "{0}.rawtlt".format(name))
314314
except:
315-
# ignore of file already exists
315+
# ignore if file already exists
316316
pass
317317
elif os.path.isfile(filename + ".mrc.mdoc"):
318318
local_run.run_shell_command(

0 commit comments

Comments
 (0)