Commit graph

57 commits

Author SHA1 Message Date
Richard Bowman
e22f36b308 Start explicit metadata argument for marshmallow
A side effect of re-locking dependencies is having a newer marshmallow.
This deprecates having `description=` as a keyword, and puts it in a
separate metadata arg instead.

This commit is the start of my search-and-replaceing to update to the new
format.
2022-08-09 12:52:57 +01:00
Richard Bowman
e356d11e7e Linter/type checking fixes 2022-04-20 13:31:33 +01:00
Richard Bowman
18145d4b67 Refactored new (and some old) code to tidy up scan function
I have:
* Moved the autofocus and focus-prediction code into a
new `FocusManager` class.  This hopefully keeps the logic relating to
axial motion in one place.
* Moved set-up code relating to autofocus and background detection
into separate functions.
* Changed the scan path from a ragged list-of-lists to a one dimensional
list.  I've left the old 2D function and added a new 1D function that
calls it and coverts, so it's not a breaking change.

The actual sequence of moves executed, and the accompanying logic, is
unchanged from the previous commit.  I've tested this a couple of times,
on my microscope with actual hardware.
I don't think it's necessary to test more widely as this is only a
refactoring change, not an algorithm change.

The shift from 2D to 1D scan path was one I initially decided against,
because I was trying to keep the new code as small as possible, and
avoid refactoring what's already there.  Since I'm doing that anyway,
I have taken the opportunity to eliminate the concept of scan
"lines".

The old behaviour was to always use the position of the last point
as the starting point for the next autofocus.  There was an exception
to this for raster scans, where the big jump used the first point
of the last line instead.  The new behaviour always uses the closest
point, which reproduces this behaviour without the need for a hard
coded exception.

If the "fast" scan axis (y) has a longer step size than the "slow"
scan axis (x), we may base the autofocus off the previous row, rather
than the previous point in the current row.  I don't see that this
should be any less reliable than the current behaviour, and is
arguably better.  It's also unlikely to be noticed, because our
default scan settings have longer spacing in X.  I think the
reduced complexity of the code is definitely worth the small
chance of changing some edge-case behaviour.
2022-04-20 13:14:23 +01:00
Richard Bowman
7f66235cac Lint and type fixes 2022-04-06 23:36:55 +01:00
Richard Bowman
333b52aa9b background detect and better focus handling
The primary change here is that there's now an option
to skip autofocus if the background detect plugin says
the current image is background.

I have also overhauled the way it picks the next Z position
based on Joe's code; instead of just using the last point, it will
pick the closest point where we have a successful autofocus
recorded.  This will usually be the last point, except for raster
scans where it neatly reproduces the behaviour of the old code
but without needing to treat it as a special case (when we jump
back to the start of a line, it will use the z position of the start
of the previous line, rather than the end of the previous line).

This does represent a minor change to previous behaviour, but
it should not break anything that isn't already broken, i.e. it might
cause slightly odd behaviour if autofocus gives random results -
but probably indistinguishable from the current behaviour.
2022-04-06 23:15:25 +01:00
Richard
72f3c11fdd linting and typing fixes 2021-07-19 20:29:13 +01:00
Richard
f2a4b976b9 Fix whitespace 2021-05-13 10:43:50 +01:00
Richard Bowman
792e782968 Validate scan shape on the server
The scan API view now uses a schema with validation
constraints to enforce a minimum size of 1 in any dimension.
This requires better error handling in the app, which I've added.
It also needs a fix in LabThings so the error propagates correctly
2021-02-09 09:21:56 +00:00
Joel Collins
18a0eedd5e Fixed tile method reference 2020-11-30 16:57:54 +00:00
Joel Collins
8d0759e9e0 Updated default extensions to subclass structure 2020-11-30 16:41:39 +00:00
Joel Collins
7866ec0f47 Static type analysis 2020-11-30 13:36:45 +00:00
Joel Collins
b2192b2190 Fixed unused imports 2020-11-25 15:32:08 +00:00
Joel Collins
5137d1b9dc Added basic unit tests of non-integrated functions 2020-11-25 15:25:17 +00:00
Joel Collins
3451b8a8a5 Added full TileScanArgs schema 2020-11-12 16:56:28 +00:00
Joel Collins
6fb61e1e3f Reverted logging style 2020-11-12 15:45:58 +00:00
Joel Collins
9f5252194a Updated all log strings to new format 2020-11-12 15:12:17 +00:00
Joel Collins
601e51d9b9 Code formatting 2020-10-26 14:58:09 +00:00
Joel Collins
ef4e825b9c Merge branch 'temporary' into 'master'
Added a spiral scan option

