# from scipy.io import loadmat, savemat, whosmat #to save and load .mat (matlab)
from lmfit import minimize, Parameters, report_fit  # , Parameter
import matplotlib.pyplot as plt
import Gnuplot as gp

plt.ion()

# load hdf5 data
# filename = 'S1_203.hdf5'
filename = 'S1_945_S11_4p1_BPF7.hdf5'
# filename = 'S1_945_S11_4p8_BPF7.hdf5'
measdata = get_hdf5data(filename)

flux0 = 2.07e-15    # Tm^2; Flux quanta: flux0 =  h / (2*charging energy)

squid = dim(name='Squid', start=-1.5, stop=0.5, pt=201, scale=flux0)
elem = handler(name='mag/phase', start=0, stop=10, pt=1)
squid.flux0 = 2.07e-15  # Tm^2; flux0=h/(2*charging energy)

elem.Z0 = 50            # R; Input impedance
elem.Z1 = 50            # R; Impedance of transmission piece 1
elem.Z2 = 50            # R; Impedance of Coplanar Waveguide
elem.Z3 = 50
elem.L1 = 0.44
elem.L2 = 0.04
elem.L3 = 0.01
elem.Z4 = 0.1           # Ohm; Wire bonds conductance to GND (-45dB isolation)
# m/s; approx. velocity in a coaxial 2/3 * speed of light
elem.v = 2.0e8
squid.Wb = 1000e-12        # Aprox: Lw (nH) = 5.08x10-3 * L * (ln(4*L/D) - 1)
squid.LOOP = 1e-30
from parsers import load_hdf5, dim
from parsers import savemtx, make_header
# import matplotlib.pyplot as plt
# from changeaxis import interp_y
# from scipy.constants import Boltzmann as Kb
# from scipy.constants import h  , e, pi

# filein = "S1_511_shot_100mV_4924_5217MHz"
filein = "S1_514_S11_4924_5217MHz"
folder = "hdf5s//09//Data_0915//"
d = load_hdf5(folder+filein+'.hdf5')

n = 3
d.n2 = [dim(name=d.stepInst[n],
            start=sPar[3],
            stop=sPar[4],
            pt=sPar[8],
            scale=1)
        for sPar in d.stepItems[n]]


def get_MP(d, chnum):
    compx = 1j*d.data[:, chnum+1, :]
    compx += d.data[:, chnum, :]
    phase = np.unwrap(zip(*np.angle(compx)))
    return np.abs(compx), zip(*phase)


MAT1 = np.zeros([10, d.shape[0], d.shape[1]])
MAT1[0] = d.data[:, 4, :]
MAT1[1] = d.data[:, 5, :]
i = 1.0j
flux0 = 2.07e-15    # Tm^2; Flux quanta: flux0 =  h / (2*charging energy)
Z0 = 50.0           # R; Input impedance
Z1 = 30.0           # R; Impedance of transmission piece 1
Z2 = 50.0           # R; Impedance of Coplanar Waveguide
l1 = 0.44           # m;
l2 = 900.0e-6       # m; adjust length with epsilonr for saphire
v = 2.0e8           # m/s; approx. velocity in a coaxial 2/3 * speed of light
Ic = 1.7e-6         # A; Ic ~ 0.85uA measured, 2.5 uA max
R = 2.3e3           # Ohm
Cap = 450e-15       # 450.0e-15     # F
Y4 = 1/0.1          # 1/Ohm; Wire bonds conductance to GND (-45dB isolation)

magnet = dim(name = 'Flux (Phi0)',
           start = -1,
           stop = 1,
           pt = 1001,
           scale = flux0)
freq = dim(name = 'Frequency (GHz)',
           start = 4,
           stop = 8,
           pt = 101,
           scale = 1e9)
dim_3 = handler(name = 'mag/phase',
           start = 0,
           stop = 10,
           pt = 11) #8 pts for S 4x2 values
dim_3._Z0 = 50

head1 = make_header(magnet, freq, dim_3, 'S11 S12 S21 S22 Z L')
dim_3.prepare_data_save(magnet, freq, dim_3)
Exemple #4
0
# from scipy.io import loadmat, savemat, whosmat #to save and load .mat (matlab)
from lmfit import minimize, Parameters, report_fit  # , Parameter
import matplotlib.pyplot as plt
import PyGnuplot as gp

plt.ion()

# load hdf5 data
# filename = 'S1_203.hdf5'
filename = 'S1_945_S11_4p1_BPF7.hdf5'
# filename = 'S1_945_S11_4p8_BPF7.hdf5'
measdata = get_hdf5data(filename)

flux0 = 2.07e-15  # Tm^2; Flux quanta: flux0 =  h / (2*charging energy)

squid = dim(name='Squid', start=-1.5, stop=0.5, pt=201, scale=flux0)
elem = handler(name='mag/phase', start=0, stop=10, pt=1)
squid.flux0 = 2.07e-15  # Tm^2; flux0=h/(2*charging energy)

elem.Z0 = 50  # R; Input impedance
elem.Z1 = 50  # R; Impedance of transmission piece 1
elem.Z2 = 50  # R; Impedance of Coplanar Waveguide
elem.Z3 = 50
elem.L1 = 0.44
elem.L2 = 0.04
elem.L3 = 0.01
elem.Z4 = 0.1  # Ohm; Wire bonds conductance to GND (-45dB isolation)
# m/s; approx. velocity in a coaxial 2/3 * speed of light
elem.v = 2.0e8
squid.Wb = 1000e-12  # Aprox: Lw (nH) = 5.08x10-3 * L * (ln(4*L/D) - 1)
squid.LOOP = 1e-30
# from scipy.constants import h  , e, pi

filein = "S1_511_shot_100mV_4924_5217MHz"
folder = "hdf5s//09//Data_0915//"
d = load_hdf5(folder + filein + ".hdf5")

# # meas specific to change mag field to flux
# # simply comment this paragraph out
# xoff = 140.5e-3  # 139.3e-3
# x1flux = 479.6e-3
# d.n2.lin = (d.n2.lin-xoff)/x1flux + 0.5
# d.n2.start = d.n2.lin[0]
# d.n2.stop = d.n2.lin[-1]
# d.n2.name = 'Flux/Flux0'

d.n2 = [dim(name=d.stepInst[0], start=sPar[3], stop=sPar[4], pt=sPar[8], scale=1) for sPar in d.stepItems[0]]


def search(chanList, searchString):
    for i, k in enumerate(chanList):
        if searchString in k:
            return i, k
    return None


def get_MP(d, chnum):
    compx = 1j * d.data[:, chnum + 1, :]
    compx += d.data[:, chnum, :]
    return np.abs(compx), np.angle(compx)