Laser bisection example#

Experiment

from atomiq import AtomiqExperiment
from artiq.experiment import kernel, parallel, sequential, delay


class BisectionLaserTest(AtomiqExperiment):
    components = ["laser_bisection_test", "ttl_test", "pd_aom_test_cal"]

    arguments = {
        "pulse_power": {"default": 0.5},
        "pulsetime": {"default": 3e-3, "unit": "ms", "scale": 1e-3},
        "off_time": {"default": 0.5, "unit": "s"},
    }

    @kernel
    def step(self, point):

        self.laser_bisection_test.set_detuning(400e6)

        # Set the desired power. Since the photodiode is calibrated this
        # is the power in mW. When the cache is empty, this command will directly trigger a
        # bisection to find the required DDS amplitude to get the requested power.
        self.laser_bisection_test.set_power(point.pulse_power)

        with parallel:
            # Output a test tll for triggering our instrumentation
            self.ttl_test.pulse(point.pulsetime)

            # Pulse on the laser
            self.laser_bisection_test.pulse(point.pulsetime)

            with sequential:
                delay(point.pulsetime/2)

                # Measure the power on the photodiode
                power = self.pd_aom_test_cal.get_power()
                self.log.info("Measured PD output: {0:.2f} " + self.pd_aom_test_cal.calibration.output_unit, [power])

        delay(point.off_time)

Components

# Basics
components = {
    "log": {
        "classname": "atomiq.components.basics.log.KernelLogger"
    }
}

# Calibrations
components = {
    "cal_pd_test": {
        "classname": "atomiq.components.basics.LinearCalibration",
        "arguments": {
            "input_unit": "V",
            "output_unit": "mW",
            "a": 30.0,
            "b": 0.0
        }
    }
}

# Sinara modules
components = {
    "kasli0": {
        "classname": "atomiq.components.sinara.Kasli",
        "arguments": {}
    },
    "urukul0": {
        "classname": "atomiq.components.sinara.Urukul",
        "arguments": {
            "cpld": "@urukul0_cpld"
        }
    },
    "sampler0": {
        "classname": "atomiq.components.sinara.Sampler",
        "arguments": {
            "sampler_device": "@sampler0",
            "sampler_default_gain": [1, 0, 0, 0, 0, 0, 0, 0]
        }
    }
}

# TTL Out
components = {
    "ttl_test": {
        "classname": "atomiq.components.sinara.DioOutput",
        "arguments": {
            "kasli": "&kasli0",
            "ttl": "@ttl8"
        }
    }
}

# Analog in
components = {
    "input_bisection_test": {
        "classname": "atomiq.components.sinara.SamplerChannel",
        "arguments": {
            "adc_device": "&sampler0",
            "channel": 0,
            "default_gain": 0
        }
    },
}

# Photodiodes
components = {
    "pd_aom_test_cal": {
        "classname": "atomiq.components.optoelectronics.photodiode.CalibratedPhotodiode",
        "arguments": {
            "adc_channel": "&input_bisection_test",
            "calibration": "&cal_pd_test"
        }
    }
}

# RF Sources
components = {
    "rfsource_aom_test": {
        "classname": "atomiq.components.sinara.UrukulChannel",
        "arguments": {
            "urukul": "&urukul0",
            "device": "@urukul0_ch2",
            "ttl": "@ttl_urukul0_sw2",
            "default_amplitude": 0.75,
            "default_frequency": 220e6,
            "freq_limit": (15e6, 400e6),
            "blind": True
            }
    }
}

components = {
    "aom_test": {
        "classname": "atomiq.components.optoelectronics.lightmodulator.AOM",
        "arguments": {
            "rfsource": "&rfsource_aom_test",
            "switch": "&rfsource_aom_test",
            "center_freq": 200e6,
            "bandwidth": 60e6,
            "switching_delay": 30e-9,
            "order": 1,
            "passes": 2
        }
    }
}

# Lock
components = {
    "lock_test": {
        "classname": "atomiq.components.lock.SpectroscopyLock",
        "arguments": {
            "reference_frequency": 539e12,
            "lock_offset": -60.0e6,
        }
    }
}

# Lasersources
components = {
    "ls_test": {
        "classname": "atomiq.components.laser.LockedLaserSource",
        "arguments": {
            "lock": "&lock_test",
            "power": 900e-3
        }
    }
}

# Lasers
components = {
    "laser_bisection_test": {
        "classname": "atomiq.components.laser.OptimizerStabilizedModulatedLaser",
        "arguments": {
            "laser_source": "&ls_test",
            "photodiode": "&pd_aom_test_cal",
            "modulator": "&aom_test",
            "optimizer": "&opt_bisect_test"
        }
    }
}

# Optimizers
components = {
    "opt_bisect_test": {
        "classname": "atomiq.components.optimizers.BisectionOptimizer",
        "arguments": {
            "actor_component": "&aom_test",
            "actor_name": "amplitude",
            "monitor_component": "&pd_aom_test_cal",
            "monitor_name": "power",
            "actor_min": 0.01,
            "actor_max": 0.85,
            "switch_actor": True,
            "timestep": 1e-3
        }
    }
}