Julian Stirling
26e265f026
Fixes from review (mostly spellings)
...
Co authored by:
* Joe Knapper <jaknapper@hotmail.com>
* Beth Probert <beth_probert@outlook.com>
2025-04-10 16:35:49 +00:00
Julian Stirling
840c527cc2
Remove unused Stitching Thing
2025-04-10 13:53:51 +01:00
Julian Stirling
a5d55c95b8
Further tidying of scan directory variables
2025-04-10 13:24:11 +01:00
Julian Stirling
90cfce146d
Fix default scan name
2025-04-10 11:46:16 +01:00
Julian Stirling
040373ef88
Run check background aonly fter scan variables are stored
2025-04-10 11:45:57 +01:00
Julian Stirling
83d2930d1f
Fix capture error handing
...
The error handling for capture needs to still send the aquired event
or it will lock forever. On getting the errors to work there
were some other minor issues in how the errors were called.
2025-04-09 23:52:47 +01:00
Julian Stirling
70e7a21a29
Starting to refactor smart scan to rely on class variables
2025-04-09 22:55:35 +01:00
Julian Stirling
ff1184d453
Handle errors in capture thread
2025-04-09 22:45:18 +01:00
Joe Knapper
1d5d67f35a
Split out background detect into a new file
2025-04-09 17:25:19 +01:00
Joe Knapper
f4db9b6e52
Removed commented out code and unused functions
2025-04-09 15:32:13 +01:00
jaknapper
a5d1f1e965
Removed commented out code
2025-04-09 15:11:26 +01:00
jaknapper
e28a160b22
Ruff formatting adding commas
2025-04-09 14:59:20 +01:00
jaknapper
8d14aee27c
Breaking out capture and save code into three seperate methods
2025-04-09 13:20:06 +01:00
jaknapper
9c2ab977c5
Removed imports and variable to pass Ruff linting
2025-04-08 19:07:23 +01:00
jaknapper
574aa1c6c0
Only grab a JPEG from the stream to get scanning working
2025-04-08 17:52:55 +01:00
Joe Knapper
d4247235e3
Merge branch 'csm-return-to-start' into 'v3'
...
CSM always returns to start on error
See merge request openflexure/openflexure-microscope-server!227
2025-04-08 12:49:38 +00:00
Joe Knapper
e4ef8b2717
Merge branch 'consistent-logging' into 'v3'
...
Stop uvicorn.run disabling existing loggers
Closes #284
See merge request openflexure/openflexure-microscope-server!228
2025-04-08 11:31:33 +00:00
jaknapper
b340da488e
Use the UV channels only to determine if an area is background or sample
2025-04-08 11:14:17 +01:00
Julian Stirling
1493f51212
Purge all windows line endings and add check to formatter.
...
Also changes python version in pyproject.toml as it is incorrect
2025-04-08 10:51:26 +01:00
Julian Stirling
3a47151694
Serve logfile and logs for UI seperately
2025-04-07 23:45:19 +01:00
Julian Stirling
70d9e2f758
Add custom log handler for sending logs to UI
2025-04-07 23:16:00 +01:00
jaknapper
33c74741fe
Fixed import and re-raise cancelled error
2025-04-07 15:46:20 +01:00
Joe Knapper
a506625e40
Treat cancellation and other errors differently
2025-04-07 14:22:43 +01:00
Joe Knapper
9995e5b3bb
Import custom Mapping error from camera_stage_mapping
2025-04-07 14:18:07 +01:00
Julian Stirling
dd0b30df51
Stop uvicorn.run disabling existing loggers
2025-04-06 15:26:39 +01:00
jaknapper
67443ff939
Capture ValueErrors, which covers most CSM errors, not all Exceptions
2025-04-03 13:52:04 +01:00
jaknapper
46d513d9e6
Catch cancelled and other errors in single line
2025-04-02 18:25:35 +01:00
Joe Knapper
79b396a66f
CSM always returns to start on error
2025-04-02 17:54:12 +01:00
Julian Stirling
32f2a7ce70
Fix spurious line endings, don't allow ruff-format to fail anymore
2025-04-02 14:25:22 +01:00
Richard Bowman
83e10b125b
Fix return type annotation for autofocus
2024-12-18 14:23:58 +00:00
Richard Bowman
9fd8fc37f1
Formatted with Ruff
2024-12-03 06:46:08 +00:00
Richard Bowman
27aec769a2
Linter fixes
...
NB I have permitted bare except: blocks in smart_scan. This should be reverted.
2024-12-03 06:43:45 +00:00
Richard Bowman
57177c6a56
Sped up camera and got CSM passing
...
Using lower resolution helps speed it up, and skipping CSM settling time makes a big difference.
2024-12-03 06:35:16 +00:00
Richard Bowman
1e7069b375
Add more tests, speed up dummy stage
...
I've sped up the stage motion, to run tests in a more reasonable time.
CSM doesn't yet calibrate in the test - I suspect debugging of capture_array
is needed.
2024-12-03 00:16:26 +00:00
Richard Bowman
bccb1ee923
Stub class for camera protocol
...
As with the previous commit, this adds a concrete stub Thing to enable
DirectThingClient generation, so we
can depend on the camera.
2024-11-29 12:53:42 +00:00
Richard Bowman
a0fbbc3e40
Convert Stage to a Protocol
...
The Stage is now implemented as a runtime-checkable Protocol.
Part of this led to the realisation that we can't create a DirectThingClient
based on a Protocol, only on a concrete Thing. While it might be
a good idea to address that in LabThings in due course, for now
we work around it by creating both a Protocol and a stub class. The stub class implements the protocol, and
can be used to declare a dependency.
2024-11-29 12:53:04 +00:00
Richard Bowman
2e2e877d75
JPEGBlob class definition
...
Static type checking is easier if JPEGBlob is declared as a class, rather than
being created with a function.
2024-11-29 12:19:05 +00:00
Richard Bowman
adbb805556
Formal Protocol for camera interface
...
I've now split the base camera code into a runtime-checkable Protocol
and a concrete base class (which is optional). This removes the requirement
for cameras to subclass `openflexure_microscope.things.camera.Camera`
and instead uses duck typing that should
work both statically and dynamically.
As part of this, I've moved the commonly-used dependencies
on the camera inside `openflexure_microscope.things.camera` for consistency, and to make it easy to update them if it changes in the future.
2024-11-29 11:26:38 +00:00
Richard Bowman
1ba799de22
Migrate to new Blob type and update imports
...
This now uses the latest version of labthings-fastapi.
2024-11-28 17:35:56 +00:00
Richard Bowman
868aa0598c
Simulation mode
...
I successfully calibrated and used the camera-stage mapping.
2024-11-02 00:10:25 +00:00
Richard Bowman
2019234ad1
Close OpenCV camera cleanly
2024-08-09 02:50:39 +01:00
Richard Bowman
2268425bf3
Depend only on generic Camera and Stage
...
I've now defined parent classes for camera and stage, and depend only on those. This allows
proper typing while enabling the actual hardware
classes to be swapped.
The interfaces definitely aren't final - this is a first
draft, largely to enable me to test out the concept
of a configuration server.
2024-08-09 02:41:39 +01:00
Richard Bowman
aa49cfcba3
Search the package for static files
...
This isn't foolproof: a zipped package will break it.
If that's something we want to support, we might
need to extract the folder to a temp location.
2024-08-09 02:39:04 +01:00
Richard Bowman
e3e248c46e
Move server config to a config file
...
Currently this is "just" a LabThings config file.
2024-08-09 01:51:11 +01:00
Richard Bowman
b7f9f6cbaf
Fix import from LabThings
2024-08-09 01:50:46 +01:00
Richard Bowman
5279dffe6a
Dummy stage class
2024-08-09 01:12:16 +01:00
Richard Bowman
3f92ed8266
Add a stub OpenCV-based camera
...
This allows the server to run on a laptop, to some extent. I've not tested if this will make the whole
web app work properly.
As StreamingPiCamera2 is hardcoded in various places, this certainly doesn't make cameras totally
interchangeable - but it is a step towards that.
2024-08-09 00:52:31 +01:00
Richard Bowman
c32b44d1a6
Refactor server into submodule
2024-08-09 00:49:24 +01:00
Joe Knapper
4ea3b5b623
Increase minimum fraction coverage - makes stitching much more reliable
2024-05-30 11:42:25 +00:00
jaknapper
f08840f0e8
Zip a stitched image with the scan name in the filename
2024-03-05 13:38:24 +00:00