Esempio n. 1
0
def visual_data():
    # 获取可视化名单
    signal_choosed_list = [i[0] for i in list(zip(signal_name_list, list(signal_choose.state()))) if i[1] == 1]
    # 判断是否已经开始画图的参数
    global begin
    begin = 0
    if begin == 0:
        begin = 1
        # 实例化示波器
        for i,j in zip(signal_choosed_list,range(len(signal_choosed_list))):

            v['frame'+str(j+1)] = LabelFrame(height=600, width=700, bg='white', text=i, font=('黑体', 30))
            v['frame' + str(j + 1)].grid(row=4,column=j)
            series = excel_data[i].dropna()
            long = len(series)
            jump = long//2000
            if jump == 0:
                jump = 1
            series = pd.DataFrame(series).iloc[range(0,long,jump),0]
            short = len(series)
            v['o'+str(j+1)]  = Oscilloscope(xlim=(short//5, (series.index.max()-series.index.min())/short), y_lim=(series.min(), series.max()), color='red', frame=v['frame'+str(j+1)])
            # 导入数据
            v['o'+str(j+1)].input_list(xs_list=list(series.index), ys_list=list(series.values))
            # 定义线程
            v['t'+ str(j+1)]= threading.Thread(target=v['o'+str(j+1)].run)
            # 开始线程
            v['t'+ str(j+1)].start()
    else:
        pass
Esempio n. 2
0
def main():
    osc = Oscilloscope(1)
    osc.write('COMM_HEADER OFF')
    osc.queryParam('WFSU')
    print osc.readBuffer(100)
    nPoints = 5000
    osc.setupWaveForm(n=nPoints,sparsing=100,firstpoint=5,segment=0)
    #osc.write('C1:INSPECT? "FIRST_VALID_PNT"')
    #print osc.dso.ReadString(1e6)
    #osc.write('C1:INSPECT? "LAST_VALID_PNT"')
    #print osc.dso.ReadString(1e6)
    osc.write('C1:INSPECT? "SIMPLE", BYTE')
    s = osc.dso.ReadString(1e9)
    l = s.split()
    ml = [i for i in l if is_number(i)]
    y = [float(i) for i in ml]
    x = range(0,len(y))
    plt.plot(x,y,'bo')
    plt.show()
resource_manager = pyvisa.ResourceManager()
inst_name = resource_manager.list_resources()
print("{0}".format(inst_name))

if not (__name__ == "__main__"):
    print("Interactive mode")
    print(
        "Use command RunMeasurement.SampleOnce(RunMeasurement.Scope,\"CH1,CH2,CH3\")"
    )
    try:
        # Interactive mode
        scope_name = input(
            "Enter your scope_name, also provide \"default\" and \"auto\" for quick setup\n"
        )
        if (scope_name == "default"):
            Scope = Oscilloscope()
        elif (scope_name == "auto"):
            Scope = Oscilloscope(inst_name[0])
        else:
            Scope = Oscilloscope(scope_name)
    except pyvisa.VisaIOError:
        print(
            "Fail to create a Osilloscope object.\n1, Check connection between oscilloscope and computer\n2, Check the name of Scope and the inst_name"
        )

# Batch mode
if __name__ == "__main__":
    parser = argparse.ArgumentParser(
        description=
        "Save multiple waveform into csv files. You can even make measure. Author: Zifeng XU, email: [email protected]"
    )
Esempio n. 4
0
    Q1=0.4,
    H=0.02,
    NTX=1.0,
    kTX=0.90,
    J=9.5214,
    Ds=0.5,
    K=0.02,
    # Parasitic resistances:
    r1=0.01,
    r2=0.01,
    rS=0.001,
    rD=0.001,
    rC=0.001)

# Initial state (zero 7x1 matrix)
initial_state = np.zeros(7)

# Time to start record and end
# (θ_StartRecord, θ_End)
θInterval = (100. * π, 104. * π)

# Run simulation, let's rock!
# The waveform will be saved in data frame "Record"
Record = My_Circuit.run(θInterval, initial_state)

# Now, see the waveform by the method "Oscilloscope"
Graph = Oscilloscope(Record, ['iC', 'vS', 'i1', 'i2', 'vD', 'vO'])

# You can also output "Record" to csv file
Record.to_csv('Record.csv', encoding='utf_8_sig')
from Oscilloscope import Oscilloscope
osc = Oscilloscope('')
osc.setParam('C1','VDIV',.06)
osc.VBScommand('app.Measure.P1.ParamEngine="Mean"')
osc.VBSquery('app.Measure.P1.Out.Result.Value')
Esempio n. 6
0
def main():
    osc = Oscilloscope(1)
    osc.write('COMM_HEADER OFF')
    osc.queryParam('WFSU')
    print osc.readBuffer(100)
    nPoints = 5000
    osc.setupWaveForm(n=nPoints, sparsing=100, firstpoint=5, segment=0)
    #osc.write('C1:INSPECT? "FIRST_VALID_PNT"')
    #print osc.dso.ReadString(1e6)
    #osc.write('C1:INSPECT? "LAST_VALID_PNT"')
    #print osc.dso.ReadString(1e6)
    osc.write('C1:INSPECT? "SIMPLE", BYTE')
    s = osc.dso.ReadString(1e9)
    l = s.split()
    ml = [i for i in l if is_number(i)]
    y = [float(i) for i in ml]
    x = range(0, len(y))
    plt.plot(x, y, 'bo')
    plt.show()