From 2372ba26e19bfd8aeafed0fbf468650a63a1fbef Mon Sep 17 00:00:00 2001 From: jtc42 Date: Sat, 21 Dec 2019 13:18:02 +0000 Subject: [PATCH] Added some basic docs (waiting on auto-doc for args) --- .../api/v2/views/actions/camera.py | 8 ++++++++ .../api/v2/views/actions/stage.py | 4 ++++ openflexure_microscope/api/v2/views/captures.py | 15 +++++++++++++++ .../common/flask_labthings/labthing.py | 1 + 4 files changed, 28 insertions(+) diff --git a/openflexure_microscope/api/v2/views/actions/camera.py b/openflexure_microscope/api/v2/views/actions/camera.py index f3b59802..ab0b95e5 100644 --- a/openflexure_microscope/api/v2/views/actions/camera.py +++ b/openflexure_microscope/api/v2/views/actions/camera.py @@ -56,6 +56,11 @@ class CaptureAPI(Resource): class GPUPreviewStartAPI(Resource): + """ + Start the onboard GPU preview. + Optional "window" parameter can be passed to control the position and size of the preview window, + in the format ``[x, y, width, height]``. + """ def post(self): microscope = find_device("openflexure_microscope") payload = JsonResponse(request) @@ -76,6 +81,9 @@ class GPUPreviewStartAPI(Resource): class GPUPreviewStopAPI(Resource): + """ + Start the onboard GPU preview. + """ def post(self): microscope = find_device("openflexure_microscope") microscope.camera.stop_preview() diff --git a/openflexure_microscope/api/v2/views/actions/stage.py b/openflexure_microscope/api/v2/views/actions/stage.py index 069ed059..e1df4553 100644 --- a/openflexure_microscope/api/v2/views/actions/stage.py +++ b/openflexure_microscope/api/v2/views/actions/stage.py @@ -9,6 +9,10 @@ import logging class MoveStageAPI(Resource): + """ + Handle stage movements. + """ + def post(self): microscope = find_device("openflexure_microscope") # Create response object diff --git a/openflexure_microscope/api/v2/views/captures.py b/openflexure_microscope/api/v2/views/captures.py index 05c98624..ebf81a38 100644 --- a/openflexure_microscope/api/v2/views/captures.py +++ b/openflexure_microscope/api/v2/views/captures.py @@ -12,6 +12,9 @@ from openflexure_microscope.common.flask_labthings.find import find_device class CaptureList(Resource): + """ + List all image captures + """ def get(self): microscope = find_device("openflexure_microscope") image_list = microscope.camera.images @@ -19,6 +22,9 @@ class CaptureList(Resource): class CaptureResource(Resource): + """ + Description of a single image capture + """ def get(self, id): microscope = find_device("openflexure_microscope") capture_obj = microscope.camera.image_from_id(id) @@ -41,6 +47,9 @@ class CaptureResource(Resource): class CaptureDownload(Resource): + """ + Image data for a single image capture + """ def get(self, id, filename): microscope = find_device("openflexure_microscope") @@ -73,6 +82,9 @@ class CaptureDownload(Resource): class CaptureTags(Resource): + """ + Tags associated with a single image capture + """ def get(self, id): microscope = find_device("openflexure_microscope") @@ -120,6 +132,9 @@ class CaptureTags(Resource): class CaptureMetadata(Resource): + """ + All metadata associated with a single image capture + """ def get(self, id): microscope = find_device("openflexure_microscope") capture_obj = microscope.camera.image_from_id(id) diff --git a/openflexure_microscope/common/flask_labthings/labthing.py b/openflexure_microscope/common/flask_labthings/labthing.py index e917ca50..0ec5264a 100644 --- a/openflexure_microscope/common/flask_labthings/labthing.py +++ b/openflexure_microscope/common/flask_labthings/labthing.py @@ -225,6 +225,7 @@ class LabThing(object): return endpoint in self.endpoints ### Description + def td(self): """ W3C-style Thing Description