def testSetExposureTime(self): callback = unittest.mock.Mock() self.args['callbacks'] = {'setExposureTime' : callback} camera = cockpit.handlers.camera.CameraHandler(**self.args) camera.setExposureTime(50) callback.assert_called_with('mock', 50)
def prepareHandlers(self): # Store the pre-experiment altitude. self.initialAltitude = cockpit.interfaces.stageMover.getPosition()[-1] # Ensure that we're the only ones moving things around. cockpit.interfaces.stageMover.waitForStop() # TODO: Handling multiple movers on an axis is broken. Do not proceed if # anything but the innermost Z mover is selected. Needs a proper fix. if (cockpit.interfaces.stageMover.mover.curHandlerIndex < len(depot.getSortedStageMovers()[2]) - 1): wx.MessageBox("Wrong axis mover selected.") raise Exception("Wrong axis mover selected.") # Prepare our position. cockpit.interfaces.stageMover.goToZ(self.altBottom, shouldBlock=True) self.zStart = cockpit.interfaces.stageMover.getAllPositions()[-1][-1] events.publish('prepare for experiment', self) # Prepare cameras. for camera in self.cameras: # We set the expsoure time here. This needs to be set before # the action table is generated, since the action table # uses camera.getExposureTime to figure out timings. exposureTime = float(self.getExposureTimeForCamera(camera)) camera.setExposureTime(exposureTime)