Skip to content

Commit

Permalink
Merge pull request #124 from decarlof/master
Browse files Browse the repository at this point in the history
Fix bug with the rotation motor speed calculation
  • Loading branch information
decarlof authored Jul 5, 2021
2 parents 62b788d + 28f2ff7 commit d2f16de
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
11 changes: 7 additions & 4 deletions docs/source/tomoScanApp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1247,10 +1247,13 @@ Interlaced scan
- Flag controlling whether the scan is regualr or interlaced. Choices are 'No' and 'Yes'. When "No" the angles are equally spaced using the Start angle, # of angles and Angle step parameters. When 'Yes' the list of angles is read from a file.
* - $(P)$(R)InterlacedFileName
- waveform
- The file name containing the list of interalced angles.
* - $(P)$(R)InterlacedRetakeFlat
- busy,
- Interlaced retake flat. Choices are 'Done' and 'Capture'. When 'Capture' a new set of flat field images will be collected.
- The file name containing the list of interalced angles in npy format.
* - $(P)$(R)InterlacedFileName
- waveform
- Interlaced file name containing the numpy list of angles to collect in interlaced mode.
* - $(P)$(R)StabilizationTime
- ao
- Settling time after the rotary stage motion is completed (used only in step scans).

tomoScan_32ID_settings.req
~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
15 changes: 8 additions & 7 deletions tomoscan/tomoscan_pso.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,6 @@ def begin_scan(self):
# Call the base class method
super().begin_scan()

# Compute the time for each frame
time_per_angle = self.compute_frame_time()
self.motor_speed = np.abs(self.rotation_step) / time_per_angle
time.sleep(0.1)

# Program the stage driver to provide PSO pulses
Expand Down Expand Up @@ -276,10 +273,7 @@ def compute_positions_PSO(self):
Assign the fly scan angular position to theta[]
'''
overall_sense, user_direction = self._compute_senses()
# Get the distance needed for acceleration = 1/2 a t^2 = 1/2 * v * t
motor_accl_time = float(self.epics_pvs['RotationAccelTime'].get()) # Acceleration time in s
accel_dist = motor_accl_time / 2.0 * float(self.motor_speed)


# Compute the actual delta to keep each interval an integer number of encoder counts
encoder_multiply = float(self.epics_pvs['PSOCountsPerRotation'].get()) / 360.
raw_delta_encoder_counts = self.rotation_step * encoder_multiply
Expand All @@ -292,6 +286,13 @@ def compute_positions_PSO(self):
# Change the rotation step Python variable and PV
self.rotation_step = delta_encoder_counts / encoder_multiply
self.epics_pvs['RotationStep'].put(self.rotation_step)

# Compute the time for each frame
time_per_angle = self.compute_frame_time()
self.motor_speed = np.abs(self.rotation_step) / time_per_angle
# Get the distance needed for acceleration = 1/2 a t^2 = 1/2 * v * t
motor_accl_time = float(self.epics_pvs['RotationAccelTime'].get()) # Acceleration time in s
accel_dist = motor_accl_time / 2.0 * float(self.motor_speed)

# Make taxi distance an integer number of measurement deltas >= accel distance
# Add 1/2 of a delta to ensure that we are really up to speed.
Expand Down

0 comments on commit d2f16de

Please sign in to comment.