Exemplo n.º 1
0
    def __init__(self, serial_number: str, **kwargs) -> None:
        super().__init__(**kwargs)
        self._dm = BMC.DM()

        if __debug__:
            BMC.ConfigureLog(os.devnull.encode(), BMC.LOG_ALL)
        else:
            BMC.ConfigureLog(os.devnull.encode(), BMC.LOG_OFF)

        status = BMC.Open(self._dm, serial_number.encode())
        if status:
            raise Exception(BMC.ErrorString(status))
Exemplo n.º 2
0
    def __init__(self, serial_number, **kwargs):
        super(BMCDeformableMirror, self).__init__(**kwargs)
        self._dm = BMC.DM()

        if __debug__:
            BMC.ConfigureLog(os.devnull.encode(), BMC.LOG_ALL)
        else:
            BMC.ConfigureLog(os.devnull.encode(), BMC.LOG_OFF)

        status = BMC.Open(self._dm, serial_number.encode())
        if status:
            raise Exception(BMC.ErrorString(status))

        self._n_actuators = self._dm.ActCount
Exemplo n.º 3
0
 def __del__(self) -> None:
     status = BMC.Close(self._dm)
     if status:
         warnings.warn(BMC.ErrorString(status), RuntimeWarning)
         super().__del__()
Exemplo n.º 4
0
 def apply_pattern(self, pattern: numpy.ndarray) -> None:
     self._validate_patterns(pattern)
     data_pointer = pattern.ctypes.data_as(ctypes.POINTER(ctypes.c_double))
     status = BMC.SetArray(self._dm, data_pointer, None)
     if status:
         raise Exception(BMC.ErrorString(status))
Exemplo n.º 5
0
 def __del__(self):
     status = BMC.Close(self._dm)
     if status:
         warnings.warn(BMC.ErrorString(status), RuntimeWarning)
         super(BMCDeformableMirror, self).__del__()
Exemplo n.º 6
0
 def _do_shutdown(self) -> None:
     status = BMC.Close(self._dm)
     if status:
         warnings.warn(BMC.ErrorString(status), RuntimeWarning)
Exemplo n.º 7
0
 def _do_apply_pattern(self, pattern: numpy.ndarray) -> None:
     data_pointer = pattern.ctypes.data_as(ctypes.POINTER(ctypes.c_double))
     status = BMC.SetArray(self._dm, data_pointer, None)
     if status:
         raise microscope.DeviceError(BMC.ErrorString(status))