Commit graph

2410 commits

Author SHA1 Message Date
Richard
0c6e6caade Improve errors with better exception
I've swapped the ValueError for a RuntimeError subclass to
make it clearer what's gone wrong.
2021-05-05 10:05:47 +01:00
Richard Bowman
14c4908a98 fix linter error 2021-05-04 13:41:39 +01:00
Richard Bowman
6e7adb66cd Fix handling of missing CSM matrix
The code checks for the camera-stage mapper matrix by looking at its truth value.
However, this is ambiguous because the matrix has many elements.  That means that
if it's missing, we get the expected result, but if it's present
we get an error.

I have avoided dict.get() and instead look it up with [] notation.
This will raise a KeyError if it's missing, which I
handle helpfully.
If the key is present but the value is not castable to an array, we'll
get an exception anyway.
2021-04-28 22:29:56 +01:00
Richard Bowman
7028ac66bb Merge branch 'auto-exposure-gain-awb' into 'master'
Fix auto-exposure and AWB

Closes #191

See merge request openflexure/openflexure-microscope-server!119
2021-04-28 07:57:56 +00:00
Richard Bowman
82eba1e99a fixed typing error 2021-04-27 20:17:07 +01:00
Richard Bowman
87f636ecc0 Code format and linting 2021-04-27 19:56:54 +01:00
Richard Bowman
bb303d4766 Simplified auto gain/exposure algorithm
adjust_shutter_and_gain_from_raw now uses a simpler algorithm.
The code is longer overall but hides some details in fuctions.
I've also split the loop into one for shutter speed and one for gain.
This isn't the algorithm that I originally wrote, but it seems to
work and is more readable.
2021-04-27 18:54:21 +01:00
Richard Bowman
42f00b69a4 Merge remote-tracking branch 'origin/master' into auto-exposure-gain-awb
This was primarily done to disable the warning about f strings in
logging statements, globally rather than per-file.
2021-04-27 17:16:19 +01:00
Richard Bowman
79b0d48cf4 Swap Generator annotation for Iterator 2021-04-27 17:13:40 +01:00
Richard
82a277b04c Cache stream settings in local storage
GPU preview and MJPEG stream settings are now persisted
using localStorage.  The old code that disabled
the stream for local connections now
just sets the initial/default value.

The initialisation of stream settings is now done
in the created() method of streamContent.vue.

I've eliminated the "globalsafetogglepreview" event
in favour of watching the store.
2021-04-27 16:36:55 +01:00
Richard
e14800b549 linter fixes 2021-04-27 14:28:08 +01:00
Richard Bowman
6d62532d6a Merge branch 'fix-absolute-move' into 'master'
Fix absolute moves

See merge request openflexure/openflexure-microscope-server!126
2021-04-27 10:30:19 +00:00
Richard Bowman
a2ba95c1d3 Minor linting improvements
I have now disabled W1203 globally, see comment in
pyproject.toml
2021-04-27 11:17:11 +01:00
Richard Bowman
90f5a755b1 Handle absolute moves correctly
I've changed the default values in MoveStageAPI
so that it correctly handles absolute moves with missing axes.
I've also simplified it so it isn't using axes_to_array as that
resulted in a confusing code path.
2021-04-27 10:55:51 +01:00
Richard Bowman
2eade9ed30 Handle None in axes_to_array
None values should be treated the same as missing ones -
previously it would just crash.
2021-04-27 10:52:52 +01:00
Richard Bowman
88de3089ea Fixed linter errors 2021-04-21 13:38:14 +01:00
Richard Bowman
8c50f73b34 Fixed type of context manager 2021-04-21 12:54:53 +01:00
Richard Bowman
fd32c22e30 Fixed formatting 2021-04-21 12:40:10 +01:00
Richard Bowman
64f2263e81 Remove poetry.lock
We've switched to pipenv, poetry.lock is now superfluous
2021-04-21 12:35:49 +01:00
Richard Bowman
1f1a75c02a Merge branch 'master' into auto-exposure-gain-awb 2021-04-21 12:10:47 +01:00
Richard Bowman
e86e4d983a Merge branch 'abandon-poetry' into 'master'
Move away from poetry

Closes #218

