@@ -1115,12 +1115,12 @@ def _find_initial_model(visit: str, machine_config: MachineConfig) -> Path | Non
11151115
11161116
11171117def _downscaled_box_size (
1118- particle_diameter : int , pixel_size : float
1118+ particle_diameter_ang : float , pixel_size : float
11191119) -> Tuple [int , float ]:
1120+ particle_diameter = particle_diameter_ang / pixel_size
11201121 box_size = int (math .ceil (1.2 * particle_diameter ))
11211122 box_size = box_size + box_size % 2
11221123 for small_box_pix in (
1123- 48 ,
11241124 64 ,
11251125 96 ,
11261126 128 ,
@@ -1145,9 +1145,9 @@ def _downscaled_box_size(
11451145 # Don't go larger than the original box
11461146 if small_box_pix > box_size :
11471147 return box_size , pixel_size
1148- # If Nyquist freq. is better than 8 .5 A, use this downscaled box, else step size
1148+ # If Nyquist freq. is better than 7 .5 A, use this downscaled box, else step size
11491149 small_box_angpix = pixel_size * box_size / small_box_pix
1150- if small_box_angpix < 4.25 :
1150+ if small_box_angpix < 3.75 :
11511151 return small_box_pix , small_box_angpix
11521152 raise ValueError (f"Box size is too large: { box_size } " )
11531153
@@ -1161,9 +1161,9 @@ def _resize_intial_model(
11611161 env : Dict [str , str ],
11621162) -> None :
11631163 with mrcfile .open (input_path ) as input_mrc :
1164- input_size_x = input_mrc .nx
1165- input_size_y = input_mrc .ny
1166- input_size_z = input_mrc .nz
1164+ input_size_x = input_mrc .header . nx
1165+ input_size_y = input_mrc .header . ny
1166+ input_size_z = input_mrc .header . nz
11671167 if executables .get ("clip" ) and not input_size_x == input_size_y == input_size_z :
11681168 # If the initial model is not a cube, do some padding
11691169 clip_proc = subprocess .run (
@@ -1198,6 +1198,8 @@ def _resize_intial_model(
11981198 str (downscaled_box_size ),
11991199 "--rescale_angpix" ,
12001200 str (downscaled_pixel_size ),
1201+ "--force_header_angpix" ,
1202+ str (downscaled_pixel_size ),
12011203 "--o" ,
12021204 str (output_path ),
12031205 ],
0 commit comments