Commit 18c98e68 authored by Matheus Müller's avatar Matheus Müller

Arquivo de configuracao usado para carregar parametros

parent 38bc67cd
......@@ -10,6 +10,27 @@ import sys
param = dict(dedx=192. ,Theta_out=70., dW2dx=20740., E0= 100000., Theta_in=0., FWHM0=180.)
ionb = dict(Z=1, mass=1.0079)
##############################################################################
# Report file, writes parameters
def config_write():
config = open("config.cfg", 'w+')
config.write( (Entrydedx.get())+'\n' )
config.write( (EntrydW2dx.get())+'\n' )
config.write( (EntryT_out.get())+'\n' )
config.write( (EntryT_in.get())+'\n' )
config.write( (EntryFWHM0.get())+'\n' )
config.write( (EntryEmin.get())+'\n' )
config.write( (EntryEmax.get())+'\n' )
config.write( (EntryEstep.get())+'\n' )
config.write( (EntryDstep.get())+'\n' )
config.write( (EntryE0.get())+'\n' )
config.write( (Entryionmass.get())+'\n' )
config.write( (EntryionZ.get())+'\n\n' )
config.write( '##############################################################################\n' )
config.write( '# dƐ/dx\n# dω²/dx\n# θ out\n# θ in\n# FWHM\n# E min\n# E max\n# E step\n# Depth step\n# Ion energy\n# Ion mass\n# Ion Z\n' )
config.close()
##############################################################################
# Calculation callback
# Defines parameters
......@@ -25,6 +46,8 @@ def init_calc():
ionb['mass'] = float(Entryionmass.get())
ionb['Z'] = float(EntryionZ.get())
config_write()
for i in range(len(Edict)):
Edict[i]['dist'] = np.loadtxt(Edict[i]['symbol']+".prof")
spectro(param, str(modelvar.get()), ionb, float(EntryEmin.get()),float(EntryEmax.get()), float(EntryEstep.get()), float(EntryDstep.get()), int(LSvar.get()) )
......@@ -122,18 +145,35 @@ Entryionmass.pack()
EntryionZ.pack()
#Initial values
Entrydedx.insert(0,param['dedx'])
EntrydW2dx.insert(0,param['dW2dx'])
EntryT_out.insert(0,param['Theta_out'])
EntryT_in.insert(0,param['Theta_in'])
EntryE0.insert(0,param['E0'])
EntryFWHM0.insert(0,param['FWHM0'])
EntryEmin.insert(0,70000)
EntryEmax.insert(0,100000)
EntryEstep.insert(0,20)
EntryDstep.insert(0,0.01)
Entryionmass.insert(0, ionb['mass'])
EntryionZ.insert(0, ionb['Z'])
try:
config = open("config.cfg", 'r+')
except IOError:
Entrydedx.insert(0,param['dedx'])
EntrydW2dx.insert(0,param['dW2dx'])
EntryT_out.insert(0,param['Theta_out'])
EntryT_in.insert(0,param['Theta_in'])
EntryE0.insert(0,param['E0'])
EntryFWHM0.insert(0,param['FWHM0'])
EntryEmin.insert(0,70000)
EntryEmax.insert(0,100000)
EntryEstep.insert(0,20)
EntryDstep.insert(0,0.01)
Entryionmass.insert(0, ionb['mass'])
EntryionZ.insert(0, ionb['Z'])
else:
Entrydedx.insert(0,float(config.readline()))
EntrydW2dx.insert(0,float(config.readline()))
EntryT_out.insert(0,float(config.readline()))
EntryT_in.insert(0,float(config.readline()))
EntryFWHM0.insert(0,float(config.readline()))
EntryEmin.insert(0,float(config.readline()))
EntryEmax.insert(0,float(config.readline()))
EntryEstep.insert(0,float(config.readline()))
EntryDstep.insert(0,float(config.readline()))
EntryE0.insert(0,float(config.readline()))
Entryionmass.insert(0, float(config.readline()))
EntryionZ.insert(0, int(config.readline()))
config.close()
##############################################################################
# Energy loss models
......@@ -168,7 +208,7 @@ ewin_build(Label1, 15, float(EntryDstep.get()))
##############################################################################
spectro(param, 'gaussiana', ionb, float(EntryEmin.get()), float(EntryEmax.get()), float(EntryEstep.get()), float(EntryDstep.get()), int(LSvar.get()) )
#spectro(param, 'gaussiana', ionb, float(EntryEmin.get()), float(EntryEmax.get()), float(EntryEstep.get()), float(EntryDstep.get()), int(LSvar.get()) )
root.mainloop()
Label1.mainloop()
......
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