pygpibtoolkit/HP3562A/HP356X.py

changeset 86
96e30b092f70
parent 80
89e31bd2524b
child 91
f2a8f688dbc0
equal deleted inserted replaced
85:b55977dcc311 86:96e30b092f70
8 # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details 8 # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details
9 # 9 #
10 # You should have received a copy of the GNU General Public License along with 10 # You should have received a copy of the GNU General Public License along with
11 # this program; if not, write to the Free Software Foundation, Inc., 11 # this program; if not, write to the Free Software Foundation, Inc.,
12 # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 12 # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
13 """ Copyright (c) 2007-2009 David Douard (Paris, FRANCE). 13 """ Copyright (c) 2007-2018 David Douard (Paris, FRANCE).
14 http://www.logilab.org/project/pygpibtoolkit -- mailto:david.douard@logilab.fr 14 http://www.logilab.org/project/pygpibtoolkit -- mailto:david.douard@sdfa3.org
15 15
16 """ 16 """
17 17
18 from pygpibtoolkit.pygpib import Constants, Command 18 from pygpibtoolkit.pygpib import Constants, Command
19 from pygpibtoolkit.pygpib import Condition 19 from pygpibtoolkit.pygpib import Condition
20 from pygpibtoolkit.pygpib import BoolValue, IntValue, FloatValue 20 from pygpibtoolkit.pygpib import BoolValue, IntValue
21 from pygpibtoolkit.pygpib import PercentageValue, FrequencyValue, DurationValue 21 from pygpibtoolkit.pygpib import PercentageValue, FrequencyValue, DurationValue
22 from pygpibtoolkit.pygpib import VoltageValue 22 from pygpibtoolkit.pygpib import VoltageValue
23 from pygpibtoolkit.pygpib import EnumValue, StringValue 23 from pygpibtoolkit.pygpib import EnumValue, StringValue
24 from pygpibtoolkit.pygpib import Mode, ModeCommand, Flag 24 from pygpibtoolkit.pygpib import Mode, ModeCommand, Flag
25 25
26 from pygpibtoolkit.gpibcontroller import AbstractGPIBDevice, deviceRegister 26 from pygpibtoolkit.gpibcontroller import AbstractGPIBDevice, deviceRegister
27 27
28
28 ##################### 29 #####################
29 # HP3562A constants and command set 30 # HP3562A constants and command set
30 # **VERY INCOMPLETE** 31 # **VERY INCOMPLETE**
31 32
32 class LinRes(Condition): 33 class LinRes(Condition):
33 def __call__(self, device): 34 def __call__(self, device):
34 return device.MeasMode == "LINEAR RES" 35 return device.MeasMode == "LINEAR RES"
35 class LogRes(Condition): 36 class LogRes(Condition): # noqa
36 def __call__(self, device): 37 def __call__(self, device):
37 return device.MeasMode == "LOG RES" 38 return device.MeasMode == "LOG RES"
38 class SweptSine(Condition): 39 class SweptSine(Condition): # noqa
39 def __call__(self, device): 40 def __call__(self, device):
40 return device.MeasMode == "SWEPT SINE" 41 return device.MeasMode == "SWEPT SINE"
41 class TimeCaptur(Condition): 42 class TimeCaptur(Condition): # noqa
42 def __call__(self, device): 43 def __call__(self, device):
43 return device.MeasMode == "TIME CAPTUR" 44 return device.MeasMode == "TIME CAPTUR"
45
44 46
45 # GPIB buffer size is 3x80 characters lines 47 # GPIB buffer size is 3x80 characters lines
46 class STATUS_BYTE(Constants): 48 class STATUS_BYTE(Constants):
47 # HP3562A Status Byte, as returned by a serial poll 49 # HP3562A Status Byte, as returned by a serial poll
48 _constants = [(0x40, "RQS", "Request Service"), # when sent in response to a serial poll 50 _constants = [(0x40, "RQS", "Request Service"),
51 # when sent in response to a serial poll
49 (0x20, "ERR", "GPIB error"), 52 (0x20, "ERR", "GPIB error"),
50 (0x10, "RDY", "ready to accept GPIB commands"), 53 (0x10, "RDY", "ready to accept GPIB commands"),
51 ] 54 ]
52 55
53 conditions = [(0, "NSR", "No service requested"), 56 conditions = [(0, "NSR", "No service requested"),
59 (6, "USRQ1", "User SRQ #6"), 62 (6, "USRQ1", "User SRQ #6"),
60 (7, "USRQ1", "User SRQ #7"), 63 (7, "USRQ1", "User SRQ #7"),
61 (8, "USRQ1", "User SRQ #8"), 64 (8, "USRQ1", "User SRQ #8"),
62 (9, "EOD", "End of disk action"), 65 (9, "EOD", "End of disk action"),
63 (10, "EOP", "End of plot action"), 66 (10, "EOP", "End of plot action"),
64 (11, "STCH", "Instrument status changed"), # any change in 67 (11, "STCH", "Instrument status changed"),
65 # the status register sets this condition 68 # STCH: any change in the status register sets this condition
66 (12, "PWR", "Power on"), 69 (12, "PWR", "Power on"),
67 (13, "KEY", "Key pressed"), 70 (13, "KEY", "Key pressed"),
68 (14, "DCP", "Device clear plotter (listen)"), 71 (14, "DCP", "Device clear plotter (listen)"),
69 # ... 72 # ...
70 ] 73 ]
74
71 def __init__(self): 75 def __init__(self):
72 super(STATUS_BYTE, self).__init__() 76 super(STATUS_BYTE, self).__init__()
73 self._conditions = dict([(x[0], x[1]) for x in self.conditions]) 77 self._conditions = dict([(x[0], x[1]) for x in self.conditions])
74 self._rev_conditions = dict([(x[1], x[0]) for x in self.conditions]) 78 self._rev_conditions = dict([(x[1], x[0]) for x in self.conditions])
75 self._long_conditions = dict([(x[0], x[2]) for x in self.conditions]) 79 self._long_conditions = dict([(x[0], x[2]) for x in self.conditions])
76 80
77 def byte_condition(self, byte): 81 def byte_condition(self, byte):
78 byte = byte & 0x8F 82 byte = byte & 0x8F
79 return self._conditions.get(byte, "N/A") 83 return self._conditions.get(byte, "N/A")
84
80 85
81 class IS(Flag): 86 class IS(Flag):
82 "INTERNAL STATUS - Internal Status Register" 87 "INTERNAL STATUS - Internal Status Register"
83 _constants = [(0x01, "MEASP", "measeurement pause"), 88 _constants = [(0x01, "MEASP", "measeurement pause"),
84 (0x02, "ASQP", "Auto sequence pause"), 89 (0x02, "ASQP", "Auto sequence pause"),
94 (0x800, "RMKT", "Remote marker knob turn"), 99 (0x800, "RMKT", "Remote marker knob turn"),
95 (0x1000, "REKT", "Remote entry knob turn"), 100 (0x1000, "REKT", "Remote entry knob turn"),
96 (0x2000, "ASRC", "Asctive Status Register changed"), 101 (0x2000, "ASRC", "Asctive Status Register changed"),
97 (0x4000, "PWRF", "Power-on test failed"), 102 (0x4000, "PWRF", "Power-on test failed"),
98 ] 103 ]
99 104
105
100 class STA(Flag): 106 class STA(Flag):
101 "STATUS QUERY - Status/event query" 107 "STATUS QUERY - Status/event query"
102 _constants = [(0x01, "N/A", "Not used"), 108 _constants = [(0x01, "N/A", "Not used"),
103 (0x02, "N/A", "Not used"), 109 (0x02, "N/A", "Not used"),
104 (0x04, "KEY", "Key pressed"), 110 (0x04, "KEY", "Key pressed"),
114 (0x1000, "SWPR", "Sweep point ready"), 120 (0x1000, "SWPR", "Sweep point ready"),
115 (0x2000, "CH1OV", "Channel 1 overrange"), 121 (0x2000, "CH1OV", "Channel 1 overrange"),
116 (0x4000, "CH2OV", "Channel 2 overrange"), 122 (0x4000, "CH2OV", "Channel 2 overrange"),
117 (0x8000, "MAOV", "Math overflow"), 123 (0x8000, "MAOV", "Math overflow"),
118 ] 124 ]
125
126
119 class AS(Flag): 127 class AS(Flag):
120 "ACTIVITY STATUS - Activity Status Register" 128 "ACTIVITY STATUS - Activity Status Register"
121 _constants = [(0x01, "CKFL", "Check fault log"), 129 _constants = [(0x01, "CKFL", "Check fault log"),
122 (0x02, "FITR", "Filling time record"), 130 (0x02, "FITR", "Filling time record"),
123 (0x04, "FLTR", "Filters settings"), 131 (0x04, "FLTR", "Filters settings"),
124 (0x08, "CFTP", "Curve fir in progress"), 132 (0x08, "CFTP", "Curve fir in progress"),
125 (0x10, "MSSM", "Missed sample"), 133 (0x10, "MSSM", "Missed sample"),
126 (0x20, "TMPR", "Timed preview"), 134 (0x20, "TMPR", "Timed preview"),
127 (0x40, "ACDA", "Accept data"), 135 (0x40, "ACDA", "Accept data"),
128 #... 136 # ...
129 ] 137 ]
130 138
131 139
132 class TraceDisplay(Mode): 140 class TraceDisplay(Mode):
133 "Trace Display" 141 "Trace Display"
135 B = ModeCommand("B trace", "B") 143 B = ModeCommand("B trace", "B")
136 AB = ModeCommand("A & B traces", "A&B") 144 AB = ModeCommand("A & B traces", "A&B")
137 145
138 def get_mode(self, device): 146 def get_mode(self, device):
139 # XXX Can I get this from the device? 147 # XXX Can I get this from the device?
140 #mode = device.DSBN. # HERE 148 # mode = device.DSBN. # HERE
141 return None 149 return None
142 150
151
143 class ARM(Command): 152 class ARM(Command):
144 "ARM - Arm" 153 "ARM - Arm"
154
155
145 class NAVG(IntValue): 156 class NAVG(IntValue):
146 "Number of averages" 157 "Number of averages"
158
147 159
148 class AverageMode(Mode): 160 class AverageMode(Mode):
149 "Average mode" 161 "Average mode"
150 _condition = LinRes() | LogRes() | TimeCaptur() 162 _condition = LinRes() | LogRes() | TimeCaptur()
151 _key = "EAVGTYP" 163 _key = "EAVGTYP"
152 _DATA_BLOCK = "DSBN" 164 _DATA_BLOCK = "DSBN"
153 165
154 STBL = ModeCommand(6, "STABLE (MEAN)") 166 STBL = ModeCommand(6, "STABLE (MEAN)")
155 EXP = ModeCommand(7, "EXPON") 167 EXP = ModeCommand(7, "EXPON")
156 PHLD = ModeCommand(8, "PEAK HOLD") 168 PHLD = ModeCommand(8, "PEAK HOLD")
157 CNPK = ModeCommand(9, "CONT PEAK") 169 CNPK = ModeCommand(9, "CONT PEAK")
158 AVOF = ModeCommand(10, "AVG OFF") 170 AVOF = ModeCommand(10, "AVG OFF")
159 171
172
160 class TIAV(BoolValue): 173 class TIAV(BoolValue):
161 "TIM AV ON OFF - Time average" 174 "TIM AV ON OFF - Time average"
162 _condition = LinRes() | TimeCaptur() | SweptSine() 175 _condition = LinRes() | TimeCaptur() | SweptSine()
163 176
177
164 class OVLP(PercentageValue): 178 class OVLP(PercentageValue):
165 "OVRLP% - Overlap (%)" 179 "OVRLP% - Overlap (%)"
166 _condition = LinRes() | TimeCaptur() | SweptSine() 180 _condition = LinRes() | TimeCaptur() | SweptSine()
167 181
182
168 class AUTO(BoolValue): 183 class AUTO(BoolValue):
169 "AUTO ON OFF - Auto calibration" 184 "AUTO ON OFF - Auto calibration"
170 185
186
171 class SNGC(Command): 187 class SNGC(Command):
172 "SINGLE CAL - Single calibration" 188 "SINGLE CAL - Single calibration"
189
173 190
174 class CoordMode(Mode): 191 class CoordMode(Mode):
175 "Coord mode" 192 "Coord mode"
176 _key = "EYCOORD" 193 _key = "EYCOORD"
177 _DATA_BLOCK = "DCBN" 194 _DATA_BLOCK = "DCBN"
178 195
179 MGDB = ModeCommand(5, "MAG (dB)") 196 MGDB = ModeCommand(5, "MAG (dB)")
180 MDBM = ModeCommand(10, "MAG (dBm)") 197 MDBM = ModeCommand(10, "MAG (dBm)")
181 MGLG = ModeCommand(4, "MAG (LOG)") 198 MGLG = ModeCommand(4, "MAG (LOG)")
182 MAG = ModeCommand(3, "MAG (LIN)") 199 MAG = ModeCommand(3, "MAG (LIN)")
183 PHSE = ModeCommand(8, "PHASE") 200 PHSE = ModeCommand(8, "PHASE")
184 REAL = ModeCommand(1, "REAL") 201 REAL = ModeCommand(1, "REAL")
185 IMAG = ModeCommand(2, "IMAG") 202 IMAG = ModeCommand(2, "IMAG")
186 NYQT = ModeCommand(6, "NYQUIST") 203 NYQT = ModeCommand(6, "NYQUIST")
187 NICL = ModeCommand(9, "NICHOL") 204 NICL = ModeCommand(9, "NICHOL")
188 205
206
189 # FREQ menu 207 # FREQ menu
190 class FRS(FrequencyValue): 208 class FRS(FrequencyValue):
191 "FREQ SPAN - Freq. span" 209 "FREQ SPAN - Freq. span"
192 210
211
193 class SF(FrequencyValue): 212 class SF(FrequencyValue):
194 "START FREQ - Start freq." 213 "START FREQ - Start freq."
195 214
215
196 class CF(FrequencyValue): 216 class CF(FrequencyValue):
197 "CENTER FREQ - Center freq." 217 "CENTER FREQ - Center freq."
198 _units = "hz","khz","mhz","ord","rmp" 218 _units = "hz", "khz", "mhz", "ord", "rmp"
199 _condition = LinRes() | TimeCaptur() | SweptSine() 219 _condition = LinRes() | TimeCaptur() | SweptSine()
200 220
221
201 class ZST(Command): 222 class ZST(Command):
202 "ZERO START - Zero start" 223 "ZERO START - Zero start"
203 _condition = LinRes() | TimeCaptur() | SweptSine() 224 _condition = LinRes() | TimeCaptur() | SweptSine()
204 225
226
205 class MAXS(FrequencyValue): 227 class MAXS(FrequencyValue):
206 "MAX SPAN - Max span" 228 "MAX SPAN - Max span"
207 _condition = LinRes() | TimeCaptur() | SweptSine() 229 _condition = LinRes() | TimeCaptur() | SweptSine()
208 230
231
209 class TLN(DurationValue): 232 class TLN(DurationValue):
210 "TIME LENGTH - Time len." 233 "TIME LENGTH - Time len."
211 _condition = LinRes() | TimeCaptur() | SweptSine() 234 _condition = LinRes() | TimeCaptur() | SweptSine()
212 235
236
213 class ESMP(BoolValue): 237 class ESMP(BoolValue):
214 "E SMPL ON OFF - E sample" 238 "E SMPL ON OFF - E sample"
215 _condition = LinRes() | TimeCaptur() | SweptSine() 239 _condition = LinRes() | TimeCaptur() | SweptSine()
216 240
241
217 class SMPF(FrequencyValue): 242 class SMPF(FrequencyValue):
218 "SAMPLE FREQ - Sample freq." 243 "SAMPLE FREQ - Sample freq."
219 _condition = LinRes() | TimeCaptur() | SweptSine() 244 _condition = LinRes() | TimeCaptur() | SweptSine()
220 245
246
221 class SPF(FrequencyValue): 247 class SPF(FrequencyValue):
222 "STOP FREQ - Stop freq." 248 "STOP FREQ - Stop freq."
223 _condition = SweptSine 249 _condition = SweptSine
224 250
251
225 class SWRT(FrequencyValue): 252 class SWRT(FrequencyValue):
226 "SWEEP RATE - Sweep rate" 253 "SWEEP RATE - Sweep rate"
227 254
255
228 class ABIB(Command): 256 class ABIB(Command):
229 "ABORT HP-IB - Abort HPIB" 257 "ABORT HP-IB - Abort HPIB"
258
230 259
231 # INPUT COUPLING 260 # INPUT COUPLING
232 class C1AC(EnumValue): 261 class C1AC(EnumValue):
233 "CHAN1 AC DC - Channel 1 AC/DC" 262 "CHAN1 AC DC - Channel 1 AC/DC"
234 _values = ["DC", "AC"] 263 _values = ["DC", "AC"]
235 264
265
236 class Chan1Coupling(Mode): 266 class Chan1Coupling(Mode):
237 "Channel 1 coupling" 267 "Channel 1 coupling"
238 _key = "FLT1" 268 _key = "FLT1"
239 _DATA_BLOCK = "DSBN" 269 _DATA_BLOCK = "DSBN"
240 FLT1 = ModeCommand(1, "FLOAT CHAN1") 270 FLT1 = ModeCommand(1, "FLOAT CHAN1")
241 GND1 = ModeCommand(0, "GROUND CHAN1") 271 GND1 = ModeCommand(0, "GROUND CHAN1")
242 272
273
243 class C2AC(EnumValue): 274 class C2AC(EnumValue):
244 "CHAN2 AC DC - Channel 2 AC/DC" 275 "CHAN2 AC DC - Channel 2 AC/DC"
245 _values = ["AC", "DC"] 276 _values = ["AC", "DC"]
246 277
278
247 class Chan2Coupling(Mode): 279 class Chan2Coupling(Mode):
248 "Channel 2 coupling" 280 "Channel 2 coupling"
249 _key = "FLT1" 281 _key = "FLT1"
250 _DATA_BLOCK = "DSBN" 282 _DATA_BLOCK = "DSBN"
251 FLT2 = ModeCommand("Float", "FLOAT CHAN2") 283 FLT2 = ModeCommand("Float", "FLOAT CHAN2")
252 GND2 = ModeCommand("Ground", "GROUND CHAN2") 284 GND2 = ModeCommand("Ground", "GROUND CHAN2")
253 285
286
254 class LCL(Command): 287 class LCL(Command):
255 "LOCAL - Local" 288 "LOCAL - Local"
256 289
290
257 class C1RG(VoltageValue): 291 class C1RG(VoltageValue):
258 "CHAN 1 RANGE - Channel 1 range" 292 "CHAN 1 RANGE - Channel 1 range"
259 _units = "V","mV","Vrms","mVrms","dBV", "EU" 293 _units = "V", "mV", "Vrms", "mVrms", "dBV", "EU"
294
260 295
261 class C2RG(VoltageValue): 296 class C2RG(VoltageValue):
262 "CHAN 2 RANGE - Channel 2 range" 297 "CHAN 2 RANGE - Channel 2 range"
263 _units = "V","mV","Vrms","mVrms","dBV", "EU" 298 _units = "V", "mV", "Vrms", "mVrms", "dBV", "EU"
299
264 300
265 # MEAS MODE 301 # MEAS MODE
266 class MeasMode(Mode): 302 class MeasMode(Mode):
267 "Measurement mode" 303 "Measurement mode"
268 _key = "EMEAS" 304 _key = "EMEAS"
269 _DATA_BLOCK = "DSBN" 305 _DATA_BLOCK = "DSBN"
270 LNRS = ModeCommand(0, "LINEAR RES") 306 LNRS = ModeCommand(0, "LINEAR RES")
271 LGRS = ModeCommand(1, "LOG RES") 307 LGRS = ModeCommand(1, "LOG RES")
272 SSIN = ModeCommand(2, "SWEPT SINE") 308 SSIN = ModeCommand(2, "SWEPT SINE")
273 CPTR = ModeCommand(3, "TIME CAPTUR") 309 CPTR = ModeCommand(3, "TIME CAPTUR")
274 310
311
275 # MEAS DISP 312 # MEAS DISP
276 class FreqResp(Condition): 313 class FreqResp(Condition):
277 def __call__(self, device): 314 def __call__(self, device):
278 return device.SelectMeas == "FREQ RESP" 315 return device.SelectMeas == "FREQ RESP"
279 316
317
280 class MeasDisp(Mode): 318 class MeasDisp(Mode):
281 # TODO 319 # TODO
282 FRQR = ModeCommand(0, "FREQ RESP", condition=(LinRes() | LogRes()) & FreqResp() | SweptSine()) 320 FRQR = ModeCommand(0, "FREQ RESP",
283 COHR = ModeCommand(0, "COHER", condition=(LinRes() | LogRes()) & FreqResp() | SweptSine()) 321 condition=((LinRes() | LogRes())
284 PSP1 = ModeCommand(0, "POWER SPEC1", condition=(LinRes() | LogRes()) & FreqResp() | SweptSine()) 322 & FreqResp()
285 PSP2 = ModeCommand(0, "POWER SPEC2", condition=(LinRes() | LogRes()) & FreqResp() | SweptSine()) 323 | SweptSine()))
286 CSPS = ModeCommand(0, "CROSS SPEC", condition=(LinRes() | LogRes()) & FreqResp() | SweptSine()) 324 COHR = ModeCommand(0, "COHER",
287 IRSP = ModeCommand(0, "IMPLS RESP", condition=LinRes() & FreqResp()) 325 condition=((LinRes() | LogRes())
326 & FreqResp()
327 | SweptSine()))
328 PSP1 = ModeCommand(0, "POWER SPEC1",
329 condition=((LinRes() | LogRes())
330 & FreqResp()
331 | SweptSine()))
332 PSP2 = ModeCommand(0, "POWER SPEC2",
333 condition=((LinRes() | LogRes())
334 & FreqResp()
335 | SweptSine()))
336 CSPS = ModeCommand(0, "CROSS SPEC",
337 condition=((LinRes() | LogRes())
338 & FreqResp()
339 | SweptSine()))
340 IRSP = ModeCommand(0, "IMPLS RESP",
341 condition=LinRes() & FreqResp())
288 AUMT = ModeCommand(0, "AUTO MATH", ) 342 AUMT = ModeCommand(0, "AUTO MATH", )
289 FILT = ModeCommand(0, "FILTRD INPUT") 343 FILT = ModeCommand(0, "FILTRD INPUT")
290 344
291 TMR1 = ModeCommand(0, "TIME REC1", condition=TimeCaptur) 345 TMR1 = ModeCommand(0, "TIME REC1", condition=TimeCaptur)
292 TMR2 = ModeCommand(0, "TIME REC2", condition=TimeCaptur) 346 TMR2 = ModeCommand(0, "TIME REC2", condition=TimeCaptur)
293 LSP1 = ModeCommand(0, "LINEAR SPEC1", condition=TimeCaptur) 347 LSP1 = ModeCommand(0, "LINEAR SPEC1", condition=TimeCaptur)
294 LSP2 = ModeCommand(0, "LINEAR SPEC2", condition=TimeCaptur) 348 LSP2 = ModeCommand(0, "LINEAR SPEC2", condition=TimeCaptur)
295 349
296 350
297 class PowerSpec(Condition): 351 class PowerSpec(Condition):
298 def __call__(self, device): 352 def __call__(self, device):
299 return device.SelectMeas == "POWER SPEC" 353 return device.SelectMeas == "POWER SPEC"
300 354
355
301 class AutoCorr(Condition): 356 class AutoCorr(Condition):
302 def __call__(self, device): 357 def __call__(self, device):
303 return device.SelectMeas == "AUTO CORR" 358 return device.SelectMeas == "AUTO CORR"
304 359
360
305 class CrossCorr(Condition): 361 class CrossCorr(Condition):
306 def __call__(self, device): 362 def __call__(self, device):
307 return device.SelectMeas == "CROSS CORR" 363 return device.SelectMeas == "CROSS CORR"
308 364
365
309 class Hist(Condition): 366 class Hist(Condition):
310 def __call__(self, device): 367 def __call__(self, device):
311 return device.SelectMeas == "HIST" 368 return device.SelectMeas == "HIST"
312
313 369
314 370
315 # SELECT MEAS 371 # SELECT MEAS
316 class SelectMeas(Mode): 372 class SelectMeas(Mode):
317 "Select measurement" 373 "Select measurement"
318 _key = "EMTYP" 374 _key = "EMTYP"
319 _DATA_BLOCK = "DSBN" 375 _DATA_BLOCK = "DSBN"
320 _condition = LinRes() | TimeCaptur() | SweptSine() 376 _condition = LinRes() | TimeCaptur() | SweptSine()
321 377
322 FRSP = ModeCommand(0, "FREQ RESP", condition=LinRes() | LogRes() | SweptSine()) 378 FRSP = ModeCommand(
323 PSPC = ModeCommand(2, "POWER SPEC", condition=LinRes() | LogRes() | TimeCaptur()) 379 0, "FREQ RESP", condition=LinRes() | LogRes() | SweptSine())
324 AUCR = ModeCommand(3, "AUTO CORR", condition=LinRes() | TimeCaptur()) 380 PSPC = ModeCommand(
325 CCOR = ModeCommand(1, "CROSS CORR", condition=LinRes()) 381 2, "POWER SPEC", condition=LinRes() | LogRes() | TimeCaptur())
326 HIST = ModeCommand(4, "HIST", condition=LinRes() | TimeCaptur()) 382 AUCR = ModeCommand(
383 3, "AUTO CORR", condition=LinRes() | TimeCaptur())
384 CCOR = ModeCommand(
385 1, "CROSS CORR", condition=LinRes())
386 HIST = ModeCommand(
387 4, "HIST", condition=LinRes() | TimeCaptur())
388
327 389
328 class Channel(Mode): 390 class Channel(Mode):
329 "" 391 ""
330 _key = "ECH" 392 _key = "ECH"
331 _DATA_BLOCK = "DDBN" # XXX sure? 393 _DATA_BLOCK = "DDBN" # XXX sure?
332 CH12 = ModeCommand("Channel 1&2 active", "CH 1&2 ACTIVE", 394 CH12 = ModeCommand("Channel 1&2 active", "CH 1&2 ACTIVE",
333 condition=LinRes() | LogRes()) 395 condition=LinRes() | LogRes())
334 CH1 = ModeCommand("Channel 1 active", "CH 1 ACTIVE", 396 CH1 = ModeCommand("Channel 1 active", "CH 1 ACTIVE",
335 condition=LinRes() | LogRes() | TimeCaptur()) 397 condition=LinRes() | LogRes() | TimeCaptur())
336 CH2 = ModeCommand("Channel 2 active", "CH 2 ACTIVE", 398 CH2 = ModeCommand("Channel 2 active", "CH 2 ACTIVE",
337 condition=LinRes() | LogRes() | TimeCaptur()) 399 condition=LinRes() | LogRes() | TimeCaptur())
338 400
401
339 class REV(StringValue): 402 class REV(StringValue):
340 _readonly = True 403 _readonly = True
341 "REVISION - Revision" 404 "REVISION - Revision"
342 405
406
343 class SACR(Command): 407 class SACR(Command):
344 "SACR - Send Auto Carrier" 408 "SACR - Send Auto Carrier"
345 409
410
346 class HP356XDevice(AbstractGPIBDevice): 411 class HP356XDevice(AbstractGPIBDevice):
347 _accepts = [ r"^(?P<model>HP *356[23][ABCD]).*$",] 412 _accepts = [r"^(?P<model>HP *356[23][ABCD]).*$", ]
348 _idn = "ID?" 413 _idn = "ID?"
414
349 def manage_srq(self, statusbyte): 415 def manage_srq(self, statusbyte):
350 print "Managing SRQ", statusbyte 416 print("Managing SRQ: %s" % statusbyte)
351 417
418
352 deviceRegister.register_manager(HP356XDevice) 419 deviceRegister.register_manager(HP356XDevice)

mercurial