How to use the qcodes.Station 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 / __init__.py View on Github external
def _copy_to_str(x, memo=None):
    return str(x)


def _setstate(self, d):
    self._short_name = d
    self._instrument = None

    def _get():
        print('instrument %s was serialized, no get available' % self.name)
        raise Exception('no get function defined')

    self.get = _get

# black magic to make qcodes objects work with deepcopy
for c in [Parameter, Instrument, ManualParameter, Station]:
    copy._deepcopy_dispatch[c] = _copy_to_str  # type: ignore

# make a qcodes instrument pickable
qcodes.Parameter.__getstate__ = _copy_to_str  # type: ignore
qcodes.Parameter.__setstate__ = _setstate  # type: ignore


# %% Enhance the qcodes functionality

try:
    from qtpy.QtCore import Qt
    from qtpy import QtWidgets
    from qcodes.plots.pyqtgraph import QtPlot

    def _qtt_keyPressEvent(self, e):
        ''' Patch to add a callback to the QtPlot figure window '''
github QuTech-Delft / qtt / src / qtt / simulation / virtual_dot_array.py View on Github external
for g in gates.parameters.keys():
        if g.startswith('O'):
            gg = getattr(gates, g)
            gg.unit = 'uV'

    vawg = SimulationAWG(qtt.measurements.scans.instrumentName('vawg'))

    logger.info('initialize: create virtual keithley instruments')
    keithley1 = VirtualMeter('keithley1', model=model)
    keithley3 = VirtualMeter('keithley3', model=model)
    keithley4 = VirtualMeter('keithley4', model=model)

    digitizer = SimulationDigitizer(qtt.measurements.scans.instrumentName('sdigitizer'), model=model)

    logger.info('initialize: create station')
    station = qcodes.Station(gates, keithley1, keithley3, keithley4, *ivvis,
                             vawg, digitizer, model, update_snapshot=False)
    station.awg = station.vawg
    station.metadata['sample'] = 'virtual_dot'
    station.model = model

    station.gate_settle = gate_settle
    station.depletiongate_name = 'D0'
    station.bottomchannel_current = station.keithley3.amplitude

    station.jobmanager = None
    station.calib_master = None

    _initialized = True
    if verbose:
        print('initialized virtual dot system (%d dots)' % nr_dots)
    return station
github QuTech-Delft / qtt / docs / notebooks / unfinished / example_CSD_videomode_2D.py View on Github external
virtual_awg = VirtualAwg([awg], settings)

width = 30/32
resolution = [64, 64]
cable_compensation = 0.0305
period = resolution[0] * resolution[1] / nearest_uhfli_sample_rate
marker_delay = (0.5 + (1 - width) - cable_compensation) * period
virtual_awg.digitizer_marker_delay(marker_delay)

marker_uptime = 0.1 * period
virtual_awg.digitizer_marker_uptime(marker_uptime)


# STATION

station = Station(virtual_awg, scope_reader.adapter.instrument)
station.gates = VirtualIVVI('gates', gates=['P1', 'P2'], model=None)


# VIDEO MODE

app = QApplication([])

sweep_gates = [{'P1': 1}, {'P2': 1}]
sweep_ranges = [1000, 1000]
scope = (scope_reader, [(1, 'Signal Input 1'), (2, 'Signal Input 2')])

vm = VideoMode(station, sweep_gates, sweep_ranges, minstrument=scope, resolution=resolution)
vm.updatebg()

app.exec_()
github QuTech-Delft / qtt / docs / notebooks / unfinished / example_CSD_videomode_1D.py View on Github external
virtual_awg = VirtualAwg([awg], settings)

period = 1e-3
width = 30/32
cable_compensation = 0.0305
marker_delay = (0.5 + (1 - width) - cable_compensation) * period
virtual_awg.digitizer_marker_delay(marker_delay)

marker_uptime = 0.1 * period
virtual_awg.digitizer_marker_uptime(marker_uptime)


# STATION

station = Station(virtual_awg, scope_reader.adapter.instrument)
station.gates = VirtualIVVI('gates', gates=['P1', 'P2'], model=None)


# VIDEO MODE

app = QApplication([])

sweep_gates = 'P1'
sweep_ranges = 1000
scope = (scope_reader, [(1, 'Signal Input 1')])

vm = VideoMode(station, sweep_gates, sweep_ranges, minstrument=scope)
vm.updatebg()

app.exec_()
github QuTech-Delft / qtt / docs / notebooks / unfinished / example_measurement_uhfli.py View on Github external
plot.clf()
    plot.xlabel(label_x)
    plot.ylabel(label_y)
    for record in records:
        plot.plot(record.set_arrays[0].flatten(), record.flatten(), color=next(color_cycler), label=record.name)
        plot.legend(loc='upper right')
        plot.draw()
        plot.pause(0.001)


# CREATE THE SCOPE READER AND STATION

device_id = 'dev2338'
scope_reader = UHFLIScopeReader(device_id)
uhfli = scope_reader.adapter.instrument
station = Station(uhfli, update_snapshot=False)


# INITIALIZE THE SCOPE READER

file_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'uhfli.dat')
configuration = load_configuration(file_path)
scope_reader.initialize(configuration)


# PREPARE THE SCOPE FOR READOUT

scope_reader.number_of_averages = 1
scope_reader.input_range = (0.5, 1.0)
scope_reader.sample_rate = 450e6
scope_reader.period = 1e-5
github QuTech-Delft / qtt / src / qtt / utilities / tools.py View on Github external
def reshape_metadata(dataset, printformat='dict', add_scanjob=True, add_gates=True, add_analysis_results=True, verbose=0):
    """ Reshape the metadata of a DataSet.

    Args:
        dataset (DataSet or qcodes.Station): a dataset of which the metadata will be reshaped.
        printformat (str): can be 'dict' or 'txt','fancy' (text format).
        add_scanjob (bool): If True, then add the scanjob at the beginning of the notes.
        add_analysis_results (bool): If True, then add the analysis_results at the beginning of the notes.
        add_gates (bool): If True, then add the scanjob at the beginning of the notes.
        verbose (int): verbosity (0 == silent).

    Returns:
        str: the reshaped metadata.

    """
    if isinstance(dataset, qcodes.Station):
        station = dataset
        all_md = station.snapshot(update=False)['instruments']
        header = None
    else:
        tmp = dataset.metadata.get('station', None)
        if tmp is None:
            all_md = {}
        else:
            all_md = tmp['instruments']

        header = 'dataset: %s' % dataset.location

        if hasattr(dataset.io, 'base_location'):
            header += ' (base %s)' % dataset.io.base_location

    if add_gates: