@@ -184,10 +184,7 @@ def extract_subtomo(self, rw, header: dict, message: dict):
184184 tilt_numbers .append (_get_tilt_number_v5_12 (Path (tilt_name )))
185185 tilt_axis_from_file = float (_get_tilt_angle_v5_12 (Path (tilt_name )))
186186 tilt_angles_radians .append (
187- (
188- tilt_axis_from_file
189- + extract_subtomo_params .refined_tilt_offset
190- )
187+ (tilt_axis_from_file + extract_subtomo_params .tilt_offset )
191188 * np .pi
192189 / 180
193190 )
@@ -215,6 +212,7 @@ def extract_subtomo(self, rw, header: dict, message: dict):
215212 theta_z = tilt_axis_radians ,
216213 delta_x = x_shifts [tilt ],
217214 delta_y = y_shifts [tilt ],
215+ binning = extract_subtomo_params .tomogram_binning ,
218216 )
219217 if tilt_angles_radians [tilt ] == 0 :
220218 with open (
@@ -370,20 +368,23 @@ def get_coord_in_tilt(
370368 theta_z : float ,
371369 delta_x : float ,
372370 delta_y : float ,
371+ binning : int ,
373372):
373+ # In binned coordinates here
374374 x_centred = x - cen_x
375375 y_centred = y - cen_y + cen_x * np .tan (theta_z ) # TODO: last factor depends on rot
376376 z_centred = z - cen_z
377377 x_2d = (
378378 x_centred * np .cos (theta_z ) * np .cos (theta_y )
379379 - y_centred * np .sin (theta_z )
380380 + z_centred * np .cos (theta_z ) * np .sin (theta_y )
381- + delta_x
382381 )
383382 y_2d = (
384383 x_centred * np .sin (theta_z ) * np .cos (theta_y )
385384 + y_centred * np .cos (theta_z )
386385 + z_centred * np .sin (theta_z ) * np .sin (theta_y )
387- + delta_y
388386 )
389- return cen_x + x_2d , cen_y + y_2d
387+ # Un-bin and apply shifts
388+ x_tilt = (cen_x + x_2d ) * binning - delta_x
389+ y_tilt = (cen_y + y_2d ) * binning - delta_y
390+ return x_tilt , y_tilt
0 commit comments