当前位置: 首页>>代码示例>>Python>>正文


Python pylab.pause函数代码示例

本文整理汇总了Python中pylab.pause函数的典型用法代码示例。如果您正苦于以下问题:Python pause函数的具体用法?Python pause怎么用?Python pause使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了pause函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: plot

def plot(plt, prev, charges, posOffset):
    for elem in prev:
        elem.remove()

    # [x], [y], [q]
    pos = ([], [], [])
    neg = ([], [], [])
    neut = ([], [], [])
    for c in charges:
        if c.q > 0:
            pos[0].append(c.pos[0])
            pos[1].append(c.pos[1])
            pos[2].append(c.size)
        elif c.q < 0:
            neg[0].append(c.pos[0])
            neg[1].append(c.pos[1])
            neg[2].append(c.size)
        else:
            neut[0].append(c.pos[0])
            neut[1].append(c.pos[1])
            neut[2].append(c.size)

    curr = []
    curr.append( plt.scatter(pos[0], pos[1], marker='o', color='red', s=pos[2]) )
    curr.append( plt.scatter(neg[0], neg[1], marker='o', color='blue', s=neg[2]) )
    curr.append( plt.scatter(neut[0], neut[1], marker='o', color='gray', s=neut[2]) )
    for c in charges:
        curr.append( plt.text(c.pos[0], c.pos[1]+ sqrt(c.size/3.14) / 2 + posOffset, "%s, %s C" % (c.name, c.q), \
                horizontalalignment='center') )

    plt.draw()
    plt.pause(TIME_INTERVAL)
    return curr
开发者ID:awchen,项目名称:p43,代码行数:33,代码来源:coulomb.py

示例2: ManetPlot

def ManetPlot():
	index_mob=0
	index_route=00
	plotting_time=0

	pl.ion()
	fig,ax=pl.subplots()
	for index_mob in range(len(time_plot)):
# plot the nodes with the positions given by index_mob of x_plot and yplot
		pl.scatter(x_plot[index_mob],y_plot[index_mob],s=100,c='g')
#		print x_plot[index_mob],y_plot[index_mob]
		for i, txt in enumerate(n):
		        pl.annotate(txt,(x_plot[index_mob, i]+10,y_plot[index_mob, i]+10))
		pl.xlabel('x axis')
		pl.ylabel('y axis')
	# set axis limits
		pl.xlim(0.0, xRange)
		pl.ylim(0.0, yRange)
		pl.title("Position updation at "+str(time_plot[index_mob]))
#		print time_plot[index_mob],route_table_time[index_route],ntemp,route_table[index_route,1:3]

#		print_neighbors(neighbor_nodes_time,time_neighb,x_plot[index_mob,:],y_plot[index_mob,:])
		pl.show()
		pl.pause(.0005)
	# show the plot on the screen
		pl.clf()
开发者ID:Mishfad,项目名称:aodv_routing,代码行数:26,代码来源:plot_node_movement.py

示例3: FindTransitManual

def FindTransitManual(kic, lc, cut=10):
    """
    This uses the KIC/EPIC to
    1) Get matching data
    2) Display in pyplot window
    3) Allow the user to find and type the single transit parameters

    returns
    # lightcurve  (cut to 20Tdur long)
    # 'guess' parameters''
    """
    if lc == []:
        lc = getKeplerLC(kic)
    p.ion()
    # PlotLC(lc, 0, 0, 0.1)
    p.figure(1)
    p.plot(lc[:, 0], lc[:, 1], ".")
    print lc
    print "You have 10 seconds to manouever the window to the transit (before it freezes)."
    print "(Sorry; matplotlib and raw_input dont work too well)"
    p.pause(25)
    Tcen = float(raw_input("Type centre of transit:"))
    Tdur = float(raw_input("Type duration of transit:"))
    depth = float(raw_input("Type depth of transit:"))
    # Tcen,Tdur,depth=2389.7, 0.35, 0.0008
    return np.array((Tcen, Tdur, depth))
