How to use the qcodes.plots.qcmatplotlib.MatPlot function in qcodes

To help you get started, we’ve selected a few qcodes examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github QuTech-Delft / qtt / src / qtt / data.py View on Github external
if fig:
        plt.figure(fig)
        plt.clf()

        if len(default_array.shape) >= 2:
            if len(parameter_names) > 1:
                arrays = [dataset.default_parameter_array(parameter_name) for parameter_name in parameter_names]
                plot_handle = MatPlot(*arrays, num=fig)

            else:
                plot_handle = MatPlot(dataset.default_parameter_array(parameter_names[0]), num=fig)
        else:
            for idx, parameter_name in enumerate(parameter_names):
                if idx == 0:
                    plot_handle = MatPlot(dataset.default_parameter_array(parameter_name), num=fig)
                else:
                    plot_handle.add(dataset.default_parameter_array(parameter_name,))
github QuTech-Delft / qtt / src / qtt / utilities / tools.py View on Github external
def plot1D(dataset, fig=1):
    """ Simple plot function."""
    if isinstance(dataset, DataArray):
        array = dataset
        dataset = None
    else:
        # assume we have a dataset
        arrayname = plot_parameter(dataset)
        array = getattr(dataset, arrayname)

    if fig is not None and array is not None:
        MatPlot(array, num=fig)
github QuTech-Delft / qtt / src / qtt / data.py View on Github external
if parameter_names == 'all':
        parameter_names = [name for name in dataset.arrays.keys() if not dataset.arrays[name].is_setpoint]

    default_array = dataset.default_parameter_array()

    if fig:
        plt.figure(fig)
        plt.clf()

        if len(default_array.shape) >= 2:
            if len(parameter_names) > 1:
                arrays = [dataset.default_parameter_array(parameter_name) for parameter_name in parameter_names]
                plot_handle = MatPlot(*arrays, num=fig)

            else:
                plot_handle = MatPlot(dataset.default_parameter_array(parameter_names[0]), num=fig)
        else:
            for idx, parameter_name in enumerate(parameter_names):
                if idx == 0:
                    plot_handle = MatPlot(dataset.default_parameter_array(parameter_name), num=fig)
                else:
                    plot_handle.add(dataset.default_parameter_array(parameter_name,))
github QuTech-Delft / qtt / src / qtt / data.py View on Github external
sigma (float):  parameter for gaussian filter kernel
    """
    meas_arr_name = alldata.default_parameter_name(meas_arr_name)
    meas_array = alldata.arrays[meas_arr_name]
    imx = qtt.utilities.tools.diffImageSmooth(meas_array.ndarray, dy=diff_dir, sigma=sigma)
    name = 'diff_dir_%s' % diff_dir
    name = uniqueArrayName(alldata, name)
    data_arr = qcodes.DataArray(
        name=name, label=name, array_id=name, set_arrays=meas_array.set_arrays, preset_data=imx)

    alldata.add_array(data_arr)

    if fig is not None:
        plt.figure(fig)
        plt.clf()
        plot = MatPlot(interval=0, num=fig)
        plot.add(alldata.arrays[name])
        plot.fig.axes[0].autoscale(tight=True)
        plot.fig.axes[1].autoscale(tight=True)

    return alldata
github QuTech-Delft / qtt / src / qtt / measurements / scans.py View on Github external
sweep_horz = p1[xvals]
        sweep_vert = p2[yvals]

        assert (data.shape[0] == len(list(sweep_vert)))
        assert (data.shape[1] == len(list(sweep_horz)))

    dataset = makeDataSet2D(sweep_vert, sweep_horz, measure_names=measure_names,
                            location=location, loc_record=loc_record, preset_data=data)

    if fig is None:
        return dataset, None
    else:
        if fig is not None:
            plt.figure(fig).clear()
        plot = MatPlot(dataset.measured, interval=0, num=fig)
        return dataset, plot
github QuTech-Delft / qtt / src / qtt / algorithms / awg_to_plunger.py View on Github external
result (dict): result dictionary from the analyse_awg_to_plunger function.
        fig (int): index of matplotlib window.

    """
    if not result.get('type', None) == 'awg_to_plunger':
        raise Exception('calibration result not of correct type ')

    angle = result['angle']

    ds = get_dataset(result)
    _, tr = qtt.data.dataset2image(ds)
    xscan = tr.pixel2scan(np.array([[0], [0]]))

    plt.figure(fig)
    plt.clf()
    MatPlot(ds.default_parameter_array(), num=fig)
    if angle is not None:
        rho = -(xscan[0] * np.cos(angle) - np.sin(angle) * xscan[1])

        for offset in [-40, -20, 0, 20, 40]:
            label = None
            if offset is 0:
                label = 'detected angle'
            qtt.pgeometry.plot2Dline(
                [np.cos(angle), -np.sin(angle), rho + offset], '--m', alpha=.6, label=label)
    plt.title('Detected line direction')
github QuTech-Delft / qtt / src / qtt / utilities / tools.py View on Github external
def clickGatevals(plot, drawmode='ro'):
    """ Get gate values for all gates at clicked point in a heatmap.

    Args:
        plot (qcodes MatPlot object): plot of measurement data.
        drawmode (string): plotting style.

    Returns:
        gatevals (dict): values of the gates at clicked point.

    """
    # TODO: implement for virtual gates
    if not isinstance(plot, qcodes.plots.qcmatplotlib.MatPlot):
        raise Exception(
            'The plot object is not based on the MatPlot class from qcodes.')

    ax = plt.gca()
    ax.set_autoscale_on(False)
    coords = qtt.pgeometry.ginput(drawmode=drawmode)
    data_array = plot.traces[0]['config']['z']
    dataset = data_array.data_set

    gatevals = copy.deepcopy(dataset.metadata['allgatevalues'])
    if len(data_array.set_arrays) != 2:
        raise Exception('The DataArray does not have exactly two set_arrays.')

    for arr in data_array.set_arrays:
        if len(arr.ndarray.shape) == 1:
            gatevals[arr.name] = coords[1, 0]
github QuTech-Delft / qtt / src / qtt / algorithms / bias_triangles.py View on Github external
Returns:
            (dict): 'intersection_point' = intersection point
                    'distance' = length of line from 3rd clicked point to line
                    through clicked points 1 and 2
                    'clicked_points' = coordinates of the three clicked points
    """

    if diff_dir is not None:
        diffDataset(ds, diff_dir='xy')
        array_name = 'diff_dir_xy'
    else:
        array_name = ds.default_parameter_name()
    plt.figure(fig)
    plt.clf()
    MatPlot(ds.arrays[array_name], num=fig)
    ax = plt.gca()
    ax.set_autoscale_on(False)

    if description == 'lever_arm' and vertical:
        print('''Please click three points;
            Point 1: on the addition line for the dot represented on the vertical axis
            Point 2: further on the addition line for the dot represented on the vertical axis
            Point 3: on the triple point at the addition line for the dot represented on the horizontal axis
            where both dot levels are aligned''')
    elif description == 'lever_arm' and not vertical:
        print('''Please click three points;
            Point 1: on the addition line for the dot represented on the horizontal axis
            Point 2: further on the addition line for the dot represented on the horizontal axis
            Point 3: on the triple point at the addition line for the dot represented on the horizontal axis
            where both dot levels are aligned''')
    elif description == 'E_charging':
github QuTech-Delft / qtt / scripts / 1dot_script_batch.py View on Github external
if cache and os.path.exists(efileplunger) and 1:
            print('  skipping 2D and plunger scan of %s' % od['name'])
            #alldata=loadExperimentData(outputdir, tag='one_dot', dstr=basename)
            # d=alldata['od']
            continue

        od = qtt.scans.loadOneDotPinchvalues(od, outputdir, verbose=1)
        alldata, od = onedotScan(station, od, basevaluesS, outputdir, verbose=1)
        
        if (np.any(np.isnan(od['setpoint']))):
            raise Exception('please debug!')
            
        #qtt.QtPlot(alldata.amplitude, remote=False, interval=0)
        plt.figure(10)
        plt.clf()
        MatPlot(alldata.arrays[alldata.default_parameter_name()], interval=0, num=10)
        pgeometry.plotPoints(od['balancepoint'], '.m', markersize=19)

        _ = wait_bg_finish()

        scandata, od = onedotHiresScan(station, od, dv=70, verbose=1)

        stripDataset(alldata)
        stripDataset(scandata['dataset'])

        hfile = experimentFile(outputdir, tag='one_dot', dstr='%s-sweep-2d-hires' % (od['name']))
        write_data(hfile, scandata)
        # x=load_data(hfile)
        #_=loadQttData(path = experimentFile(outputdir, tag='one_dot', dstr='%s-sweep-2d-hires' % (od['name'])) )

        saveExperimentData(outputdir, alldata, tag='one_dot', dstr=basename)
github QuTech-Delft / qtt / src / qtt / measurements / scans.py View on Github external
def plot1D(data, fig=100, mstyle='-b'):
    """ Show result of a 1D scan """

    val = data.default_parameter_name()

    if fig is not None:
        plt.figure(fig)
        plt.clf()
        MatPlot(getattr(data, val), interval=None, num=fig)