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


Python numerix.sin函数代码示例

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


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

示例1: calc_O1_O2_k

    def calc_O1_O2_k(self,r1,r2,tan_a,teta):
        #print("r1: %0.3f, r2: %0.3f, tan_a: %0.3f, teta: %0.3f" %(r1,r2,tan_a,teta))
        #print("N1: x: %0.3f, y: %0.3f" %(-sin(tan_a), cos(tan_a)))
        #print("V: x: %0.3f, y: %0.3f" %(-sin(teta+tan_a),cos(teta+tan_a)))

        O1=PointClass(x=self.Pa.x-r1*sin(tan_a),\
                      y=self.Pa.y+r1*cos(tan_a))
        k=PointClass(x=self.Pa.x+r1*(-sin(tan_a)+sin(teta+tan_a)),\
                     y=self.Pa.y+r1*(cos(tan_a)-cos(tan_a+teta)))
        O2=PointClass(x=k.x+r2*(-sin(teta+tan_a)),\
                      y=k.y+r2*(cos(teta+tan_a)))
        return O1, O2, k
开发者ID:arnew,项目名称:dxf2gcode,代码行数:12,代码来源:Ellipse_fitting_by_Biarc_curves.py

示例2: calc_std_parameters

    def calc_std_parameters(self):
        #Berechnung der langen Seite der Ellipse
        self.De1=self.dm*sin(radians(180)-self.a1)/(2*sin(self.a1-self.a2))
        self.De2=self.dm*sin(self.a1)/(2*sin(radians(180)-self.a1-self.a2))
        self.De=self.De1+self.De2

        #Berechnung des Versatzes von der Mittellinie
        self.vers=(self.De2-(self.De/2))
        self.vers_h=self.vers*sin(self.a2)
        self.vers_d=self.vers*cos(self.a2)

        #Berechnung der kurzen Seite der Ellipse        
        self.dmv=self.dm-2*self.vers_h/tan(self.a1)
        self.de=2*sqrt((self.dmv/2)**2-(self.vers_d/2)**2)
开发者ID:arnew,项目名称:dxf2gcode,代码行数:14,代码来源:Kegelstump_Abwicklung_2dxf.py

示例3: OnInit

    def OnInit(self):
        self.timer = wx.PyTimer(self.OnTimer)
        self.numPoints = 0

        self.frame = wxmpl.PlotFrame(None, -1, 'WxMpl Stripchart Demo')
        self.frame.Show(True)

        # The data to plot
        x =  arange(0.0, 200, 0.1)
        y1 = 4*cos(2*pi*(x-1)/5.7)/(6+x) + 2*sin(2*pi*(x-1)/2.2)/(10)
        y2 = y1 + .5
        y3 = y2 + .5
        y4 = y3 + .5

        # Fetch and setup the axes
        axes = self.frame.get_figure().gca()
        axes.set_title('Stripchart Test')
        axes.set_xlabel('t')
        axes.set_ylabel('f(t)')

        # Attach the StripCharter and define its channels
        self.charter = wxmpl.StripCharter(axes)
        self.charter.setChannels([
            TestChannel('ch1', x, y1),
            TestChannel('ch2', x, y2),
            TestChannel('ch3', x, y3),
            TestChannel('ch4', x, y4)
        ])

        # Prime the pump and start the timer
        self.charter.update()
        self.timer.Start(100)
        return True
开发者ID:ednspace,项目名称:pyroLogger,代码行数:33,代码来源:stripcharting.py

示例4: draw

    def draw(self):
        if not hasattr(self, 'subplot'):
            self.subplot = self._figure.add_subplot(111)

        theta = arange(0, 45*2*pi, 0.02)
        rad = (0.8*theta/(2*pi)+1)
        r = rad*(8 + sin(theta*7+rad/1.8))
        x = r*cos(theta)
        y = r*sin(theta)
        #Now draw it
        self.subplot.plot(x,y, '-r')
        #Set some plot attributes
        self.subplot.set_title("A polar flower (%s points)"%len(x), fontsize = 12)
        self.subplot.set_xlabel("test plot", fontsize = 8)
        self.subplot.set_xlim([-400, 400])
        self.subplot.set_ylim([-400, 400])
开发者ID:anondroid5,项目名称:Matplotlib,代码行数:16,代码来源:fig41.py

示例5: __init__

    def __init__(self):
        self.widgets = gtk.glade.XML('mpl_with_glade.glade')
        self.widgets.signal_autoconnect(GladeHandlers.__dict__)

        self['windowMain'].connect('destroy', lambda x: gtk.main_quit())
        self['windowMain'].move(10,10)
        self.figure = Figure(figsize=(8,6), dpi=72)
        self.axis = self.figure.add_subplot(111)
        
        t = arange(0.0,3.0,0.01)
        s = sin(2*pi*t)
        self.axis.plot(t,s)
        self.axis.set_xlabel('time (s)')
        self.axis.set_ylabel('voltage')

        self.canvas = FigureCanvas(self.figure) # a gtk.DrawingArea
        self.canvas.show()
        self.canvas.set_size_request(600, 400)
        self.canvas.set_events(
            gtk.gdk.BUTTON_PRESS_MASK      |            
            gtk.gdk.KEY_PRESS_MASK      |
            gtk.gdk.KEY_RELEASE_MASK    
            )
        self.canvas.set_flags(gtk.HAS_FOCUS|gtk.CAN_FOCUS)
        self.canvas.grab_focus()

        def keypress(widget, event):
            print 'key press'
        def buttonpress(widget, event):
            print 'button press'

        self.canvas.connect('key_press_event', keypress)
        self.canvas.connect('button_press_event', buttonpress)      

        def onselect(xmin, xmax):
            print xmin, xmax

        span = HorizontalSpanSelector(self.axis, onselect, useblit=False,
                                          rectprops=dict(alpha=0.5, facecolor='red') )


        self['vboxMain'].pack_start(self.canvas, True, True)
        self['vboxMain'].show()
        
        # below is optional if you want the navigation toolbar
        self.navToolbar = NavigationToolbar(self.canvas, self['windowMain'])
        self.navToolbar.lastDir = '/var/tmp/'
        self['vboxMain'].pack_start(self.navToolbar)
        self.navToolbar.show()

        sep = gtk.HSeparator()
        sep.show()
        self['vboxMain'].pack_start(sep, True, True)


        self['vboxMain'].reorder_child(self['buttonClickMe'],-1)
开发者ID:pv,项目名称:matplotlib-cvs,代码行数:56,代码来源:mpl_with_glade.py

示例6: OnInit

 def OnInit(self):
     from matplotlib.numerix import arange, sin, pi, cos
     'Create the main window and insert the custom frame'
     x = arange(0.0,3.0,0.01)
     s = sin(2*pi*x)
     c = cos(2*pi*x)
     t = sin(2*pi*x) + cos(2*pi*x)
     frame = ExtendedPlotFrame(None)
     style = {'with':'lines', 'color':'blue','line':'solid','width':2}
     style['legend'] = 'sin(x)'
     frame.insertCurve(x,s, style)
     style = {'with':'lines', 'color':'red','line':'solid','width':2}
     style['legend'] = 'cos(x)'
     frame.insertCurve(x,c, style)
     style = {'with':'lines', 'color':'black','line':'solid','width':2}
     #style['legend'] = 'sin(x)+cos(x)'
     frame.insertCurve(x,t, style)
     frame.Show(True)
     return True
开发者ID:cfarrow,项目名称:diffpy.pdfgui,代码行数:19,代码来源:extendedplotframe.py

示例7: init_plot_data

 def init_plot_data(self):
     # jdh you can add a subplot directly from the fig rather than
     # the fig manager
     a = self.fig.add_subplot(111)
     self.x = numerix.arange(120.0)*2*numerix.pi/120.0
     self.x.resize((100,120))
     self.y = numerix.arange(100.0)*2*numerix.pi/100.0
     self.y.resize((120,100))
     self.y = numerix.transpose(self.y)
     z = numerix.sin(self.x) + numerix.cos(self.y)
     self.im = a.imshow( z, cmap=cm.jet)#, interpolation='nearest')
开发者ID:pv,项目名称:matplotlib-cvs,代码行数:11,代码来源:dynamic_image_wxagg.py

示例8: plot2plot

 def plot2plot(self, plot):
     x=[]; y=[]
     #Alle 6 Grad ein Linien Segment Drucken
     segments=int((abs(degrees(self.ext))//6)+1)
     for i in range(segments+1):
         ang=self.s_ang+i*self.ext/segments
         x.append(self.O.x+cos(ang)*abs(self.r))
         y.append(self.O.y+sin(ang)*abs(self.r))
         
     plot.plot(x,y,'-g')
     #plot.plot([x[0],x[-1]],[y[0],y[-1]],'cd')
     plot.plot([self.Pa.x,self.Pe.x],[self.Pa.y,self.Pe.y],'cd')
开发者ID:arnew,项目名称:dxf2gcode,代码行数:12,代码来源:Ellipse_fitting_by_Biarc_curves.py

示例9: init_plot_data

 def init_plot_data(self):
     # jdh you can add a subplot directly from the fig rather than
     # the fig manager
     a = self.fig.add_axes([0.075,0.1,0.75,0.85])
     cax = self.fig.add_axes([0.85,0.1,0.075,0.85])
     self.x = numerix.arange(120.0)*2*numerix.pi/120.0
     self.x.resize((100,120))
     self.y = numerix.arange(100.0)*2*numerix.pi/100.0
     self.y.resize((120,100))
     self.y = numerix.transpose(self.y)
     z = numerix.sin(self.x) + numerix.cos(self.y)
     self.im = a.imshow( z, cmap=cm.jet)#, interpolation='nearest')
     self.fig.colorbar(self.im,cax=cax,orientation='vertical')
开发者ID:pv,项目名称:matplotlib-cvs,代码行数:13,代码来源:dynamic_image_wxagg2.py

示例10: OnWhiz

    def OnWhiz(self,evt):
        self.x += numerix.pi/15
        self.y += numerix.pi/20
        z = numerix.sin(self.x) + numerix.cos(self.y)
        self.im.set_array(z)

        zmax = mlab.max(mlab.max(z))-ERR_TOL
        ymax_i, xmax_i = numerix.nonzero(
            numerix.greater_equal(z, zmax))
        if self.im.origin == 'upper':
            ymax_i = z.shape[0]-ymax_i
        self.lines[0].set_data(xmax_i,ymax_i)

        self.canvas.draw()
开发者ID:pv,项目名称:matplotlib-cvs,代码行数:14,代码来源:embedding_in_wx3.py

示例11: __init__

    def __init__(self):
        gtk.Window.__init__(self,gtk.WINDOW_TOPLEVEL)

        self.set_title("MixedEmotions")
        self.set_border_width(10)
        
        self.fig = Figure(figsize=(3,1), dpi=100)
        self.ax = self.fig.add_subplot(111)
        self.x = arange(0,2*pi,0.01)           # x-array
        self.lines = self.ax.plot(self.x,sin(self.x))
        self.canvas = FigureCanvas(self.fig)
        self.add(self.canvas)      

        self.figcount = 0
        gtk.timeout_add(100, self.updatePlot)
开发者ID:BBelonder,项目名称:PyExpLabSys,代码行数:15,代码来源:example2.py

示例12: update_line

def update_line(*args):
    # restore the clean slate background
    canvas.restore_region(background)
    # update the data
    line.set_ydata(nx.sin(x+update_line.cnt/10.0))  
    # just draw the animated artist
    ax.draw_artist(line)
    # just redraw the axes rectangle
    canvas.blit(ax.bbox) 

    if update_line.cnt==50:
        # print the timing info and quit
        print 'FPS:' , update_line.cnt/(time.time()-tstart)
        sys.exit()

    update_line.cnt += 1
    return True
开发者ID:BKJackson,项目名称:SciPy-CookBook,代码行数:17,代码来源:Matplotlib(2f)Animations.py

示例13: _create_plot

def _create_plot(self):
        from matplotlib.figure import Figure
        from matplotlib.backends.backend_gtkagg import FigureCanvasGTKAgg as FigureCanvas
        from matplotlib.numerix import arange, sin, pi

        figure = Figure(figsize=(5, 4), dpi=100)
        canvas = FigureCanvas(figure)  # a gtk.DrawingArea
        #win.add(canvas)

        axes = figure.add_subplot(111)
        x = arange(0.0, 30.0, 0.01)
        y = sin(2 * pi * x)
        line, = axes.plot(x, y)
        axes.set_title('hi mom')
        axes.grid(True)
        axes.set_xlabel('time')
        axes.set_ylabel('volts')
开发者ID:CoDe--BuStErS,项目名称:ISVOSA,代码行数:17,代码来源:agilent.py

示例14: update

 def update(self,ptr):
     # restore the clean slate background
     if self.background is None:
         self.background = self.canvas.copy_from_bbox(self.ax.bbox)  
     self.canvas.restore_region(self.background)
     # update the data
     line.set_ydata(nx.sin(x+self.cnt/10.0))  
     # just draw the animated artist
     self.ax.draw_artist(line)
     # just redraw the axes rectangle
     self.canvas.blit(ax.bbox) 
     self.cnt+=1
     if self.cnt==200:
         # print the timing info and quit
         print 'FPS:' , 200/(time.time()-self.tstart)
         sys.exit()
     return True
开发者ID:pv,项目名称:matplotlib-cvs,代码行数:17,代码来源:animation_blit_fltk.py

示例15: __init__

 def __init__( self, strengthRange, ax, pos, decay_time=2 ) :
     
   n = 25
   t = arange(n)*2*pi/n
   self.disc = array([(cos(x),sin(x)) for x in t])
   self.strength = 0
   self.pos = pos
   self.offset = (279, 157)
   self.scale = 1.35
   self.max_size = 5 #0.5
   self.min_size = 0.10 #0.05
   self.size = self.min_size
   self.color = '#ff8000'
   self.decay_time = decay_time
   self.strengthRange = strengthRange
   self.t0 = 0
   v = self.disc * self.size + self.pos
   self.poly = ax.fill( v[:,0], v[:,1], self.color )
开发者ID:saurabhd14,项目名称:tinyos-1.x,代码行数:18,代码来源:RfsFieldGui.py


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