diff --git a/openflexure_microscope/camera/pi.py b/openflexure_microscope/camera/pi.py index 18186236..ee4d53ee 100644 --- a/openflexure_microscope/camera/pi.py +++ b/openflexure_microscope/camera/pi.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """ -Raspberry Pi camera implementation of the StreamingCamera class. +Raspberry Pi camera implementation of the PiCameraStreamer class. NOTES: Still port used for image capture @@ -12,7 +12,7 @@ Video port: Splitter port 2: Video capture Splitter port 3: [Currently unused] -StreamingCamera streams at video_resolution +PiCameraStreamer streams at video_resolution Camera capture resolution set to stream_resolution in frames() Video port uses that resolution for everything. If a different resolution is specified for video capture, this is handled by the resizer. @@ -41,8 +41,8 @@ from .set_picamera_gain import set_analog_gain, set_digital_gain # MAIN CLASS -class StreamingCamera(BaseCamera): - """Raspberry Pi camera implementation of StreamingCamera.""" +class PiCameraStreamer(BaseCamera): + """Raspberry Pi camera implementation of PiCameraStreamer.""" picamera_settings_keys = [ 'exposure_mode', 'analog_gain', @@ -61,7 +61,7 @@ class StreamingCamera(BaseCamera): # Attach to Pi camera self.camera = picamera.PiCamera() #: :py:class:`picamera.PiCamera`: Picamera object - # Store state of StreamingCamera + # Store state of PiCameraStreamer self.state.update({ 'stream_active': False, 'record_active': False, @@ -87,7 +87,7 @@ class StreamingCamera(BaseCamera): pass def close(self): - """Close the Raspberry Pi StreamingCamera.""" + """Close the Raspberry Pi PiCameraStreamer.""" # Run BaseCamera close method BaseCamera.close(self) # Detach Pi camera @@ -97,7 +97,7 @@ class StreamingCamera(BaseCamera): # HANDLE SETTINGS def read_config(self) -> dict: """ - Return config dictionary of the StreamingCamera. + Return config dictionary of the PiCameraStreamer. """ conf_dict = { @@ -109,7 +109,7 @@ class StreamingCamera(BaseCamera): } # PiCamera parameters - for key in StreamingCamera.picamera_settings_keys: + for key in PiCameraStreamer.picamera_settings_keys: try: value = getattr(self.camera, key) logging.debug("Reading PiCamera().{}: {}".format(key, value)) @@ -121,7 +121,7 @@ class StreamingCamera(BaseCamera): def apply_config(self, config: dict): """ - Write a config dictionary to the StreamingCamera config. + Write a config dictionary to the PiCameraStreamer config. The passed dictionary may contain other parameters not relevant to camera config. Eg. Passing a general config file will work fine. @@ -132,7 +132,7 @@ class StreamingCamera(BaseCamera): # TODO: Include timing and batching logic when applying PiCamera settings paused_stream = False - logging.debug("StreamingCamera: Applying config:") + logging.debug("PiCameraStreamer: Applying config:") logging.debug(config) with self.lock: @@ -150,7 +150,7 @@ class StreamingCamera(BaseCamera): if 'picamera_settings' in config: # If new settings are given self.apply_picamera_settings(config['picamera_settings'], pause_for_effect=True) - # StreamingCamera parameters + # PiCameraStreamer parameters for key, value in config.items(): # For each provided setting if (key != 'picamera_settings') and hasattr(self, key): setattr(self, key, value) diff --git a/tests/test_camera.py b/tests/test_camera.py index a1271592..0188fa2f 100644 --- a/tests/test_camera.py +++ b/tests/test_camera.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -from openflexure_microscope.camera.pi import StreamingCamera, CaptureObject +from openflexure_microscope.camera.pi import PiCameraStreamer, CaptureObject import os import io @@ -279,7 +279,7 @@ class TestThreadStarting(unittest.TestCase): if __name__ == '__main__': - with StreamingCamera() as camera: + with PiCameraStreamer() as camera: suites = [ unittest.TestLoader().loadTestsFromTestCase(TestCaptureMethods), diff --git a/tests/test_plugins.py b/tests/test_plugins.py index 4eb3d61c..82b3b9f6 100644 --- a/tests/test_plugins.py +++ b/tests/test_plugins.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -from openflexure_microscope.camera.pi import StreamingCamera +from openflexure_microscope.camera.pi import PiCameraStreamer from openflexure_stage import OpenFlexureStage from openflexure_microscope import Microscope, config @@ -31,7 +31,7 @@ class TestPluginMethods(unittest.TestCase): if __name__ == '__main__': - with Microscope(StreamingCamera(), OpenFlexureStage("/dev/ttyUSB0")) as microscope: + with Microscope(PiCameraStreamer(), OpenFlexureStage("/dev/ttyUSB0")) as microscope: microscope.plugin.attach("openflexure_microscope.plugins.testing:Plugin")