forked from ImSwitch/ImSwitch
-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathLantzLaserManager.py
48 lines (37 loc) · 1.73 KB
/
LantzLaserManager.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
from imswitch.imcommon.model import initLogger
from imswitch.imcontrol.model.interfaces import LantzLaser
from .LaserManager import LaserManager
class LantzLaserManager(LaserManager):
""" Base LaserManager for lasers that are fully digitally controlled using
drivers available through Lantz.
Manager properties:
- ``digitalPorts`` -- a string array containing the COM ports to connect
to, e.g. ``["COM4"]``
"""
def __init__(self, laserInfo, name, isBinary, valueUnits, valueDecimals, driver,
**_lowLevelManagers):
self.__logger = initLogger(self, instanceName=name)
ports = laserInfo.managerProperties['digitalPorts']
# Init laser
self._laser = LantzLaser(driver, ports)
self._numLasers = len(ports)
self.__logger.info(f'Initialized laser, model: {self._laser.idn}')
super().__init__(laserInfo, name, isBinary=isBinary, valueUnits=valueUnits,
valueDecimals=valueDecimals)
def finalize(self):
self._laser.finalize()
# Copyright (C) 2020-2021 ImSwitch developers
# This file is part of ImSwitch.
#
# ImSwitch is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# ImSwitch is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.