spirack 0.2.12__tar.gz → 0.2.14__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.
- {spirack-0.2.12 → spirack-0.2.14}/PKG-INFO +1 -1
- {spirack-0.2.12 → spirack-0.2.14}/spirack/D5a_module.py +47 -16
- spirack-0.2.14/spirack/S5k_module.py +858 -0
- spirack-0.2.14/spirack/version.py +1 -0
- {spirack-0.2.12 → spirack-0.2.14}/spirack.egg-info/PKG-INFO +1 -1
- spirack-0.2.12/spirack/S5k_module.py +0 -558
- spirack-0.2.12/spirack/version.py +0 -1
- {spirack-0.2.12 → spirack-0.2.14}/LICENSE +0 -0
- {spirack-0.2.12 → spirack-0.2.14}/README.md +0 -0
- {spirack-0.2.12 → spirack-0.2.14}/setup.cfg +0 -0
- {spirack-0.2.12 → spirack-0.2.14}/setup.py +0 -0
- {spirack-0.2.12 → spirack-0.2.14}/spirack/B1b_module.py +0 -0
- {spirack-0.2.12 → spirack-0.2.14}/spirack/B2b_module.py +0 -0
- {spirack-0.2.12 → spirack-0.2.14}/spirack/D4_module.py +0 -0
- {spirack-0.2.12 → spirack-0.2.14}/spirack/D4a_module.py +0 -0
- {spirack-0.2.12 → spirack-0.2.14}/spirack/D4b_module.py +0 -0
- {spirack-0.2.12 → spirack-0.2.14}/spirack/D5b_module.py +0 -0
- {spirack-0.2.12 → spirack-0.2.14}/spirack/F1d_module.py +0 -0
- {spirack-0.2.12 → spirack-0.2.14}/spirack/M2j_module.py +0 -0
- {spirack-0.2.12 → spirack-0.2.14}/spirack/M2p_module.py +0 -0
- {spirack-0.2.12 → spirack-0.2.14}/spirack/P2d_module.py +0 -0
- {spirack-0.2.12 → spirack-0.2.14}/spirack/S4g_module.py +0 -0
- {spirack-0.2.12 → spirack-0.2.14}/spirack/S5i_module.py +0 -0
- {spirack-0.2.12 → spirack-0.2.14}/spirack/S5l_module.py +0 -0
- {spirack-0.2.12 → spirack-0.2.14}/spirack/U1c_module.py +0 -0
- {spirack-0.2.12 → spirack-0.2.14}/spirack/U2_module.py +0 -0
- {spirack-0.2.12 → spirack-0.2.14}/spirack/__init__.py +0 -0
- {spirack-0.2.12 → spirack-0.2.14}/spirack/chip_mode.py +0 -0
- {spirack-0.2.12 → spirack-0.2.14}/spirack/spi_rack.py +0 -0
- {spirack-0.2.12 → spirack-0.2.14}/spirack.egg-info/SOURCES.txt +0 -0
- {spirack-0.2.12 → spirack-0.2.14}/spirack.egg-info/dependency_links.txt +0 -0
- {spirack-0.2.12 → spirack-0.2.14}/spirack.egg-info/requires.txt +0 -0
- {spirack-0.2.12 → spirack-0.2.14}/spirack.egg-info/top_level.txt +0 -0
|
@@ -44,8 +44,8 @@ class D5a_module(object):
|
|
|
44
44
|
|
|
45
45
|
# DAC software span constants
|
|
46
46
|
range_4V_uni = 0
|
|
47
|
-
range_4V_bi = 2
|
|
48
47
|
range_8V_uni = 1
|
|
48
|
+
range_4V_bi = 2
|
|
49
49
|
range_8V_bi = 3
|
|
50
50
|
range_2V_bi = 4
|
|
51
51
|
|
|
@@ -67,8 +67,8 @@ class D5a_module(object):
|
|
|
67
67
|
self.spi_rack = spi_rack
|
|
68
68
|
self.module = module
|
|
69
69
|
self._num_dacs = num_dacs
|
|
70
|
-
self.span = [np.
|
|
71
|
-
self.voltages = [np.
|
|
70
|
+
self.span = [np.NaN]*self._num_dacs
|
|
71
|
+
self.voltages = [np.NaN]*self._num_dacs
|
|
72
72
|
|
|
73
73
|
for i in range(self._num_dacs):
|
|
74
74
|
self.get_settings(i)
|
|
@@ -126,6 +126,11 @@ class D5a_module(object):
|
|
|
126
126
|
DAC_ic = DAC//2
|
|
127
127
|
# send data via controller
|
|
128
128
|
self.spi_rack.write_data(self.module, DAC_ic, LTC2758_MODE, LTC2758_SPEED, data)
|
|
129
|
+
|
|
130
|
+
# The change of span will also cause a change in the actual output voltage
|
|
131
|
+
# Make update to the voltages array to reflect that change
|
|
132
|
+
new_settings = self.get_settings(DAC) # read from actual hardware
|
|
133
|
+
self.span[DAC] = new_settings[0] # update to the cached variables
|
|
129
134
|
|
|
130
135
|
def change_span(self, DAC, span):
|
|
131
136
|
"""Changes the software span of selected DAC without update
|
|
@@ -249,6 +254,34 @@ class D5a_module(object):
|
|
|
249
254
|
# send data via controller
|
|
250
255
|
self.spi_rack.write_data(self.module, DAC_ic, LTC2758_MODE, LTC2758_SPEED, data)
|
|
251
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
|
+
|
|
252
285
|
def set_voltage(self, DAC, voltage):
|
|
253
286
|
"""Sets the DAC output voltage and updates the DAC output
|
|
254
287
|
|
|
@@ -313,7 +346,7 @@ class D5a_module(object):
|
|
|
313
346
|
def get_stepsize(self, DAC):
|
|
314
347
|
"""Returns the smallest voltage step for a given DAC
|
|
315
348
|
|
|
316
|
-
Calculates and returns the
|
|
349
|
+
Calculates and returns the smalles voltage step of the DAC for the
|
|
317
350
|
set span. Voltage steps smaller than this will not change the DAC value.
|
|
318
351
|
Recommended to only step the DAC in multiples of this value, as otherwise
|
|
319
352
|
steps might not behave as expected.
|
|
@@ -327,15 +360,13 @@ class D5a_module(object):
|
|
|
327
360
|
raise ValueError('D5a module {} [get_stepsize]: DAC {} does not exist.'.format(self.module, DAC))
|
|
328
361
|
|
|
329
362
|
if self.span[DAC] == D5a_module.range_4V_uni:
|
|
330
|
-
return 4.0
|
|
331
|
-
|
|
332
|
-
return 8.0
|
|
333
|
-
|
|
334
|
-
return 16.0
|
|
335
|
-
|
|
336
|
-
return 4.0
|
|
337
|
-
else:
|
|
338
|
-
raise ValueError(f"Span for DAC {DAC} not set to valid value. Span currently set to {self.span[DAC]}.")
|
|
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)
|
|
339
370
|
|
|
340
371
|
def get_settings(self, DAC):
|
|
341
372
|
"""Reads current DAC settings
|
|
@@ -357,14 +388,14 @@ class D5a_module(object):
|
|
|
357
388
|
DAC_ic = DAC//2
|
|
358
389
|
|
|
359
390
|
# Read code command
|
|
360
|
-
command = 0b1101
|
|
391
|
+
command = 0b1101 # 0xd
|
|
361
392
|
data = bytearray([(command<<4) | address, 0, 0, 0])
|
|
362
393
|
|
|
363
394
|
code_data = self.spi_rack.read_data(self.module, DAC_ic, LTC2758_MODE, LTC2758_RD_SPEED, data)
|
|
364
395
|
code = (code_data[1]<<10) | (code_data[2]<<2) | (code_data[3]>>6)
|
|
365
396
|
|
|
366
397
|
# Read span command
|
|
367
|
-
command = 0b1100
|
|
398
|
+
command = 0b1100 # 0xc
|
|
368
399
|
data = bytearray([(command<<4) | address, 0, 0, 0])
|
|
369
400
|
|
|
370
401
|
span_data = self.spi_rack.read_data(self.module, DAC_ic, LTC2758_MODE, LTC2758_RD_SPEED, data)
|
|
@@ -385,5 +416,5 @@ class D5a_module(object):
|
|
|
385
416
|
|
|
386
417
|
self.voltages[DAC] = voltage
|
|
387
418
|
self.span[DAC] = span
|
|
388
|
-
|
|
419
|
+
|
|
389
420
|
return [voltage, span]
|