a simple example may looks like this:
class DummyEnv(HasEnvironment):
def build(self):
self.core = self.get_device('core')
self.doppler_cool_beam = self.get_device('dummyTTL')
def build_doppler(self, **kwargs):
if 'ttl' in kwargs.keys():
self.doppler_cool_beam = kwargs('ttl')
self.has_ttl = True
else:
self.has_ttl = False
@kernel
def run(self):
# complicate sequence, for example:
if self.has_ttl:
self.doppler_cool_beam.pulse(2*ms)
class UserExperiment(DummyEnv, Experiment):
def build(self):
DummyEnv.build(self)
self.ttl3 = self.get_device('ttl3')
self.build_doppler(ttl=self.ttl3)
In this example, I only need to write the DummyEnv
and define the pulses there.
But I don't know which TTL
channel will be used for doppler_cool_beam
.
When the user starts writing the real UserExperiment
, he doesn't need to know how the sequence will work.
instead, he only needs to use self.build_doppler(ttl=self.ttl3)
to specify that ttl3
should do this job.
Currently, I need to ask the user to make sure they have this dummyTTL
in their device_db.py
.
I just feel this should have a better way, is it?