Interfacing to hardware

In order to provide compatibility with a wide range of different hardware libraries and programming styles, we do not require subclassing or use as a mixin to add functionality to a stage or camera. Instead, each calibration routine requires functions that allow it to control the hardware. These functions are deliberately kept minimal, and we have tried to name them consistently throughout the API. The required functions are:

  • move(pos): Perform an absolute move of the stage. The position pos is specified as a 2- or 3-element ndarray. For stages that support only relative moves, it is fairly simple to emulate absolute moves by keeping track of the current position in software. A wrapper function to do this is planned but not yet implemented.

  • get_position(): Retrieve the absolute position of the stage. Returns a 2- or 3-element ndarray. Any datatype that can be converted using numpy.array() should work.

  • grab_image(): Acquire an image from the camera, as an ndarray. This should have a shape of either (N, M, 3) or (N, M) depending on whether it is colour or monochrome. We have tested it with RGB images only, but monochrome or multi-channel images ought to work.

  • settle(): Ensure that the microscope has stopped vibrating after a move of the stage, and that the camera will return a fresh frame. Normally this involves some amount of waiting, and possibly the acquisition of one or more camera frames, which are then ignored.

Frequently, get_position() and grab_image() are bundled together into a Tracker object, which takes care of managing lists of points from both the camera and the stage.