Skip to content

Commit f926e82

Browse files
committed
Enable software gating of the outputs.
Adds enable flat to synth output that is independent of the optional hardware-timed gate provided by another digital output on the DDS. Note, you will need to use WinfreakSynth.enable_output() in scripts to enable the output at the device level.
1 parent c92a4e0 commit f926e82

File tree

3 files changed

+30
-7
lines changed

3 files changed

+30
-7
lines changed

labscript_devices/Windfreak/blacs_tabs.py

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

1414
from blacs.device_base_class import DeviceTab
1515

16-
import labscript_utils.properties
1716

1817
class WindfreakSynthTab(DeviceTab):
1918

@@ -28,9 +27,9 @@ def initialise_GUI(self):
2827
conn_obj = self.settings['connection_table'].find_by_name(self.device_name).properties
2928

3029
self.allowed_chans = conn_obj.get('allowed_chans',None)
31-
30+
3231
# finish populating these from device properties
33-
chan_prop = {'freq':{},'amp':{},'phase':{}}
32+
chan_prop = {'freq':{},'amp':{},'phase':{},'gate':{}}
3433
freq_limits = conn_obj.get('freq_limits',None)
3534
chan_prop['freq']['min'] = freq_limits[0]
3635
chan_prop['freq']['max'] = freq_limits[1]

labscript_devices/Windfreak/blacs_workers.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from blacs.tab_base_classes import Worker
1515
import labscript_utils.h5_lock, h5py
1616

17+
1718
class WindfreakSynthWorker(Worker):
1819

1920
def init(self):
@@ -22,7 +23,8 @@ def init(self):
2223

2324
# init smart cache to a known point
2425
self.smart_cache = {'STATIC_DATA':None}
25-
self.subchnls = ['freq','amp','phase']
26+
self.subchnls = ['freq','amp','phase','gate']
27+
# this will be the order in which each channel is programmed
2628

2729
Worker.init(self)
2830

@@ -37,7 +39,7 @@ def init(self):
3739

3840
def set_trigger_mode(self,mode):
3941
"""Sets the synth trigger mode.
40-
42+
4143
Provides basic error checking to confirm setting is valid.
4244
4345
Args:
@@ -85,6 +87,8 @@ def check_remote_value(self,channel,type):
8587
return self.synth[channel].power
8688
elif type == 'phase':
8789
return self.synth[channel].phase
90+
elif type == 'gate':
91+
return self.synth[channel].rf_enable and self.synth[channel].pll_enable
8892
else:
8993
raise ValueError(type)
9094

@@ -96,6 +100,9 @@ def program_static_value(self,channel,type,value):
96100
self.synth[channel].power = value
97101
elif type == 'phase':
98102
self.synth[channel].phase = value
103+
elif type == 'gate':
104+
self.synth[channel].rf_enable = value
105+
self.synth[channel].pll_enable = value
99106
else:
100107
raise ValueError(type)
101108

@@ -131,4 +138,4 @@ def transition_to_buffered(self, device_name, h5file, initial_values, fresh):
131138
def shutdown(self):
132139
# save current state the memory
133140
self.synth.save()
134-
self.synth.close()
141+
self.synth.close()

labscript_devices/Windfreak/labscript_devices.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class WindfreakSynth(Device):
2323
allowed_children = [StaticDDS]
2424
# note, box labels 'A', 'B' map to programming channels 0, 1
2525
allowed_chans = [0, 1]
26+
enabled_chans = []
2627

2728
# define output limitations for the SynthHDPro
2829
freq_limits = (10e6, 24e9) # set in Hz
@@ -124,14 +125,30 @@ def generate_code(self, hdf5_file):
124125

125126
static_dtypes = [(f'freq{i:d}',np.float64) for i in self.allowed_chans] +\
126127
[(f'amp{i:d}',np.float64) for i in self.allowed_chans] +\
127-
[(f'phase{i:d}',np.float64) for i in self.allowed_chans]
128+
[(f'phase{i:d}',np.float64) for i in self.allowed_chans] +\
129+
[(f'gate{i:d}',bool) for i in self.allowed_chans]
128130
static_table = np.zeros(1,dtype=static_dtypes)
129131

130132
for connection in DDSs:
131133
static_table[f'freq{connection}'] = dds.frequency.raw_output
132134
static_table[f'amp{connection}'] = dds.amplitude.raw_output
133135
static_table[f'phase{connection}'] = dds.phase.raw_output
136+
static_table[f'gate{connection}'] = self.enabled_chans[connection]
134137

135138
grp = self.init_device_group(hdf5_file)
136139
grp.create_dataset('STATIC_DATA',compression=config.compression,data=static_table)
137140

141+
def enable_output(self, channel):
142+
"""Enable an output channel at the device level.
143+
144+
This is a software enable only, it cannot be hardware timed.
145+
146+
Args:
147+
channel (int): Channel to enable.
148+
"""
149+
150+
if channel in self.allowed_chans:
151+
if channel not in self.enabled_chans:
152+
self.enabled_chans.append(channel)
153+
else:
154+
raise LabscriptError(f'Channel {channel} is not a valid option for {self.device.name}.')

0 commit comments

Comments
 (0)