Completed
Push — pulsed_with_queued_connections ( 0b7aaa...175b78 )
by
unknown
04:14 queued 01:18
created

SimpleLaserDummy.allowed_control_modes()   A

Complexity

Conditions 1

Size

Total Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
c 1
b 0
f 0
dl 0
loc 2
rs 10
1
# -*- coding: utf-8 -*-
2
"""
3
This module acts like a laser.
4
5
Qudi is free software: you can redistribute it and/or modify
6
it under the terms of the GNU General Public License as published by
7
the Free Software Foundation, either version 3 of the License, or
8
(at your option) any later version.
9
10
Qudi is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
GNU General Public License for more details.
14
15
You should have received a copy of the GNU General Public License
16
along with Qudi. If not, see <http://www.gnu.org/licenses/>.
17
18
Copyright (c) the Qudi Developers. See the COPYRIGHT.txt file at the
19
top-level directory of this distribution and at <https://github.com/Ulm-IQO/qudi/>
20
"""
21
22
from core.base import Base
23
from interface.simple_laser_interface import SimpleLaserInterface
24
from interface.simple_laser_interface import LaserState
25
from interface.simple_laser_interface import ShutterState
26
from interface.simple_laser_interface import ControlMode
27
28
29
class SimpleLaserDummy(Base, SimpleLaserInterface):
30
    """
31
    Lazors
32
    """
33
    _modclass = 'laserdummy'
34
    _modtype = 'hardware'
35
36
    # connectors
37
    _out = {'laser': 'SimpleLaser'}
38
39
    def __init__(self, **kwargs):
40
        super().__init__(**kwargs)
41
        self.lstate = LaserState.OFF
42
        self.shutter = ShutterState.CLOSED
43
        self.mode = ControlMode.POWER
44
        self.current_setpoint = 0
45
        self.power_setpoint = 0
46
47
    def on_activate(self, e):
48
        """
49
50
        @param e:
51
        @return:
52
        """
53
        pass
54
55
    def on_deactivate(self, e):
56
        """
57
        @param e:
58
        @return:
59
        """
60
        pass
61
62
    def get_power(self):
63
        """ Return laser power
64
        @return float: Laser power in watts
65
        """
66
        return self.power_setpoint
67
68
    def get_power_setpoint(self):
69
        return self.power_setpoint
70
71
    def set_power(self, power):
72
        self.power_setpoint = power
73
        return self.power_setpoint
74
75
    def get_current(self):
76
        """ Return laser current
77
        @return float: laser current in amperes
78
        """
79
        return self.current_setpoint
80
81
    def get_current_setpoint(self):
82
        return self.current_setpoint
83
84
    def set_current(self, current):
85
        self.current_setpoint = current
86
        return self.current_setpoint
87
88
    def allowed_control_modes(self):
89
        return [ControlMode.POWER, ControlMode.CURRENT]
90
91
    def get_control_mode(self):
92
        return self.mode
93
94
    def set_control_mode(self, control_mode):
95
        self.mode = control_mode
96
        return self.mode
97
98
    def on(self):
99
        self.lstate = LaserState.ON
100
        return self.lstate
101
102
    def off(self):
103
        self.lstate = LaserState.OFF
104
        return self.lstate
105
106
    def get_laser_state(self):
107
        return self.lstate
108
109
    def set_laser_state(self, state):
110
        self.lstate = state
111
        return self.lstate
112
113
    def get_shutter_state(self):
114
        return self.shutter
115
116
    def set_shutter_state(self, state):
117
        self.shutter = state
118
        return self.shutter
119
120
    def get_temperatures(self):
121
        return {'psu': 32.2, 'head': 42.0}
122
123
    def set_temperatures(self, temps):
124
        return {}
125
126
    def get_extra_info(self):
127
        return "Dummy laser v0.9.9\nnot used very much\nvery cheap price good quality"
128