|
1
|
|
|
# -*- coding: utf-8 -*- |
|
2
|
|
|
|
|
3
|
|
|
""" |
|
4
|
|
|
This file contains the Qudi Interface file to control microwave devices. |
|
5
|
|
|
|
|
6
|
|
|
Qudi is free software: you can redistribute it and/or modify |
|
7
|
|
|
it under the terms of the GNU General Public License as published by |
|
8
|
|
|
the Free Software Foundation, either version 3 of the License, or |
|
9
|
|
|
(at your option) any later version. |
|
10
|
|
|
|
|
11
|
|
|
Qudi is distributed in the hope that it will be useful, |
|
12
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14
|
|
|
GNU General Public License for more details. |
|
15
|
|
|
|
|
16
|
|
|
You should have received a copy of the GNU General Public License |
|
17
|
|
|
along with Qudi. If not, see <http://www.gnu.org/licenses/>. |
|
18
|
|
|
|
|
19
|
|
|
Copyright (c) the Qudi Developers. See the COPYRIGHT.txt file at the |
|
20
|
|
|
top-level directory of this distribution and at <https://github.com/Ulm-IQO/qudi/> |
|
21
|
|
|
""" |
|
22
|
|
|
|
|
23
|
|
|
from core.util.customexceptions import InterfaceImplementationError |
|
24
|
|
|
from core.util.units import in_range |
|
25
|
|
|
|
|
26
|
|
|
|
|
27
|
|
|
class MicrowaveInterface: |
|
28
|
|
|
"""This is the Interface class to define the controls for the simple |
|
29
|
|
|
microwave hardware. |
|
30
|
|
|
""" |
|
31
|
|
|
|
|
32
|
|
|
_modclass = 'MicrowaveInterface' |
|
33
|
|
|
_modtype = 'interface' |
|
34
|
|
|
|
|
35
|
|
|
def on(self): |
|
36
|
|
|
""" Switches on any preconfigured microwave output. |
|
37
|
|
|
|
|
38
|
|
|
@return int: error code (0:OK, -1:error) |
|
39
|
|
|
""" |
|
40
|
|
|
raise InterfaceImplementationError('MicrowaveInterface>on') |
|
41
|
|
|
|
|
42
|
|
|
def off(self): |
|
43
|
|
|
""" Switches off any microwave output. |
|
44
|
|
|
|
|
45
|
|
|
@return int: error code (0:OK, -1:error) |
|
46
|
|
|
""" |
|
47
|
|
|
raise InterfaceImplementationError('MicrowaveInterface>off') |
|
48
|
|
|
|
|
49
|
|
|
def get_power(self): |
|
50
|
|
|
""" Gets the microwave output power. |
|
51
|
|
|
|
|
52
|
|
|
@return float: the power set at the device in dBm |
|
53
|
|
|
""" |
|
54
|
|
|
raise InterfaceImplementationError('MicrowaveInterface>get_power') |
|
55
|
|
|
|
|
56
|
|
|
def set_power(self, power=0.): |
|
57
|
|
|
""" Sets the microwave output power. |
|
58
|
|
|
|
|
59
|
|
|
@param float power: the power (in dBm) set for this device |
|
60
|
|
|
|
|
61
|
|
|
@return int: error code (0:OK, -1:error) |
|
62
|
|
|
""" |
|
63
|
|
|
raise InterfaceImplementationError('MicrowaveInterface>set_power') |
|
64
|
|
|
|
|
65
|
|
|
def get_frequency(self): |
|
66
|
|
|
""" Gets the frequency of the microwave output. |
|
67
|
|
|
|
|
68
|
|
|
@return float: frequency (in Hz), which is currently set for this device |
|
69
|
|
|
""" |
|
70
|
|
|
raise InterfaceImplementationError('MicrowaveInterface>get_frequency') |
|
71
|
|
|
|
|
72
|
|
|
def set_frequency(self, freq=0.): |
|
73
|
|
|
""" Sets the frequency of the microwave output. |
|
74
|
|
|
|
|
75
|
|
|
@param float freq: the frequency (in Hz) set for this device |
|
76
|
|
|
|
|
77
|
|
|
@return int: error code (0:OK, -1:error) |
|
78
|
|
|
""" |
|
79
|
|
|
raise InterfaceImplementationError('MicrowaveInterface>set_frequency') |
|
80
|
|
|
|
|
81
|
|
|
def set_cw(self, freq=None, power=None, useinterleave=None): |
|
82
|
|
|
""" Sets the MW mode to cw and additionally frequency and power |
|
83
|
|
|
|
|
84
|
|
|
@param float freq: frequency to set in Hz |
|
85
|
|
|
@param float power: power to set in dBm |
|
86
|
|
|
@param bool useinterleave: If this mode exists you can choose it. |
|
87
|
|
|
|
|
88
|
|
|
@return int: error code (0:OK, -1:error) |
|
89
|
|
|
|
|
90
|
|
|
Interleave option is used for arbitrary waveform generator devices. |
|
91
|
|
|
""" |
|
92
|
|
|
raise InterfaceImplementationError('MicrowaveInterface>set_cw') |
|
93
|
|
|
|
|
94
|
|
|
def set_list(self, freq=None, power=None): |
|
95
|
|
|
""" Sets the MW mode to list mode |
|
96
|
|
|
|
|
97
|
|
|
@param list freq: list of frequencies in Hz |
|
98
|
|
|
@param float power: MW power of the frequency list in dBm |
|
99
|
|
|
|
|
100
|
|
|
@return int: error code (0:OK, -1:error) |
|
101
|
|
|
""" |
|
102
|
|
|
raise InterfaceImplementationError('MicrowaveInterface>set_list') |
|
103
|
|
|
|
|
104
|
|
|
def reset_listpos(self): |
|
105
|
|
|
""" Reset of MW List Mode position to start from first given frequency |
|
106
|
|
|
|
|
107
|
|
|
@return int: error code (0:OK, -1:error) |
|
108
|
|
|
""" |
|
109
|
|
|
raise InterfaceImplementationError('MicrowaveInterface>reset_listpos') |
|
110
|
|
|
|
|
111
|
|
|
def list_on(self): |
|
112
|
|
|
""" Switches on the list mode. |
|
113
|
|
|
|
|
114
|
|
|
@return int: error code (0:OK, -1:error) |
|
115
|
|
|
""" |
|
116
|
|
|
raise InterfaceImplementationError('MicrowaveInterface>list_on') |
|
117
|
|
|
|
|
118
|
|
|
def sweep_on(self): |
|
119
|
|
|
""" Switches on the sweep mode. |
|
120
|
|
|
|
|
121
|
|
|
@return int: error code (0:OK, -1:error) |
|
122
|
|
|
""" |
|
123
|
|
|
raise InterfaceImplementationError('MicrowaveInterface>sweep_on') |
|
124
|
|
|
|
|
125
|
|
|
def set_sweep(self, start, stop, step, power): |
|
126
|
|
|
""" Sweep from frequency start to frequency sto pin steps of width stop with power. |
|
127
|
|
|
""" |
|
128
|
|
|
raise InterfaceImplementationError('MicrowaveInterface>set_sweep') |
|
129
|
|
|
|
|
130
|
|
|
def reset_sweep(self): |
|
131
|
|
|
""" Reset of MW sweep position to start |
|
132
|
|
|
|
|
133
|
|
|
@return int: error code (0:OK, -1:error) |
|
134
|
|
|
""" |
|
135
|
|
|
raise InterfaceImplementationError('MicrowaveInterface>sweep_reset') |
|
136
|
|
|
|
|
137
|
|
|
def sweep_pos(self, frequency=None): |
|
138
|
|
|
""" |
|
139
|
|
|
""" |
|
140
|
|
|
raise InterfaceImplementationError('MicrowaveInterface>sweep_pos') |
|
141
|
|
|
|
|
142
|
|
|
def set_ex_trigger(self, source, pol): |
|
143
|
|
|
""" Set the external trigger for this device with proper polarization. |
|
144
|
|
|
|
|
145
|
|
|
@param str source: channel name, where external trigger is expected. |
|
146
|
|
|
@param str pol: polarisation of the trigger (basically rising edge or |
|
147
|
|
|
falling edge) |
|
148
|
|
|
|
|
149
|
|
|
@return int: error code (0:OK, -1:error) |
|
150
|
|
|
""" |
|
151
|
|
|
raise InterfaceImplementationError('MicrowaveInterface>trigger') |
|
152
|
|
|
|
|
153
|
|
|
def set_modulation(self, flag=None): |
|
154
|
|
|
""" |
|
155
|
|
|
""" |
|
156
|
|
|
raise InterfaceImplementationError('MicrowaveInterface>set_modulation') |
|
157
|
|
|
|
|
158
|
|
|
def output(self): |
|
159
|
|
|
""" |
|
160
|
|
|
""" |
|
161
|
|
|
raise InterfaceImplementationError('MicrowaveInterface>output') |
|
162
|
|
|
|
|
163
|
|
|
def am(self, depth=None): |
|
164
|
|
|
""" |
|
165
|
|
|
|
|
166
|
|
|
@return float: |
|
167
|
|
|
""" |
|
168
|
|
|
raise InterfaceImplementationError('MicrowaveInterface>am') |
|
169
|
|
|
|
|
170
|
|
|
def get_limits(self): |
|
171
|
|
|
""" Return the device-specific limits in a nested dictionary. |
|
172
|
|
|
|
|
173
|
|
|
@return MicrowaveLimits: Microwave limits object |
|
174
|
|
|
""" |
|
175
|
|
|
raise InterfaceImplementationError('MicrowaveInterface>get_limits') |
|
176
|
|
|
|
|
177
|
|
|
|
|
178
|
|
|
class MicrowaveLimits: |
|
179
|
|
|
""" A container to hold all limits for microwave sources. |
|
180
|
|
|
""" |
|
181
|
|
View Code Duplication |
def __init__(self): |
|
|
|
|
|
|
182
|
|
|
"""Create an instance containing all parameters with default values.""" |
|
183
|
|
|
|
|
184
|
|
|
# how the microwave source can give you microwaves |
|
185
|
|
|
# CW: can output single frequency continuously |
|
186
|
|
|
# LIST: can load a list where frequencies are changed on trigger |
|
187
|
|
|
# SWEEP: can sweep frequency in form of start, stop, step with each step being triggered |
|
188
|
|
|
# AN_SWEEP: can sweep frequency from start to stop but only one trigger to start sweep |
|
189
|
|
|
self.supported_modes = ('CW', 'LIST', 'SWEEP', 'AN_SWEEP') |
|
190
|
|
|
|
|
191
|
|
|
# frequency in Hz |
|
192
|
|
|
self.min_frequency = 1e6 |
|
193
|
|
|
self.max_frequency = 1e9 |
|
194
|
|
|
|
|
195
|
|
|
# power in dBm |
|
196
|
|
|
self.min_power = -10 |
|
197
|
|
|
self.max_power = 0 |
|
198
|
|
|
|
|
199
|
|
|
# list limits, frequencies in Hz, entries are single steps |
|
200
|
|
|
self.list_minstep = 1 |
|
201
|
|
|
self.list_maxstep = 1e9 |
|
202
|
|
|
self.list_maxentries = 1e3 |
|
203
|
|
|
|
|
204
|
|
|
# sweep limits, frequencies in Hz, entries are single steps |
|
205
|
|
|
self.sweep_minstep = 1 |
|
206
|
|
|
self.sweep_maxstep = 1e9 |
|
207
|
|
|
self.sweep_maxentries = 1e3 |
|
208
|
|
|
|
|
209
|
|
|
# analog sweep limits, slope in Hz/s |
|
210
|
|
|
self.sweep_minslope = 1 |
|
211
|
|
|
self.sweep_maxslope = 1e9 |
|
212
|
|
|
|
|
213
|
|
|
def frequency_in_range(self, frequency): |
|
214
|
|
|
return in_range(frequency, self.min_frequency, self.max_frequency) |
|
215
|
|
|
|
|
216
|
|
|
def power_in_range(self, power): |
|
217
|
|
|
return in_range(power, self.min_power, self.max_power) |
|
218
|
|
|
|
|
219
|
|
|
def list_step_in_range(self, step): |
|
220
|
|
|
return in_range(step, self.list_minstep, self.list_maxstep) |
|
221
|
|
|
|
|
222
|
|
|
def sweep_step_in_range(self, step): |
|
223
|
|
|
return in_range(step, self.sweep_minstep, self.sweep_maxstep) |
|
224
|
|
|
|
|
225
|
|
|
def slope_in_range(self, slope): |
|
226
|
|
|
return in_range(slope, self.sweep_minslope, self.sweep_maxslope) |
|
227
|
|
|
|