示例#1
0
 def take_point(self):
     try:
         # gather data
         data = [time.time() * Unit('s')]
         errors = []
         for w in self.watchers:
             try:
                 r = yield w.take_point()
                 data.extend(r)
             except T.Error as err:
                 errors.append((w.server_name, err.msg))
         if errors:
             self.errors = errors
             returnValue(None)
         # strip units
         data = [x[x.unit] for x in data]
         # did the day roll over?
         if self.currentDay != time.strftime("%d"):
             self.new_dataset()
         try:
             # make dataset if first time
             if self.data_vault is None:
                 print("Making new dataset")
                 yield self.make_dataset()
             # add data
             yield self.data_vault.add(data, context=self.ctx)
         except T.Error as err:
             print("Error when writing data to data vault: {}".format(err))
             if 'NoDatasetError' in err.msg:
                 try:
                     yield self.make_dataset()
                     yield self.data_vault.add(data, context=self.ctx)
                 except T.Error as err:
                     errors.append(("Data Vault", str(err)))
             else:
                 errors.append(("General", str(err)))
         self.errors = errors
     except Exception as e:
         import traceback
         traceback.print_exc()
示例#2
0
from zilabrad.instrument.qubitServer import loadQubits, Unit2SI, Unit2num
from zilabrad.instrument.qubitServer import runQubits

from zilabrad.instrument import qubitServer
# for sweep/looping
from zilabrad.pyle import sweeps
from zilabrad.pyle.sweeps import gridSweep, checkAbort
from zilabrad.pyle.util import sweeptools
from zilabrad.pyle.workflow import switchSession
# for physical units, GHz, ns, ...
from labrad.units import Unit, Value

_unitSpace = ('V', 'mV', 'us', 'ns', 's', 'GHz', 'MHz', 'kHz', 'Hz', 'dBm',
              'rad', 'None')
V, mV, us, ns, s, GHz, MHz, kHz, Hz, dBm, rad, _l = [
    Unit(s) for s in _unitSpace
]

ar = sweeptools.r

_noisy_printData = True


def runDummy(qubits, exp_devices):
    data = np.array([])
    for q in qubits:
        if len(data) == 0:
            data_new = np.random.random(
                q['stats']) + 1j * np.random.random(q['stats'])
            data = data_new
        else:
示例#3
0
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

import os
from datetime import datetime

import labrad
from labrad.units import Unit

us, ns, V, mV, GHz, dBm = [
    Unit(s) for s in ('us', 'ns', 'V', 'mV', 'GHz', 'dBm')
]

import registry

