mirror of https://github.com/m-labs/artiq.git
examples/transport: tweak for profiling
This commit is contained in:
parent
2ce3c08697
commit
c0bbd99bfa
|
@ -54,6 +54,18 @@
|
|||
"class": "TTLOut",
|
||||
"arguments": {"channel": 5}
|
||||
},
|
||||
"ttl4": {
|
||||
"type": "local",
|
||||
"module": "artiq.coredevice.ttl",
|
||||
"class": "TTLOut",
|
||||
"arguments": {"channel": 6}
|
||||
},
|
||||
"ttl5": {
|
||||
"type": "local",
|
||||
"module": "artiq.coredevice.ttl",
|
||||
"class": "TTLOut",
|
||||
"arguments": {"channel": 7}
|
||||
},
|
||||
"ttl_sma": {
|
||||
"type": "local",
|
||||
"module": "artiq.coredevice.ttl",
|
||||
|
@ -106,25 +118,25 @@
|
|||
# that it always resolves to a network-visible IP address (see documentation).
|
||||
"host": "::1",
|
||||
"port": 4000,
|
||||
"command": "pdq2_controller -p {port} --bind {bind} --simulation --dump qc_q1_0.bin"
|
||||
"command": "pdq2_controller --no-localhost-bind -p {port} --bind {bind} --simulation --dump qc_q1_0.bin"
|
||||
},
|
||||
"qc_q1_1": {
|
||||
"type": "controller",
|
||||
"host": "::1",
|
||||
"port": 4001,
|
||||
"command": "pdq2_controller -p {port} --bind {bind} --simulation --dump qc_q1_1.bin"
|
||||
"command": "pdq2_controller --no-localhost-bind -p {port} --bind {bind} --simulation --dump qc_q1_1.bin"
|
||||
},
|
||||
"qc_q1_2": {
|
||||
"type": "controller",
|
||||
"host": "::1",
|
||||
"port": 4002,
|
||||
"command": "pdq2_controller -p {port} --bind {bind} --simulation --dump qc_q1_2.bin"
|
||||
"command": "pdq2_controller --no-localhost-bind -p {port} --bind {bind} --simulation --dump qc_q1_2.bin"
|
||||
},
|
||||
"qc_q1_3": {
|
||||
"type": "controller",
|
||||
"host": "::1",
|
||||
"port": 4003,
|
||||
"command": "pdq2_controller -p {port} --bind {bind} --simulation --dump qc_q1_3.bin"
|
||||
"command": "pdq2_controller --no-localhost-bind -p {port} --bind {bind} --simulation --dump qc_q1_3.bin"
|
||||
},
|
||||
"electrodes": {
|
||||
"type": "local",
|
||||
|
@ -132,8 +144,8 @@
|
|||
"class": "CompoundPDQ2",
|
||||
"arguments": {
|
||||
"pdq2_devices": ["qc_q1_0", "qc_q1_1", "qc_q1_2", "qc_q1_3"],
|
||||
"trigger_device": "ttl3",
|
||||
"frame_devices": ["ttl0", "ttl1", "ttl2"]
|
||||
"trigger_device": "ttl2",
|
||||
"frame_devices": ["ttl3", "ttl4", "ttl5"]
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -3,29 +3,29 @@
|
|||
import numpy as np
|
||||
|
||||
from artiq.experiment import *
|
||||
|
||||
from artiq.wavesynth.coefficients import SplineSource
|
||||
|
||||
|
||||
transport = SplineSource(
|
||||
x=np.linspace(0, 10, 101), # waveform time
|
||||
y=np.random.rand(4*3*3, 101)*1e-6, # waveform data,
|
||||
# 4 devices, 3 board each, 3 dacs each
|
||||
)
|
||||
|
||||
|
||||
class Transport(EnvExperiment):
|
||||
"""Transport"""
|
||||
|
||||
def build(self):
|
||||
self.core = self.get_device("core")
|
||||
self.bd_sw = self.get_device("bd_sw")
|
||||
self.pmt = self.get_device("pmt")
|
||||
self.electrodes = self.get_device("electrodes")
|
||||
self.setattr_device("core")
|
||||
self.setattr_device("bd_sw")
|
||||
self.setattr_device("pmt")
|
||||
self.setattr_device("electrodes")
|
||||
|
||||
self.wait_at_stop = self.get_argument("wait_at_stop",
|
||||
NumberValue(100*us))
|
||||
self.speed = self.get_argument("speed", NumberValue(1.5))
|
||||
self.repeats = self.get_argument("repeats", NumberValue(100))
|
||||
self.nbins = self.get_argument("nbins", NumberValue(100))
|
||||
self.setattr_argument("wait_at_stop", NumberValue(100*us))
|
||||
self.setattr_argument("speed", NumberValue(1.5))
|
||||
self.setattr_argument("repeats", NumberValue(100))
|
||||
self.setattr_argument("bins", NumberValue(100))
|
||||
|
||||
def calc_waveforms(self, stop):
|
||||
self.electrodes.disarm()
|
||||
|
@ -74,26 +74,34 @@ class Transport(EnvExperiment):
|
|||
|
||||
@kernel
|
||||
def repeat(self):
|
||||
self.histogram[:] = [0 for _ in range(self.nbins)]
|
||||
|
||||
hist = [0 for _ in range(self.bins)]
|
||||
for i in range(self.repeats):
|
||||
n = self.one()
|
||||
if n >= self.nbins:
|
||||
n = self.nbins - 1
|
||||
self.histogram[n] += 1
|
||||
if n >= self.bins:
|
||||
n = self.bins - 1
|
||||
hist[n] += 1
|
||||
self.set_dataset("hist", hist)
|
||||
|
||||
def scan(self, stops):
|
||||
for s in stops:
|
||||
self.histogram = []
|
||||
self.histogram = [0 for _ in range(self.bins)]
|
||||
# non-kernel, build frames
|
||||
# could also be rpc'ed from repeat()
|
||||
self.calc_waveforms(s)
|
||||
# kernel part
|
||||
self.repeat()
|
||||
# live update 2d plot with current self.histogram
|
||||
# broadcast(s, self.histogram)
|
||||
|
||||
def run(self):
|
||||
# scan transport endpoint
|
||||
stops = range(10, len(transport.x), 10)
|
||||
self.scan(stops)
|
||||
|
||||
|
||||
# class Benchmark(Transport):
|
||||
# def build(self):
|
||||
# Transport.build(self)
|
||||
# self.calc_waveforms(.3)
|
||||
#
|
||||
# @kernel
|
||||
# def run(self):
|
||||
# self.repeat()
|
||||
|
|
Loading…
Reference in New Issue