2
0
mirror of https://github.com/m-labs/artiq.git synced 2024-12-05 09:46:36 +08:00
artiq/examples/master/repository/photon_histogram.py

40 lines
912 B
Python

from artiq import *
class PhotonHistogram(Experiment, AutoDB):
"""Photon histogram"""
class DBKeys:
core = Device()
bd = Device()
bdd = Device()
pmt = Device()
nbins = Argument(100)
repeats = Argument(100)
@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)
self.pmt.gate_rising(100*us)
self.bd.on(200*MHz)
self.bdd.on(300*MHz)
return self.pmt.count()
@kernel
def run(self):
hist = [0 for _ in range(self.nbins)]
for i in range(self.repeats):
n = self.cool_detect()
if n >= self.nbins:
n = self.nbins - 1
hist[n] += 1
print(hist)