conductor package
conductor.conductor module
Coordinate setting and saving experiment parameters.
Experiment parameters are pretty much anything that could be changed from shot-to-shot of the experiment. Examples:
molecule RF frequency
function generator amplitude
the sequence of modules (
'highFieldRampRecompress', etc.)analog/digital sequence variables, etc.
The primary abstraction over experiment parameters is the conductor.devices.conductor_device.conductor_parameter.ConductorParameter, which forms the base class for all custom parameters.
ConductorParameter ‘s are organized by the physical or abstracted device they are associated with. For example, the kd1 device controls the RF synthesizer that drives the K D1 EOM. It has two parameters, Frequency and Amplitude.
ConductorParameter provides two key methods:
ConductorParameter.update(): Called to update the hardware with the current value of the parameter.
ConductorParameter.advance(): Supports iteration over an iterable parameter value. For example, a list of dictionaries that define the DDS configuration over several shots.
New parameters can be added to the Conductor by subclassing ConductorParameter and overriding the ConductorParameter.update() method.
Parameters can be registered on-the-fly, but we typically enable them by including them in the config.json file. Here’s an example::
{
# ... setting conductor directories, etc.
# Here is where we define Conductor's default parameters.
"default_parameters": {
# ... other parameters
# The kd1 EOM RF synthesizer
"kd1": {
# Tell conductor to use the Frequency parameter
"frequency": {
# This value will be loaded as a class variable (self.default)
"default": 1286
},
# Tell conductor to use the Amplitude parameter
"amplitude": {
# This value will be loaded as a class variable (self.default)
"default": -11
}
},
}
}
(Note: the snippet above is commented for clarity, but we can’t actually put comments in json :/)
- class conductor.conductor.ConductorServer(LabradServer)
Bases:
LabradServerCoordinate setting and saving experiment parameters.
Parameters are classes defined in ./devices/.
parameters hold values representing real world attributes.
typically send/receive data to/from hardware.
see ./devices/conductor_device/conductor_parameter.py for documentation.
Experiments specify parameter values to be iterated over and a filename for saving data.
- __init__(config_path='./config.json')
- abort_experiment(self, c)
Abort the experiment immediately, then run defaults. Also cancels queued experiments.
- Parameters:
c – LabRAD context
- advance(self, c, delay=0, **kwargs)
Calls :meth:advance_parameters after a time of
delay. Keeps track of experiments that are queued inself.advance_dictso they can be cancelled.- Parameters:
c – LabRAD context
delay (int, optional) – The delay in seconds before advancing the experiment. Defaults to 0.
- advance_experiment(self)
Runs the next queued experiment. Advances logging.
- advance_logging(self, c, end=False)
Tells the logging server to begin logging for the next shot. Shot number is reset daily.
- Parameters:
c – LabRAD context
end (bool, optional) – Stops logging the current shot if True. Defaults to False.
- advance_parameters(self)
Get new parameter values then send to devices. Calls
advance_experiment().
- experiment_started = <labrad.server.Signal object>
signal__experiment_started
Emitted in
self.advance_experimentwhen a new experiment is started.Note
Payload (bool): always
True.See also
For help with Signals, see Labrad Tips & Tricks.
- experiment_stopped = <labrad.server.Signal object>
signal__experiment_stopped
Emitted in
self.advance_experimentwhen an experiment is stopped.Note
Payload (bool): always
True.See also
For help with Signals, see Labrad Tips & Tricks.
- get_data(self, c)
Returns json-dumped dictionary of current parameter values.
- Parameters:
c – LabRAD context
- Returns:
json-dumped dictionary of current parameter values
- Return type:
- get_parameter_value(self, device_name, parameter_name, use_registry=False)
- Parameters:
- Raises:
Exception – Throws an error if an invalid parameter is used.
- Yields:
any – The value of the selected parameter
- get_parameter_values(self, c, parameters=None, use_registry=False)
Gets specified parameter values.
- Parameters:
c – LabRAD context
parameters (str, optional) –
json dumped string (
json.dumps(...)()) of dict:{ device_name: { parameter_name: None } }
Defaults to None, in which case all parameter values are returned.
use_registry (bool, optional) – Look for parameter in registry (deprecated). Defaults to False.
- Yields:
str – json dumped string (
json.dumps(...)()) of dict of parameter values
- initServer(self)
Registers default parameters and loads sequencer variables after connected to LabRAD
- load_config(self, path=None)
Set instance attributes defined in json config.
- Parameters:
path (str, optional) – Location of the JSON config. Defaults to None, in which case the object’s
self.config_pathis loaded.
- load_variables(self)
Loads sequencer variables from
clients/variables_config.py.
- name = 'conductor'
- parameter_removed = <labrad.server.Signal object>
signal__parameter_removed
Emitted in
self.remove_parameterswhen a parameter is removed.Note
Payload (str):
device_name + " " + parameter_name.See also
For help with Signals, see Labrad Tips & Tricks.
- parameters_changed = <labrad.server.Signal object>
signal__parameters_changed
Emitted when parameters are updated in
self.set_parametersandself.advance_parameters.This is very similar to
signal__parameters_updated, but its payload has the actual parameters changed and their new values.Note
Payload (str):
json.dumpsstring containing changed parameter values. Same format as returned byself.get_parameter_values()See also
For help with Signals, see Labrad Tips & Tricks.
- parameters_refreshed = <labrad.server.Signal object>
signal__parameters_refreshed
Emitted in
self.refresh_default_parameters.Note
Payload (bool): always
True.See also
For help with Signals, see Labrad Tips & Tricks.
- parameters_updated = <labrad.server.Signal object>
signal__parameters_updated
Emitted when parameters are updated in
self.set_parametersandself.advance_parameters.Note
Payload (bool): always
True.See also
For help with Signals, see Labrad Tips & Tricks.
- print_delay(self, c, do_print_delay=None)
- queue_experiment(self, c, experiment, run_next=False)
- Parameters:
c – LabRAD context
experiment (str) –
json-dumped string with keys
name’ (str): Some string. Required.parameter_values(Dict, optional): {name: value}.append data(bool, optional): Save data to previous file?loop(bool, optional): Inserts experiment back into begining of queue.
run_next (bool, optional) – Add the experiment at the beginning of the queue. Defaults to False.
- Returns:
Number of experiments in the queue
- Return type:
- refresh_default_parameters(self, c)
Tries to register all default parameters defined in the
config.jsonfile.Also checks that all sequencer variables are defined.
- Parameters:
c – LabRAD context
- register_parameter(self, device_name, parameter_name, parameter_config, generic_parameter, value_type)
Populate
self.parameterswith specified parameter.Look in
./devices/for specified parameter.If no suitable parameter is found and generic_parameter is
True, create generic parameter for holding values.- Parameters:
device_name (str) – Name of device (e.g. “dds1”)
parameter_name (str) – Name of parameter (e.g. “frequency”)
parameter_config (str) – passed to parameter’s
__init__generic_parameter (bool) – Specifies whether or not to use
devices/conductor_device/conductor_parameter.pyifdevices/device_name/parameter_name.pyis not found.value_type (str) – Description of parameter value (e.g. “single”, “list”, “data”)
- Raises:
ParameterAlreadyRegistered – if specified parameter is already in
self.parametersParameterNotImported – if import of specified parameter fails
- register_parameters(self, c, parameters, generic_parameter=False, value_type=None)
Load parameters into conductor.
Parameters are defined in conductor/devices/device_name/parameter_name.py.
View defined parameters with conductor.available_parameters
- Parameters:
c – LabRAD context
parameters (str) –
json.dumps(...)of:{ device_name: { parameter_name: { parameter_config } }
where
device_nameis a string (e.g. “dds1”),parameter_nameis a string (e.g. “frequency”), andparameter_configis passed to parameter’s__init__.generic_parameter (bool, optional) – If
Trueand no defined parameter is found, will create generic_parameter for holding values. Defaults to False.value_type (str, optional) – e.g. “single”, “list”, “data”. Defaults to None.
- Yields:
bool – True if an error occurs
- remove_parameter(self, device_name, parameter_name)
Remove specified parameter from
self.parameters.
- remove_parameters(self, c, parameters)
Remove specified parameters.
- Parameters:
c – LabRAD context
parameters (str) –
json dumped string (
json.dumps(...)()) of dict:{ device_name: { parameter_name: None } }
- Yields:
bool – True
- save_parameters(self)
Save to disk a json-dumped dictionary of current parameter values
self.data. The file is saved in the folder on the dataserver determined by the logging server’s current shot number.
- set_experiment_queue(self, c, experiment_queue=None)
Loads the experiments in
experiment_queueinto the queue.- Parameters:
c – LabRAD context
experiment_queue (str, optional) – json-dumped list of experiments. See
queue_experiment()for format of an experiment. Defaults to None.
- Returns:
Number of experiments in the queue
- Return type:
- set_parameter_value(self, device_name, parameter_name, parameter_value, generic_parameter=False, value_type=None)
- Parameters:
device_name (str) – Name of device (e.g. “dds1”)
parameter_name (str) – Name of parameter (e.g. “frequency”)
parameter_value (any) – Any type (e.g. 20E6)
generic_parameter (bool, optional) – Specifies whether or not to use
devices/conductor_device/conductor_parameter.pyifdevices/device_name/parameter_name.pyis not found. Defaults to False.value_type (str, optional) – Description of parameter value (e.g. “single”, “list”, “data”). Defaults to None.
- Raises:
ParameterNotImported – if import of specified parameter fails.
- set_parameter_values(self, c, parameters, generic_parameter=False, value_type=None)
- Parameters:
c – A LabRAD context
parameters (str) –
json dumped string (
json.dumps(...)()) of dict:{ device_name: { parameter_name: value } }
generic_parameter (bool, optional) – Specifies whether or not to use
devices/conductor_device/conductor_parameter.pyifdevices/device_name/parameter_name.pyis not found. Defaults to False.value_type (str, optional) – Description of parameter value (e.g. “single”, “list”, “data”). Defaults to None.
- Yields:
bool – True
- stopServer(self)
Called when the server is stopped. Saves the current parameters before closing.
- stop_experiment(self, c)
Sets
self.parametersto run the default sequence and sends theexperiment_stoppedsignal.Do not call this directly. Used internally in
abort_experiment(), which you should call.- Parameters:
c – LabRAD context
- Returns:
True
- Return type:
- update_parameter(self, parameter)
Have device update parameter value. Prints a warning message and removes the parameter if the parameter can’t be updated.
- Parameters:
parameter (ConductorParameter) – The parameter to update.
conductor.devices module
Conductor devices for configuring hardware when the experiment is run.
TODO: Document this more, including how to write a conductor device
conductor.devices.conductor_device module
Includes conductor.devices.conductor_device, which is the base class for all conductor parameters.
conductor.devices.conductor_device.conductor_parameter module
- class conductor.devices.conductor_device.conductor_parameter.ConductorParameter(object)
Bases:
objectBase class/template for conductor parameters
ConductorParameters are meant to provide a nice way to iterate/monitor settings/measurements each experimental cycle.
The methods and properties defined here are all used by the conductor. It is therefore recommended that all conductor parameters inherit this class.
The conductor calls parameters’ update with higher priority first. If
priority <= 0, update does not get called.value_typeis used to select preconfigured behaviors ofConductorParameter.{value, advance, remaining_points, ...}- value_type = ‘single’:
Default.
If
_valueis list, pops then returns first value in listElse returns
_value.
- value_type = ‘list’:
A single value is a list.
If
_valueis list of lists, pops then returns first item.Else returns
_value.
- value_type = ‘once’:
_valueis anything.Returns
_valuethen sets_valuetoNone.
- value_type = ‘data’:
_valueis anything.remaining_points = None
Returns
_value.
- __init__(self, config)
Handle config (dict)
Upon creating a class instance, the conductor passes a config (dict).
Default behavior is to set (key, value) -> (instance attribute, value)
- advance(self)
Change
_valuefor next experimental run.If
_valueis list of values to be iterated over, remove previous value.Value_type should dictate if/how elements are removed from
_value.
- critical = False
- initialize(self)
Called only once, upon loading parameter into conductor.
Use to initialize LabRAD connection and configure device.
- priority = 1
- remaining_values(self)
Return how many values in
_valuequeue.this should depend on
value_type.
- stop(self)
Close connections if you must.
- update(self)
Called at begining of every experimental cycle.
New conductor parameters should override this method to communicate with hardware.
- property value
Return value for current experimental run.
Should return “something” representing parameter’s current “value” (usually just a float) each experimental cycle, conductor saves output of value to data.
_valuepossibly contains list of values to be iterated over.value_typeshould dictate howvalueis processed to get current value.
- value_type = 'single'
conductor.devices.3xAD9959_0 module
Conductor device for controlling 3x AD9959 DDS, using dds.dds_server. Not currently used in the experiment.
conductor.devices.3xAD9959_0.downlegexp module
- class conductor.devices.3xAD9959_0.downlegexp.Downlegexp(ConductorParameter)
Bases:
ConductorParameterSets the down leg AOM frequency in MHz. Example config:
{ "3xAD9959_0": { "downlegexp": [163.8] }, }
IMPORTANT: This parameter is no longer used, since the down leg frequency is controlled with a fiber EOM.
- __init__(config={})
- initialize()
- priority = 2
- update()
conductor.devices.3xAD9959_0.uplegdp module
Conductor parameter for setting the up leg double pass AOM frequency in MHz. Example config:
{ "3xAD9959_0": { "uplegdp": [70.2] }, }
IMPORTANT: This parameter is no longer used, since the up leg frequency is controlled with a fiber EOM.
conductor.devices.ad9910 module
Conductor device for controlling AD9910 DDS, using ad9910.ad9910_server. We currently have two units, each controlled by a conductor parameter, conductor.devices.ad9910.update for controlling the K RF.
conductor.devices.ad9910.helpers module
- class conductor.devices.ad9910.helpers.AD9910Device(*args: Any, **kwargs: Any)
Bases:
ConductorParameterConductor parameter for controlling AD9910 DDS. Individual DDSs should subclass this. The configuration for which hardware a conductor parameter communicates with is set in
conductor.conductor’s config.json.Data format::
value = { 'program': [...], 'profiles': [...], }
See documentation for
ad9910.ad9910_serverfor the correct format for theprogramandprofilelists.TODO: Finish documenting this.
- __init__(config={})
- initialize()
- priority = 3
- update()
conductor.devices.ad9910.update module
- class conductor.devices.ad9910.update.Update(helpers.AD9910Device)
Bases:
AD9910DeviceAD9910 DDS for K RF (ARP and K cleaning pulse). Example config:
{ "ad9910": { "update": { "program": [ {"mode": "sweep", "start": 246.0, "stop": 249, "dt": 1, "nsteps": 10000}, {"mode": "single", "freq": 200, "ampl": 0, "phase": 0}, ] } }
- __init__(config={})
conductor.devices.arp33220A module
Conductor device for controlling Keysight/Agilent 33220A AWG’s sine output, using gpib.gpib_server. This controls the AWG on port GPIB0::22::INSTR on the krbjila computer. The AWG’s output is currently connected to the lattice intensity servo and used for parametric heating.
conductor.devices.arp33220A.amplitude module
- class conductor.devices.arp33220A.amplitude.Amplitude(ConductorParameter)
Bases:
ConductorParameterConductor parameter for controlling the frequency of a Keysight/Agilent 33220A AWG’s sine output in V. Example config:
{ "arp33220A": { "amplitude": 1 } }
- __init__(config={})
- initialize()
- priority = 3
- update()
conductor.devices.arp33220A.frequency module
- class conductor.devices.arp33220A.frequency.Frequency(ConductorParameter)
Bases:
ConductorParameterConductor parameter for controlling the amplitude of a Keysight/Agilent 33220A AWG’s sine output in Hz. Example config:
{ "arp33220A": { "frequency": 100, } }
- __init__(config={})
- initialize()
- priority = 3
- update()
conductor.devices.dg800 module
Conductor device for controlling Rigol DG800 series AWG’s sine output, using awgs.RigolDG800Server. This controls the lowest-indexed AWG connected to the imaging computer.
conductor.devices.dg800.sin module
- class conductor.devices.dg800.sin.Sin(ConductorParameter)
Bases:
ConductorParameterConductor parameter for controlling the frequency, amplitude (Vpp), offset (V), phase (deg), and enable and gating status of each of the Rigol DG800’s channels. Example config:
{ "dg800": { "sin": [{ "freq1": 100, "amplitude1": 0.20, "phase1": 0, "offset1": 0, "output1": 1, "gated1": 1, "ncycles1": 5, "freq2": 100, "amplitude2": 0.31, "phase2": 0, "offset2": 0, "output2": 0, "gated2": 1, "ncycles2": 5, }] } }
- __init__(config={})
- initialize()
- priority = 3
- update()
conductor.devices.E8257D module
Conductor device for controlling Keysight/Agilent E8257D microwave synthesizer, using gpib.gpib_server. This controls the synthesizer connected to the krbjila computer, located on the cloud of the experiment table near the air filter. The synthesizer is used to generate the rubidium RF.
conductor.devices.E8257D.enable module
- class conductor.devices.E8257D.enable.Enable(ConductorParameter)
Bases:
ConductorParameterConductor parameter for controlling the Keysight/Agilent E8257D microwave synthesizer. The frequency is in MHz, and the amplitude is in dBm.
Example config:
{ "E8257D":{ "frequency": 6834.5, "amplitude": -12 } }
- __init__(config={})
- advanceAction(cntx, signal)
- initialize()
- priority = 3
- startAction(cntx, signal)
- stopAction(cntx, signal)
- update()
- updateAction(cntx, signal)
- conductor.devices.E8257D.enable.sleep(secs)
conductor.devices.electrode module
Conductor device for setting electrode presets, using electrode.electrode_server.
This is not yet fully implemented, and not currently used in the experiment.
conductor.devices.electrode.update module
- class conductor.devices.electrode.update.Update(ConductorParameter)
Bases:
ConductorParameterConductor parameter for updating electrode presets when the experiment is run.
Only supports setting existing presets by normal modes, but normal modes can be calculated from other values using the functions in gui_defaults_helpers.py. The field is not updated and an error message is shown if the normal modes are out of range or aren’t defined correctly.
Example config:
{ "80": { "normalModes": { "HGrad": -0.0, "GlobalOffset": -0.0, "RodOffset": 0.0, "Bias": 1012.5, "EastWest": -0.0, "RodScale": 0.4225, "CompShim": 0.0 } } }
- __init__(config={})
- get_zeros()
- initialize()
- priority = 20
- update()
value is a dict of presets to update
conductor.devices.elliptec module
Conductor device for controlling a Thorlabs Elliptec stage, using motion.elliptec_server. This controls the stage attached to the imaging computer, which is used to control the position of the razor blade in front of the side/ axial imaging camera.
Because setting the stage is not completely robust (sometimes the stage moves to the zero position), the conductor device is not currently used in the experiment.
conductor.devices.elliptec.position module
- class conductor.devices.elliptec.position.Position(ConductorParameter)
Bases:
ConductorParameterConductor parameter for setting the position (in mm) of a Thorlabs Elliptec stage.
Not currently used in the experiment. Example config:
{ "elliptec": { "position": 5.0 } }
- __init__(config={})
- initialize()
- priority = 3
- update()
conductor.devices.highFieldRbARP module
Conductor device for Keysight/Agilent 33220A AWG, using gpib.gpib_server. This controls the AWG on port GPIB0::10::INSTR on the krbjila computer. The AWG is located on top of the main optics table’s cloud.
The AWG generates ramps, which are used to modulate the Agilent E8257D’s frequency (controlled by conductor.devices.E8257D) for the rubidium ARPs.
conductor.devices.highFieldRbARP.duration module
conductor.devices.kd1 module
Conductor device for Agilent MXG synthesizer, using gpib.gpib_server. This controls the AWG on port GPIB0::1::INSTR on the krbjila computer. The synthesizer is located on the wire shelves on top of the main optics table’s cloud. The synthesizer’s screen is broken, so this conductor device is the best way to control it.
The synthesizer generates an RF tone for an EOM which makes sidebands on the K D1 light, to be used for gray molasses cooling.
“They don’t make those EOMs anymore, so try not to break it” - William G. Tobias (2021)
conductor.devices.kd1.amplitude module
conductor.devices.kd1.frequency module
conductor.devices.magevaptimer module
Conductor device for automatically setting the *MagEvapTime parameter (used as a column length in the magEvap sequence) based on the duration of the magnetic evaporation, as saved in magnetic_evaporation/evap.json.
conductor.devices.magevaptimer.time module
conductor.devices.pixelfly module
Conductor device for controlling a pco pixelfly camera using cameras.pco_server.
Not currently used on the experiment, but should be set up to control the pixelfly for imaging the MOT region, rather than the current MATLAB GUI.
conductor.devices.pixelfly.recordimage module
- class conductor.devices.pixelfly.recordimage.Recordimage(ConductorParameter)
Bases:
ConductorParameterConductor parameter for recording an image on a pixelfly pco camera (the lowest indexed camera on the
polarkrbcomputer). Allows configuration of exposure (s), binning, interframing, number of images, region of interest, along with enabling or disabling the camera. Example config:{ "pixelfly": { "recordimage": { "enable": 1, "exposure": 1E-3, "interframing_enable": 1, "binning": [2,2], "n_images": 3, "roi": "None" } } }
- __init__(config={})
- initialize()
- priority = 1
- update()
conductor.devices.pulseShaperAWG module
Conductor device for controlling an Agilent 33220A AWG through the usb.usb_server. The AWG is connected to the polarkrb computer at address USB0::0x0957::0x0407::MY44005958::INSTR.
The AWG output is mixed with the |0,0> to |1,0> RF (controlled by conductor.devices.ad9910.update) to enable shaped pulses.
conductor.devices.pulseShaperAWG.blackman module
- class conductor.devices.pulseShaperAWG.blackman.Blackman(ConductorParameter)
Bases:
ConductorParameterConductor parameter that configures the function generator to output a Blackman window.
The duration (in s) and peak amplitude (in V) of the window function can be configured. Example config:
{ "pulseShaperAWG": { "blackman": { "period": 150E-6, "amplitude": 0.5 } } }
- __init__(config={})
- initialize()
- priority = 3
- update()
conductor.devices.sequencer module
Conductor device for loading a sequence, substituting parameters, and uploading the sequence to the TTL and DAC FPGAs.
TODO: Finish documenting this
conductor.devices.sequencer.sequence module
- class conductor.devices.sequencer.sequence.Sequence(ConductorParameter)
Bases:
ConductorParameterConductor parameter for setting the sequence
TODO: Finish documenting this.
- __init__(config={})
- critical = True
- get_e()
- initialize()
- priority = 2
- update()
value can be sequence or list of sub-sequences
- value_type = 'list'
conductor.devices.time module
Conductor device for logging the time when the experiment was run.
conductor.devices.time.timestamp module
conductor.devices.stirap module
Conductor device for setting the EOM frequencies which offset the STIRAP lasers from the cavity.
conductor.devices.stirap.helpers module
- class conductor.devices.stirap.helpers.STIRAPDevice(*args: Any, **kwargs: Any)
Bases:
ConductorParameterConductor parameter for controlling STIRAP DDS. Individual DDSs should subclass this. The configuration for which hardware a conductor parameter communicates with is set in
conductor.conductor’s config.json.Data format::
[...]
See documentation for
stirap_dds.stirap_serverfor the correct format for theprogramandprofilelists.TODO: Finish documenting this.
- __init__(channel, config={})
- initialize()
- priority = 3
- update()
- value_type = 'list'