Debian Codegraph @

pymeasure/instruments/oxfordinstruments/ps120_10.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
26 from .ips120_10 import IPS120_10
27
28
29 def PS_custom_get_process(v):
30 """Adjust the received value, for working with the PS 120-10 """
31 return v * 1e-2
32
33
34 def PS_custom_set_process(v):
35 """Convert float to proper int value, for working with the PS 120-10 """
36 return int(v * 1e2)
37
38
39 class PS120_10(IPS120_10):
40 """Represents the Oxford Superconducting Magnet Power Supply PS 120-10.
41
42 .. code-block:: python
43
44 ps = PS120_10("GPIB::25") # Default channel for the IPS
45
46 ps.enable_control() # Enables the power supply and remote control
47
48 ps.train_magnet([ # Train the magnet after it has been cooled-down
49 (11.8, 1.0),
50 (13.9, 0.4),
51 (14.9, 0.2),
52 (16.0, 0.1),
53 ])
54
55 ps.set_field(12) # Bring the magnet to 12 T. The switch heater will
56 # be turned off when the field is reached and the
57 # current is ramped back to 0 (i.e. persistent mode).
58
59 print(self.field) # Print the current field (whether in persistent or
60 # non-persistent mode)
61
62 ps.set_field(0) # Bring the magnet to 0 T. The persistent mode will be
63 # turned off first (i.e. current back to set-point and
64 # switch-heater on); afterwards the switch-heater will
65 # again be turned off.
66
67 ps.disable_control() # Disables the control of the supply, turns off the
68 # switch-heater and clamps the output.
69
70 :param clear_buffer: A boolean property that controls whether the instrument
71 buffer is clear upon initialisation.
72 :param switch_heater_heating_delay: The time in seconds (default is 20s) to wait after
73 the switch-heater is turned on before the heater is expected to be heated.
74 :param switch_heater_cooling_delay: The time in seconds (default is 20s) to wait after
75 the switch-heater is turned off before the heater is expected to be cooled down.
76 :param field_range: A numeric value or a tuple of two values to indicate the
77 lowest and highest allowed magnetic fields. If a numeric value is provided
78 the range is expected to be from :code:`-field_range` to :code:`+field_range`.
79
80 """
81
82 def __init__(self,
83 adapter,
84 name="Oxford PS",
85 **kwargs):
86
87 super().__init__(
88 adapter=adapter,
89 name=name,
90 **kwargs,
91 )
92
93 current_measured_get_process = PS_custom_get_process
94
95 demand_current_get_process = PS_custom_get_process
96
97 demand_field_get_process = PS_custom_get_process
98
99 persistent_field_get_process = PS_custom_get_process
100
101 current_setpoint_get_process = PS_custom_get_process
102 current_setpoint_set_process = PS_custom_set_process
103 current_setpoint_set_command = "I%d"
104
105 field_setpoint_get_process = PS_custom_get_process
106 field_setpoint_set_process = PS_custom_set_process
107 field_setpoint_set_command = "J%d"
108
109 sweep_rate_get_process = PS_custom_get_process
110 sweep_rate_set_process = PS_custom_set_process
111 sweep_rate_set_command = "T%d"