See merge request openflexure/openflexure-microscope-server!75
2020-10-26 14:54:23 +00:00
Joel Collins
1677f0df76 Blackened 2020-10-19 18:34:58 +01:00
Joel Collins
4ae39db402 Revert scan to use old fast autofocus 2020-10-19 18:20:40 +01:00
Joel Collins
994e83dbeb Code cleanup 2020-10-14 14:56:29 +00:00
Joe Knapper
ad8fd54cb7 Added a spiral scan option 2020-10-14 15:52:44 +01:00
Joel Collins
2bfb988460 Code formatting 2020-10-13 15:02:19 +01:00
Joel Collins
1c0cc32b6c Close #166 2020-09-30 13:25:36 +01:00
Joel Collins
e110045dd3 Increased default_stop_timeout on TileScanAPI 2020-07-22 16:11:26 +01:00
Joel Collins
24398ba7dc Updated tasks nomenclature 2020-07-21 12:54:42 +01:00
Joel Collins
54c5605cb1 Removed use of deprecated current_task_stopped 2020-07-21 11:57:33 +01:00
Joel Collins
4bf866b66b Added fancy-stopping to scan task 2020-07-15 16:54:34 +01:00
Joel Collins
ab3c4b3745 Merge remote-tracking branch 'origin/master' into labthings-070 2020-07-03 18:13:20 +01:00
Joel Collins
6c0017be5a Added metadata cache key 2020-07-01 15:35:31 +01:00
Joel Collins
e6cb9f6b35 Initial 0.7.0 conversion 2020-06-29 15:24:59 +01:00
Joel Collins
9cecb477cb Flipped to explicit finite lock timeouts 2020-06-29 09:03:27 +01:00
Joel Collins
efdffa51e9 Added scan timing log 2020-06-11 16:58:14 +01:00
Joel Collins
677b08d509 Restructured scan extension 2020-05-22 11:20:12 +01:00
Joel Collins
eaf4cf09f5 Updated to new Action tasks 2020-05-12 11:29:53 +01:00
Joel Collins
28e555ad9b Added explicit endpoints 2020-05-10 16:35:16 +01:00
Joel Collins
45ee112e6f Fixed broken references 2020-04-28 14:40:09 +01:00
Joel Collins
caf553db7a Moved capture management into separate object 2020-04-28 14:32:56 +01:00
Joel Collins
9646058c37 Code format 2020-04-28 13:20:38 +01:00
Joel Collins
37dc7b055c Fixed missing microscope parameter for autofocus 2020-03-30 17:04:09 +01:00
Joel Collins
10fa93d11c Iterated to 2.0.0 2020-03-24 10:22:49 +00:00
Joel Collins
a4f6bc7dbe Fixed scanning fast autofocus 2020-02-17 11:44:26 +00:00
Joel Collins
65fc58c651 Fixed scan to use newer fast autofocus 2020-01-30 14:22:03 +00:00
Joel Collins
7458d278d8 Simplified new configuration and metadata 2020-01-29 15:36:57 +00:00
jtc42
6df7fe9405 Blackened 2020-01-24 15:41:33 +00:00
jtc42
36334ed743 Moved to a LabThings dependency for server 2020-01-17 15:13:32 +00:00
Joel Collins
a329b9197b Renamed Resource to View, and allow custom root links 2020-01-14 11:41:56 +00:00
Joel Collins
4003e4e65c Renamed devices to components 2020-01-13 11:08:05 +00:00
Joel Collins
f0f2a30d7e Added versions and full names to default extensions 2020-01-11 21:17:08 +00:00
Joel Collins
a4196b6765 Refactored adding views, actions, props and components 2020-01-11 14:58:50 +00:00