Skip to content

Commit

Permalink
Updated ADAndor3 configure test. TODO: Multiple tests now required
Browse files Browse the repository at this point in the history
  • Loading branch information
callumforrester committed May 21, 2018
1 parent 51c4b03 commit 530cb39
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
11 changes: 9 additions & 2 deletions malcolm/modules/ADAndor3/parts/andor3driverpart.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,21 @@ def setup_detector(self, child, completed_steps, steps_to_do, params=None):
# row_readout_time, the time taken to read out a row of pixels.
# Use of the floor function ensures that exposure time is set to the
# largest possible value under the target. The readout time is
# subtracted once because of rounding errors.
# subtracted because the camera has additional dead time that is given
# in "rows" in the Andor Neo hardware guide (page 57).
#
# Note: row_readout_time can only be calculated like this when the
# camera is not in overlap mode
row_readout_time = readout_time / child.arrayHeight.value
ideal_exposure = duration - readout_time
extra_rows = {
"Rolling": 1,
"Global": 4
}[child.shutterMode.value]
exposure = \
(np.floor(ideal_exposure / row_readout_time) - 1) * row_readout_time
(np.floor(ideal_exposure / row_readout_time) - extra_rows) \
* row_readout_time

fs.append(child.exposure.put_value_async(exposure))

# Need to reset acquirePeriod after setting exposure as it's
Expand Down
6 changes: 5 additions & 1 deletion tests/test_modules/test_ADAndor3/test_andor3driverpart.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,13 @@ def test_configure(self):
completed_steps = 0
steps_to_do = 2000*3000
part_info = ANY
# Need a known value for the readout time and array height
# Need a known value for the readout time, array height and
# shutter mode
self.child.parts["readoutTime"].attr.set_value(0.002)
self.child.parts["arrayHeight"].attr.set_value(270)
choices = ["Rolling", "Global"]
self.child.parts["shutterMode"].attr.meta.set_choices(choices)
self.child.parts["shutterMode"].attr.set_value("Rolling")
self.o.configure(
self.context, completed_steps, steps_to_do, part_info, params)
# Need to wait for the spawned mock start call to run
Expand Down

0 comments on commit 530cb39

Please sign in to comment.