Skip to content

Commit

Permalink
examples/tdr: adapt to compiler changes
Browse files Browse the repository at this point in the history
jordens committed Mar 1, 2016
1 parent 81b35be commit baf7b0d
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions examples/master/repository/coredevice_examples/tdr.py
Original file line number Diff line number Diff line change
@@ -39,6 +39,7 @@ def run(self):
n = 1000 # repetitions
latency = 50e-9 # calibrated latency without a transmission line
pulse = 1e-6 # pulse length, larger than rtt
self.t = [0 for i in range(2)]
try:
self.many(n, seconds_to_mu(pulse, self.core))
except PulseNotReceivedError:
@@ -53,21 +54,19 @@ def run(self):

@kernel
def many(self, n, p):
t = [0 for i in range(2)]
self.core.break_realtime()
for i in range(n):
self.one(t, p)
self.t = t
self.one(p)

@kernel
def one(self, t, p):
def one(self, p):
t0 = now_mu()
with parallel:
self.pmt0.gate_both_mu(2*p)
self.ttl2.pulse_mu(p)
for i in range(len(t)):
for i in range(len(self.t)):
ti = self.pmt0.timestamp_mu()
if ti <= 0:
raise PulseNotReceivedError
t[i] += ti - t0
raise PulseNotReceivedError()
self.t[i] = int(self.t[i] + ti - t0)
self.pmt0.count() # flush

0 comments on commit baf7b0d

Please sign in to comment.