示例#1
0
# filein = 'S1_514_DCE_MAP_low_pow'
# folder = "hdf5s//09//Data_0912//"
# filein = 'S1_482_shot_5090_5019MHz'
# folder = "hdf5s//09//Data_0921//"
# filein = 'S1_520_shot_BPF3'
# folder = "hdf5s//10//Data_1022//"
# filein = 'S1_631_SN_G100_BPF4'
# folder = "hdf5s//10//Data_1030//"
# filein = 'S1_655_SN_4p1_4p5_BPF7'
# folder = "hdf5s//10//Data_1028//"
# filein = 'S1_649_DCE_4p1_4p5_BPF7'
folder = 'hdf5s//11//Data_1110//'
filein = 'S1_940_DCE_4p1p8_BPF7'


d = load_hdf5(folder+filein+'.hdf5')


def get_MP(d, chnum):
    '''
    This function is used to obtain the magnitude and phase from
    a complex data set.
    It assumes that the next channel is part of the complex number.
    real + i* imaginary
    '''
    compx = 1j*d.data[:, chnum+1, :]
    compx += d.data[:, chnum, :]
    phase = np.unwrap(zip(*np.angle(compx)))
    return np.abs(compx), zip(*phase)

'''
import numpy as np
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"
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
示例#3
0
import numpy as np
from parsers import load_hdf5
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

filename = "hdf5s//09//Data_0912//S1_480_DCE_MAP_large_fine.hdf5"
d = load_hdf5(filename)
d.c8 = d.data[:, 8, :]  # Real data (MagAvg)
d.c9 = d.data[:, 9, :]  # Imag data (MagAvg)
d.D1compx = 1j*d.c9
d.D1compx += d.c8
d.D1mag = np.absolute(d.D1compx)
d.D1phase = np.angle(d.D1compx)
d.D1Pow = d.data[:, 6, :]

d.c10 = d.data[:, 10, :]   # Real data (MagAvg)
d.c11 = d.data[:, 11, :]  # Imag data (MagAvg)
d.D2compx = 1j*d.c11
d.D2compx += d.c10
d.D2mag = np.absolute(d.D2compx)
d.D2phase = np.angle(d.D2compx)
d.D2Pow = d.data[:, 7, :]

# scale data to photon number
D1AvgP = np.mean(d.D1Pow[-1, :])  # background power
D2AvgP = np.mean(d.D2Pow[-1, :])
f1 = 5.135e9
f2 = 5.145e9
import numpy as np
from parsers import load_hdf5
from parsers import savemtx, make_header
# import matplotlib.pyplot as plt
from changeaxis import interp_y

d = load_hdf5('S1_471_DCE_MAP2.hdf5')
d.cD1 = 1j*d.data[:, 6, :]
d.cD1 += d.data[:, 5, :]
d.D1mag = np.absolute(d.cD1)
d.D1ang = np.angle(d.cD1)
d.D1pow = d.data[:, 7, :]
d.D1lev = d.data[:, 8, :]
d.shape = d.data.shape

xoff = 139.3e-3
x1flux = 479.6e-3
d.dim_1.lin = (d.dim_1.lin-xoff)/x1flux + 0.5
d.dim_1.start = d.dim_1.lin[0]
d.dim_1.stop = d.dim_1.lin[-1]

MAT1 = np.zeros([6, d.shape[0], d.shape[2]])
MAT1[0] = d.data[:, 3, :]
MAT1[1] = d.data[:, 4, :]
MAT1[2] = d.D1mag
MAT1[3] = d.D1ang
MAT1[4] = d.D1pow
MAT1[5] = d.D1lev

y = (d.dim_2.lin*d.dim_2.lin/50.0)  # position of the data
y2, MAT2 = interp_y(y, d.D1pow)