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))
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
def __del__(self) -> None: status = BMC.Close(self._dm) if status: warnings.warn(BMC.ErrorString(status), RuntimeWarning) super().__del__()
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))
def __del__(self): status = BMC.Close(self._dm) if status: warnings.warn(BMC.ErrorString(status), RuntimeWarning) super(BMCDeformableMirror, self).__del__()
def _do_shutdown(self) -> None: status = BMC.Close(self._dm) if status: warnings.warn(BMC.ErrorString(status), RuntimeWarning)
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))