spirack 0.2.17__tar.gz → 0.2.19__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. {spirack-0.2.17 → spirack-0.2.19}/PKG-INFO +3 -3
  2. {spirack-0.2.17 → spirack-0.2.19}/setup.py +2 -2
  3. {spirack-0.2.17 → spirack-0.2.19}/spirack/D5a_module.py +52 -40
  4. {spirack-0.2.17 → spirack-0.2.19}/spirack/M2p_module.py +138 -114
  5. {spirack-0.2.17 → spirack-0.2.19}/spirack/spi_rack.py +8 -0
  6. spirack-0.2.19/spirack/version.py +1 -0
  7. {spirack-0.2.17 → spirack-0.2.19}/spirack.egg-info/PKG-INFO +3 -3
  8. spirack-0.2.17/spirack/version.py +0 -1
  9. {spirack-0.2.17 → spirack-0.2.19}/LICENSE +0 -0
  10. {spirack-0.2.17 → spirack-0.2.19}/README.md +0 -0
  11. {spirack-0.2.17 → spirack-0.2.19}/setup.cfg +0 -0
  12. {spirack-0.2.17 → spirack-0.2.19}/spirack/B1b_module.py +0 -0
  13. {spirack-0.2.17 → spirack-0.2.19}/spirack/B2b_module.py +0 -0
  14. {spirack-0.2.17 → spirack-0.2.19}/spirack/D4_module.py +0 -0
  15. {spirack-0.2.17 → spirack-0.2.19}/spirack/D4a_module.py +0 -0
  16. {spirack-0.2.17 → spirack-0.2.19}/spirack/D4b_module.py +0 -0
  17. {spirack-0.2.17 → spirack-0.2.19}/spirack/D5b_module.py +0 -0
  18. {spirack-0.2.17 → spirack-0.2.19}/spirack/F1d_module.py +0 -0
  19. {spirack-0.2.17 → spirack-0.2.19}/spirack/M2j_module.py +0 -0
  20. {spirack-0.2.17 → spirack-0.2.19}/spirack/P2d_module.py +0 -0
  21. {spirack-0.2.17 → spirack-0.2.19}/spirack/S4g_module.py +0 -0
  22. {spirack-0.2.17 → spirack-0.2.19}/spirack/S5i_module.py +0 -0
  23. {spirack-0.2.17 → spirack-0.2.19}/spirack/S5k_module.py +0 -0
  24. {spirack-0.2.17 → spirack-0.2.19}/spirack/S5l_module.py +0 -0
  25. {spirack-0.2.17 → spirack-0.2.19}/spirack/U1c_module.py +0 -0
  26. {spirack-0.2.17 → spirack-0.2.19}/spirack/U2_module.py +0 -0
  27. {spirack-0.2.17 → spirack-0.2.19}/spirack/__init__.py +0 -0
  28. {spirack-0.2.17 → spirack-0.2.19}/spirack/chip_mode.py +0 -0
  29. {spirack-0.2.17 → spirack-0.2.19}/spirack.egg-info/SOURCES.txt +0 -0
  30. {spirack-0.2.17 → spirack-0.2.19}/spirack.egg-info/dependency_links.txt +0 -0
  31. {spirack-0.2.17 → spirack-0.2.19}/spirack.egg-info/requires.txt +0 -0
  32. {spirack-0.2.17 → spirack-0.2.19}/spirack.egg-info/top_level.txt +0 -0
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: spirack
3
- Version: 0.2.17
3
+ Version: 0.2.19
4
4
  Summary: Drivers for the QuTech SPI-rack
5
- Home-page: https://github.com/mtiggelman/SPI-rack
6
- Author: Marijn Tiggelman
5
+ Home-page: https://github.com/qutechdev/SPI-rack
6
+ Author: QuTech Electronics Team
7
7
  Author-email: qutechdev@gmail.com
8
8
  License: MIT
