GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing python-microscope.org — ABCs — Python Microscope ABCs¶At the core of Microscope are the Abstract Base Classes (ABC) for the
different device types. ABCs are a way to enforce a defined interface
by requiring those subclassing from them, the concrete classes, to
implement the declared abstract methods. For example,
Microscope has the following ABCs that map to a specific device type:
In addition, they all subclass from There is an additional special device class
The actual concrete classes, those which provide actual control over the devices, are listed on the section Supported Devices. In addition to the different device ABC, there is
Finally, Settings¶Many microscope devices have specialised features which, when not unique, are very specific to the hardware. For example, some cameras have the option of applying noise filters during acquisition or provide control over amplifiers in the different stages of the readout. Being so specialised, such features do not fit in the ABC of their device type. To supported these features, Microscope has the concept of “Settings”. Settings map a name, such as “TemperatureSetPoint” or
“PREAMP_DELAY”, to their setters and getters which act at the lowest
level available. Those getter/setter are not exposed and only
available via the camera.get_setting("TemperatureSetPoint") # Some settings are readonly, so check first if not camera.describe_setting("TemperatureSetPoint")["readonly"]: camera.set_setting("TemperatureSetPoint", -5) Settings often overlap with the defined interface. For example,
The use of settings is a powerful feature that provides a more direct access to the device but this comes at the cost of reduced interoperability, i.e., code written using settings becomes tied to that specific hardware which makes it hard to later replace the device with a different one. In addition, settings also bypass the rest of the device code and it is possible for settings to lead a device into an unknown state. Once settings are used, there is no more promise on the behaviour of the device interface. If possible, avoid use of settings and prefer methods defined by the ABC. An alternative to the current settings scheme would be to declare a
method for each setting on the concrete device classes. There are a
few reasons not to. First, many classes support a wide range of
models, for example, |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |