|
12 | 12 | from pyp import utils |
13 | 13 | from pyp.analysis import plot |
14 | 14 | from pyp.inout.image import mrc |
| 15 | +from pyp.inout.image.core import get_image_dimensions |
15 | 16 | from pyp.inout.utils import pyp_edit_box_files as imod |
16 | 17 | from pyp.merge import weights as pyp_weights |
17 | 18 | from pyp.system import project_params |
@@ -315,10 +316,25 @@ def reconstruct_tomo(parameters, name, x, y, binning, zfact, tilt_options, force |
315 | 316 | if not parameters["tomo_rec_aretomo_sart"]: |
316 | 317 | reconstruct_option = "-Wbp 1" |
317 | 318 |
|
| 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 | + |
318 | 333 | command = f"{get_aretomo_path()} \ |
319 | 334 | -InMrc {name}.ali \ |
320 | 335 | -OutMrc {name}.rec \ |
321 | 336 | -AngFile {name}.tlt \ |
| 337 | +-AlnFile {name}.aln \ |
322 | 338 | -VolZ {int(1.0 * thickness)} \ |
323 | 339 | -OutBin {binning} \ |
324 | 340 | -DarkTol {parameters['tomo_ali_aretomo_dark_tol']} \ |
|
0 commit comments