Exemplo n.º 1
0
def sweep_dim_2(obj, value):
    ramp(obj, obj.sweep_par, value, obj.sstep, obj.stime)


def sweep_dim_3(obj, value):
    ramp(obj, obj.sweep_par, value, obj.sstep, obj.stime)


# This describes how data is saved
DS = DataStoreSP(folder, filen_0, dim_1, dim_2, dim_3, 'Vx1k')
# CorrProc controls, coordinates D1 and D2 together (also does thes calcs.)
if recordD12:
    D12.create_datastore_objs(folder, filen_0, dim_1, dim_2, dim_3)

DS.ask_overwrite()
copy_file(thisfile, filen_0, folder)


# describe how data is to be stored
def record_data(kk, jj, ii, back):
    '''This function is called with each change in ii,jj,kk
        content: what to measure each time
    '''
    if recordD12:
        D12.init_trigger()  # Trigger and check D1 & D2
        #print 'send trigger from loop'
    vdata = vm.get_val()  # aquire voltage data point
    if back is True:
        return DS.record_data2(vdata, kk, jj, ii)

    DS.record_data(vdata, kk, jj, ii)
#for the VNA I want 4 data files for Real, Imag, MAG, Phase
filen_1 = filen_0 + '_real'  + '.mtx'
filen_2 = filen_0 + '_imag'  + '.mtx'
filen_3 = filen_0 + '_mag'   + '.mtx'
filen_4 = filen_0 + '_phase' + '.mtx'
head_1 = make_header(dim_1, dim_2, dim_3, 'S21 _real')
head_2 = make_header(dim_1, dim_2, dim_3, 'S21 _imag')
head_3 = make_header(dim_1, dim_2, dim_3, 'S21 _mag')
head_4 = make_header(dim_1, dim_2, dim_3, 'S21 _phase')
matrix3d_1 = np.zeros((dim_3.pt, dim_2.pt, dim_1.pt))
matrix3d_2 = np.zeros((dim_3.pt, dim_2.pt, dim_1.pt))
matrix3d_3 = np.zeros((dim_3.pt, dim_2.pt, dim_1.pt))
matrix3d_4 = np.zeros((dim_3.pt, dim_2.pt, dim_1.pt))

ask_overwrite(folder+filen_1)
copy_file(thisfile, filen_0, folder) #backup this script

dim_1.lin = np.linspace(dim_1.start,dim_1.stop,dim_1.pt)
dim_2.lin = np.linspace(dim_2.start,dim_2.stop,dim_2.pt)
dim_3.lin = np.linspace(dim_3.start,dim_3.stop,dim_3.pt)

print 'Executing sweep'
print 'req time (h):'+str(dim_3.pt*dim_2.pt*dim_1.sweeptime/3600)
t0 = time()
try:
    for kk in range(dim_3.pt): 
        dim_3val = dim_3.lin[kk] 
        dim_3.set_freq_cw(dim_3val)
        #sleep(5.2)

        dim_2.sweep_v(dim_2.start, 4)