Commit d3c0e4cb authored by Matheus Müller's avatar Matheus Müller

Delta de dirac na origem, controle de curvas no plot, perfil da amostra...

Delta de dirac na origem, controle de curvas no plot, perfil da amostra mostrado mas nao editavel ainda na janela principal
parent 89945571
......@@ -8,6 +8,9 @@ import os
import tkFileDialog
import shutil
import sys
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
from matplotlib.figure import Figure
from matplotlib import pyplot
##############################################################################
# Control variables and lists
......@@ -26,7 +29,7 @@ def elem_callback(x, edict , ebutton):
##############################################################################
# Element selection
def elem_select(i, button):
def elem_select(i, button, grafico, f, a, t):
global Econtrol, Edict, Labentrys
button[Econtrol]['relief']='raised'
......@@ -40,8 +43,8 @@ def elem_select(i, button):
Labentrys[4].configure(text = 'Line Shape α - %f' %Edict[i]['LineShape'])
Labentrys[5].configure(text = 'Max Depht - %f' %Edict[i]['profundidademax'])
for i in arange(6,12):
Labentrys[i].delete (0, "end")
for j in arange(6,12):
Labentrys[j].delete (0, "end")
Labentrys[6].insert(0, Edict[int(Econtrol)]['name'])
Labentrys[7].insert(0, Edict[int(Econtrol)]['mass'])
......@@ -50,17 +53,28 @@ def elem_select(i, button):
Labentrys[10].insert(0, Edict[int(Econtrol)]['LineShape'])
Labentrys[11].insert(0, Edict[int(Econtrol)]['profundidademax'])
Edict[i]['dist'] = np.loadtxt(Edict[i]['symbol']+".prof")
grafico.set_xdata(range(len(Edict[i]['dist'])))
grafico.set_ydata(Edict[i]['dist'])
t.set_text('%s' %Edict[i]['symbol'])
a.relim()
a.autoscale_view()
f.canvas.draw()
##############################################################################
# Init
def ewin_build(window, OFlabentries, mainwindow, calcbutton, distvar, modevar, Labelframe):
def ewin_build(window, OFlabentries, mainwindow, calcbutton, distvar, modevar, Labelframe, grafico, f, a):
t = f.suptitle('Hf')
##############################################################################
# Element addition
def create():
global i, Edict, Ebuttons
Edict[i]=dict(name="New Element",symbol="Hf",mass=178.,Z=72,dist=zeros(int(10./float(OFlabentries[17].get()))),LineShape=200.,profundidademax=10.)
Ebuttons.insert(i, tk.Button(Eframe, text=i, width=1, height=1, command = lambda i=i : elem_select(i,Ebuttons)) )
Ebuttons[i].grid(column = ((len(Ebuttons)-1)%13), row = int(math.floor((len(Ebuttons)-1)/13)))
Edict[i]=dict(name="New Element",symbol="Hf",mass=178.,Z=72,dist=zeros(int(10./float(OFlabentries[17].get()))),LineShape=200.,profundidademax=2.)
Ebuttons.insert(i, tk.Button(Eframe, text=i, width=1, height=1, command = lambda i=i : elem_select(i,Ebuttons,grafico,f,a,t)) )
Ebuttons[i].grid(row = ((len(Ebuttons)-1)%6), column = int(math.floor((len(Ebuttons)-1)/6)))
i = i+1
##############################################################################
......@@ -80,15 +94,21 @@ def ewin_build(window, OFlabentries, mainwindow, calcbutton, distvar, modevar, L
if Econtrol == i:
Econtrol = Econtrol -1
Ebuttons[Econtrol]['relief']='sunken'
elem_select(0, Ebuttons)
elem_select(0, Ebuttons, grafico, f)
##############################################################################
# Hotkeys
#cidclick = f.canvas.mpl_connect('button_press_event', key_4)
#cidmotion = f.canvas.mpl_connect('motion_notify_event', key_5)
#cidrelease = f.canvas.mpl_connect('button_release_event', key_6)
##############################################################################
# Element Frames
Labelprop = tk.LabelFrame(window, text = 'Properties', relief='raised', bd=2)
Labelprop.pack(side = 'top')
Labelprop.pack(side = 'left')
Label1 = tk.LabelFrame(window, text = 'Elements', relief='raised', bd=2)
Label1.pack(side = 'top')
Label1.pack(side = 'left')
# For Button Creation
Eframe = tk.Canvas(Label1)
Eframe.pack(fill='both',expand=0)
......@@ -115,6 +135,7 @@ def ewin_build(window, OFlabentries, mainwindow, calcbutton, distvar, modevar, L
Edict[i]['profundidademax'] = float(Labentrys[11].get())
Labentrys[5].configure(text = 'Max Depht - %f' %Edict[i]['profundidademax'])
Edict[i]['dist'] = np.loadtxt(Edict[i]['symbol']+".prof")
elem_select(i,Ebuttons,grafico,f,a,t)
for i in range(3):
Frames.insert(i, tk.Frame(Labelprop) )
......@@ -202,7 +223,7 @@ def ewin_build(window, OFlabentries, mainwindow, calcbutton, distvar, modevar, L
Ebuttons[n]['text'] = str(els[n])
shutil.copy(arquivo.name + '-' + Edict[n]['symbol'] + '.dat' , Edict[n]['symbol']+'.dat')
shutil.copy(arquivo.name + '-' + Edict[n]['symbol'] + '.prof' , Edict[n]['symbol']+'.prof')
elem_select(0,Ebuttons)
elem_select(0,Ebuttons,grafico, f)
arquivo.close()
def SAVESAMPLE():
......@@ -334,7 +355,7 @@ def ewin_build(window, OFlabentries, mainwindow, calcbutton, distvar, modevar, L
def changemode2():
RDra.invoke()
elem_select(0,Ebuttons)
elem_select(0,Ebuttons,grafico, f, a, t)
but['state'] = 'disabled'
butrmv['state'] = 'disabled'
RLay['state'] = 'disabled'
......@@ -343,9 +364,9 @@ def ewin_build(window, OFlabentries, mainwindow, calcbutton, distvar, modevar, L
Ebuttons[n]['state'] = 'disabled'
modevar.set(1) # Foi preciso forcar isso pois o radiobutton nao o fazia
Rions = tk.Radiobutton(Labelframe, text="Ion Scattering", variable=modevar, value=0, width=18, command=lambda i=i :changemode())
Rions = tk.Radiobutton(Labelframe, text="Ion Scattering", variable=modevar, value=0, width=20, command=lambda i=i :changemode())
Rions.pack()
Rrrna = tk.Radiobutton(Labelframe, text="Resonant RNA", variable=modevar, value=1, width=18, command=lambda i=i :changemode2())
Rrrna = tk.Radiobutton(Labelframe, text="Resonant RNA", variable=modevar, value=1, width=20, command=lambda i=i :changemode2())
Rrrna.pack()
##############################################################################
......
No preview for this file type
0 0
5.01736972705 0.303571428571
6.0 0
1.73399503722 0.9975
2.0 0
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.303571428571
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975
0.9975