Loading openflexure_microscope/camera/base.py +6 −2 Original line number Diff line number Diff line Loading @@ -137,12 +137,16 @@ class BaseCamera(metaclass=ABCMeta): @abstractmethod def apply_config(self, config: dict): """Update settings from a config dictionary""" pass with self.lock: # Apply valid config params to camera object for key, value in config.items(): # For each provided setting if hasattr(self, key): # If the instance has a matching property setattr(self, key, value) # Set to the target value @abstractmethod def read_config(self) -> dict: """Return the current settings as a dictionary""" pass return {"paths": self.paths} def __enter__(self): """Create camera on context enter.""" Loading openflexure_microscope/camera/mock.py +6 −2 Original line number Diff line number Diff line Loading @@ -75,12 +75,16 @@ class MockStreamer(BaseCamera): Return config dictionary of the PiCameraStreamer. """ conf_dict = { # Get config items from the base class conf_dict = BaseCamera.read_config(self) # Include device-specific config items conf_dict.update({ "stream_resolution": self.stream_resolution, "image_resolution": self.image_resolution, "numpy_resolution": self.numpy_resolution, "jpeg_quality": self.jpeg_quality, } }) return conf_dict Loading openflexure_microscope/camera/pi.py +8 −3 Original line number Diff line number Diff line Loading @@ -109,15 +109,20 @@ class PiCameraStreamer(BaseCamera): Return config dictionary of the PiCameraStreamer. """ conf_dict = { # Get config items from the base class conf_dict = BaseCamera.read_config(self) # Include device-specific config items conf_dict.update({ "stream_resolution": self.stream_resolution, "image_resolution": self.image_resolution, "numpy_resolution": self.numpy_resolution, "jpeg_quality": self.jpeg_quality, "picamera_settings": {}, } }) # PiCamera parameters # Include a subset of picamera properties # TODO: Expand this subset so we have more metadata? for key in PiCameraStreamer.picamera_settings_keys: try: value = getattr(self.camera, key) Loading Loading
openflexure_microscope/camera/base.py +6 −2 Original line number Diff line number Diff line Loading @@ -137,12 +137,16 @@ class BaseCamera(metaclass=ABCMeta): @abstractmethod def apply_config(self, config: dict): """Update settings from a config dictionary""" pass with self.lock: # Apply valid config params to camera object for key, value in config.items(): # For each provided setting if hasattr(self, key): # If the instance has a matching property setattr(self, key, value) # Set to the target value @abstractmethod def read_config(self) -> dict: """Return the current settings as a dictionary""" pass return {"paths": self.paths} def __enter__(self): """Create camera on context enter.""" Loading
openflexure_microscope/camera/mock.py +6 −2 Original line number Diff line number Diff line Loading @@ -75,12 +75,16 @@ class MockStreamer(BaseCamera): Return config dictionary of the PiCameraStreamer. """ conf_dict = { # Get config items from the base class conf_dict = BaseCamera.read_config(self) # Include device-specific config items conf_dict.update({ "stream_resolution": self.stream_resolution, "image_resolution": self.image_resolution, "numpy_resolution": self.numpy_resolution, "jpeg_quality": self.jpeg_quality, } }) return conf_dict Loading
openflexure_microscope/camera/pi.py +8 −3 Original line number Diff line number Diff line Loading @@ -109,15 +109,20 @@ class PiCameraStreamer(BaseCamera): Return config dictionary of the PiCameraStreamer. """ conf_dict = { # Get config items from the base class conf_dict = BaseCamera.read_config(self) # Include device-specific config items conf_dict.update({ "stream_resolution": self.stream_resolution, "image_resolution": self.image_resolution, "numpy_resolution": self.numpy_resolution, "jpeg_quality": self.jpeg_quality, "picamera_settings": {}, } }) # PiCamera parameters # Include a subset of picamera properties # TODO: Expand this subset so we have more metadata? for key in PiCameraStreamer.picamera_settings_keys: try: value = getattr(self.camera, key) Loading