See merge request openflexure/openflexure-microscope-server!124
2021-04-21 10:57:28 +00:00
Richard Bowman
5d5990f738 Described config files better in reame 2021-04-21 11:40:45 +01:00
Richard Bowman
1b5b576664 Improved comments 2021-04-21 11:28:30 +01:00
Richard Bowman
85df85c6e8 reworked readme to improve clarity and style 2021-04-21 11:12:54 +01:00
Richard Bowman
4629fa67c6 Consistent single backtick code 2021-04-21 10:35:09 +01:00
Richard Bowman
9783dfaeff Updated readme and version-bump for clarity 2021-03-31 10:21:45 +01:00
Richard Bowman
1cea75be70 Formatting fixes 2021-03-31 09:40:31 +01:00
Richard Bowman
300d6878bb Upgraded black to match master 2021-03-31 09:35:13 +01:00
Richard Bowman
e73ee8875c Fixed type annotations in autofocus and mock stage
I don't know why these didn't fail before - possibly because of
incomplete type information from old numpy...
I removed a few annotations because they were failing (e.g.
np.sum can return a scalar or an array), but I don't think
this should be a problem - the function inputs and return values
are still typed.
2021-03-30 17:51:00 +01:00
Richard Bowman
cd5e32b843 Removed deprecated np.float
numpy 1.20 deprecates np.float, which was only ever an alias for
``float``.  I've replaced all occurrences of np.float with float, as
recommended.  There should be no change in functionality.
2021-03-30 17:40:19 +01:00
Kaspar Emanuel
97bbbdee84 Merge branch 'ihi_scan' into 'master'
IHI scan style raster

See merge request openflexure/openflexure-microscope-server!113
2021-03-30 12:29:32 +00:00
Richard Bowman
17b19d7dfd fix poe
poe was assuming we were using poetry - I have
configured it not to use poetry now. This required
using a newer version.
2021-03-29 16:59:40 +01:00
Richard Bowman
53876ee70d Use pipenv to manage setup.py dependencies 2021-03-29 16:59:00 +01:00
Richard Bowman
3ca469cca6 Install dev dependencies
We now install with --dev to make sure development dependencies
are included.  I've also removed "poetry run"
from the "poe" commands, as we are
already in an active virtual environment, so
it's unnecessary (and also broken).

Finally, I added a tarball of the vue app to
the output distribution.
2021-03-29 14:57:18 +01:00
Richard Bowman
faa08f3aef Switch CI to use poetry 2021-03-29 11:26:38 +01:00
Richard Bowman
4c70562687 Updated readme with new install instructions 2021-03-26 21:13:16 +00:00
Richard Bowman
af7ef08f63 Move away from poetry
More or less everything is now done by setup.py
Pipfile simply installs the module in editable mode, which
recursively resolves dependencies as defined in setup.py.
2021-03-26 21:11:22 +00:00
Richard Bowman
a373afd955 swap print for logging in old function 2021-03-16 11:01:57 +00:00
Richard Bowman
03a4f36556 Remove spurious GPU preview event 2021-03-01 12:20:04 +00:00
Richard Bowman
8624e45df4 Axios version bump and vuex-map-fields
vuex-map-fields cleans up code when mapping
store state to local computed properties.
2021-02-23 17:36:58 +00:00
Richard Bowman
a7bb0f9423 Reset tour button and URL origin
Reset tour button resets the local storage used to mark the tour
as done.

Overriding the origin can now be done with a query string.
This will load the store with the new origin from the start,
so might be better for testing some things.
I'm not worried about unexpected bugs, as it is quite obvious
from the URL what's going on.
2021-02-23 15:56:15 +00:00
Richard Bowman
1f3ba2bff1 Allow origin to be overridden by query
Specifying overrideOrigin in the URL now
sets up the store with the modified origin.
This is intended for development, and makes it
much less annoying to develop with a Vue dev server.
2021-02-23 15:54:28 +00:00
Richard Bowman
bc0995d0cf Added poe serve
To save some typing ``poe serve`` now runs a debug server.
2021-02-18 18:03:42 +00:00
Richard Bowman
3b435ab2ee Deleted obsolete functions 2021-02-18 15:56:11 +00:00
Richard Bowman
414fd55c5b Upgrade numpy
numpy/scipy were mismatched in version, which led to a confusing
import error.  I've removed the numpy version specification entirely
and left it to scipy to ensure numpy
is installed.  This could do with
review in the future...
2021-02-18 14:33:07 +00:00
Richard Bowman
20001e4946 Force installation only from piwheels
Forcing the use of piwheels avoids trying
to install numpy/scipy from source,
which is the Right Answer.

Unfortunately, sometimes packages fail on piwheels, but poetry still
tries to install them.  I've had to fix
pyyaml at 5.4.0 for that reason.
2021-02-18 13:29:02 +00:00
Richard Bowman
1e45640195 Added control to reset LST
You can now recalibrate the LST without running auto-gain.
2021-02-15 20:19:39 +00:00
Richard Bowman
b06dd187ec Fixed args in endpoints 2021-02-15 20:18:34 +00:00
Richard Bowman
069d27bf15 Lock access to picamera
The picamera object isn't thread safe; I have now wrapped all access
in context managers that acquire the BaseCamera.lock

I also added an endpoint to reset the LST without auto-gain.
2021-02-15 20:15:55 +00:00
Richard Bowman
a9709b14ea Added locking to recalibrate functions
When testing the UI I noticed that the different recalibrate routines
don't use locks properly, so they try to run
concurrently.

This commit isn't tested yet...
2021-02-15 19:21:27 +00:00