# default set of keys that will be set in the registry for each newly-created qubit
DEFAULT_KEYS = {
    'channels': [('timing', 'Preamp', ['DR Lab Preamp 1', 'A']),
                 ('flux', 'FastBias', ['DR Lab FastBias 2', 'A']),
                 ('squid', 'FastBias', ['DR Lab FastBias 3', 'A']),
                 ('uwave', 'Iq', ['DR Lab FPGA 1']),
                 ('meas', 'Analog', ['DR Lab FPGA 7', 'A'])],
    'biasOperate':
    0 * V,
    'biasOperateSettling':
    40 * us,
示例#4
0
if os.name == "posix":
    base_path = os.environ["HOME"] + "/src"
elif os.name == "nt":
    base_path = "~/src"

PYLABRAD_PATH = 'pylabrad'
PYLE_PATH = 'pyle'

sys.path.insert(1, os.path.join(base_path))
sys.path.insert(1, os.path.join(base_path, PYLABRAD_PATH))
sys.path.insert(1, os.path.join(base_path, PYLE_PATH))

import labrad
import labrad.units as U
from labrad.units import Unit, Value
rad, ns, us, MHz, GHz, mV, V, Ohm, dBm = (Unit(s) for s in \
    ['rad','ns','us','MHz','GHz','mV','V','Ohm','dBm'])
from labrad.units import ValueArray

if os.name == "nt":
    try:
        import thread, ctypes, imp
        import win32api
        basepath = imp.find_module('numpy')[1]
        lib1 = ctypes.CDLL(os.path.join(basepath, 'core', 'libmmd.dll'))
        lib2 = ctypes.CDLL(os.path.join(basepath, 'core', 'libifcoremd.dll'))

        def handler(sig, hook=thread.interrupt_main):
            hook()
            return 1
示例#5
0
 def getAmplitude(self):
     self.amplitude = yield self.query(':sour:pow?').addCallback(float)
     self.amplitude = self.amplitude * Unit('dBm')
     returnValue(self.amplitude)
示例#6
0
cmdline = %PYTHON% %FILE%
timeout = 20

[shutdown]
message = 987654321
timeout = 5
### END NODE INFO
"""

from labrad.server import setting
from labrad.gpib import GPIBManagedServer, GPIBDeviceWrapper
from twisted.internet.defer import inlineCallbacks, returnValue

from labrad.units import Unit, Value

Hz, MHz, GHz = (Unit(s) for s in ['Hz', 'MHz', 'GHz'])


class RSWrapper(GPIBDeviceWrapper):
    @inlineCallbacks
    def initialize(self):
        self.frequency = yield self.getFrequency()
        self.amplitude = yield self.getAmplitude()
        self.outputStateKnown = False
        self.output = True

    @inlineCallbacks
    def getFrequency(self):
        self.frequency = yield self.query(':sour:freq?').addCallback(float)
        self.frequency = self.frequency * Hz
        returnValue(self.frequency)
示例#7
0
[shutdown]
message = 987654321
timeout = 20
### END NODE INFO
"""

from labrad import types as T, gpib
from labrad.server import setting
from labrad.gpib import GPIBManagedServer, GPIBDeviceWrapper
from labrad.units import Unit
from twisted.internet.defer import inlineCallbacks, returnValue
from twisted.internet.task import LoopingCall
import numpy as np, time

V, A = Unit('V'), Unit('A')

VOLT_LIMIT = 0.9 * V
CURRENT_LIMIT = 17.17 * A


class KepcoWrapper(GPIBDeviceWrapper):
    pass
    #@inlineCallbacks
    #def initialize(self):
    #    if int( (yield self.query("FUNC:MODE?")) ):
    #        yield self.write("FUNC:MODE VOLT")


class KepcoServer(GPIBManagedServer):
    name = 'Kepco ABC'
timeout = 20
[shutdown]
message = 987654321
timeout = 20
### END NODE INFO
"""

from labrad.server import setting
from labrad.gpib import GPIBManagedServer, GPIBDeviceWrapper
from twisted.internet.defer import inlineCallbacks, returnValue

from labrad import util

from labrad.units import Value, Unit

Hz, MHz, V, nV = [Unit(s) for s in ['Hz', 'MHz', 'V', 'nV']]

from struct import unpack
import numpy as np
import time

NUM_POINTS = 400

COUPLINGS = {0: 'AC', 1: 'DC'}

GROUNDINGS = {0: 'FLOAT', 1: 'GROUND'}

SPANS = {
    0: 0.191,
    1: 0.382,
    2: 0.763,
示例#9
0
-- It reports all of its statuses in one function, and all of its measurements in another.
'''

import labrad
from labrad.devices import DeviceServer, DeviceWrapper
from labrad.server import setting
from labrad.types import Error
from labrad.units import Unit, Value

from twisted.internet.task import LoopingCall
from twisted.internet.defer import inlineCallbacks, returnValue

from OrderedDict import OrderedDict  # if we ever go to 2.7 we can use collections.OrderedDict
import math, time

K, A, V, T, Ohm = Unit('K'), Unit('A'), Unit('V'), Unit('T'), Unit('Ohm')

# hard limits
TEMP_LIMIT = 6.5 * K
CURRENT_LIMIT = 17.17 * A
VOLTAGE_RESOLUTION = 0.0006 * V
VOLTAGE_LIMIT_DEFAULT = 0.1 * V
VOLTAGE_LIMIT_MAX = 0.7 * V
VOLTAGE_LIMIT_MIN = VOLTAGE_RESOLUTION
VOLTAGE_STEP = VOLTAGE_RESOLUTION * 3

DMM2_RESISTANCE = 5.2 * Ohm

CURRENT_RESOLUTION = 0.005 * A

FIELD_CURRENT_RATIO = 0.2823 * T / A
示例#10
0
#!/usr/bin/env python
# coding: utf-8

# Copyright (c) 2020, Ziyu Tao

import os
from functools import reduce
import re

# from util.units import Unit,Value
from util.sweeptools import RangeCreator
from labrad.units import Unit, Value

_unitSpace = ('V', 'mV', 'us', 'ns', 'GHz', 'MHz', 'kHz', 'Hz', 'dBm', 'rad',
              'None')
V, mV, us, ns, GHz, MHz, kHz, Hz, dBm, rad, _l = [Unit(s) for s in _unitSpace]

ar = RangeCreator()


def MatchString(string):
    string_new = None

    # if the string is in python expression
    try:
        eval(string)
    except:
        pass
    else:
        string_new = eval(string)
        return string_new
示例#11
0
from pyle.plotting import tomography
from pyle.interpol import interp1d_cubic
from pyle.analysis import readout
from pyle.dataking.benchmarking import randomizedBechmarking as rb
from pyle.dataking import zfuncs
import matplotlib.pyplot as plt
from scipy import optimize
from matplotlib.pyplot import figure
from pyle.gates import Gate
from labrad import units as U
from labrad.units import Unit
from pyle.util import convertUnits
from pyle.pipeline import returnValue, FutureList

V, mV, us, ns, GHz, MHz, dBm, rad, au = [
    Unit(s) for s in ('V', 'mV', 'us', 'ns', 'GHz', 'MHz', 'dBm', 'rad', 'au')
]


class lzxPulse(NumericalPulse):
    @convertUnits(tau0='ns', tau1='ns', taup='ns', amp='GHz', T0='ns')
    def __init__(self, q, tau0=0, tau1=37.5, taup=25, k0=1.0, amp=1.0, T0=1.0):
        self.q = q
        self.tau0 = tau0  # 'the start time for lzpulse'
        self.tau1 = tau1
        self.taup = taup
        self.k0 = k0
        self.amp = amp
        self.T0 = T0
        self.tau2 = 3 * tau1 - 2 * tau0
        self.tauc = 2 * tau1 - 2 * tau0 + taup
示例#12
0
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

import labrad
from labrad.units import Unit, Value
s = Unit('s')

from PyQt4 import QtCore, QtGui, uic
import sys


POLLING_TIME = 1000 #milliseconds

SERVER_NAME = 'cryo_notifier'

TIMER_NAMES = ['LN2','LHe','Trap']
#Timer names are eg. 'vince:LN2', 'jules:Tra


class FridgeGuardianMainWindow(QtGui.QMainWindow):
    def __init__(self, cxn):
示例#13
0
 def measureValue(self, slot):
     result = yield self.query('MEASU:MEAS%d:UNI?;VAL?' % slot)
     u, v = result.split(';')
     v = float(v)
     u = Unit(u[1:-1])
     returnValue(v * u)