开发者ID:hposborn,项目名称:Namaste,代码行数:26,代码来源:planetlib.py

示例4: main

def main(plot=True):

    # Setup grid
    g = 4
    nx, ny = 200, 50
    Lx, Ly = 26, 26/4

    (x, y), (dx, dy) = ghosted_grid([nx, ny], [Lx, Ly], 0)

    # monkey patch the velocity
    uc = MultiFab(sizes=[nx, ny], n_ghost=4, dof=2)
    uc.validview[0] = (y > Ly / 3) * (2 * Ly / 3 > y)
    uc.validview[1] = np.sin(2 * pi * x / Lx) * .3 / (2 * pi / Lx)
    # state.u = np.random.rand(*x.shape)

    tad = BarotropicSolver()
    tad.geom.dx = dx
    tad.geom.dy = dx

    dt = min(dx, dy) / 4

    if plot:
        import pylab as pl
        pl.ion()

    for i, (t, uc) in enumerate(steps(tad.onestep, uc, dt, [0.0, 10000 * dt])):
        if i % 100 == 0:
            if plot:
                pl.clf()
                pl.pcolormesh(uc.validview[0])
                pl.colorbar()
                pl.pause(.01)
开发者ID:nbren12,项目名称:gnl,代码行数:32,代码来源:barotropic.py

示例5: fftComputeAndGraph

	def fftComputeAndGraph(self, data):
		fft = np.fft.fft(data)
		fftr = 10*np.log10(abs(fft.real))[:len(data)/2]
		ffti = 10*np.log10(abs(fft.imag))[:len(data)/2]
		fftb = 10*np.log10(np.sqrt(fft.imag**2+fft.real**2))[:len(data)/2]
		freq = np.fft.fftfreq(np.arange(len(data)).shape[-1])[:len(data)/2]
		freq = freq*self.RATE/1000 #make the frequency scale
		pylab.subplot(411)
		pylab.title("Original Data")
		pylab.grid()    
		pylab.plot(np.arange(len(data))/float(self.RATE)*1000,data,'r-',alpha=1)
		pylab.xlabel("Time (milliseconds)")
		pylab.ylabel("Amplitude")
		pylab.subplot(412)
		pylab.title("Real FFT")
		pylab.xlabel("Frequency (kHz)")
		pylab.ylabel("Power")
		pylab.grid()    
		pylab.plot(freq,fftr,'b-',alpha=1)
		pylab.subplot(413)
		pylab.title("Imaginary FFT")
		pylab.xlabel("Frequency (kHz)")
		pylab.ylabel("Power")
		pylab.grid()    
		pylab.plot(freq,ffti,'g-',alpha=1)
		pylab.subplot(414)
		pylab.title("Real+Imaginary FFT")
		pylab.xlabel("Frequency (kHz)")
		pylab.ylabel("Power")
		pylab.grid()    
		pylab.plot(freq,fftb,'k-',alpha=1)
		pylab.draw()
		pylab.pause(0.0001)
		pylab.clf()
开发者ID:gt-ros-pkg,项目名称:hrl-assistive,代码行数:34,代码来源:pyaudio_fft_realtime.py

示例6: TablePlot

def TablePlot():
    index_time=0
#    print [x[2] for x in RouteTablewithSeq]
        
    pl.ion()
    fig,ay=pl.subplots()
    fig,ax=pl.subplots()
    fig.set_tight_layout(True)
    
    idx_row = Index(np.arange(0,nNodes))
    idx_col = Index(np.arange(0,nPackets))
    df = DataFrame(cache_matrix[0,:,:], index=idx_row, columns=idx_col)
#    print df
    normal = pl.Normalize(0, 1)
    for index_time in range(len(RouteTablewithSeq_time)):
	vals=cache_matrix[index_time,:,:30]

