Debian Codegraph @

pymeasure/instruments/anritsu/anritsuMG3692C.py

raw
1 #
2 # This file is part of the PyMeasure package.
3 #
4 # Copyright (c) 2013-2024 PyMeasure Developers
5 #
6 # Permission is hereby granted, free of charge, to any person obtaining a copy
7 # of this software and associated documentation files (the "Software"), to deal
8 # in the Software without restriction, including without limitation the rights
9 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 # copies of the Software, and to permit persons to whom the Software is
11 # furnished to do so, subject to the following conditions:
12 #
13 # The above copyright notice and this permission notice shall be included in
14 # all copies or substantial portions of the Software.
15 #
16 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 # THE SOFTWARE.
23 #
24
25 from pymeasure.instruments import Instrument, SCPIUnknownMixin
26
27
28 class AnritsuMG3692C(SCPIUnknownMixin, Instrument):
29 """ Represents the Anritsu MG3692C Signal Generator
30 """
31 power = Instrument.control(
32 ":POWER?;", ":POWER %g dBm;",
33 """Control the output power in dBm. (float))"""
34 )
35 frequency = Instrument.control(
36 ":FREQUENCY?;", ":FREQUENCY %e Hz;",
37 """Control the output frequency in Hz. This property can be set. (float)"""
38 )
39
40 def __init__(self, adapter, name="Anritsu MG3692C Signal Generator", **kwargs):
41 super().__init__(
42 adapter,
43 name,
44 **kwargs
45 )
46
47 @property
48 def output(self):
49 """Control the signal output state. (bool)"""
50 return int(self.ask(":OUTPUT?")) == 1
51
52 @output.setter
53 def output(self, value):
54 if value:
55 self.write(":OUTPUT ON;")
56 else:
57 self.write(":OUTPUT OFF;")
58
59 def enable(self):
60 """ Enables the signal output.
61 """
62 self.output = True
63
64 def disable(self):
65 """ Disables the signal output.
66 """
67 self.output = False
68
69 def shutdown(self):
70 """ Shuts down the instrument, putting it in a safe state.
71 """
72 # TODO: Implement modulation
73 self.modulation = False
74 self.disable()
75 super().shutdown()