Argument providersΒΆ
Experiment
from atomiq import AtomiqExperiment, AtomiqBlock
from atomiq.arguments import ArgumentProvider
from atomiq.arguments.json import JSONArgumentProvider
from blocks_example import MOT
from artiq.experiment import *
# define a custom argument provider. To be simple, this one just defines two dummy variables
class CustomArgumentProvider(ArgumentProvider):
def _build_arguments(self, target_class: type, arguments: dict = {}) -> dict:
if target_class.__name__ == "MOT":
return {"mot_dummy_param": {"default": -10, "unit": "MHz", "scale": 1e6, "ndecimals": 3}}
if target_class.__name__ == "ArgumentProviderTest":
return {"test_dummy_param": {"default": -10, "unit": "V", "ndecimals": 2}}
# OPTION A: gloabally overwrite the default argument provider
# This one will be used for every class that does not explicitly define
# an argument provider
AtomiqExperiment.arg_provider = CustomArgumentProvider()
class ArgumentProviderTest(AtomiqExperiment):
components = ["ttl_cool", "ttl_test"]
blocks = [MOT]
arguments = {
"on_time": {"default": 0.5, "unit": "s"},
"off_time": {"default": 0.5, "unit": "s"},
}
# OPTION B: the argument provider can be overwritten per class
# this is also used for imported blocks even if the block
# defines a different argument provider
arg_provider = JSONArgumentProvider("http://user:pass@couchdb-server.com/my_database/document_name")
@kernel
def step(self, point):
self.log.info("blink")
self.ttl_test.pulse(point.on_time)
delay(point.off_time)
Components
components = {}
# Add core stuff
components.update({
"log": {
"classname": "atomiq.components.basics.log.KernelLogger"
}
})
# Add locks
components.update({
"lock_cooler": {
"classname": "atomiq.components.lock.ULELock",
"arguments": {
"lock_offset": 34e6
}
}
})
# Add calibrations
components.update({
"cal_pd_cooler": {
"classname": "atomiq.components.basics.calibration.LinearCalibration",
"arguments": {
"input_unit": "mV",
"output_unit": "mW",
"a": 0.342,
"b": 0.002
}
},
"cal_aom_cooler": {
"classname": "atomiq.components.basics.calibration.InvSigmoidCalibration",
"arguments": {
"input_unit": "amp",
"output_unit": "amp",
"A": 5.,
"k": 1.,
"x_offset": 10.,
"y_offset": 0.3
}
}
})
# Add low level Sinara hardware
components.update({
"kasli0": {
"classname": "atomiq.components.sinara.Kasli",
"arguments": {}
},
"sampler0": {
"classname": "atomiq.components.sinara.Sampler",
"arguments": {
"sampler_device": "@sampler0",
"sampler_default_gain": [1, 0, 0, 0, 0, 0, 0, 0]
}
},
"urukul0": {
"classname": "atomiq.components.sinara.Urukul",
"arguments": {
"cpld": "@urukul0_cpld"
}
}
})
# Add low Sinara DIOs
components.update({
"ttl_test": {
"classname": "atomiq.components.sinara.DioOutput",
"arguments": {
"kasli": "&kasli0",
"ttl": "@led0"
}
},
"ttl_cool": {
"classname": "atomiq.components.sinara.DioOutput",
"arguments": {
"kasli": "&kasli0",
"ttl": "@ttl4"
}
},
"ttl_repump": {
"classname": "atomiq.components.sinara.DioOutput",
"arguments": {
"kasli": "&kasli0",
"ttl": "@ttl6"
}
}
})
# Add DDS channels
components.update({
"dds_cooler": {
"classname": "atomiq.components.sinara.UrukulChannel",
"arguments": {
"urukul": "&urukul0",
"device": "@urukul0_ch0",
"ttl": "@ttl_urukul0_sw0"
}
},
"dds_repumper": {
"classname": "atomiq.components.sinara.UrukulChannel",
"arguments": {
"urukul": "&urukul0",
"device": "@urukul0_ch1",
"ttl": "@ttl_urukul0_sw1"
}
}
})
# Add AOMs
components.update({
"aom_cooler": {
"classname": "atomiq.components.optoelectronics.lightmodulator.AOM",
"arguments": {
"rfsource": "&dds_cooler",
"switch": "&dds_cooler",
"center_freq": 80e6,
"switching_delay": 30e-9
}
},
"aom_repumper": {
"classname": "atomiq.components.optoelectronics.lightmodulator.AOM",
"arguments": {
"rfsource": "&dds_repumper",
"switch": "&ttl_repump",
"center_freq": 110e6,
"switching_delay": 45e-9
}
}
})
# Add analog inputs
components.update({
"input_cooler_pd": {
"classname": "atomiq.components.sinara.SamplerChannel",
"arguments": {
"adc_device": "&sampler0",
"channel": 0,
"default_gain": 0
}
},
"input_dummy": {
"classname": "atomiq.components.electronics.adc.ADCChannel",
"arguments": {
"adc_device": "&adc_dummy0",
"channel": 0,
}
},
})
# Add photodiodes
components.update({
"pd_cooler": {
"classname": "atomiq.components.optoelectronics.photodiode.CalibratedPhotodiode",
"arguments": {
"adc_channel": "&input_cooler_pd",
"calibration": "&cal_pd_cooler"
}
}
})
# Add lasers
components.update({
"laser_cooler": {
"classname": "atomiq.components.sinara.BisectionAOMLaser",
"arguments": {
"lock": "&lock_cooler",
"monitor_pd": "&pd_cooler",
"aom": "&aom_cooler"
}
}
})
# Add Datasinks
components.update({
"pubsub": {
"classname": "atomiq.components.basics.datasink.RPCPublisherSink",
"arguments": {
"rpc_publisher": "@messagebuswriter",
"topic_prefix": "artiq.",
"default_topic": "newData"
}
}
})