forked from M-Labs/artiq
1
0
Fork 0
artiq/examples/al_spectroscopy.py

64 lines
1.9 KiB
Python
Raw Normal View History

2014-09-30 17:38:02 +08:00
from artiq import *
2014-05-17 20:08:50 +08:00
2014-09-05 12:03:22 +08:00
2014-08-13 18:30:57 +08:00
class AluminumSpectroscopy(AutoContext):
mains_sync = Device("ttl_in")
laser_cooling = Device("dds")
spectroscopy = Device("dds")
spectroscopy_b = Device("dac")
state_detection = Device("dds")
pmt = Device("ttl_in")
spectroscopy_freq = Parameter()
photon_limit_low = Parameter()
photon_limit_high = Parameter()
2014-09-05 12:03:22 +08:00
@kernel
def run(self):
state_0_count = 0
for count in range(100):
self.mains_sync.wait_edge()
delay(10*us)
self.laser_cooling.pulse(100*MHz, 100*us)
delay(5*us)
with parallel:
self.spectroscopy.pulse(self.spectroscopy_freq, 100*us)
with sequential:
delay(50*us)
self.spectroscopy_b.set(200)
delay(5*us)
while True:
delay(5*us)
with parallel:
self.state_detection.pulse(100*MHz, 10*us)
photon_count = self.pmt.count_gate(10*us)
if (photon_count < self.photon_limit_low
or photon_count > self.photon_limit_high):
break
if photon_count < self.photon_limit_low:
state_0_count += 1
return state_0_count
2014-05-17 20:08:50 +08:00
2014-10-05 16:24:21 +08:00
def main():
2014-09-05 12:03:22 +08:00
from artiq.sim import devices as sd
from artiq.sim import time
2014-09-05 12:03:22 +08:00
exp = AluminumSpectroscopy(
core=sd.Core(),
mains_sync=sd.Input(name="mains_sync"),
laser_cooling=sd.WaveOutput(name="laser_cooling"),
spectroscopy=sd.WaveOutput(name="spectroscopy"),
spectroscopy_b=sd.VoltageOutput(name="spectroscopy_b"),
state_detection=sd.WaveOutput(name="state_detection"),
pmt=sd.Input(name="pmt"),
2014-09-05 12:03:22 +08:00
spectroscopy_freq=432*MHz,
photon_limit_low=10,
photon_limit_high=15
)
exp.run()
print(time.manager.format_timeline())
2014-10-05 16:24:21 +08:00
if __name__ == "__main__":
main()