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

Funcao que cria distribuicao

parent b08ec43b
......@@ -156,9 +156,9 @@ def ewin_build(window, xmax, xstep):
Entrysymbol.pack()
#EntryLS.pack()
BUpdate = tk.Button(EPframee2, text ='Update properties', command=lambda i=int(Econtrol) :update(i), width=15)
BUpdate = tk.Button(EPframee2, text ='Update properties', command=lambda i=i :update(Econtrol), width=15)
BUpdate.pack()#side='right')
BUpdateD = tk.Button(EPframee2, text ='Update Distribution', command=lambda i=int(Econtrol) :update(i), width=15)
BUpdateD = tk.Button(EPframee2, text ='Update Distribution', command=lambda i=i :update(Econtrol), width=15)
BUpdateD.pack()#side='left')
but = tk.Button(EPframel2, command=create, text='Add element', bd=1, height=1,width=15)
......
from pylab import *
def montaperfil( arquivo, step, modo, xmax):
x,y = loadtxt(arquivo, unpack=True)
profundidade = arange(0, xmax, step)
concent = profundidade*0
u = 0
if modo == 'step':
global u
for i in x:
for j in arange (u, i, step)
concent[int(j/step)] = y[i]
u = i
if modo == 'reta':
global u
for i in x:
for j in arange (u, i, step)
concent[int(j/step)] = (j-u)*(y[i]-y[u])/(x[i]-x[u])
u = i
plot(profundidade, concent)
show()
# draggable rectangle with the animation blit techniques; see
# http://www.scipy.org/Cookbook/Matplotlib/Animations
import numpy as np
import matplotlib.pyplot as plt
from pylab import *
lista = list()
class DraggableRectangle:
lock = None # only one can be animated at a time
def __init__(self, rect):
self.rect = rect
self.press = None
self.background = None
def connect(self):
'connect to all the events we need'
self.cidpress = self.rect.figure.canvas.mpl_connect(
'button_press_event', self.on_press)
self.cidrelease = self.rect.figure.canvas.mpl_connect(
'button_release_event', self.on_release)
self.cidmotion = self.rect.figure.canvas.mpl_connect(
'motion_notify_event', self.on_motion)
def on_press(self, event):
'on button press we will see if the mouse is over us and store some data'
if event.inaxes != self.rect.axes: return
if DraggableRectangle.lock is not None: return
contains, attrd = self.rect.contains(event)
if not contains: return
#print 'event contains', self.rect.xy
x0, y0 = self.rect.xy
self.press = x0, y0, event.xdata, event.ydata
DraggableRectangle.lock = self
# draw everything but the selected rectangle and store the pixel buffer
canvas = self.rect.figure.canvas
axes = self.rect.axes
self.rect.set_animated(True)
canvas.draw()
self.background = canvas.copy_from_bbox(self.rect.axes.bbox)
# now redraw just the rectangle
axes.draw_artist(self.rect)
# and blit just the redrawn area
canvas.blit(axes.bbox)
def on_motion(self, event):
'on motion we will move the rect if the mouse is over us'
if DraggableRectangle.lock is not self:
return
if event.inaxes != self.rect.axes: return
x0, y0, xpress, ypress = self.press
dx = event.xdata - xpress
dy = event.ydata - ypress
self.rect.set_x(x0+dx)
self.rect.set_y(y0+dy)
canvas = self.rect.figure.canvas
axes = self.rect.axes
# restore the background region
canvas.restore_region(self.background)
# redraw just the current rectangle
axes.draw_artist(self.rect)
# blit just the redrawn area
canvas.blit(axes.bbox)
def on_release(self, event):
'on release we reset the press data'
if DraggableRectangle.lock is not self:
return
self.press = None
DraggableRectangle.lock = None
# turn off the rect animation property and reset the background
self.rect.set_animated(False)
self.background = None
# redraw the full figure
self.rect.figure.canvas.draw()
for i in range(10):
lista[i] = drs[i].rect.xy
print lista
def disconnect(self):
'disconnect all the stored connection ids'
self.rect.figure.canvas.mpl_disconnect(self.cidpress)
self.rect.figure.canvas.mpl_disconnect(self.cidrelease)
self.rect.figure.canvas.mpl_disconnect(self.cidmotion)
fig = plt.figure()
ax = fig.add_subplot(111)
rects = ax.bar(range(10), (1 + 0.01*np.random.rand(10)))
drs = []
for rect in rects:
dr = DraggableRectangle(rect)
dr.connect()
drs.append(dr)
lista.append(dr.rect.xy)
ylim([0,50])
xlim([0,50])
plt.show()
......@@ -44,7 +44,7 @@ def spectro(p, modelo, ion, Emin, Emax, EPasso, passox, LScontrol):
e = arange(Emin, Emax, EPasso)
Y = e*0.
dose = 10e33
dose = 10e32
Theta_s = PI - (p['Theta_in'] + p['Theta_out'])*PI/180
mi = ion['mass']
......@@ -108,8 +108,8 @@ def spectro(p, modelo, ion, Emin, Emax, EPasso, passox, LScontrol):
xlabel("Enegy (eV)")
ylabel("Yield")
amostra = np.loadtxt('H2.py')
xxx= amostra[:,0]*1000
amostra = np.loadtxt('gustavson.xy')
xxx= amostra[:,0]
ccc=amostra[:,1]
plot (xxx, ccc, 'r.')
......
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