def get_id(self) -> str: if self._initialized: return self._uid else: raise microscope.IncompatibleStateError( "uid is not available until after initialisation" )
def _purge_buffers(self): """Purge buffers on both camera and PC.""" _logger.debug("Purging buffers.") self._buffers_valid = False if self._acquiring: raise microscope.IncompatibleStateError( "Can not modify buffers while camera acquiring.") SDK3.Flush(self.handle) while True: try: self.buffers.get(block=False) except queue.Empty: break
def apply_pattern(self, pattern: numpy.ndarray) -> None: """Apply this pattern. Raises: microscope.IncompatibleStateError: if device trigger type is not set to software. """ if self.trigger_type is not microscope.TriggerType.SOFTWARE: # An alternative to error is to change the trigger type, # apply the pattern, then restore the trigger type, but # that would clear the queue on the device. It's better # to have the user specifically do it. See issue #61. raise microscope.IncompatibleStateError( "apply_pattern requires software trigger type" ) self._validate_patterns(pattern) self._do_apply_pattern(pattern)
def trigger(self) -> None: """Trigger device. The actual effect is device type dependent. For example, on a `Camera` it triggers image acquisition while on a `DeformableMirror` it applies a queued pattern. See documentation for the devices implementing this interface for details. Raises: microscope.IncompatibleStateError: if trigger type is not set to `TriggerType.SOFTWARE`. """ if self.trigger_type is not microscope.TriggerType.SOFTWARE: raise microscope.IncompatibleStateError( "trigger type is not software" ) _logger.debug("trigger by software") self._do_trigger()
def _do_trigger(self) -> None: raise microscope.IncompatibleStateError( "trigger does not make sense in trigger mode bulb, only enable")