コード例 #1
0
ファイル: abox.py プロジェクト: ArunJayan/expeyes-programs
def do_fit():
    global fitted, data
    if data == None : 
        msg.config(text='No Data Present')
        return
    fitted = phmath.fit_sine(data)
    par = fitted[1]
    other = Toplevel()
    other.title('Curve Fitting Window')
    fitwin = disp(other, WIDTH, HEIGHT,'white')
    fitwin.setWorld(0,-5000,data[-1][0],5000)
    f = Frame(other)
    f.pack()
    ss = 'A = %4.1f mV | F = %4.1f Hz |  ph = %4.1f rad | Offset = %4.1f mV'\
        %(par[0], par[1]*1.0e6, par[2], par[3])
    l1 = Label(f,text=ss)
    l1.pack(side=LEFT)
    b1 = Button(f,text = 'Save',command = save_fit)
    b1.pack(side=LEFT)
    
    x = []
    y1 = []
    y2 = []
    for k in fitted[0]:
      y1.append((k[0],k[1]))
      y2.append((k[0],k[2]))
    fitwin.line(y1,'black')
    fitwin.line(y2,'red')
コード例 #2
0
def do_fit():
    global fitted, data
    if data == None:
        msg.config(text='No Data Present')
        return
    fitted = phmath.fit_sine(data)
    par = fitted[1]
    other = Toplevel()
    other.title('Curve Fitting Window')
    fitwin = disp(other, WIDTH, HEIGHT, 'white')
    fitwin.setWorld(0, -5000, data[-1][0], 5000)
    f = Frame(other)
    f.pack()
    ss = 'A = %4.1f mV | F = %4.1f Hz |  ph = %4.1f rad | Offset = %4.1f mV'\
        %(par[0], par[1]*1.0e6, par[2], par[3])
    l1 = Label(f, text=ss)
    l1.pack(side=LEFT)
    b1 = Button(f, text='Save', command=save_fit)
    b1.pack(side=LEFT)

    x = []
    y1 = []
    y2 = []
    for k in fitted[0]:
        y1.append((k[0], k[1]))
        y2.append((k[0], k[2]))
    fitwin.line(y1, 'black')
    fitwin.line(y2, 'red')
コード例 #3
0
ファイル: readblock_fit.py プロジェクト: minrk/phoenix
import phm, time, phmath

p = phm.phm()

of = open('vf.dat','w')
for k in range(0,256,5):
    p.set_dac(k)
    time.sleep(0.1)
    data = p.read_block(400,100,0)
    res = phmath.fit_sine(data)
    frfit = res[1][1]*1.0e6
    if frfit < 90:
        print frfit
        continue
#        p.plot(res[0]);raw_input()
    ss = '%5.0f %4.1f'%(k*5000.0/255, frfit)
    print ss
    of.write(ss+'\n')
    of.flush()