#    fig = pl.figure(figsize=(15,8))
#    ax = fig.add_subplot(111, frameon=True, xticks=[], yticks=[])
#	print vals.shape
    	the_table=pl.table(cellText=vals, rowLabels=df.index, colLabels=df.columns, colWidths = [0.03]*vals.shape[1], loc='center', cellColours=pl.cm.hot(normal(vals)), fontsize=3)
	the_table.alpha=0
	for i in range(index_time+1):
		for j in range(vals.shape[0]):
			if (vals[j,i]==1):
				the_table._cells[(j+1, i)]._text.set_color('white')

	pl.title("Table at time: "+str(cache_time[index_time])+" Packet: "+str(index_time)+" Probability: "+str(p) )
    	pl.show()
	pl.pause(.0005)
	pl.clf()
开发者ID:Mishfad,项目名称:aodv_routing,代码行数:31,代码来源:manet_CachingTable_withCachinginNeighborsfromRoutingtable_ubuntu.py

示例7: plot3DCamera

 def plot3DCamera(self, T):
     #transform affine
     ori = T * np.matrix([[0],[0],[0],[1]])
     v1 =  T * np.matrix([[self.camSize],[0],[0],[1]])
     v2 =  T * np.matrix([[0],[self.camSize],[0],[1]])
     v3 =  T * np.matrix([[0],[0],[self.camSize],[1]])
     
     #initialize objects
     if not self.initialized:
         self.cam_x = self.ax.plot(np.squeeze([ori[0], v1[0]]), np.squeeze([ori[1], v1[1]]), np.squeeze([ori[2], v1[2]]), color="r")
         self.cam_y = self.ax.plot(np.squeeze([ori[0], v2[0]]), np.squeeze([ori[1], v2[1]]), np.squeeze([ori[2], v2[2]]), color="g")
         self.cam_z = self.ax.plot(np.squeeze([ori[0], v3[0]]), np.squeeze([ori[1], v3[1]]), np.squeeze([ori[2], v3[2]]), color="b")
         self.initialized = True
         
     else:
         xy=np.squeeze([ori[0:2], v1[0:2]]).transpose()
         z=np.squeeze([ori[2], v1[2]]).transpose()
         self.cam_x[0].set_data(xy)
         self.cam_x[0].set_3d_properties(z)
         xy=np.squeeze([ori[0:2], v2[0:2]]).transpose()
         z=np.squeeze([ori[2], v2[2]]).transpose()
         self.cam_y[0].set_data(xy)
         self.cam_y[0].set_3d_properties(z)
         xy=np.squeeze([ori[0:2], v3[0:2]]).transpose()
         z=np.squeeze([ori[2], v3[2]]).transpose()
         self.cam_z[0].set_data(xy)
         self.cam_z[0].set_3d_properties(z)
         pl.pause(0.00001)
开发者ID:AnnaDaiZH,项目名称:Kalibr,代码行数:28,代码来源:IccPlots.py

示例8: plot_coupe

def plot_coupe(sol):
    ax1.cla()
    ax2.cla()
    mx = int(sol.domain.N[0]/2-1)
    my = int(sol.domain.N[1]/2-1)
    x = sol.domain.x[0][1:-1]
    y = sol.domain.x[1][1:-1]
    u = sol.m[0][1][1:-1,1:-1] / rhoo
    for i in [0,mx,-1]:
        ax1.plot(y+x[i], u[i, :], 'b')
    for j in [0,my,-1]:
        ax1.plot(x+y[j], u[:,j], 'b')
    ax1.set_ylabel('velocity', color='b')
    for tl in ax1.get_yticklabels():
        tl.set_color('b')
    ax1.set_ylim(-.5*rhoo*vmax, 1.5*rhoo*vmax)
    p = sol.m[0][0][1:-1,my] * la**2 / 3.0
    p -= np.average(p)
    ax2.plot(x, p, 'r')
    ax2.set_ylabel('pressure', color='r')
    for tl in ax2.get_yticklabels():
        tl.set_color('r')
    ax2.set_ylim(pressure_gradient*L, -pressure_gradient*L)
    plt.title('Poiseuille flow at t = {0:f}'.format(sol.t))
    plt.draw()
    plt.pause(1.e-3)
开发者ID:gouarin,项目名称:pylbm_notebook,代码行数:26,代码来源:05_Poiseuille.py

示例9: save_render_plot

def save_render_plot(imgs,label,save=None,res_vec=None,clean=False):
  if clean and len(imgs)==1:
   imsave(save,imgs[0]) 
   return
  plt.clf()
  fig = plt.gcf()
  if not clean:
   fig.suptitle(label)

  subfig=1
  t_imgsx = (math.ceil(float(len(imgs))/3))
  t_imgsy = min(3,len(imgs))
  
  for img in imgs:
         plt.subplot(t_imgsx,t_imgsy,subfig)
         if res_vec!=None:
          plt.title("Confidence: %0.2f%%" % (res_vec[subfig-1]*100.0))
         plt.imshow(img)
         plt.axis('off')
         subfig+=1

  if save!=None:
   plt.draw()
   plt.pause(0.1)
   if not clean:
    plt.savefig(save)
   else:
    plt.savefig(save,bbox_inches='tight')
  else:
   plt.show()
开发者ID:bryongloden,项目名称:fobj,代码行数:30,代码来源:fool.py

示例10: test

def test(c, s, N):
    dico = {
        'box':{'x':[0., 1.], 'label':-1},
        'scheme_velocity':1.,
        'space_step':1./N,
        'schemes':[
            {
                'velocities':[1,2],
                'conserved_moments':u,
                'polynomials':[1, X],
                'equilibrium':[u, c*u],
                'relaxation_parameters':[0., s],
                'init':{u:(solution, (0.,))},
            },
        ],
        'generator':pyLBM.CythonGenerator,
    }
    sol = pyLBM.Simulation(dico)
    while sol.t < Tf:
        sol.one_time_step()
    sol.f2m()
    x = sol.domain.x[0][1:-1]
    y = sol.m[0][0][1:-1]
    plt.clf()
    plt.plot(x, y, 'k', x, solution(x, sol.t), 'r')
    plt.pause(1.e-5)
    return sol.domain.dx * np.linalg.norm(y - solution(x, sol.t), 1)
开发者ID:gouarin,项目名称:pylbm_notebook,代码行数:27,代码来源:09_convergence.py

示例11: main

def main():
    sdr = RtlSdr()
    print('Configuring SDR...')
    sdr.DEFAULT_ASYNC_BUF_NUMBER = 16
    sdr.rs = 2.5e6   ## sampling rate
    sdr.fc = 100e6   ## center frequency
    sdr.gain = 10

    print('  sample rate: %0.6f MHz' % (sdr.rs/1e6))
    print('  center frequency %0.6f MHz' % (sdr.fc/1e6))
    print('  gain: %d dB' % sdr.gain)

    print('Reading samples...')
    samples = sdr.read_samples(256*1024)
    print('  signal mean:', sum(samples)/len(samples))

    filter = signal.firwin(5, 2* array([99.5,100.5])/sdr.rs,pass_zero=False)



    mpl.figure()
    for i in range(100):
        print('Testing spectrum plotting...')
        mpl.clf()
        signal2 = convolve(sdr.read_samples(256*1024),filter)
        psd = mpl.psd(signal2, NFFT=1024, Fc=sdr.fc/1e6, Fs=sdr.rs/1e6)

        mpl.pause(0.001)
        #mpl.plot(sdr.read_samples(256*1024))
        mpl.show(block=False)

    print('Done\n')
    sdr.close()
开发者ID:Williangalvani,项目名称:sdrTests,代码行数:33,代码来源:realtimeSpectrum.py

示例12: calc_idct

def calc_idct(dct, cos, idct, choice):
   for i in range(352/8):
    for j in range(288/8):
        block_R=np.mat(dct[i*8:i*8+8,j*8:j*8+8,0])
        block_G=np.mat(dct[i*8:i*8+8,j*8:j*8+8,1])
        block_B=np.mat(dct[i*8:i*8+8,j*8:j*8+8,2])
        
        block_R[:,0]=block_R[:,0]/1.414
        block_G[:,0]=block_G[:,0]/1.414
        block_B[:,0]=block_B[:,0]/1.414
        block_R[0,:]=block_R[0,:]/1.414
        block_G[0,:]=block_G[0,:]/1.414
        block_B[0,:]=block_B[0,:]/1.414
        
        r=(((block_R*cos).transpose())*cos)/4
        g=(((block_G*cos).transpose())*cos)/4
        b=(((block_B*cos).transpose())*cos)/4
                
        idct[i*8:i*8+8,j*8:j*8+8,0]=r.round(2)
        idct[i*8:i*8+8,j*8:j*8+8,1]=g.round(2)
        idct[i*8:i*8+8,j*8:j*8+8,2]=b.round(2)
        
        if choice=='1':
            display(idct)
            pl.pause(arg[1]/1000+0.0000001)
   return idct
开发者ID:waater,项目名称:MultiMedia,代码行数:26,代码来源:jpeg.py

示例13: get_fig

def get_fig(moves, key):
    global colors, arg
    # draw init speed


    # draw end point
    for i, move in enumerate(moves[key]):
        ax = make_axes()
        arrow(vel=key, color='r')
        endP = move[0]
        endV = move[2],move[1]
        arrow(start=endP, vel=endV, color='g')
        taken = move[3]
        bezier = move[4]
        s = "key: {0}\nendP: {1}\nendV: {2}\ntaken: {3}\n".format(key, endP, endV, taken)
#        s = str(endP)
#        print s
        pylab.text(-3.3 * arg, 3.3 * arg, s)

        pylab.scatter(zip(*bezier)[0], zip(*bezier)[1], c='g', alpha=.25, edgecolors='none')

        pylab.scatter(zip(*taken)[0], zip(*taken)[1], c='r', s=20, alpha=.75, edgecolors='none')

        pylab.draw()
        pylab.pause(0.0001)
        pylab.clf()
开发者ID:myzael,项目名称:Sterowanie-pojazdami-w-przestrzeni-dyskretnej,代码行数:26,代码来源:physics.py

示例14: update_plot

    def update_plot(self):

        plt.clf()
        nsr = self.ca.grid.node_vector_to_raster(self.ca.node_state)
        plt.imshow(nsr, interpolation='None', origin='lower')
        plt.draw()
        plt.pause(0.01)
开发者ID:nicgaspar,项目名称:landlab,代码行数:7,代码来源:link_ca.py

示例15: draw

def draw(state_view, progress_view, state, tick):
    print
    state_view.cla()
    values = np.zeros((3, 4))
    for y in range(3):
        for x in range(3):
            for entity in state[y][x][TEAM.RED]:
                values[y][x] += entity.hp
            for entity in state[y][x][TEAM.BLUE]:
                values[y][x] -= entity.hp
            values[y][x] = min(values[y][x], 100)
            values[y][x] = max(values[y][x], -100)

    values[0][3] = 100
    values[1][3] = 0
    values[2][3] = -100

    print values
    state_view.imshow(values, interpolation="nearest", cmap="bwr")

    progress_view.cla()
    xs = np.arange(0, 2 * np.pi, 0.01)
    ys = np.sin(xs + tick * 0.1)
    progress_view.plot(ys)

    pl.pause(1.0 / FPS)
开发者ID:rex8312,项目名称:test_0710,代码行数:26,代码来源:main.py


注:本文中的pylab.pause函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。