Debian Codegraph @

pymeasure/instruments/lakeshore/lakeshore331.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 import logging
26
27 from pymeasure.instruments import Instrument, SCPIUnknownMixin
28 from pymeasure.instruments.lakeshore.lakeshore_base import LakeShoreTemperatureChannel, \
29 LakeShoreHeaterChannel
30
31 log = logging.getLogger(__name__)
32 log.addHandler(logging.NullHandler())
33
34
35 class LakeShore331(SCPIUnknownMixin, Instrument):
36 """ Represents the Lake Shore 331 Temperature Controller and provides
37 a high-level interface for interacting with the instrument. Note that the
38 331 provides two input channels (A and B) and two output channels (1 and 2).
39 This driver makes use of the :ref:`LakeShoreChannels`.
40
41 .. code-block:: python
42
43 controller = LakeShore331("GPIB::1")
44
45 print(controller.output_1.setpoint) # Print the current setpoint for loop 1
46 controller.output_1.setpoint = 50 # Change the loop 1 setpoint to 50 K
47 controller.output_1.heater_range = 'low' # Change the heater range to low.
48 controller.input_A.wait_for_temperature() # Wait for the temperature to stabilize.
49 print(controller.input_A.temperature) # Print the temperature at sensor A.
50 """
51 input_A = Instrument.ChannelCreator(LakeShoreTemperatureChannel, 'A')
52
53 input_B = Instrument.ChannelCreator(LakeShoreTemperatureChannel, 'B')
54
55 output_1 = Instrument.ChannelCreator(LakeShoreHeaterChannel, 1)
56
57 output_2 = Instrument.ChannelCreator(LakeShoreHeaterChannel, 2)
58
59 def __init__(self, adapter, name="Lakeshore Model 336 Temperature Controller", **kwargs):
60 kwargs.setdefault('read_termination', "\r\n")
61 super().__init__(
62 adapter,
63 name,
64 **kwargs
65 )