2014-09-30 17:38:02 +08:00
|
|
|
from artiq import *
|
2014-09-13 19:38:15 +08:00
|
|
|
|
|
|
|
|
2015-01-12 18:51:23 +08:00
|
|
|
class PhotonHistogram(AutoDB):
|
2015-02-21 05:01:34 +08:00
|
|
|
__artiq_unit__ = "Photon histogram"
|
|
|
|
|
2015-01-12 18:51:23 +08:00
|
|
|
class DBKeys:
|
|
|
|
bd = Device()
|
|
|
|
bdd = Device()
|
|
|
|
pmt = Device()
|
2014-09-13 19:38:15 +08:00
|
|
|
|
2015-01-12 18:51:23 +08:00
|
|
|
nbins = Argument(100)
|
|
|
|
repeats = Argument(100)
|
2015-01-10 15:41:35 +08:00
|
|
|
|
2014-09-13 19:38:15 +08:00
|
|
|
@kernel
|
|
|
|
def cool_detect(self):
|
|
|
|
with parallel:
|
|
|
|
self.bd.pulse(200*MHz, 1*ms)
|
|
|
|
self.bdd.pulse(300*MHz, 1*ms)
|
|
|
|
self.bd.pulse(210*MHz, 100*us)
|
|
|
|
with parallel:
|
|
|
|
self.bd.pulse(220*MHz, 100*us)
|
2014-09-30 16:42:07 +08:00
|
|
|
self.pmt.gate_rising(100*us)
|
2014-09-13 19:38:15 +08:00
|
|
|
self.bd.on(200*MHz)
|
|
|
|
self.bdd.on(300*MHz)
|
2014-09-30 16:42:07 +08:00
|
|
|
return self.pmt.count()
|
2014-09-13 19:38:15 +08:00
|
|
|
|
|
|
|
@kernel
|
2015-01-10 15:41:35 +08:00
|
|
|
def run(self):
|
|
|
|
hist = [0 for _ in range(self.nbins)]
|
2014-09-13 19:38:15 +08:00
|
|
|
|
2015-01-10 15:41:35 +08:00
|
|
|
for i in range(self.repeats):
|
2014-09-13 19:38:15 +08:00
|
|
|
n = self.cool_detect()
|
2015-01-10 15:41:35 +08:00
|
|
|
if n >= self.nbins:
|
|
|
|
n = self.nbins - 1
|
2014-09-13 19:38:15 +08:00
|
|
|
hist[n] += 1
|
|
|
|
|
2014-12-19 15:20:19 +08:00
|
|
|
print(hist)
|