BioImager  3.9.1
A .NET microscopy imaging library. Supports various microscopes by using imported libraries & GUI automation. Supported libraries include PriorĀ® & ZeissĀ® & all devices supported by Micromanager 2.0 and python-microscope.
Loading...
Searching...
No Matches
hardware.py
1#!/usr/bin/env python3
2
3## Copyright (C) 2020 David Miguel Susano Pinto <carandraug@gmail.com>
4##
5## This file is part of Microscope.
6##
7## Microscope is free software: you can redistribute it and/or modify
8## it under the terms of the GNU General Public License as published by
9## the Free Software Foundation, either version 3 of the License, or
10## (at your option) any later version.
11##
12## Microscope is distributed in the hope that it will be useful,
13## but WITHOUT ANY WARRANTY; without even the implied warranty of
14## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15## GNU General Public License for more details.
16##
17## You should have received a copy of the GNU General Public License
18## along with Microscope. If not, see <http://www.gnu.org/licenses/>.
19
20"""Interactive tests for hardware.
21"""
22
23import time
24
25import numpy
26
27
28def test_mirror_actuators(dm, time_interval=0.5):
29 """Iterate over all actuators of a deformable mirror.
30
31 Args:
32 dm (microscope.abc.DeformableMirror): The mirror to test.
33 time_interval (float): Number of seconds between trying each
34 actuator.
35 """
36 base_value = 0.5
37 data = numpy.full((dm.n_actuators), base_value)
38 dm.apply_pattern(data)
39
40 time.sleep(time_interval)
41 for new_value in [1.0, 0.0]:
42 for i in range(dm.n_actuators):
43 data[i] = new_value
44 dm.apply_pattern(data)
45 time.sleep(time_interval)
46 data[i] = base_value
47
48 dm.apply_pattern(data)