Add module level docstrings.
This commit is contained in:
parent
80beeea07b
commit
2cb4003835
17 changed files with 70 additions and 2 deletions
|
|
@ -1,3 +1,5 @@
|
||||||
|
"""Test data collection from the Raspberry Picamera."""
|
||||||
|
|
||||||
from fastapi.testclient import TestClient
|
from fastapi.testclient import TestClient
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
"""Test changing and setting camerat modes on the Raspberry Picamera."""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from fastapi.testclient import TestClient
|
from fastapi.testclient import TestClient
|
||||||
|
|
|
||||||
|
|
@ -129,7 +129,6 @@ ignore = [
|
||||||
"D213", # incompatible with D212
|
"D213", # incompatible with D212
|
||||||
"D400", # A stricter version of #415 that doesn't allow !
|
"D400", # A stricter version of #415 that doesn't allow !
|
||||||
# The checkers below should be turned on as they complain about missing docstrings.
|
# The checkers below should be turned on as they complain about missing docstrings.
|
||||||
"D100",
|
|
||||||
"D102",
|
"D102",
|
||||||
"D101",
|
"D101",
|
||||||
"D103",
|
"D103",
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
"""A script for uploading data to Zenodo."""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from argparse import ArgumentParser, Namespace
|
from argparse import ArgumentParser, Namespace
|
||||||
from zenodo import Zenodo
|
from zenodo import Zenodo
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
"""A script for uploading to zenodo.
|
"""A script for packaging data for Zenodo.
|
||||||
|
|
||||||
Copyright (c) 2020 Bath Open Instrumentation Group
|
Copyright (c) 2020 Bath Open Instrumentation Group
|
||||||
Adapted from: https://gitlab.com/schlauch/zenodo-api-test/
|
Adapted from: https://gitlab.com/schlauch/zenodo-api-test/
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,16 @@
|
||||||
|
"""Configure logging for the OpenFlexure Server.
|
||||||
|
|
||||||
|
A module containing a custom logging handler and helper function for
|
||||||
|
the OpenFlexure server. These handle formatting logs, ensuring that logs
|
||||||
|
are logged both to a file and to the terminal (see note below!). Functionality
|
||||||
|
is also provided for retrieving logs for to send over HTTP.
|
||||||
|
|
||||||
|
Note that when running in production OpenFlexure Microscope the server is run via
|
||||||
|
``systemd``. As such, the logs that are sent to the terminal (STDERR) or any other
|
||||||
|
output to STDOUT/STDERR are captured by ``systemd``. These can be viewed by using
|
||||||
|
``journalctl`` or the ``ofm journal`` command.
|
||||||
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
from logging.handlers import RotatingFileHandler
|
from logging.handlers import RotatingFileHandler
|
||||||
import os
|
import os
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
"""Provide endpoints that mimic the v2 API for OpenFlexure Connect discoverability."""
|
||||||
|
|
||||||
import labthings_fastapi as lt
|
import labthings_fastapi as lt
|
||||||
from fastapi import Response
|
from fastapi import Response
|
||||||
from socket import gethostname
|
from socket import gethostname
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
"""Add endpoints for static files to the underlying FastAPI server."""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
"""Provide functionality for automatically recentring the Stage."""
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,10 @@
|
||||||
|
"""Provide functionality to detect if the camera is imaging sample or background.
|
||||||
|
|
||||||
|
An example background image must be captured and analysed by BackgroundDetectThing,
|
||||||
|
information from this images is used to detect whether the current camera field of
|
||||||
|
view contains sample.
|
||||||
|
"""
|
||||||
|
|
||||||
from typing import Mapping, Optional
|
from typing import Mapping, Optional
|
||||||
import cv2
|
import cv2
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,12 @@
|
||||||
|
"""The core sample scanning functionality for the OpenFlexure Microscope.
|
||||||
|
|
||||||
|
SmartScan provides sample scanning functionality including automatic background
|
||||||
|
dectection (via the `BackgroundDetectThing`) and automatic path planning via
|
||||||
|
`scan_planners`. It manages the directories of past scans via `scan_directories`.
|
||||||
|
It also controls external processes for live stitching composite images, and
|
||||||
|
the creation of the final stitched images.
|
||||||
|
"""
|
||||||
|
|
||||||
from typing import Optional, Mapping
|
from typing import Optional, Mapping
|
||||||
import threading
|
import threading
|
||||||
import os
|
import os
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
"""Functionality for mimicking a stage during simulation and testing."""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from collections.abc import Mapping
|
from collections.abc import Mapping
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
"""Provide a LabThings-FastAPI interface to the Sangaboard motor controller."""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
import logging
|
import logging
|
||||||
import threading
|
import threading
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,13 @@
|
||||||
|
"""Test the server without creating a full HTTP server and socket connection.
|
||||||
|
|
||||||
|
Rather than spinning up a full uvicorn webserver for each test these tests use
|
||||||
|
the FastAPI ``TestClient`` or to directly communicate with the underlying
|
||||||
|
LabThings-FastAPI code. This increases speed of testing significantly.
|
||||||
|
|
||||||
|
For tests that require a full running server see the ``integration-tests``
|
||||||
|
directory in the root of the repository.
|
||||||
|
"""
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
"""Test the functionality in the scan_directories module."""
|
||||||
|
|
||||||
import tempfile
|
import tempfile
|
||||||
import os
|
import os
|
||||||
import math
|
import math
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,9 @@
|
||||||
|
"""Test the scan planning algorithms of the Microscope.
|
||||||
|
|
||||||
|
As well as low level function by function tests, this test suite also provides tests
|
||||||
|
that simulate scanning a sample, checking that the expected path is followed.
|
||||||
|
"""
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from copy import copy
|
from copy import copy
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,9 @@
|
||||||
|
"""Utility functions for testing scan planners.
|
||||||
|
|
||||||
|
These including fake sample creation, scan path visualisation, and
|
||||||
|
persistent storage of expected scan paths for samples.
|
||||||
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import pickle
|
import pickle
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue