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

Remocao de pontos no perfil funcional, interface modificada e melhorias no codigo

parent d1738f9b
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
1.24565756824 0.206632653061 1.24565756824 0.206632653061
5.0 0 5.0 0
...@@ -2,16 +2,19 @@ ...@@ -2,16 +2,19 @@
import Tkinter as tk import Tkinter as tk
from PTE import * from PTE import *
from pylab import * from pylab import *
from layers import *
from numpy import zeros from numpy import zeros
import os import os
import tkFileDialog import tkFileDialog
import shutil import shutil
import sys
############################################################################## ##############################################################################
# Control variables and lists # Control variables and lists
Edict = dict() Edict = dict()
Ebuttons = list() Ebuttons = list()
Labentrys = list() Labentrys = list()
Frames = list()
i=0 i=0
Econtrol = 0 Econtrol = 0
...@@ -49,15 +52,15 @@ def elem_select(i, button): ...@@ -49,15 +52,15 @@ def elem_select(i, button):
############################################################################## ##############################################################################
# Init # Init
def ewin_build(window, OFlabentries): def ewin_build(window, OFlabentries, mainwindow, calcbutton, distvar):
############################################################################## ##############################################################################
# Element addition # Element addition
def create(): def create():
global i, Edict, Ebuttons global i, Edict, Ebuttons
Edict[i] = dict(name = "New", symbol = "Hf", mass = 178.00, Z = 72, dist = zeros(int(10./float(OFlabentries[17].get()) )), LineShape = 200., profundidademax=10.) Edict[i]=dict(name="New",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.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)%14), row = int(math.floor((len(Ebuttons)-1)/14))) Ebuttons[i].grid(column = ((len(Ebuttons)-1)%13), row = int(math.floor((len(Ebuttons)-1)/13)))
i = i+1 i = i+1
############################################################################## ##############################################################################
...@@ -79,10 +82,9 @@ def ewin_build(window, OFlabentries): ...@@ -79,10 +82,9 @@ def ewin_build(window, OFlabentries):
Labelprop = tk.LabelFrame(window, text = 'Properties', relief='raised', bd=2) Labelprop = tk.LabelFrame(window, text = 'Properties', relief='raised', bd=2)
Labelprop.pack(side = 'top') Labelprop.pack(side = 'top')
Label1 = tk.LabelFrame(window, text = 'Elements', relief='raised', bd=2) Label1 = tk.LabelFrame(window, text = 'Elements', relief='raised', bd=2)
Label1.pack(side = 'top') Label1.pack(side = 'top')
# For Button Creation
Eframe = tk.Canvas(Label1) Eframe = tk.Canvas(Label1)
Eframe.pack(fill='both',expand=0) Eframe.pack(fill='both',expand=0)
...@@ -109,22 +111,28 @@ def ewin_build(window, OFlabentries): ...@@ -109,22 +111,28 @@ def ewin_build(window, OFlabentries):
Labentrys[5].configure(text = 'Max Depht - %f' %Edict[i]['profundidademax']) Labentrys[5].configure(text = 'Max Depht - %f' %Edict[i]['profundidademax'])
Edict[i]['dist'] = np.loadtxt(Edict[i]['symbol']+".prof") Edict[i]['dist'] = np.loadtxt(Edict[i]['symbol']+".prof")
LpFrame1 = tk.Frame(Labelprop) for i in range(3):
LpFrame1.pack(side='left') Frames.insert(i, tk.Frame(Labelprop) )
LpFrame2 = tk.Frame(Labelprop)
LpFrame2.pack(side='top') Frames[0].pack(side='left')
LpFrame3 = tk.Frame(Labelprop) Frames[1].pack(side='top')
LpFrame3.pack(side='right') Frames[2].pack(side='right')
for i in arange(3, 5):
Frames.insert(i, tk.Frame(Frames[0]) )
EPframel = tk.Frame(LpFrame1) Frames[3].pack(side='left')
EPframel.pack(side='left') Frames[4].pack(side='right')
EPframee = tk.Frame(LpFrame1)
EPframee.pack(side='right')
EPframel2 = tk.Frame(LpFrame2) for i in arange(5, 7):
EPframel2.pack(side='left') Frames.insert(i, tk.Frame(Frames[1]) )
EPframee2 = tk.Frame(LpFrame2)
EPframee2.pack(side='right') Frames[5].pack(side='left')
Frames[6].pack(side='right')
Labeldist = tk.LabelFrame(Frames[5], text = 'Distribution', relief='raised', bd=2)
Labeldist.pack(side = 'bottom')
Frames.insert(7, tk.Frame(Labeldist) )
Frames[7].pack(side='top')
# Label // Entries numbers: # Label // Entries numbers:
# 0 // 6 = Name # 0 // 6 = Name
...@@ -133,24 +141,25 @@ def ewin_build(window, OFlabentries): ...@@ -133,24 +141,25 @@ def ewin_build(window, OFlabentries):
# 3 // 9 = Symbol # 3 // 9 = Symbol
# 4 // 10 = Line shape # 4 // 10 = Line shape
# 5 // 11 = Max Depht # 5 // 11 = Max Depht
Labentrys.insert(0, tk.Label(EPframel, width=26, pady=2, text='%s' %Edict[int(Econtrol)]['name']) ) Labentrys.insert(0, tk.Label(Frames[3], width=23, pady=2, text='%s' %Edict[int(Econtrol)]['name']) )
Labentrys.insert(1, tk.Label(EPframel, width=26, pady=2, text='Mass - %f' %Edict[int(Econtrol)]['mass']) ) Labentrys.insert(1, tk.Label(Frames[3], width=23, pady=2, text='Mass - %f' %Edict[int(Econtrol)]['mass']) )
Labentrys.insert(2, tk.Label(EPframel, width=26, pady=2, text='Z - %f' %Edict[int(Econtrol)]['Z']) ) Labentrys.insert(2, tk.Label(Frames[3], width=23, pady=2, text='Z - %f' %Edict[int(Econtrol)]['Z']) )
Labentrys.insert(3, tk.Label(EPframel, width=26, pady=2, text= 'Symbol - %s' %Edict[int(Econtrol)]['symbol']) ) Labentrys.insert(3, tk.Label(Frames[3], width=23, pady=2, text= 'Symbol - %s' %Edict[int(Econtrol)]['symbol']) )
Labentrys.insert(4, tk.Label(EPframel, width=26, pady=2, text='Line Shape α - %f' %Edict[int(Econtrol)]['LineShape']) ) Labentrys.insert(4, tk.Label(Frames[3], width=23, pady=2, text='Line Shape α - %f' %Edict[int(Econtrol)]['LineShape']) )
Labentrys.insert(5, tk.Label(EPframel, width=26, pady=2, text='Max Depht - %f' %Edict[int(Econtrol)]['profundidademax']) ) Labentrys.insert(5, tk.Label(Frames[3], width=23, pady=2, text='Max Depht - %f' %Edict[int(Econtrol)]['profundidademax']) )
for i in range(6): for i in range(6):
Labentrys[i].pack() Labentrys[i].pack()
for i in arange(6, 12): for i in arange(6, 12):
Labentrys.insert(i, tk.Entry(EPframee, width=18) ) Labentrys.insert(i, tk.Entry(Frames[4], width=17) )
Labentrys[i].pack() Labentrys[i].pack()
# Declaration of interpolation method variable # Declaration of interpolation and distribution method variables
methodvar = tk.StringVar() methodvar = tk.StringVar()
methodvar.set('reta') methodvar.set('reta')
############################################################################## ##############################################################################
# Load/Save sample # Load/Save sample
def LOADSAMPLE(): def LOADSAMPLE():
...@@ -211,36 +220,80 @@ def ewin_build(window, OFlabentries): ...@@ -211,36 +220,80 @@ def ewin_build(window, OFlabentries):
elist.close() elist.close()
config.close() config.close()
##############################################################################
# Menu
def donothing():
return 0
menubar = tk.Menu(mainwindow, bg='grey', relief='flat', bd=0)
filemenu = tk.Menu(menubar, tearoff=0)
filemenu.add_command(label="Simulate", command=lambda i=int(Econtrol) :calcbutton.invoke())
filemenu.add_separator()
filemenu.add_command(label="Exit", command=sys.exit)
menubar.add_cascade(label="File", menu=filemenu)
samplemenu = tk.Menu(menubar, tearoff=0)
samplemenu.add_command(label="Load Sample", command=lambda i=int(Econtrol) :LOADSAMPLE())
samplemenu.add_command(label="Save Sample", command=lambda i=int(Econtrol) :SAVESAMPLE())
menubar.add_cascade(label="Samples", menu=samplemenu)
helpmenu = tk.Menu(menubar, tearoff=0)
helpmenu.add_command(label="Help!", command=donothing)
helpmenu.add_command(label="About...", command=donothing)
menubar.add_cascade(label="Help", menu=helpmenu)
mainwindow.config(menu=menubar)
############################################################################## ##############################################################################
# Buttons # Buttons
but = tk.Button(EPframel2, command=create, text='Add element', bd=1, height=1,width=15) but = tk.Button(Frames[3], command=create, text='Add element', bd=1, height=1,width=15, pady='4')
but.pack() but.pack()
butrmv = tk.Button(EPframel2, command=remove, text='Remove element', bd=1, height=1,width=15) butrmv = tk.Button(Frames[4], command=remove, text='Remove element', bd=1, height=1,width=14, pady='4')
butrmv.pack() butrmv.pack()
butPTE = tk.Button(EPframel2, text='Show PTE', bd=1, width=15, command=lambda i=i :elem_callback(Econtrol,Edict,Ebuttons) ) butPTE = tk.Button(Frames[5], text='Select from PTE', bd=1, width=15, command=lambda i=i :elem_callback(Econtrol,Edict,Ebuttons) )
butPTE.pack() butPTE.pack()
BUpdate = tk.Button(EPframel2, text ='Update properties', command=lambda i=int(Econtrol) :update(Econtrol), width=15) BUpdate = tk.Button(Frames[5], text ='Update properties', command=lambda i=int(Econtrol) :update(Econtrol), width=15)
BUpdate.pack() BUpdate.pack()
BUpdateD = tk.Button(EPframel2, text ='Distribution', command =lambda i=int(Econtrol) : os.system("python profiler.py %s %s %s %s &" %( Edict[int(Econtrol)]['symbol'], str(methodvar.get()), str(Labentrys[11].get()), str(OFlabentries[17].get()) ) ), width=15)
BUpdateD.pack()
BLoad = tk.Button(EPframel, text ='Load Sample', command=lambda i=int(Econtrol) :LOADSAMPLE(), width=15)
BLoad.pack()
BSave = tk.Button(EPframee, text ='Save Sample', command=lambda i=int(Econtrol) :SAVESAMPLE(), width=15)
BSave.pack()
############################################################################## ##############################################################################
# Interpolation methods # Distribution
RS = tk.Radiobutton(Labelprop, text="Step", variable=methodvar, value='step') def changestate():
if str(distvar.get()) == 'layer':
BLayer['state']='normal'
BUpdateD['state']='disabled'
RS['state']='disabled'
RL['state']='disabled'
elif str(distvar.get()) == 'drawing':
BLayer['state']='disabled'
BUpdateD['state']='normal'
RS['state']='normal'
RL['state']='normal'
def call_layers():
layers()
# By Layers
BLayer = tk.Button(Labeldist, text ='Open Layers', command = lambda i = int(Econtrol) : call_layers(), width=15)
BLayer.pack()
# By Drawing
BUpdateD = tk.Button(Labeldist, text = 'Element Distribution', command = lambda i = int(Econtrol) : os.system("python profiler.py %s %s %s %s &" %( Edict[int(Econtrol)]['symbol'], str(methodvar.get()), str(Labentrys[11].get()), str(OFlabentries[17].get()) ) ), width=15)
BUpdateD.pack()
# Interpolation methods
RS = tk.Radiobutton(Labeldist, text="Step", variable=methodvar, value='step')
RS.pack(side='left') RS.pack(side='left')
RL = tk.Radiobutton(Labelprop, text="Lines", variable=methodvar, value='reta') RL = tk.Radiobutton(Labeldist, text="Lines", variable=methodvar, value='reta')
RL.pack(side='right') RL.pack(side='right')
# Distribution methods
RLay = tk.Radiobutton(Frames[7], text="Layers", command=lambda i=int(Econtrol) :changestate(), variable=distvar, value='layer')
RLay.pack(side='left')
RDra = tk.Radiobutton(Frames[7], text="Drawing", command=lambda i=int(Econtrol) :changestate(), variable=distvar, value='drawing')
RDra.pack(side='right')
############################################################################## ##############################################################################
# Init # Init
RDra.invoke()
RS.select() RS.select()
Ebuttons[0].invoke() Ebuttons[0].invoke()
......
No preview for this file type
0 0
1.22580645161 0.308673469388
1.38461538462 0.188775510204
2.03970223325 0.234693877551
2.55583126551 0.135204081633
4.20347394541 0.614540816327
6.04962779156 0.454081632653
7.06203473946 0.326530612245
8.23325062035 0.262755102041
9.20595533499 0.108214285714
10.0 0
This diff is collapsed.
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
1.02543424317 0.165816326529
1.19851116625 0.163265306122 1.19851116625 0.163265306122
1.80397022333 0.00255102040817
2.27047146402 0.00255102040816 2.27047146402 0.00255102040816
5.0 0 5.0 0
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.165816326529 0.163265306122
0.163265306122 0.163265306122
0.163265306122 0.163265306122
0.163265306122 0.163265306122
0.163265306122 0.163265306122
0.163265306122 0.163265306122
0.163265306122 0.163265306122
0.163265306122 0.163265306122
0.163265306122 0.163265306122
0.163265306122 0.163265306122
0.163265306122 0.163265306122
0.163265306122 0.163265306122
0.163265306122 0.163265306122
0.163265306122 0.163265306122
0.163265306122 0.163265306122
0.163265306122 0.163265306122
0.163265306122 0.163265306122
0.163265306122 0.163265306122
0.00255102040817 0.00255102040816
0.00255102040817 0.00255102040816
0.00255102040817 0.00255102040816
0.00255102040817 0.00255102040816
0.00255102040817 0.00255102040816
0.00255102040817 0.00255102040816
0.00255102040817 0.00255102040816
0.00255102040817 0.00255102040816
0.00255102040817 0.00255102040816
0.00255102040817 0.00255102040816
0.00255102040817 0.00255102040816
0.00255102040817 0.00255102040816
0.00255102040817 0.00255102040816
0.00255102040817 0.00255102040816
0.00255102040817 0.00255102040816
0.00255102040817 0.00255102040816
0.00255102040817 0.00255102040816
0.00255102040817 0.00255102040816
0.00255102040817 0.00255102040816
0.00255102040817 0.00255102040816
0.00255102040817 0.00255102040816
0.00255102040817 0.00255102040816
0.00255102040817 0.00255102040816
0.00255102040817 0.00255102040816
0.00255102040817 0.00255102040816
0.00255102040817 0.00255102040816
0.00255102040817 0.00255102040816
0.00255102040817 0.00255102040816
0.00255102040817 0.00255102040816
0.00255102040817 0.00255102040816
0.00255102040817 0.00255102040816
0.00255102040817 0.00255102040816
0.00255102040817 0.00255102040816
0.00255102040817 0.00255102040816
0.00255102040817 0.00255102040816
0.00255102040817 0.00255102040816
0.00255102040817 0.00255102040816
0.00255102040817 0.00255102040816
0.00255102040817 0.00255102040816
0.00255102040817 0.00255102040816
0.00255102040817 0.00255102040816
0.00255102040817 0.00255102040816
0.00255102040817 0.00255102040816
0.00255102040817 0.00255102040816
0.00255102040817 0.00255102040816
0.00255102040817 0.00255102040816
0.00255102040817 0.00255102040816
0.00255102040817 0.00255102040816
0.00255102040817 0.00255102040816
0.00255102040817 0.00255102040816
0.00255102040817 0.00255102040816
0.00255102040817 0.00255102040816
0.00255102040817 0.00255102040816
0.00255102040817 0.00255102040816
0.00255102040817 0.00255102040816
0.00255102040817 0.00255102040816
0.00255102040817 0.00255102040816
0.00255102040817 0.00255102040816
0.00255102040817 0.00255102040816
0.00255102040817 0.00255102040816
0.00255102040817 0.00255102040816
0.00255102040816 0.00255102040816
0.00255102040816 0.00255102040816
0.00255102040816 0.00255102040816
......
...@@ -3,14 +3,12 @@ ...@@ -3,14 +3,12 @@
import Tkinter as tk import Tkinter as tk
from Ewindow import * from Ewindow import *
from numerical import * from numerical import *
import sys
############################################################################## ##############################################################################
# Arbitrary parameters to declare dictionaries # Arbitrary parameters to declare dictionaries
param = dict(dedx=192. ,Theta_out=70., dW2dx=20740., E0= 100000., Theta_in=0., FWHM0=180.) param = dict(dedx=192. ,Theta_out=70., dW2dx=20740., E0= 100000., Theta_in=0., FWHM0=180.)
ionb = dict(Z=1, mass=1.0079) ionb = dict(Z=1, mass=1.0079)
OFlabentries = list() OFlabentries = list()
init=0
############################################################################## ##############################################################################
# Calculation callback # Calculation callback
...@@ -30,15 +28,18 @@ def init_calc(): ...@@ -30,15 +28,18 @@ def init_calc():
for i in range(len(Edict)): for i in range(len(Edict)):
Edict[i]['dist'] = np.loadtxt(Edict[i]['symbol']+".prof") Edict[i]['dist'] = np.loadtxt(Edict[i]['symbol']+".prof")
if str(distvar.get()) == 'drawing':
spectro(param, str(modelvar.get()), ionb, OFlabentries, int(LSvar.get()), int(CGvar.get())) spectro(param, str(modelvar.get()), ionb, OFlabentries, int(LSvar.get()), int(CGvar.get()))
elif str(distvar.get()) == 'layer':
spectrolayer(param, str(modelvar.get()), ionb, OFlabentries, int(LSvar.get()), int(CGvar.get()))
############################################################################## ##############################################################################
# Main window # Main window
root = tk.Tk() root = tk.Tk()
root.minsize(700,500) root.minsize(670,470)
root.title('Open Flatus') root.title('Open Flatus')
root.geometry('700x500+200+400') root.geometry('670x470+200+400')