Parameter Vault - syue99/Lab_control GitHub Wiki

Introduction

We use the Parameter Vault server to retrieve and set experimental parameters. The advantage of using this server instead of storing experimetnal parameters in the Registry is the additional provided features:

  • Notification when any parameter is changed. (Registry only emits signals when a parameter in the same directory is changed).

  • Custom parameter types (scan, selection etc).

  • Support for bounds-checking for set parameters, including for custom parameter types. For example this will disallow ever setting a voltage to an unreasonably high value.

  • Easy grouping of parameters by collection. For example all of Doppler cooling frequencies and amplitudes are stored together in the DopplerCooling collection.

  • Seamless interface with the ScriptScanner GUI.

When the Parameter Vault starts, the parameters are loaded from the Registry. Then over the course of the experiments we interact with Parameter Vault to modify them. When the servers exits, the parameters are saved back to the Registry. The interaction with the Parameter Vault is primarily graphical through the ScriptScanner interface. That interface automatically creates appropriate GUIs to modify the stored parameter types. Furthermore ScriptScanner is able to display only the parameters relevant to the specific experiment.

Registry Saving

The parameters are initially retrieved from the LabRAD Registry. The directory is set with registryDirectory list in the server to be ['','Servers', 'Parameter Vault']. In that path, any folder will become a collection of the parameters that are stored inside. The parameters are stored as key-value pairs where key is the name of the parameter and value is a tuple in the form (parameterType, value). Here parameterType is a string, e.g. 'parameter' or 'scan', and the value is the corresponding parameter value.

Getting started

The clearest way to get started using parameter vault is to manually add some parameters (as key value pairs) to a collection via the Registry editor.

Example

Navigate to the Parameter Vault directory in the Registry editor and start a new collection by adding a folder. For example "MOT_free_expansion". Then open this folder in the Registry editor.

We are envisioning using this collection to ramp values for measuring the free expansion of a MOT to extract its temperature. We will want some fixed values such as the number of ramp steps to take for a given free expansion measurement, and the total time over which to perform the ramp.

To add the number of ramp steps

key = ramp_steps
value = ('parameter', [2, 100, 10])

This sets the minimum number of ramp steps to 2, the maximum to 100, and the default value to 10. This will control how many steps to take in a given free expansion measurement.

Then we want to include the total time over which we are stepping the ramp

key = ramp_time
value = ('parameter', [0.0 ms, 1000.0 ms, 30.0 ms])

This is now a labrad.units type with units of seconds. The units, including order of magnitude, have to be identical for the min, max and default values. Note: floats in the LabRAD Registry must include a number after the decimal point.

To access these values from the command prompt we do the following.

>>> cxn = labrad.connect()
>>> pv = cxn.parametervault
>>> rs = pv.get_parameter('MOT_free_expansion', 'ramp_steps')
>>> rs
10L

To convert this to a int:

>>> rs = int(rs)
>>> rs
10

Similarly, for the ramp time:

>>> rt = pv.get_parameter('MOT_free_expansion', 'ramp_time')
>>> rt
Value(30.0, 'ms')

which is a labrad.units type with units of milliseconds.

To access this code from a client, for example to load spinbox values, you'll want to run the following somewhere in the initialization (should have a concrete example server and client for this).

### from an initialization procedure of a QtGui.QWidget that is a client
    # self.pv = self.cxn.parametervault has already been called before the below.   

    # Load parameter vault values
    yield self.init_PV_values() 


    @inlineCallbacks
    def init_PV_values(self):
        """
        Connect widgets to the Parameter Vault values.
        """
         
        ramp_steps = yield self.pv.get_parameter('MOT_free_expansion', 'ramp_steps')
        ramp_steps = int(ramp_steps)  
        
        ramp_time  = yield self.pv.get_parameter('MOT_free_expansion', 'ramp_time')

ramp_steps and ramp_time can then be connected to the appropriate widgets.

Supported types

  • Bool. Stores a boolean value, the syntax is ('bool', False).

  • String. Stores a string, the syntax is ('string', 'hello').

  • Parameter. This is a general value with units. The syntax is ('parameter', [Value(60.0, 'MHz'), Value(100.0, 'MHz'), Value(80.0, 'MHz')]). The list is of the form [min, max, current_value].

  • Scan. Represents a scan over a parameter. tHe syntax is ('scan', ([Value(-60.0, 'MHz'), Value(140.0, 'MHz')], (Value(-28.85, 'MHz'), Value(-28.65, 'MHz'), 21))), where the list is in the form [min, max] and the tuple is (starting_value, stopping_value, number_of_steps).

  • Selection Simple. Provides a selection out a number of choices. ('selection_simple', ('normal', ['custom', 'normal', 'fine', 'ultimate'])). The syntax is (current_selection, ([selection choices])).

  • Duration Bandwidth. Similar to a parameter, but also used to automatically compute and display the Fourier bandwidth of the duration. ('duration_bandwidth', [Value(0.0, 'us'), Value(100000.0, 'us'), Value(30.0, 'us')])

  • Sideband Selection. Selects the sideband of a carrier transition e.g ('sideband_selection', [0, 0, 0, 0]). The syntax for the list is [radial_sideband_1, radial_sideband_2, axial_sideband, micromotion_sideband] where each value indicates the sideband number (negative for red, positive for blue).

  • Spectrum Sensitivity. Describes conditions to measure the line spectrum e.g ('spectrum_sensitivity', (Value(60.0, 'kHz'), Value(2.0, 'kHz'), Value(70.0, 'us'), Value(-17.0, 'dBm'))). The syntax is in the form (range, step_size, excitation_duration, excitation_power).

  • Line Selection. Selects the carrier transition e.g ('line_selection', ('S-1/2D-5/2', [('S+1/2D+3/2', 'S+1/2D+3/2'), ('S-1/2D+1/2', 'S-1/2D+1/2'), ('S-1/2D-5/2', 'carrier -1/2-5/2'), ('S-1/2D-1/2', 'carrier -1/2-1/2'), ('S+1/2D-1/2', 'S+1/2D-1/2'), ('S+1/2D-3/2', 'OP'), ('S+1/2D+5/2', 'S+1/2D+5/2'), ('S-1/2D+3/2', 'Right OP'), ('S-1/2D-3/2', 'S-1/2D-3/2'), ('S+1/2D+1/2', 'S+1/2D+1/2')])). The first element is the current selection. The list is in the form [(transition, nickname)].

Version Control

Version 2.0

  • Stable.