Skip to content

Commit 4e479df

Browse files
committed
Merged in cbillington/labscript_devices/feature (pull request labscript-suite#12)
Added DummyDevice Approved-by: Philip Starkey <philip.starkey@monash.edu>
2 parents a1e2cb3 + 4f64bc9 commit 4e479df

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

DummyPseudoclock.py

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#####################################################################
2+
# #
3+
# /labscript_devices/DummyPseudoclock.py #
4+
# #
5+
# Copyright 2017, Joint Quantum Institute #
6+
# #
7+
# This file is part of labscript_devices, in the labscript suite #
8+
# (see http://labscriptsuite.org), and is licensed under the #
9+
# Simplified BSD License. See the license.txt file in the root of #
10+
# the project for the full license. #
11+
# #
12+
#####################################################################
13+
14+
# This file represents a dummy labscript device for purposes of testing BLACS
15+
# and labscript. The device is a PseudoclockDevice, and can be the sole device
16+
# in a connection table or experiment.
17+
18+
19+
from labscript_devices import labscript_device, BLACS_tab, BLACS_worker
20+
from labscript import PseudoclockDevice
21+
22+
@labscript_device
23+
class DummyPseudoclock(PseudoclockDevice):
24+
25+
description = 'Dummy pseudoclock'
26+
clock_limit = 1e6
27+
28+
def __init__(self, name='dummy_pseudoclock', BLACS_connection='dummy_connection', **kwargs):
29+
self.BLACS_connection = BLACS_connection
30+
PseudoclockDevice.__init__(self, name, None, None, **kwargs)
31+
32+
def generate_code(self, hdf5_file):
33+
group = self.init_device_group(hdf5_file)
34+
35+
36+
from blacs.device_base_class import DeviceTab, define_state, MODE_BUFFERED
37+
from blacs.tab_base_classes import Worker
38+
39+
40+
@BLACS_tab
41+
class DummyPseudoclockTab(DeviceTab):
42+
def initialise_workers(self):
43+
worker_initialisation_kwargs = {}
44+
self.create_worker("main_worker", DummyPseudoclockWorker, worker_initialisation_kwargs)
45+
self.primary_worker = "main_worker"
46+
47+
@define_state(MODE_BUFFERED, True)
48+
def start_run(self, notify_queue):
49+
notify_queue.put('done')
50+
51+
@BLACS_worker
52+
class DummyPseudoclockWorker(Worker):
53+
def program_manual(self, values):
54+
return {}
55+
56+
def transition_to_buffered(self, device_name, h5file, initial_values, fresh):
57+
return {}
58+
59+
def transition_to_manual(self):
60+
return True
61+
62+
def shutdown(self):
63+
return

0 commit comments

Comments
 (0)