On the math trail
This commit is contained in:
parent
5aa8304a2d
commit
dc97dedbfd
44
JFSphoto.py
44
JFSphoto.py
@ -297,6 +297,7 @@ class Jfsphoto (object):
|
||||
|
||||
# root.mainloop()
|
||||
def do_math(self):
|
||||
stati = [("Raw",1),("Raw + Baseline",2),("Transmission",3),("Absorption",4)]
|
||||
|
||||
win = tk.Toplevel()
|
||||
#win.geometry("450x200+100+100")
|
||||
@ -307,7 +308,7 @@ class Jfsphoto (object):
|
||||
self.center.grid_columnconfigure(1, weight=1)
|
||||
self.center.grid(row=1, sticky="nsew")
|
||||
self.ctr_mid = tk.Frame(self.center, bg='yellow', width=250, height=190, padx=3, pady=3)
|
||||
self.ctr_right = tk.Frame(self.center, bg='green', width=100, height=190, padx=3, pady=3)
|
||||
self.ctr_right = tk.Frame(self.center, bg='green', width=200, height=190, padx=3, pady=3)
|
||||
self.ctr_mid.grid(row=0, column=0, sticky="nsew")
|
||||
self.ctr_right.grid(row=0, column=1, sticky="ns")
|
||||
self.fig = plt.Figure(figsize=(8,4),dpi=100)
|
||||
@ -317,8 +318,13 @@ class Jfsphoto (object):
|
||||
self.ax1.plot(t, s, linewidth=0.6)
|
||||
self.canvas = FigureCanvasTkAgg(self.fig, master = self.ctr_mid)
|
||||
self.canvas._tkcanvas.pack(side = tk.TOP, fill = tk.BOTH, expand = 1)
|
||||
self.chb = tk.Checkbutton(master=self.ctr_right,text='Hi there',variable=self.ok,command=self.look)
|
||||
self.chb.grid(row=0,column=0)
|
||||
#self.chb = tk.Checkbutton(master=self.ctr_right,text='Raw',variable=self.ok,command=self.look)
|
||||
#self.chb.grid(row=0,column=0)
|
||||
n = 0
|
||||
for txt,val in stati:
|
||||
tk.Radiobutton(master=self.ctr_right,text=txt,variable=self.ok,command=self.look,value=val,padx=5,pady=5).grid(row=n,column=0,sticky="w")
|
||||
n=n+1
|
||||
|
||||
|
||||
win.focus_set()
|
||||
win.grab_set()
|
||||
@ -329,6 +335,38 @@ class Jfsphoto (object):
|
||||
self.ax1.clear()
|
||||
if self.ok.get()==1:
|
||||
self.df.plot(x = 'nmscale',y = 'p1', color='red',linewidth=0.6,ax=self.ax1)
|
||||
elif self.ok.get()==2:
|
||||
self.df.plot(x = 'nmscale',y = 'p1', color='red',linewidth=0.6,ax=self.ax1)
|
||||
self.df.plot(x = 'nmscale',y = 'baseline', color='blue',linewidth=0.6,ax=self.ax1)
|
||||
elif self.ok.get()==3:
|
||||
right = 0
|
||||
left = 0
|
||||
y = self.df['p1']
|
||||
b = self.df['baseline']
|
||||
c = np.zeros(3694, np.float32)
|
||||
for i in range(0,3694):
|
||||
if b[i]==0:
|
||||
c[i] = 1
|
||||
if (left > 0 and right==0):
|
||||
right=i
|
||||
else:
|
||||
if (left==0):
|
||||
left=i
|
||||
c[i] = y[i]/b[i]
|
||||
print("left ",left," right ",right)
|
||||
self.df['p2']=c
|
||||
|
||||
#for i in range(0,3694):
|
||||
# self.df
|
||||
# if (self.df(pltBaseData16[i] == 0):
|
||||
# config.pltData16[i] = 1
|
||||
# else:
|
||||
# config.pltData16[i] = (config.pltData16[i] / config.pltBaseData16[i])
|
||||
# if (self.jf.abs_trans.get()==1):
|
||||
# config.pltData16 = np.log10(config.pltData16)*-1
|
||||
|
||||
self.df.plot(x = 'nmscale',y = 'p2', color='red',linewidth=0.6,ax=self.ax1)
|
||||
self.ax1.set_xlim([self.nm_left+left*self.nm_step, self.nm_left+right*self.nm_step])
|
||||
else:
|
||||
t = arange(0.0, 3.0, 0.01)
|
||||
s = sin(2*pi*t)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user