9
9
  Keywords: SPI,Qcodes,SPI-rack,QuTech,TU Delft,SPI
@@ -30,8 +30,8 @@ setup(name='spirack',
30
30
  description='Drivers for the QuTech SPI-rack',
31
31
  long_description=long_description,
32
32
  long_description_content_type="text/markdown",
33
- url='https://github.com/mtiggelman/SPI-rack',
34
- author='Marijn Tiggelman',
33
+ url='https://github.com/qutechdev/SPI-rack',
34
+ author='QuTech Electronics Team',
35
35
  author_email='qutechdev@gmail.com',
36
36
  license='MIT',
37
37
  packages=['spirack'],
@@ -44,8 +44,8 @@ class D5a_module(object):
44
44
 
45
45
  # DAC software span constants
46
46
  range_4V_uni = 0
47
- range_8V_uni = 1
48
47
  range_4V_bi = 2
48
+ range_8V_uni = 1
49
49
  range_8V_bi = 3
50
50
  range_2V_bi = 4
51
51
 
@@ -254,34 +254,6 @@ class D5a_module(object):
254
254
  # send data via controller
255
255
  self.spi_rack.write_data(self.module, DAC_ic, LTC2758_MODE, LTC2758_SPEED, data)
256
256
 
257
- def update_multiple_this_is_a_test(self, DAC1, DAC2):
258
- """Updates the output of the DAC to the written value
259
-
260
- Updates the output of the DAC when called. Neccessary after using
261
- change_value or change_span when wanting to update the DAC.
262
-
263
- Args:
264
- DAC (int: 0-15): DAC inside the module of which to update
265
- """
266
- if DAC not in range(self._num_dacs):
267
- raise ValueError('D5a module {} [update]: DAC {} does not exist.'.format(self.module, DAC))
268
-
269
- # Determine which DAC in IC by checking even/uneven
270
- address = (DAC%2)<<1
271
-
272
- # Update DAC to given span/value
273
- command = 0b0100
274
- b1 = (command<<4) | address
275
- b2 = 0
276
- b3 = 0
277
- b4 = 0
278
- data = bytearray([b1, b2, b3, b4])
279
-
280
- # Determine in which IC the DAC is, for SPI chip select
281
- DAC_ic = DAC//2
282
- # send data via controller
283
- self.spi_rack.write_data(self.module, DAC_ic, LTC2758_MODE, LTC2758_SPEED, data)
284
-
285
257
  def set_voltage(self, DAC, voltage):
286
258
  """Sets the DAC output voltage and updates the DAC output
287
259
 
@@ -346,7 +318,7 @@ class D5a_module(object):
346
318
  def get_stepsize(self, DAC):
347
319
  """Returns the smallest voltage step for a given DAC
348
320
 
349
- Calculates and returns the smalles voltage step of the DAC for the
321
+ Calculates and returns the smallest voltage step of the DAC for the
350
322
  set span. Voltage steps smaller than this will not change the DAC value.
351
323
  Recommended to only step the DAC in multiples of this value, as otherwise
352
324
  steps might not behave as expected.
@@ -360,13 +332,15 @@ class D5a_module(object):
360
332
  raise ValueError('D5a module {} [get_stepsize]: DAC {} does not exist.'.format(self.module, DAC))
361
333
 
362
334
  if self.span[DAC] == D5a_module.range_4V_uni:
363
- return 4.0/(2**18)
364
- if self.span[DAC] == (D5a_module.range_4V_bi or D5a_module.range_8V_uni):
365
- return 8.0/(2**18)
366
- if self.span[DAC] == D5a_module.range_8V_bi:
367
- return 16.0/(2**18)
368
- if self.span[DAC] == D5a_module.range_2V_bi:
369
- return 4.0/(2**18)
335
+ return 4.0 / (2 ** 18)
336
+ elif self.span[DAC] == D5a_module.range_4V_bi or self.span[DAC] == D5a_module.range_8V_uni:
337
+ return 8.0 / (2 ** 18)
338
+ elif self.span[DAC] == D5a_module.range_8V_bi:
339
+ return 16.0 / (2 ** 18)
340
+ elif self.span[DAC] == D5a_module.range_2V_bi:
341
+ return 4.0 / (2 ** 18)
342
+ else:
343
+ raise ValueError(f"Span for DAC {DAC} not set to valid value. Span currently set to {self.span[DAC]}.")
370
344
 
371
345
  def get_settings(self, DAC):
372
346
  """Reads current DAC settings
@@ -388,14 +362,14 @@ class D5a_module(object):
388
362
  DAC_ic = DAC//2
389
363
 
390
364
  # Read code command
391
- command = 0b1101 # 0xd
365
+ command = 0b1101
392
366
  data = bytearray([(command<<4) | address, 0, 0, 0])
393
367
 
394
368
  code_data = self.spi_rack.read_data(self.module, DAC_ic, LTC2758_MODE, LTC2758_RD_SPEED, data)
395
369
  code = (code_data[1]<<10) | (code_data[2]<<2) | (code_data[3]>>6)
396
370
 
397
371
  # Read span command
398
- command = 0b1100 # 0xc
372
+ command = 0b1100
399
373
  data = bytearray([(command<<4) | address, 0, 0, 0])
400
374
 
401
375
  span_data = self.spi_rack.read_data(self.module, DAC_ic, LTC2758_MODE, LTC2758_RD_SPEED, data)
@@ -416,5 +390,43 @@ class D5a_module(object):
416
390
 
417
391
  self.voltages[DAC] = voltage
418
392
  self.span[DAC] = span
419
-
393
+
420
394
  return [voltage, span]
395
+
396
+ def is_D5a_communicating(self):
397
+ """Checks proper communication with the D5a.
398
+ """
399
+ DAC = 0 # DAC 0 is expected available for any D5a version (any number of DACs)
400
+
401
+ # Determine which DAC in IC by checking even/uneven
402
+ address = (DAC%2)<<1
403
+ # Determine in which IC the DAC is, for SPI chip select
404
+ DAC_ic = DAC//2
405
+
406
+ # Read initial value of input code resgiter.
407
+ # Any value could be legal and user-given
408
+
409
+ # Command to read input code register
410
+ command = 0b1011
411
+ data = bytearray([(command<<4) | address, 0, 0, 0])
412
+ orig_data_rd = self.spi_rack.read_data(self.module, DAC_ic, LTC2758_MODE, LTC2758_RD_SPEED, data)
413
+ orig_value = (orig_data_rd[1]<<10) | (orig_data_rd[2]<<2) | (orig_data_rd[3]>>6)
414
+
415
+ # Write a new value and read back to check
416
+ # First write to the input code register
417
+ test_value = 177033 # Arbitrary, 0b10 1011 0011 1000 1001
418
+ self.change_value(DAC, test_value)
419
+ # Now read back the updated value
420
+ command = 0b1011
421
+ data = bytearray([(command<<4) | address, 0, 0, 0])
422
+ new_data_rd = self.spi_rack.read_data(self.module, DAC_ic, LTC2758_MODE, LTC2758_RD_SPEED, data)
423
+ new_value = (new_data_rd[1]<<10) | (new_data_rd[2]<<2) | (new_data_rd[3]>>6)
424
+
425
+ # Write again the original value
426
+ self.change_value(DAC, orig_value)
427
+
428
+ # Check and return the result
429
+ if (test_value != new_value):
430
+ return 0
431
+ else:
432
+ return 1
@@ -1,10 +1,6 @@
1
1
  import numpy as np
2
- from spi_rack import *
3
- from chip_mode import BICPINS_MODE, BICPINS_SPEED
4
- from time import sleep
2
+ from .chip_mode import BICPINS_MODE, BICPINS_SPEED
5
3
 
6
- #global values
7
- gainlist = [1,10,100,1000,10000]
8
4
 
9
5
  class M2p_module(object):
10
6
  """M2p module interface class
@@ -22,9 +18,20 @@ class M2p_module(object):
22
18
  remote_settings: contains a byte with the remote settigns (IQ gain and filter)
23
19
  """
24
20
 
21
+ #allowed gain values
22
+ gainlist = [1,10,100,1000,10000]
23
+
24
+
25
25
  def __init__(self, spi_rack, module):
26
26
  self.module = module
27
27
  self.spi_rack = spi_rack
28
+
29
+ # Upon start-up copy the existing local settings
30
+ # and set module to local operation
31
+ initial_gain = self.get_gain_local()
32
+ initial_coupling = self.get_coupling_local()
33
+ self.remote_set_gain_and_coupling(gain = initial_gain, coupling = initial_coupling)
34
+ self.set_local()
28
35
 
29
36
  def set_remote(self):
30
37
  """
@@ -35,29 +42,33 @@ class M2p_module(object):
35
42
  # check if module is already in remote mode, if so do nothing
36
43
  set_mode = self.get_operating_mode()
37
44
  if (set_mode == 1):
38
- print("Already in remotemode, no mode change made" )
45
+ print("Already in remote mode. No mode change made" )
39
46
  return #exit do nothing
40
47
 
41
- # Get gainswitch and coupleswitcht setting
42
- gain = self.get_gainswitch()
43
- couple = self.get_couple_switchsetting()
44
- self.set_gain(gain,couple)
48
+ # Get the local gain and coupling settings (from the front panel) ...
49
+ gain = self.get_gain_local()
50
+ couple = self.get_coupling_local()
51
+ # ... and use them initially when switching to remote mode
52
+ self.remote_set_gain_and_coupling(gain,couple)
45
53
 
46
54
  dummy_data = bytearray([0,0])
47
55
  r_data = bytearray([0,0])
48
56
  r_data = self.spi_rack.read_data(self.module, 6, BICPINS_MODE, BICPINS_SPEED, dummy_data)
49
57
 
50
- #set remote bit keep the others
51
- commandlow = r_data[0]|0b10000000
52
- commandhigh = r_data[1]|0b10000000
53
- s_data = bytearray([commandhigh, commandlow,])
54
- self.spi_rack.write_data(self.module, 5, BICPINS_MODE, BICPINS_SPEED, s_data)
55
- self.set_gain(gain,couple)
58
+ #set remote bit to 1 (keeping other setings)
59
+ high_byte = r_data[0]|0b10000000
60
+ #low_byte = r_data[1]|0b10000000
61
+ low_byte = r_data[1]
62
+
63
+ #write new settings (with high remote bit)
64
+ w_data = bytearray([high_byte,low_byte])
65
+ self.spi_rack.write_data(self.module, 5, BICPINS_MODE, BICPINS_SPEED, w_data)
66
+ self.remote_set_gain_and_coupling(gain,couple)
56
67
 
57
68
  def set_local(self):
58
69
  """
59
- Set the module to local mode. The gain- and coupling settings reverts to the frontpanel switch setting.
60
- If the remotely set gain is different from the front panel setting there migh be a jump in output due to a differnce in gain.
70
+ Set the module to local mode. The gain- and coupling settings revert to the front-panel switch setting.
71
+ If the remotely set gain is different from the front panel setting there might be a jump in output due to a differnce in gain.
61
72
  """
62
73
 
63
74
  # read last high and low byte setting
@@ -65,209 +76,222 @@ class M2p_module(object):
65
76
  r_data = bytearray([0,0])
66
77
  r_data = self.spi_rack.read_data(self.module, 6, BICPINS_MODE, BICPINS_SPEED, dummy_data)
67
78
 
68
- #reset remote bit keep the others
69
- commandlow = r_data[0] & 0b01111111
70
- commandhigh = r_data[1] & 0b01111111
79
+ #reset remote bit to 0 (keeping other setings)
80
+ high_byte = r_data[0] & 0b01111111
81
+ #low_byte = r_data[1] & 0b01111111
82
+ low_byte = r_data[1]
71
83
 
72
- #write settings with reset remote bit
73
- s_data = bytearray([commandlow,commandhigh])
74
- self.spi_rack.write_data(self.module, 5, BICPINS_MODE, BICPINS_SPEED, s_data)
84
+ #write new settings (with 0-set remote bit)
85
+ w_data = bytearray([high_byte,low_byte])
86
+ self.spi_rack.write_data(self.module, 5, BICPINS_MODE, BICPINS_SPEED, w_data)
75
87
 
76
- def set_gain(self, gainlevel, couplemode):
88
+ def remote_set_gain_and_coupling(self, gain, coupling):
77
89
  """
78
90
  Set gain and coupling mode
79
91
  Posible gain settings : 1, 10, 100, 1000, 10.000
80
- Coupling DC=0 AC=1
92
+ Coupling 'DC'=1 'AC'=0
93
+
81
94
  gainlevel and couplemode parameters are checked for valid values.
82
95
  When one of the parameters is out of range or otherwise invalid no change in settings will be made
83
- The remote/local setting will not ne changed, so if current setting is local NO CHANGE in gain or coupling will happen.
96
+
97
+ The remote/local selection is maintained, so under a 'local' setting NO CHANGE in gain or coupling will happen.
84
98
  But the last written values can be readback
85
99
  """
86
100
 
87
- # check for valid gain and couple values
88
- if self.gainvalid(gainlevel) == False or self.couplemodevalid(couplemode) == False:
89
- print("Invalid gain or couplemode, no settings changed" )
101
+ # check for valid gain and coupling values
102
+ if self._is_gain_valid(gain) == False or self._is_couplemode_valid(coupling) == False:
103
+ print("Invalid gain or coupling, no settings changed" )
90
104
  return
91
105
 
92
- # read high byte for remote bit and couple bit
106
+ # read to preserve the value of the high byte for the upcoming 'write'
93
107
  dummy_data = bytearray([0,0])
94
108
  r_data = bytearray([0,0])
95
109
  r_data = self.spi_rack.read_data(self.module, 6, BICPINS_MODE, BICPINS_SPEED, dummy_data)
96
- commandhigh = r_data[1]
110
+ high_byte = r_data[0]
97
111
 
98
- #commandhigh = 0b10000001
99
- # set gain bits
100
- if gainlevel == 1:
101
- commandlow = 0b10010000
102
- if gainlevel == 10:
103
- commandlow = 0b10010001
104
- if gainlevel == 100:
105
- commandlow = 0b10010010
106
- if gainlevel == 1000:
107
- commandlow = 0b10010110
108
- if gainlevel == 10000:
109
- commandlow = 0b10011010
112
+ # config gain bits
113
+ if gain == 1:
114
+ low_byte = 0b10010000
115
+ elif gain == 10:
116
+ low_byte = 0b10010001
117
+ elif gain == 100:
118
+ low_byte = 0b10010010
119
+ elif gain == 1000:
120
+ low_byte = 0b10010110
121
+ else:
122
+ # gain == 10000:
123
+ low_byte = 0b10011010
110
124
 
111
- # (re)setcouple bit while keeping remote bit setting
112
- if couplemode == 0:
113
- commandlow = commandlow | 0b00010000 # DC
125
+ # config coupling bit (while keeping other settings)
126
+ if coupling == 'DC':
127
+ low_byte = low_byte | 0b00010000 # For DC, set control bit to 1
114
128
  else:
115
- commandlow = commandlow & 0b11101111 # AC
129
+ low_byte = low_byte & 0b11101111 # For AC, set control bit to 0
116
130
 
117
- s_data = bytearray([commandhigh,commandlow])
118
- self.spi_rack.write_data(self.module, 5, BICPINS_MODE, BICPINS_SPEED, s_data)
131
+ w_data = bytearray([high_byte,low_byte])
132
+ self.spi_rack.write_data(self.module, 5, BICPINS_MODE, BICPINS_SPEED, w_data)
119
133
 
120
- def gainvalid(self, gain):
134
+ def _is_gain_valid(self, gain):
121
135
  # Check gain parameter for valid values
122
136
  # return True (valid) or False (invalid)
123
- if gain in gainlist:
137
+ if gain in self.gainlist:
124
138
  return True
125
139
  else:
126
140
  return False
127
141
 
128
- def couplemodevalid(self, couplemode):
142
+ def _is_couplemode_valid(self, couplemode):
129
143
  # Check couple parameter for valid values
130
144
  # return True (valid) or False (invalid)
131
- if couplemode <0 or couplemode>1:
132
- return False
133
- else:
145
+ if couplemode in ['AC','DC']:
134
146
  return True
147
+ else:
148
+ return False
135
149
 
136
150
  def get_operating_mode(self):
137
151
  """
138
152
  read the operating status of the module.
139
- Either 1 = Remote mode or 0 = local mode
153
+ Modes can be 'remote' or 'local'
140
154
  """
141
155
 
142
- mode = 0
156
+ mode = ''
143
157
  dummy_data = bytearray([0,0])
144
158
  r_data = bytearray([0,0])
145
159
  r_data = self.spi_rack.read_data(self.module, 6, BICPINS_MODE, BICPINS_SPEED, dummy_data)
146
160
 
147
161
  if r_data[0] & 0b10000000:
148
- mode = 1
162
+ mode = 'remote'
149
163
  else:
150
- mode = 0
164
+ mode = 'local'
151
165
 
152
166
  return(mode)
153
167
 
154
- def get_lastgainset(self):
168
+ def get_gain_setting(self):
155
169
  """
156
170
  Get lastgain switch setting command.
157
171
  This in NOT the same as the gain settings of the switch panel!
158
172
  This is the last gain set in remote mode.
159
- posible results: 1, 10, 100, 1000, 10000
173
+ Posible results: 1, 10, 100, 1000, 10000
160
174
  """
161
- commandhigh = 0b00000000
162
- commandlow = 0b00000000
163
- s_data = bytearray([commandhigh, commandlow])
175
+ if self.get_operating_mode()=='local':
176
+ return self.get_gain_local()
177
+ else:
178
+ return self.get_gain_remote()
179
+
180
+ def get_gain_remote(self):
181
+ s_data = bytearray([0, 0])
164
182
  r_data = self.spi_rack.read_data(self.module, 6, BICPINS_MODE, BICPINS_SPEED, s_data)
165
183
  gain = -1
166
184
  if r_data[1] & 0b00001111 == 0:
167
185
  gain = 1
168
- if r_data[1] & 0b00000001 == 0b00000001:
186
+ if r_data[1] & 0b00001111 == 0b00000001:
169
187
  gain = 10
170
- if r_data[1] & 0b00000010 == 0b00000010 :
188
+ if r_data[1] & 0b00001111 == 0b00000010:
171
189
  gain = 100
172
- if r_data[1] & 0b00000110 == 0b00000110:
190
+ if r_data[1] & 0b00001111 == 0b00000110:
173
191
  gain = 1000
174
- if r_data[1] & 0b00001010 == 0b00001010:
192
+ if r_data[1] & 0b00001111 == 0b00001010:
175
193
  gain = 10000
176
194
  return (gain)
177
195
 
178
196
 
179
- def get_gainswitch(self):
197
+ def get_gain_local(self):
180
198
  """
181
- Get the frontpanel gain switch setting.
182
- posible results: 1, 10, 100, 1000, 10000
199
+ Get the front-panel gain switch setting.
200
+ Posible results: 1, 10, 100, 1000, 10000
183
201
  """
184
- commandhigh = 0b00000000
185
- commandlow = 0b00000000
186
- s_data = bytearray([commandhigh, commandlow])
202
+ s_data = bytearray([0,0])
187
203
  r_data = self.spi_rack.read_data(self.module, 4, BICPINS_MODE, BICPINS_SPEED, s_data)
188
204
 
189
205
  gain = -1
190
206
  if r_data[1] & 0b00001111 == 0:
191
207
  gain = 1
192
- if r_data[1] & 0b00000001 == 0b00000001:
208
+ elif r_data[1] & 0b00001111 == 0b00000001:
193
209
  gain = 10
194
- if r_data[1] & 0b00000010 == 0b00000010 :
210
+ elif r_data[1] & 0b00001111 == 0b00000010:
195
211
  gain = 100
196
- if r_data[1] & 0b00000110 == 0b00000110:
212
+ elif r_data[1] & 0b00001111 == 0b00000110:
197
213
  gain = 1000
198
- if r_data[1] & 0b00001010 == 0b00001010:
214
+ elif r_data[1] & 0b00001111 == 0b00001010:
199
215
  gain = 10000
200
216
 
201
217
  return (gain)
202
218
 
203
- def get_lastcouple_switchsetting(self):
219
+ def get_coupling_setting(self):
204
220
  """
205
221
  Get the last frontpanel couple mode (AC/DC) switch setting command.
206
222
  This in NOT the same as the couple mode settings on the front panel!
207
- posible results: 0 = DC 1=AC
223
+ posible results: 'DC'=1 AC='0'
208
224
  """
225
+ if self.get_operating_mode()=='local':
226
+ return self.get_coupling_local()
227
+ else:
228
+ return self.get_coupling_remote()
229
+
230
+ def get_coupling_remote(self):
209
231
  dummy_data = bytearray([0,0])
210
232
  r_data = self.spi_rack.read_data(self.module, 6, BICPINS_MODE, BICPINS_SPEED, dummy_data)
211
233
  mode = -1
212
234
  if r_data[1] & 0b00010000:
213
- mode = 1
235
+ mode = 'DC'
214
236
  else:
215
- mode = 0
237
+ mode = 'AC'
216
238
  return (mode)
217
239
 
218
- def get_couple_switchsetting(self):
240
+ def get_coupling_local(self):
219
241
  """
220
242
  Get the frontpanel couple mode (AC/DC) switch setting.
221
- posible results: 0 = DC 1=AC
243
+ posible results: 'DC'=1 AC='0'
222
244
  """
223
245
  dummy_data = bytearray([0,0])
224
246
  r_data = self.spi_rack.read_data(self.module, 4, BICPINS_MODE, BICPINS_SPEED, dummy_data)
225
247
  mode = -1
226
248
  if r_data[1] & 0b00010000:
227
- mode = 1
249
+ mode = 'DC'
228
250
  else:
229
- mode = 0
251
+ mode = 'AC'
230
252
  return (mode)
231
-
232
- def get_clipped_latched(self):
233
- # Return:
234
- # 0 if none clipped
235
- # 1 if pos clipped
236
- # 2 if neg clipped
237
- # 3 if pos and neg clipped (is posible when clipped is latched)
238
- clipped = -1
239
- dummy_data = bytearray([0,0])
240
- r_data = self.spi_rack.read_data(self.module, 7, BICPINS_MODE, BICPINS_SPEED, dummy_data)
241
-
242
- if (((r_data[0] & 0b01000000) == 0) & ((r_data[0] & 0b10000000) == 0)):
243
- clipped = 0
244
- elif (r_data[0] & 0b11000000 == 0b11000000):
245
- clipped = 3
246
- elif (r_data[0] & 0b01000000):
247
- clipped = 2
248
- elif (r_data[0] & 0b10000000):
249
- clipped = 1
250
-
251
- return (clipped)
252
253
 
253
254
  def get_clipped_unlatched(self):
255
+ # Inverted polarity
254
256
  # Return:
255
257
  # 0 if none clipped
256
258
  # 1 if pos clipped
257
259
  # 2 if neg clipped
258
260
  # 3 if pos and neg clipped (is posible when clipped is latched)
259
261
 
260
- clipped = -1
262
+ clipped = ''
261
263
  dummy_data = bytearray([0,0])
262
- r_data = self.spi_rack.read_data(self.module, 7, BICPINS_MODE, BICPINS_SPEED, dummy_data)
264
+ r_data = self.spi_rack.read_data(self.module, 3, BICPINS_MODE, BICPINS_SPEED, dummy_data)
263
265
 
264
266
  if (r_data[0] & 0b00110000) == 0b00110000:
265
- clipped = 0
267
+ clipped = 'not clipped'
266
268
  elif (((r_data[0] & 0b00010000) == 0) & ((r_data[0] & 0b00100000) == 0)):
267
- clipped = 3
269
+ clipped = 'pos and neg clipped'
268
270
  elif (r_data[0] & 0b00010000) == 0:
269
- clipped = 1
271
+ clipped = 'pos clipped'
270
272
  elif (r_data[0] & 0b00100000) == 0:
271
- clipped = 2
273
+ clipped = 'neg clipped'
274
+
275
+ return (clipped)
276
+
277
+ def get_clipped_latched(self):
278
+ # Regular polarity (non-inverted)
279
+ # Return:
280
+ # 0 if none clipped
281
+ # 1 if pos clipped
282
+ # 2 if neg clipped
283
+ # 3 if pos and neg clipped (is posible when clipped is latched)
284
+ clipped = ''
285
+ dummy_data = bytearray([0,0])
286
+ r_data = self.spi_rack.read_data(self.module, 4, BICPINS_MODE, BICPINS_SPEED, dummy_data)
287
+
288
+ if (((r_data[0] & 0b01000000) == 0) & ((r_data[0] & 0b10000000) == 0)):
289
+ clipped = 'not clipped'
290
+ elif (r_data[0] & 0b11000000 == 0b11000000):
291
+ clipped = 'pos and neg clipped'
292
+ elif (r_data[0] & 0b01000000):
293
+ clipped = 'neg clipped'
294
+ elif (r_data[0] & 0b10000000):
295
+ clipped = 'pos clipped'
272
296
 
273
297
  return (clipped)
@@ -381,3 +381,11 @@ class SPI_rack(serial.Serial):
381
381
 
382
382
  version = self.readline().decode('utf-8')
383
383
  return version[:-1]
384
+
385
+ def is_C1b_communicating(self):
386
+ """
387
+ """
388
+ if (self.get_battery()==[0.0,0.0]) and (self.get_temperature()==0.0):
389
+ if (self.get_battery()==[0.0,0.0]) and (self.get_temperature()==0.0):
390
+ return 0
391
+ return 1
@@ -0,0 +1 @@
1
+ __version__ = '0.2.19'
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: spirack
3
- Version: 0.2.17
3
+ Version: 0.2.19
4
4
  Summary: Drivers for the QuTech SPI-rack
5
- Home-page: https://github.com/mtiggelman/SPI-rack
6
- Author: Marijn Tiggelman
5
+ Home-page: https://github.com/qutechdev/SPI-rack
6
+ Author: QuTech Electronics Team
7
7
  Author-email: qutechdev@gmail.com
8
8
  License: MIT
9
9
  Keywords: SPI,Qcodes,SPI-rack,QuTech,TU Delft,SPI
@@ -1 +0,0 @@
1
- __version__ = '0.2.17'
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes