from artiq.experiment import *


class SamplerInit(EnvExperiment):
    def build(self):
        self.setattr_device("core")
        self.sampler = self.get_device("sampler0")

    def prepare(self):
        self.smp = [0.0]*8

    @kernel
    def run(self):
        self.core.reset()
        self.core.break_realtime()
        self.sampler.init()
        delay(5*ms)
        for i in range(8):
            self.sampler.set_gain_mu(i, 0)
            delay(100*us)
        self.sampler.sample(self.smp)
