def graphdata(self,count,ncounts): status=self.datagen() if status!=None: for i in range(len(self.ssidlabel)): if self.ssidlabel[i] in self.data: quality=vg.gdots(gdisplay=self.f,color=self.ssidcolor[i],size=2) level=vg.gdots(gdisplay=self.g,color=self.ssidcolor[i],size=2) vg.label(display=self.f.display,text=str(self.ssidlabel[i]),pos=(-(1.0*ncounts/5.0),(-0.07*i+1.0)),color=self.ssidcolor[i],height=7,font='sans') vg.label(display=self.g.display,text=str(self.ssidlabel[i]),pos=(-(1.0*ncounts/5.0),(7*i-100)),color=self.ssidcolor[i],height=7,font='sans') quality.plot(pos=(count,self.data[self.data.index(self.ssidlabel[i])+1])) level.plot(pos=(count,self.data[self.data.index(self.ssidlabel[i])+2])) else: print "sorry i can not found any wireless network!!! Try again :)"
def __init__(self,L,n,T,contenedor,m=12*Units.amu): self.L = L*Units.m self.n_vis = n self.n_graph = 10*n self.T = T*Units.K self.m = m*Units.kg self.r = self.L*0.01 self.cubo = contenedor self.bolas_visual,self.bolas_grafica = self.crear_bolas() self.dt = 0.1*self.L*np.sqrt(np.pi*self.m/(8*Constants.kBJ*self.T)) self.P = [] self.t = 0 self.counter = 0 self.graph = vs_graph.gdots() self.p_ideal_graph = vs_graph.gcurve(color=vs_graph.color.blue)
escena = gdisplay(height=500,width=500, xmin=-0.5*D,xmax=0.5*D,ymin=-0.5*D,ymax=0.5*D) puntos = [] def Intensidad(x,z): I = 0.25*(1.+2.*m*cos(pi*lamb*z/(L*L))*cos(2.*pi*x/L) +m*m*cos(2.*pi*x/L)**2) return I j=0 for i in arange(-0.5*D,0.5*D,dx): puntos.append(gdots()) puntos[j].radius=dx/2 j+=1 j=0 #------------ #GRAFICACION #------------ #Plano de observacion: z=(2.*L*L/lamb)*1. #Primera auto-imagen #(3.*L*L/lamb) --> Auto-imagen con desfase espacial pi
# Define y position plots position_plots = gdisplay(width=800, height=240, title='Vertical position of balls and plate vs time', xtitle='time', ytitle='y', y=400, foreground=color.black, background=(0.5,0.5,0.5)) plateplot = gcurve(gdisplay=position_plots, color=color.blue) for b in balls: b.y_plot = gcurve(gdisplay=position_plots, color=b.color) # Define bounce time plots step_plots = gdisplay(width=600, height=400, x=200, title='Current vs previous bounce intervals', xtitle='previous bounce', ytitle='current bounce (in units of plate oscillation period)', foreground=color.black, background=(0.5,0.5,0.5)) for b in balls: b.step_plot = gdots(gdisplay=step_plots, color=b.color) def bounce(ball,a,L): bounced = False # Calculate new ball velocity and position using symplectic Euler method. ball.velocity = ball.velocity + a*dt ball.pos = ball.pos + ball.velocity*dt # (Verlet algorithm is an possible alternative, i.e. # ball.pos = ball.pos + ball.velocity*dt + 0.5*a*dt**2 # ball.velocity = ball.velocity + a*dt) # Ball can only bounce if it is over plate. if (-(L/2+ball.radius) < ball.x < L/2+ball.radius) : # Bounce if ball is on plate, otherwise let it fall. if ( ball.pos.y < ball.radius+plate.height/2+plate.pos.y ) : # Calculate ball velocity in plate reference frame ball.velocity.y = ball.velocity.y - plate.velocity.y