plot_controls

qctrlvisualizer.plot_controls(figure, controls, polar=True, smooth=False, unit_symbol='Hz', two_pi_factor=True)

Creates a plot of the specified controls.

Parameters
  • figure (matplotlib.figure.Figure) – The matplotlib Figure in which the plots should be placed. The dimensions of the Figure will be overridden by this method.

  • controls (dict) –

    The dictionary of controls to plot. The keys should be the names of the controls, and the values represent the pulse by either (1) a dictionary with the ‘durations’ and ‘values’ for that control, or (2) a list of segments, each a dictionary with ‘duration’ and ‘value’ keys. The durations must be in seconds and the values (possibly complex) in the units specified by unit_symbol. For example, the following two controls inputs would be valid (and equivalent):

    controls={
      "Clock": {"durations": [1.0, 1.0, 2.0], "values": [-0.5, 0.5, -1.5]},
      "Microwave": {"durations": [0.5, 1.0], "values": [0.5 + 1.5j, 0.2 - 0.3j]},
    }
    
    controls={
      'Clock': [
        {'duration': 1.0, 'value': -0.5},
        {'duration': 1.0, 'value': 0.5},
        {'duration': 2.0, 'value': -1.5},
      ],
      'Microwave': [
        {'duration': 0.5, 'value': 0.5 + 1.5j},
        {'duration': 1.0, 'value': 0.2 - 0.3j},
      ],
    }
    

  • polar (bool, optional) – The mode of the plot when the values appear to be complex numbers. Plot magnitude and angle in two figures if set to True, otherwise plot I and Q in two figures. Defaults to True.

  • smooth (bool, optional) – Whether to plot the controls as samples joined by straight lines, rather than as piecewise-constant segments. Defaults to False.

  • unit_symbol (str, optional) – The symbol of the unit to which the controls values correspond. Defaults to “Hz”.

  • two_pi_factor (bool, optional) – Whether the values of the controls should be divided by 2π in the plots. Defaults to True.

Raises

ValueError – If any of the input parameters are invalid.