Commit 1f9dab0f authored by Matheus Müller's avatar Matheus Müller

Versao para commitdiff debug

parent 369633e2
...@@ -159,7 +159,7 @@ def ewin_build(window, OFlabentries, mainwindow, calcbutton, distvar, modevar, L ...@@ -159,7 +159,7 @@ def ewin_build(window, OFlabentries, mainwindow, calcbutton, distvar, modevar, L
# Declaration of interpolation and distribution method variables # Declaration of interpolation and distribution method variables
methodvar = tk.StringVar() methodvar = tk.StringVar()
methodvar.set('reta') methodvar.set('step')
############################################################################## ##############################################################################
...@@ -261,37 +261,36 @@ def ewin_build(window, OFlabentries, mainwindow, calcbutton, distvar, modevar, L ...@@ -261,37 +261,36 @@ def ewin_build(window, OFlabentries, mainwindow, calcbutton, distvar, modevar, L
# Distribution # Distribution
def changestate(): def changestate():
if str(distvar.get()) == 'layer': BLayer['state']='normal'
BLayer['state']='normal' BUpdateD['state']='disabled'
BUpdateD['state']='disabled' RS['state']='disabled'
RS['state']='disabled' RL['state']='disabled'
RL['state']='disabled' OFlabentries[9]['state']='disabled'
OFlabentries[9]['state']='disabled' OFlabentries[10]['state']='disabled'
OFlabentries[10]['state']='disabled' for i in arange(6, 12):
for i in arange(6, 12): Labentrys[i]['state']='disabled'
Labentrys[i]['state']='disabled' but['state']='disabled'
but['state']='disabled' butrmv['state']='disabled'
butrmv['state']='disabled' butPTE['state']='disabled'
butPTE['state']='disabled' BUpdate['state']='disabled'
BUpdate['state']='disabled' for n in arange(0, len(Ebuttons)):
for n in arange(0, len(Ebuttons)): Ebuttons[n]['state'] = 'disabled'
Ebuttons[n]['state'] = 'disabled'
def changestate2():
elif str(distvar.get()) == 'drawing': BLayer['state']='disabled'
BLayer['state']='disabled' BUpdateD['state']='normal'
BUpdateD['state']='normal' RS['state']='normal'
RS['state']='normal' RL['state']='normal'
RL['state']='normal' OFlabentries[9]['state']='normal'
OFlabentries[9]['state']='normal' OFlabentries[10]['state']='normal'
OFlabentries[10]['state']='normal' for i in arange(6, 12):
for i in arange(6, 12): Labentrys[i]['state']='normal'
Labentrys[i]['state']='normal' but['state']='normal'
but['state']='normal' butrmv['state']='normal'
butrmv['state']='normal' butPTE['state']='normal'
butPTE['state']='normal' BUpdate['state']='normal'
BUpdate['state']='normal' for n in arange(0, len(Ebuttons)):
for n in arange(0, len(Ebuttons)): Ebuttons[n]['state'] = 'normal'
Ebuttons[n]['state'] = 'normal'
def call_layers(): def call_layers():
layers() layers()
...@@ -308,43 +307,42 @@ def ewin_build(window, OFlabentries, mainwindow, calcbutton, distvar, modevar, L ...@@ -308,43 +307,42 @@ def ewin_build(window, OFlabentries, mainwindow, calcbutton, distvar, modevar, L
RL = tk.Radiobutton(Labeldist, 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 # Distribution methods
RLay = tk.Radiobutton(Frames[7], text="Layers", command=lambda i=int(Econtrol) :changestate(), variable=distvar, value='layer') RLay = tk.Radiobutton(Frames[7], text="Layers", command=lambda i=int(Econtrol) :changestate(), variable=distvar, value=0)
RLay.pack(side='left') RLay.pack(side='left')
RDra = tk.Radiobutton(Frames[7], text="Drawing", command=lambda i=int(Econtrol) :changestate(), variable=distvar, value='drawing') RDra = tk.Radiobutton(Frames[7], text="Drawing", command=lambda i=int(Econtrol) :changestate2(), variable=distvar, value=1)
RDra.pack(side='right') RDra.pack(side='right')
############################################################################## ##############################################################################
# Experiment variations # Experiment variations
def changemode(): def changemode():
if str(modevar.get()) == 'IONS': for n in range(len(Ebuttons)):
for n in range(len(Ebuttons)): Ebuttons[n]['state']='normal'
Ebuttons[n]['state']='normal' but['state'] = 'normal'
but['state'] = 'normal' butrmv['state'] = 'normal'
butrmv['state'] = 'normal' butPTE['state'] = 'normal'
butPTE['state'] = 'normal' RLay['state'] = 'normal'
RLay['state'] = 'normal' Labentrys[12]['state'] = 'disabled'
Labentrys[12]['state'] = 'disabled'
def changemode2():
elif str(modevar.get()) == 'RRNA': RDra.invoke()
RDra.invoke() elem_select(0,Ebuttons)
elem_select(0,Ebuttons) but['state'] = 'disabled'
but['state'] = 'disabled' butrmv['state'] = 'disabled'
butrmv['state'] = 'disabled' RLay['state'] = 'disabled'
RLay['state'] = 'disabled' Labentrys[12]['state'] = 'normal'
Labentrys[12]['state'] = 'normal' for n in arange(1, len(Ebuttons)):
for n in arange(1, len(Ebuttons)): Ebuttons[n]['state'] = 'disabled'
Ebuttons[n]['state'] = 'disabled'
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", command=lambda i=i :changemode(), variable=modevar, value='IONS', width=18)
Rions.pack() Rions.pack()
Rrrna = tk.Radiobutton(Labelframe, text="Resonant RNA", command=lambda i=i :changemode(), variable=modevar, value='RRNA', width=18) Rrrna = tk.Radiobutton(Labelframe, text="Resonant RNA", variable=modevar, value=1, width=18, command=lambda i=i :changemode2())
Rrrna.pack() Rrrna.pack()
Rions.invoke()
############################################################################## ##############################################################################
# Init # Init
Rions.invoke()
RDra.invoke() RDra.invoke()
RS.select() RS.select()
Ebuttons[0].invoke() Ebuttons[0].invoke()
......
No preview for this file type
0 0 0 0
1.9523573201 0.00520408163265 9.37667493796 0.960612244896
2.84863523573 0.842704081633
7.2129032258 0.932270408162
10.0 0 10.0 0
This diff is collapsed.
...@@ -10,6 +10,8 @@ ax = fig.add_subplot(111) ...@@ -10,6 +10,8 @@ ax = fig.add_subplot(111)
fig.canvas.set_window_title("Signal") fig.canvas.set_window_title("Signal")
xx = arange(0,1, 0.1) xx = arange(0,1, 0.1)
temp, = plot(xx,xx*0) temp, = plot(xx,xx*0)
xlabel("Enegy (eV)")
ylabel("Yield")
doseold = 12e34 doseold = 12e34
############################################################################## ##############################################################################
...@@ -34,8 +36,9 @@ def loadexp(): ...@@ -34,8 +36,9 @@ def loadexp():
# Adjust graphic # Adjust graphic
def adjust(): def adjust():
temp.set_xdata(arange(OFlabentries[14].get(),OFlabentries[15].get(),OFlabentries[16].get())) fraction = float(OFlabentries[24].get())/doseold
temp.set_ydata(temp.ydata/doseold*float(OFlabentries[24].get())) newdata = temp.ydata*fraction
temp.set_ydata(newdata)
doseold = float(OFlabentries[24].get()) doseold = float(OFlabentries[24].get())
show() show()
...@@ -53,16 +56,16 @@ def init_calc(): ...@@ -53,16 +56,16 @@ def init_calc():
param['FWHM0'] = float(OFlabentries[13].get()) param['FWHM0'] = float(OFlabentries[13].get())
ionb['mass'] = float(OFlabentries[22].get()) ionb['mass'] = float(OFlabentries[22].get())
ionb['Z'] = float(OFlabentries[23].get()) ionb['Z'] = float(OFlabentries[23].get())
print distvar.get()
if str(modevar.get()) == 'IONS': if int(modevar.get()) == 0:
if str(distvar.get()) == 'drawing': if int(distvar.get()) == 1:
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")
spectro(param, str(modelvar.get()), ionb, OFlabentries, int(LSvar.get()), int(CGvar.get()), temp) spectro(param, str(modelvar.get()), ionb, OFlabentries, int(LSvar.get()), int(CGvar.get()), temp)
elif str(distvar.get()) == 'layer': elif int(distvar.get()) == 0:
spectrolayer(param, str(modelvar.get()), ionb, OFlabentries, int(LSvar.get()), int(CGvar.get()), temp) spectrolayer(param, str(modelvar.get()), ionb, OFlabentries, int(LSvar.get()), int(CGvar.get()), temp)
elif str(modevar.get()) == 'RRNA': elif int(modevar.get()) == 1:
spectroRNA(param, str(modelvar.get()), ionb, OFlabentries, int(LSvar.get()), int(CGvar.get()), temp) spectroRNA(param, str(modelvar.get()), ionb, OFlabentries, int(LSvar.get()), int(CGvar.get()), temp)
############################################################################## ##############################################################################
...@@ -128,20 +131,16 @@ OFlabentries.insert(1, tk.Label(Pframel, width=9, text='dω²/dx', pady=2)) ...@@ -128,20 +131,16 @@ OFlabentries.insert(1, tk.Label(Pframel, width=9, text='dω²/dx', pady=2))
OFlabentries.insert(2, tk.Label(Pframel, width=9, text='θ out', pady=2)) OFlabentries.insert(2, tk.Label(Pframel, width=9, text='θ out', pady=2))
OFlabentries.insert(3, tk.Label(Pframel, width=9, text='θ in', pady=2)) OFlabentries.insert(3, tk.Label(Pframel, width=9, text='θ in', pady=2))
OFlabentries.insert(4, tk.Label(Pframel, width=9, text='FWHM0', pady=2)) OFlabentries.insert(4, tk.Label(Pframel, width=9, text='FWHM0', pady=2))
OFlabentries.insert(5, tk.Label(Gframel, width=9, text='Emin', pady=2)) OFlabentries.insert(5, tk.Label(Pframel, width=9, text='Emin', pady=2))
OFlabentries.insert(6, tk.Label(Gframel, width=9, text='Emax', pady=2)) OFlabentries.insert(6, tk.Label(Pframel, width=9, text='Emax', pady=2))
OFlabentries.insert(7, tk.Label(Pframel, width=9, text='Estep', pady=2)) OFlabentries.insert(7, tk.Label(Pframel, width=9, text='Estep', pady=2))
OFlabentries.insert(8, tk.Label(Pframel, width=9, text='Depth step', pady=2)) OFlabentries.insert(8, tk.Label(Pframel, width=9, text='Depth step', pady=2))
OFlabentries.insert(24, tk.Entry(Gframee, width=11)) OFlabentries.insert(24, tk.Entry(Gframee, width=11))
OFlabentries.insert(25, tk.Label(Gframel, width=9, text='Dose', pady=2)) OFlabentries.insert(25, tk.Label(Gframel, width=9, text='Dose', pady=2))
# Entries # Entries
for n in arange(9,18): for n in arange(9,18):
if n == 14 or n == 15: OFlabentries.insert(n, tk.Entry(Pframee, width=11))
OFlabentries.insert(n, tk.Entry(Gframee, width=11))
else:
OFlabentries.insert(n, tk.Entry(Pframee, width=11))
#Ion #Ion
# Labels // Entries numbers: # Labels // Entries numbers:
...@@ -173,8 +172,7 @@ OFlabentries[17].insert(0,0.01) ...@@ -173,8 +172,7 @@ OFlabentries[17].insert(0,0.01)
OFlabentries[21].insert(0,param['E0']) OFlabentries[21].insert(0,param['E0'])
OFlabentries[22].insert(0, ionb['mass']) OFlabentries[22].insert(0, ionb['mass'])
OFlabentries[23].insert(0, ionb['Z']) OFlabentries[23].insert(0, ionb['Z'])
OFlabentries[24].insert(0, 12e34) OFlabentries[24].insert(0, "12e34")
doseold = float(OFlabentries[24].get())
############################################################################## ##############################################################################
# Grahical parameters buttons # Grahical parameters buttons
...@@ -187,8 +185,6 @@ Databut.pack() ...@@ -187,8 +185,6 @@ Databut.pack()
############################################################################## ##############################################################################
# Energy loss models # Energy loss models
modevar = tk.StringVar()
modevar.set('IONS')
modelvar = tk.StringVar() modelvar = tk.StringVar()
modelvar.set('bessel') modelvar.set('bessel')
R1 = tk.Radiobutton(Label4, text="Gaussian", variable=modelvar, value='gaussiana') R1 = tk.Radiobutton(Label4, text="Gaussian", variable=modelvar, value='gaussiana')
...@@ -220,8 +216,8 @@ CalcButton.pack() ...@@ -220,8 +216,8 @@ CalcButton.pack()
############################################################################## ##############################################################################
# Elements callback # Elements callback
distvar = tk.StringVar() modevar = tk.IntVar()
distvar.set('drawing') distvar = tk.IntVar()
ewin_build(Label1, OFlabentries, root, CalcButton, distvar, modevar, Label0) ewin_build(Label1, OFlabentries, root, CalcButton, distvar, modevar, Label0)
############################################################################## ##############################################################################
......
...@@ -76,6 +76,20 @@ def convoluiGaussdev(espectro, Sigma,passoE): ...@@ -76,6 +76,20 @@ def convoluiGaussdev(espectro, Sigma,passoE):
return temp*areaantes/temp.sum(), wg4_step*passoE return temp*areaantes/temp.sum(), wg4_step*passoE
####################################################################################################################################################
####################################################################################################################################################
# Funcoes em comum
def spect_file(x, y, shift, dose):
data2 = open('temp.sim', 'w')
for i in range(len(y)):
print>>data2, x[i]-shift,y[i]*dose
data2.close()
def set_lim(x, y, shift, dose):
ylim([0,max(y*dose)*1.1])
xlim([min(x-shift)*0.95,max(x-shift)*1.05])
#################################################################################################################################################### ####################################################################################################################################################
#################################################################################################################################################### ####################################################################################################################################################
...@@ -85,9 +99,9 @@ def spectro(p, modelo, ion, OFlabentries, LScontrol, CGausscontrol, tempor): ...@@ -85,9 +99,9 @@ def spectro(p, modelo, ion, OFlabentries, LScontrol, CGausscontrol, tempor):
passox = float(OFlabentries[17].get()) passox = float(OFlabentries[17].get())
e = arange(float(OFlabentries[14].get()), float(OFlabentries[15].get()), EPasso) e = arange(float(OFlabentries[14].get()), float(OFlabentries[15].get()), EPasso)
resol = float(OFlabentries[13].get()) resol = float(OFlabentries[13].get())
X = e*0.
dose = float(OFlabentries[24].get()) dose = float(OFlabentries[24].get())
gshift=0 gshift=0
X = e*0.
Theta_s = PI - (p['Theta_in'] + p['Theta_out'])*PI/180 Theta_s = PI - (p['Theta_in'] + p['Theta_out'])*PI/180
mi = ion['mass'] mi = ion['mass']
...@@ -151,27 +165,12 @@ def spectro(p, modelo, ion, OFlabentries, LScontrol, CGausscontrol, tempor): ...@@ -151,27 +165,12 @@ def spectro(p, modelo, ion, OFlabentries, LScontrol, CGausscontrol, tempor):
if CGausscontrol == 1: if CGausscontrol == 1:
X, gshift = convoluiGauss(X,resol/2.35482,EPasso) X, gshift = convoluiGauss(X,resol/2.35482,EPasso)
#plt.plot(e-gshift,X*dose, linecolor)
tempor.set_xdata(e-gshift) tempor.set_xdata(e-gshift)
tempor.set_ydata(X*dose) tempor.set_ydata(X*dose)
#tempor.set_color(linecolor)
#draw()
ylim([0,max(X*dose)*1.1])
xlim([0,max(e-gshift)*1.05])
#suptitle('Signal received', fontsize=12)
xlabel("Enegy (eV)")
ylabel("Yield")
data2 = open('temp.sim', 'w') set_lim(e, X, gshift, dose)
for i in range(len(X)): spect_file(e, X, gshift, dose)
print>>data2, e[i]-gshift,X[i]*dose
data2.close()
amostra = np.loadtxt('H2.py')
xxx= amostra[:,0]*1000
ccc=amostra[:,1]
plot (xxx, ccc, 'r.')
show() show()
#################################################################################################################################################### ####################################################################################################################################################
...@@ -183,8 +182,8 @@ def spectrolayer(p, modelo, ion, OFlabentries, LScontrol, CGausscontrol, tempor) ...@@ -183,8 +182,8 @@ def spectrolayer(p, modelo, ion, OFlabentries, LScontrol, CGausscontrol, tempor)
passox = float(OFlabentries[17].get()) passox = float(OFlabentries[17].get())
e = arange(float(OFlabentries[14].get()), float(OFlabentries[15].get()), EPasso) e = arange(float(OFlabentries[14].get()), float(OFlabentries[15].get()), EPasso)
resol = float(OFlabentries[13].get()) resol = float(OFlabentries[13].get())
X = e*0.
dose = float(OFlabentries[24].get()) dose = float(OFlabentries[24].get())
X = e*0.
gshift=0. gshift=0.
curdepht=passox #Avoid zero division curdepht=passox #Avoid zero division
...@@ -249,18 +248,14 @@ def spectrolayer(p, modelo, ion, OFlabentries, LScontrol, CGausscontrol, tempor) ...@@ -249,18 +248,14 @@ def spectrolayer(p, modelo, ion, OFlabentries, LScontrol, CGausscontrol, tempor)
curdepht = xfinal curdepht = xfinal
if CGausscontrol == 1: if CGausscontrol == 1:
X, gshift = convoluiGauss(X,resol/2.35482,EPasso) X, gshift = convoluiGauss(X,resol/2.35482,EPasso)
plt.plot(e-gshift,X*dose, linecolor)
ylim([0,max(X*dose)*1.1]) tempor.set_xdata(e-gshift)
suptitle('Signal received', fontsize=12) tempor.set_ydata(X*dose)
xlabel("Enegy (eV)")
ylabel("Yield")
data2 = open('temp.sim', 'w') set_lim(e, X, gshift, dose)
for i in range(len(X)): spect_file(e, X, gshift, dose)
print>>data2, e[i]-gshift,X[i]*dose
data2.close()
show() show()
#################################################################################################################################################### ####################################################################################################################################################
...@@ -272,8 +267,8 @@ def spectroRNA(p, modelo, ion, OFlabentries, LScontrol, CGausscontrol, tempor): ...@@ -272,8 +267,8 @@ def spectroRNA(p, modelo, ion, OFlabentries, LScontrol, CGausscontrol, tempor):
passox = float(OFlabentries[17].get()) passox = float(OFlabentries[17].get())
e = arange(float(OFlabentries[14].get()), float(OFlabentries[15].get()), EPasso) e = arange(float(OFlabentries[14].get()), float(OFlabentries[15].get()), EPasso)
resol = float(OFlabentries[13].get()) resol = float(OFlabentries[13].get())
X = e*0.
dose = float(OFlabentries[24].get()) dose = float(OFlabentries[24].get())
X = e*0.
gshift=0 gshift=0
Theta_s = PI - (p['Theta_in'] + p['Theta_out'])*PI/180 Theta_s = PI - (p['Theta_in'] + p['Theta_out'])*PI/180
...@@ -300,13 +295,6 @@ def spectroRNA(p, modelo, ion, OFlabentries, LScontrol, CGausscontrol, tempor): ...@@ -300,13 +295,6 @@ def spectroRNA(p, modelo, ion, OFlabentries, LScontrol, CGausscontrol, tempor):
# É multiplicada pelo passo para manter a escala do gráfico independente do mesmo. # É multiplicada pelo passo para manter a escala do gráfico independente do mesmo.
# Bessel: # Bessel:
# Ainda falta incluir a delta de Dirac na origem
# Existe um valor máximo em energia no qual a função de Bessel pode ser computada em função
# da precisão numérica. Uma possível solução pode ser trabalhar em outras unidades que não
# resultem em argumentos tão grandes para a função exponencial.
# Também temos um problema com a primeira camada, que tem profundidade zero.
# Perceba que os cálculos de Bessel correspondentes às camadas mais fundas estão truncados
# para uma perda de energia maior que 25 keV. (Observado com Theta_in=70, para x > 30)
if modelo == 'bessel': if modelo == 'bessel':
alpha=dedxef*(2./dw2dxef) alpha=dedxef*(2./dw2dxef)
m=alpha*dedxef m=alpha*dedxef
...@@ -339,22 +327,10 @@ def spectroRNA(p, modelo, ion, OFlabentries, LScontrol, CGausscontrol, tempor): ...@@ -339,22 +327,10 @@ def spectroRNA(p, modelo, ion, OFlabentries, LScontrol, CGausscontrol, tempor):
tempor.set_xdata(e-gshift) tempor.set_xdata(e-gshift)
tempor.set_ydata(X*dose) tempor.set_ydata(X*dose)
#tempor.set_color(linecolor)
ylim([0,max(X*dose)*1.1])
xlim([0,max(e-gshift)*1.05])
xlabel("Enegy (eV)")
ylabel("Yield")
data2 = open('temp.sim', 'w') set_lim(e, X, gshift, dose)
for i in range(len(X)): spect_file(e, X, gshift, dose)
print>>data2, e[i]-gshift,X[i]*dose
data2.close()
amostra = np.loadtxt('H2.py')
xxx= amostra[:,0]*1000
ccc=amostra[:,1]
#plot (xxx, ccc, 'r.')
show() show()
#################################################################################################################################################### ####################################################################################################################################################
......
No preview for this file type
...@@ -16,7 +16,7 @@ profundidademax = float(sys.argv[3]) ...@@ -16,7 +16,7 @@ profundidademax = float(sys.argv[3])
dxstep = float(sys.argv[4]) dxstep = float(sys.argv[4])
print "nome dos arquivos "+filename+" e "+ filename2 print "nome dos arquivos "+filename+" e "+ filename2
fig.canvas.set_window_title(filename) fig.canvas.set_window_title(filename)
xx = arange(0,profundidademax, dxstep) xx = arange(0, profundidademax, dxstep)
temp, = plot(xx,xx*0) temp, = plot(xx,xx*0)
####################################################################################################### #######################################################################################################
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment