diff --git a/ConstantVelocityAcquisitionPlugin/constant_velocity_acquisition.py b/ConstantVelocityAcquisitionPlugin/constant_velocity_acquisition.py index 615be15..1284797 100644 --- a/ConstantVelocityAcquisitionPlugin/constant_velocity_acquisition.py +++ b/ConstantVelocityAcquisitionPlugin/constant_velocity_acquisition.py @@ -77,7 +77,6 @@ def update_saving_config(self, model): model : object navigate model """ - # TODO: number of steps return { "z": model.configuration["experiment"]["ConstantVelocity"][ "number_of_frames" diff --git a/ConstantVelocityAcquisitionPlugin/controller/constant_velocity_acquisition_controller.py b/ConstantVelocityAcquisitionPlugin/controller/constant_velocity_acquisition_controller.py index ab75680..61025da 100644 --- a/ConstantVelocityAcquisitionPlugin/controller/constant_velocity_acquisition_controller.py +++ b/ConstantVelocityAcquisitionPlugin/controller/constant_velocity_acquisition_controller.py @@ -44,7 +44,26 @@ def func(*args): widget_name ] = value except (TypeError, ValueError): - pass + return + + start_position = self.parent_controller.configuration["experiment"][ + "ConstantVelocity" + ]["start_position"] + end_position = self.parent_controller.configuration["experiment"][ + "ConstantVelocity" + ]["end_position"] + step_size = self.parent_controller.configuration["experiment"][ + "ConstantVelocity" + ]["step_size"] + # calculate the estimated number of frames + try: + frame_number = abs(end_position - start_position) // step_size + except: + frame_number = 1 + self.variables["number_of_frames"].set(frame_number) + self.parent_controller.configuration["experiment"]["ConstantVelocity"][ + "number_of_frames" + ] = int(frame_number) return func @@ -59,7 +78,6 @@ def func(*args): return func def update_axis(self, *args): - print("*** update axis!") self.parent_controller.configuration["experiment"]["ConstantVelocity"][ "axis" ] = self.variables["axis"].get()