Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import numpy as np
from qcodes import Instrument
from qcodes.data.data_set import load_data
from qcodes.utils.validators import Numbers
try:
import graphviz
except:
pass
# %%
class VirtualDAC(Instrument):
""" This class maps the dacs of IVVI('s) to named gates.
The main functionality is the renaming of numbered dacs of one or multiple
DAC instruments (for example an IVVI or SPI D5a module) to gates, which in
general have names describing their main purpose or position on the sample.
Attributes:
name (str): The name given to the VirtualDAC object
instruments (list): a list of qcodes instruments
gate_map (dict): the map between IVVI dac and gate
rc_times (dict): dictionary with rc times for the gates
"""
def __init__(self, name, instruments, gate_map, rc_times=None, **kwargs):
""" Virtual instrument providing a translation to physical instruments
#%%
from qcodes import Instrument
from zmqrpc.ZmqRpcClient import ZmqRpcClient
class BlueFors(Instrument):
'''
Proxy to BlueFors fridge
'''
def __init__(self, name, ip_address = 'localhost', **kwargs):
super().__init__(name, **kwargs)
self.client = ZmqRpcClient(zmq_req_endpoints=["tcp://%s:30000" % ip_address])
self.add_parameter('temperature', unit='mK', get_cmd=lambda : self.client.invoke('temperature'),
docstring='Temperature of cold plate')
#_ = self.timestamp.get()
#%%
if __name__=='__main__':
b=BlueFors(name='xld', ip_address='localhost')
def instrumentName(namebase):
""" Return name for qcodes instrument that is available
Args:
namebase (str)
Returns:
name (str)
"""
inames = qcodes.Instrument._all_instruments
name = namebase
for ii in range(10000):
if not (name in inames):
return name
else:
name = namebase + '%d' % ii
raise Exception(
'could not find unique name for instrument with base %s' % namebase)
import logging
import numpy as np
from qcodes import Instrument
from qtt.instrument_drivers.virtualAwg.sequencer import Sequencer
from qtt.instrument_drivers.virtualAwg.awgs.Tektronix5014C import Tektronix5014C_AWG
from qtt.instrument_drivers.virtualAwg.awgs.KeysightM3202A import KeysightM3202A_AWG
from qtt.instrument_drivers.virtualAwg.awgs.ZurichInstrumentsHDAWG8 import ZurichInstrumentsHDAWG8
class VirtualAwgError(Exception):
""" Exception for a specific error related to the virtual AWG."""
class VirtualAwg(Instrument):
""" The virtual AWG is an abstraction layer to produce pulse driven state manipulation of physical qubits.
The class aims for hardware independent control, where only common arbitrary waveform generator (AWG)
functionality is used. A translation between the AWG channels and the connected quantum gates provide
the user control of the AWG's in terms of gate names and waveform sequences only. The virtual AWG is
used for fast change of the DC landscape by changing the voltage levels of the gates. No microwave
control is involved, meaning not related to the spin degrees of freedom of the qubits.
"""
__digitizer_name = 'm4i_mk'
__awg_slave_name = 'awg_mk'
__volt_to_millivolt = 1e3
def __init__(self, awgs, settings, name='virtual_awg', logger=logging, **kwargs):
""" Creates and initializes an virtual AWG object and sets the relation between the quantum gates,
markers and the AWG channels. The default settings (marker delays) are constructed at startup.
def _get_gate(self, gate):
if self.model is None:
return np.random.rand()
return self.model.get(self.name + '_' + gate)
def get_idn(self):
""" Overrule because the default get_idn yields a warning """
IDN = {'vendor': 'QuTech', 'model': self.name,
'serial': None, 'firmware': None}
return IDN
# %%
class VirtualIVVI(Instrument):
def __init__(self, name, model, gates=['dac%d' % i for i in range(1, 17)], dac_unit='a.u.', **kwargs): # type: ignore
""" Virtual instrument representing a DAC
Args:
name (str)
model (object): the model should implement functions get and set
which can get and set variables of the form INSTR_PARAM
Here INSTR is the name of the VirtualIVVI, PARAM is the name
of the gate
gates (list of gate names)
dac_unit (str): unit to set for the dac parameters
"""
super().__init__(name, **kwargs)
self.model = model
from functools import partial
from qcodes import Instrument
from zmqrpc.ZmqRpcClient import ZmqRpcClient
class InstrumentDataClient(Instrument):
'''
A proxy client for collecting instrument measurable quantities
from a server.
Args:
name (str): the name of the instrument.
address (str): the ip-address of the server.
port (int): the port number of the proxy server.
user (str): a username for protection.
password (str): a password for protection.
'''
def __init__(self, name, address='localhost', port=8080, user=None,
password=None, **kwargs):
super().__init__(name, **kwargs)
self._client_ = ZmqRpcClient(["tcp://{0}:{1}".format(address, port)],
#
# Pieter Eendebak
import time
import logging
from functools import partial
import numpy as np
import qtt.utilities.tools
from qcodes import Instrument
from qcodes.utils.validators import Numbers as NumbersValidator
@qtt.utilities.tools.deprecated
class KeithleyVirtual(Instrument):
'''
This is the qcodes driver for the Keithley_2700 Multimeter
Usage: Initialize with
= = KeithleyVirtual(, address='', ... )
'''
def __init__(self, name, address, reset=False, **kwargs):
super().__init__(name, **kwargs)
self.add_parameter('dummy',
get_cmd=self.get_dummy,
set_cmd=self.set_dummy,
vals=NumbersValidator())
self.add_function('readnext', call_cmd=self.readnext_function, unit='arb.unit')
import numpy as np
from PyQt5.QtWidgets import QApplication
from qcodes import Instrument, ManualParameter, Station, Parameter
from qcodes.instrument_drivers.ZI.ZIHDAWG8 import WARNING_ANY, ZIHDAWG8
from qcodes.utils.validators import Numbers
from qtt.instrument_drivers.virtualAwg.virtual_awg import VirtualAwg
from qtt.instrument_drivers.virtual_instruments import VirtualIVVI
from qtt.measurements.acquisition import UHFLIScopeReader
from qtt.measurements.videomode import VideoMode
## INITIALIZE THE HARDWARE SETTINGS
class HardwareSettings(Instrument):
def __init__(self, name='settings'):
super().__init__(name)
awg_gates = {'P1': (0, 0), 'P2': (0, 1)}
awg_markers = {'m4i_mk': (0, 4, 0)}
self.awg_map = {**awg_gates, **awg_markers}
for awg_gate in self.awg_map:
parameter_name = 'awg_to_{}'.format(awg_gate)
parameter_label = '{} (factor)'.format(parameter_name)
self.add_parameter(parameter_name, parameter_class=ManualParameter,
initial_value=1000, label=parameter_label, vals=Numbers(1, 1000))
settings = HardwareSettings()
from qcodes import Instrument
from functools import partial
from zmqrpc.ZmqRpcClient import ZmqRpcClient
from zmqrpc.ZmqRpcServer import ZmqRpcServerThread
# -----------------------------------------------------------------------------
class InstrumentDataClient(Instrument):
'''
A proxy client for collecting instrument measurable quantities
from a server.
Args:
name (str): the name of the instrument.
address (str): the ip-address of the server.
port (int): the port number of the proxy server.
user (str): a username for protection.
password (str): a password for protection.
'''
def __init__(self, name, address='localhost', port=8080, user=None,
password=None, **kwargs):
super().__init__(name, **kwargs)
self._client_ = ZmqRpcClient(["tcp://{0}:{1}".format(address, port)],