Skip to content

Commit baa00c8

Browse files
committed
Fix issue with windfreak API that doesn't handle the np.bool_ type correctly.
Also fix accidental override of internal `type` command with function local variables.
1 parent 4719e54 commit baa00c8

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

labscript_devices/Windfreak/blacs_workers.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
from blacs.tab_base_classes import Worker
1515
import labscript_utils.h5_lock, h5py
16+
import numpy as np
1617

1718

1819
class WindfreakSynthWorker(Worker):
@@ -79,28 +80,31 @@ def program_manual(self, front_panel_values):
7980

8081
return self.check_remote_values()
8182

82-
def check_remote_value(self,channel,type):
83+
def check_remote_value(self,channel,typ):
8384

84-
if type == 'freq':
85+
if typ == 'freq':
8586
return self.synth[channel].frequency
86-
elif type == 'amp':
87+
elif typ == 'amp':
8788
return self.synth[channel].power
88-
elif type == 'phase':
89+
elif typ == 'phase':
8990
return self.synth[channel].phase
90-
elif type == 'gate':
91+
elif typ == 'gate':
9192
return self.synth[channel].rf_enable and self.synth[channel].pll_enable
9293
else:
9394
raise ValueError(type)
9495

95-
def program_static_value(self,channel,type,value):
96+
def program_static_value(self,channel,typ,value):
9697

97-
if type == 'freq':
98+
if typ == 'freq':
9899
self.synth[channel].frequency = value
99-
elif type == 'amp':
100+
elif typ == 'amp':
100101
self.synth[channel].power = value
101-
elif type == 'phase':
102+
elif typ == 'phase':
102103
self.synth[channel].phase = value
103-
elif type == 'gate':
104+
elif typ == 'gate':
105+
# windfreak API does not like np.bool_
106+
# convert to native python bool
107+
if isinstance(value, np.bool_): value = value.item()
104108
self.synth[channel].rf_enable = value
105109
self.synth[channel].pll_enable = value
106110
else:

0 commit comments

Comments
 (0)