Scan Timelapse Functionality

Hi All. I’m wondering how easy it would be to modify the default scan extension to add a time lapse variable such that the scope scans across a specified grid indefinitely (or for a set amount of scans) with a wait time in between each scan. I’m not the best at coding so any help on this matter would be really useful.

Thanks!

You could do that with a little program on a client that calls the server to run the scan. Then deal with the images taken and wait before asking for another.

As William suggested, I think this is the sort of thing that our PyClient would be really good for:

By using the PyClient, you’d be able to use all the Python datetime libraries, and get much more freedom around how you manage the data being collected.

The libraries README has some simple tutorials.

What I will do though is add a built-in timelapse extension to the to-do list. In the meantime though, running a script is probably easiest.

This looks like the kind of thing that’s simple enough with my limited coding capabilities to play around with.

I’ll give it a go!

Just tried to download the python client but it looks like there’s a version conflict. Any suggestions?

/etc/poetry/lib/poetry/_vendor/py2.7/subprocess32.py:149: RuntimeWarning: The _p                                                                                
osixsubprocess module is not being used. Child process reliability may suffer if                                                                                 
 your program uses threads.
  "program uses threads.", RuntimeWarning)
The currently activated Python version 2.7.16 is not supported by the project (^3.6).
Trying to find and use a compatible version.
Using python3 (3.7.3)
Creating virtualenv openflexure-microscope-client-FiS6qrJl-py3.7 in 
/home/pi/.cache/pypoetry/virtualenvs
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
NameError: name 'PosixPath' is not defined
Installing dependencies from lock file

[SolverProblemError]
The current project's Python requirement (2.7.16) is not compatible with some of the required 
packages Python requirement:
- pytest requires Python >=3.5

Because no versions of pytest match >=5.4,<5.4.3 || >5.4.3,<6.0
and pytest (5.4.3) requires Python >=3.5, pytest is forbidden.
So, because openflexure-microscope-client depends on pytest (^5.4), version solving failed.

I missed this earlier. Those complaints seem to stem from it trying to use Python 2, but wanting python 3.7. Is it possible to force Python 3 before trying to run this?

Hey, so you can either create a virtual environment using Python 3 (python3 -m venv my_venv_folder), or just install the client globally with pip3 (pip3 install openflexure-microscope-client) then access it from python3.

Hey, I also found this tutorial by @jc2450

I updated it to work with the recent version. You can find it here

Hi @Ryan,
Are you trying to install the pyclient using poetry? It is probably easier to do that using pip, so you can just run pip install openflexure-microscope-client. It may only work for python 3, I can’t remember…

You only need to install it using poetry if you are doing development on the client library, installing with pip is much easier if you just want to use it. Sorry if that’s not clear from the readme! I probably wrote the readme before it was published on PyPI.