diff --git a/docs/requirements.txt b/docs/requirements.txt index 6ba8bc78..9aa2c29a 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1 +1,2 @@ -sphinxcontrib.httpdomain \ No newline at end of file +sphinxcontrib.httpdomain +sphinx_rtd_theme \ No newline at end of file diff --git a/docs/source/apirequests.rst b/docs/source/apirequests.rst index e828614b..2c836c15 100644 --- a/docs/source/apirequests.rst +++ b/docs/source/apirequests.rst @@ -42,21 +42,23 @@ CURL .. code-block:: none curl -X POST -H "Content-Type: application/json" -d \\ - '{"picamera_settings": {"shutter_speed": 2000}, "jpeg_quality": 90}' http://192.168.1.126:5000/api/v1/config + '{"camera_settings": {"picamera_settings": {"shutter_speed": 2000}, "jpeg_quality": 90}}' http://192.168.1.126:5000/api/v1/config HTTPie ++++++ .. code-block:: none - http POST http://192.168.1.126:5000/api/v1/config jpeg_quality:=90 picamera_settings:='{"shutter_speed": 2000}' + http POST http://192.168.1.126:5000/api/v1/config camera_settings:='{"jpeg_quality": 90, "picamera_settings": {"shutter_speed": 2000}}' Python Requests +++++++++++++++ .. code-block:: python json_payload = { - "jpeg_quality": 90, - "picamera_settings": {"shutter_speed": 2000} + camera_settings: { + "jpeg_quality": 90, + "picamera_settings": {"shutter_speed": 2000} + } } requests.post('http://192.168.1.126:5000/api/v1/config', json=json_payload) diff --git a/docs/source/config.rst b/docs/source/config.rst index 2444e860..9ddbde71 100644 --- a/docs/source/config.rst +++ b/docs/source/config.rst @@ -1,5 +1,5 @@ Microscope configuration -======================================================= +======================== .. toctree:: :maxdepth: 2 @@ -18,7 +18,7 @@ in separate "auxillary" config files, and are linked together by adding the conf microscope RC file. This is set up by default, as shown below: Default microscope_settings.yaml -+++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++ .. code-block:: yaml # Resolutions for streaming and capture @@ -58,7 +58,7 @@ Example picamera_settings.yaml Loading the runtime-config -+++++++ +++++++++++++++++++++++++++ By default, a microscope object will load the a runtime-config from the default location. This RC can then be passed to any hardware attached to the microscope. This can be particularly diff --git a/docs/source/plugins/class.rst b/docs/source/plugins/class.rst index 87366775..205a7071 100644 --- a/docs/source/plugins/class.rst +++ b/docs/source/plugins/class.rst @@ -22,12 +22,17 @@ Lock module Default plugins --------------- -Microscope plugin -+++++++++++++++++ -.. automodule:: openflexure_microscope.plugins.default.plugin +Autofocus ++++++++++ +.. automodule:: openflexure_microscope.plugins.default.autofocus :members: -Web API plugin -++++++++++++++ -.. automodule:: openflexure_microscope.plugins.default.api +Camera calibration +++++++++++++++++++ +.. automodule:: openflexure_microscope.plugins.default.camera_calibration :members: + +Scan and Stack +++++++++++++++ +.. automodule:: openflexure_microscope.plugins.default.scan + :members: \ No newline at end of file diff --git a/docs/source/plugins/introduction.rst b/docs/source/plugins/introduction.rst index 36b8e54d..50d163fb 100644 --- a/docs/source/plugins/introduction.rst +++ b/docs/source/plugins/introduction.rst @@ -26,7 +26,7 @@ Generally, for adding anything other than very simple functionality, plugins sho The main restriction is that the plugin package must be importable using an absolute import from within the Python environment being used to load your microscope. Loading plugins with microscope_settings.yaml --------------------------------------- +--------------------------------------------- Both types of plugin are loaded by specifying the plugin class in your :ref:`MicroscopeRC`. In the case of a single-file plugin, specify the path to the plugin file, followed by the name of your :py:class:`openflexure_microscope.plugins.MicroscopePlugin` child class, separated by a colon. For packaged plugins, specify the absolute module name in place of the path. For example, the plugins section of your microscope_settings.yaml file may look like: diff --git a/openflexure_microscope/api/app.py b/openflexure_microscope/api/app.py index d2931aa5..44e99e7a 100644 --- a/openflexure_microscope/api/app.py +++ b/openflexure_microscope/api/app.py @@ -148,6 +148,12 @@ app.register_blueprint(task_blueprint, url_prefix=uri('/task', 'v1')) def routes(): """ List of all connected API routes + + .. :quickref: System; Routes + + :>header Accept: application/json + :>header Content-Type: application/json + :status 200: stream active """ return jsonify(list_routes(app)) @@ -156,6 +162,12 @@ def routes(): def err_log(): """ Most recent 1mb of log output + + .. :quickref: System; Log + + :>header Accept: application/json + :>header Content-Type: application/json + :status 200: stream active """ timestamp = datetime.now().strftime("%Y-%m-%d_%H-%M-%S") return send_file( diff --git a/openflexure_microscope/api/v1/blueprints/base.py b/openflexure_microscope/api/v1/blueprints/base.py index 2195a025..24681f0d 100644 --- a/openflexure_microscope/api/v1/blueprints/base.py +++ b/openflexure_microscope/api/v1/blueprints/base.py @@ -100,35 +100,36 @@ class ConfigAPI(MicroscopeView): Content-Type: application/json { - "image_resolution": [ - 2592, - 1944 - ], - "jpeg_quality": 75, - "name": "0e2c6fac5421429aac67c7903107bdd8", - "numpy_resolution": [ - 1312, - 976 - ], - "picamera_settings": { - "analog_gain": 1.0, - "digital_gain": 1.0, - "awb_gains": [ - 0.92578125, - 2.94921875 - ], - "awb_mode": "off", - "exposure_mode": "off", - "framerate": 24.0, - "saturation": 0, - "shutter_speed": 5378 - }, + "id": "0e2c6fac5421429aac67c7903107bdd8", + "name": "docuscope-2000", + "fov": [4100, 3146], + "camera_settings": { + "image_resolution": [2592, 1944], + "numpy_resolution": [1312, 976], + "video_resolution": [832, 624], + "jpeg_quality": 75, + "picamera_settings": { + "analog_gain": 1.0, + "digital_gain": 1.0, + "awb_gains": [0.92578125, 2.94921875], + "awb_mode": "off", + "exposure_mode": "off", + "framerate": 24.0, + "saturation": 0, + "shutter_speed": 5378 + }, + }, + "stage_settings": { + "backlash": { + "x": 256, + "y": 256, + "z": 0 + } + } "plugins": [ - "openflexure_microscope.plugins.default:Plugin" - ], - "stream_resolution": [ - 832, - 624 + "openflexure_microscope.plugins.default.autofocus:AutofocusPlugin", + "openflexure_microscope.plugins.default.scan:ScanPlugin", + "openflexure_microscope.plugins.default.camera_calibration:Plugin" ] } @@ -152,18 +153,52 @@ class ConfigAPI(MicroscopeView): Accept: application/json { - "analog_gain": 1.0, - "digital_gain": 1.0, - "jpeg_quality": 75, - "picamera_params": { - "framerate": 24.0, - "saturation": 0, - "shutter_speed": 5000 + "id": "0e2c6fac5421429aac67c7903107bdd8", + "name": "docuscope-2000", + "fov": [4100, 3146], + "camera_settings": { + "image_resolution": [2592, 1944], + "numpy_resolution": [1312, 976], + "video_resolution": [832, 624], + "jpeg_quality": 75, + "picamera_settings": { + "analog_gain": 1.0, + "digital_gain": 1.0, + "awb_gains": [0.92578125, 2.94921875], + "awb_mode": "off", + "exposure_mode": "off", + "framerate": 24.0, + "saturation": 0, + "shutter_speed": 5378 + }, + }, + "stage_settings": { + "backlash": { + "x": 256, + "y": 256, + "z": 0 + } } + "plugins": [ + "openflexure_microscope.plugins.default.autofocus:AutofocusPlugin", + "openflexure_microscope.plugins.default.scan:ScanPlugin", + "openflexure_microscope.plugins.default.camera_calibration:Plugin" + ] } :>header Accept: application/json + :