@@ -400,11 +400,12 @@ def _apply_blur(arr_flat):
400400
401401 @tool (name = "acquire_image" , return_type = ToolReturnType .IMAGE_PATH )
402402 def acquire_image (
403- self ,
404- loc_y : Annotated [float , "The y-coordinate of the top-left corner of the image to acquire." ],
405- loc_x : Annotated [float , "The x-coordinate of the top-left corner of the image to acquire." ],
406- size_y : Annotated [int , "The height of the image to acquire." ],
407- size_x : Annotated [int , "The width of the image to acquire." ],
403+ self ,
404+ loc_y : Annotated [float , "The y-coordinate of the top-left corner of the image to acquire." ],
405+ loc_x : Annotated [float , "The x-coordinate of the top-left corner of the image to acquire." ],
406+ size_y : Annotated [int , "The height of the image to acquire." ],
407+ size_x : Annotated [int , "The width of the image to acquire." ],
408+ scan_step : Annotated [float , "The step size between sampled points in both y and x directions." ] = 1 ,
408409 ) -> Annotated [str , "The path to the acquired image." ]:
409410 """Acquire an image of a given size from the whole image at a given
410411 location.
@@ -423,21 +424,22 @@ def acquire_image(
423424 str
424425 The path of the acquired image saved in hard drive.
425426 """
426- self .update_image_acquisition_call_history (loc_x , loc_y , size_x , size_y , psize_x = 1 , psize_y = 1 )
427+ self .update_image_acquisition_call_history (loc_x , loc_y , size_x , size_y , psize_x = scan_step , psize_y = scan_step )
427428
428429 loc = [loc_y , loc_x ]
429430 size = [size_y , size_x ]
430- logger .info (f"Acquiring image of size { size } at location { loc } ." )
431- y = np .arange (loc [0 ], loc [0 ] + size [0 ] - 0.5 )
432- x = np .arange (loc [1 ], loc [1 ] + size [1 ] - 0.5 )
431+ logger .info (f"Acquiring image of size { size } at location { loc } with scan_step= { scan_step } ." )
432+ y = np .arange (loc [0 ], loc [0 ] + size [0 ], scan_step )
433+ x = np .arange (loc [1 ], loc [1 ] + size [1 ], scan_step )
433434 yy , xx = np .meshgrid (y + self .offset [0 ], x + self .offset [1 ], indexing = "ij" )
434435
435- arr = self ._sample (yy .ravel (), xx .ravel (), shape = size ).reshape (size )
436-
436+ arr_shape = (len (y ), len (x ))
437+ arr = self ._sample (yy .ravel (), xx .ravel (), shape = arr_shape ).reshape (arr_shape )
438+
437439 if self .show_image_in_real_time :
438440 self .update_real_time_view (arr )
439-
440- self .update_image_buffers (arr , psize = 1 )
441+
442+ self .update_image_buffers (arr , psize = scan_step )
441443
442444 if self .return_message :
443445 filename = f"image_{ loc_y } _{ loc_x } _{ size_y } _{ size_x } _{ get_timestamp ()} .png"
0 commit comments