• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python visvis.clf函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: PlotReferencePhase

	def PlotReferencePhase (self, event) :
		"""
		Plot reference phase
		"""
		visvis.cla(); visvis.clf(); 
		
		# get actual amplitude and phased
		phase = self.GetReferencePhase()[0]
		ampl = np.ones(phase.size)
		ampl, phase = self.DevPulseShaper.GetUnwrappedAmplPhase(ampl, phase) 
		
		# Wrap the phase in radians
		phase %= (2*np.pi)
		
		# Get the phase in unites of 2*pi
		phase /= (2*np.pi)
		
		visvis.subplot(211)
		visvis.plot(phase)
		visvis.ylabel ('Reference phase')
		visvis.xlabel ('puls shaper pixel number')
		visvis.title ('Current reference phase (in unites of 2*pi)')
		
		visvis.subplot(212)
		visvis.plot( self.corrections, lc='r',ms='*', mc='r' )
		visvis.ylabel ('Value of coefficients')
		visvis.xlabel ('coefficient number')
		visvis.title ('Value of corrections')
开发者ID:dibondar,项目名称:PyPhotonicReagents,代码行数:28,代码来源:miips_tab.py


示例2: _createWindow

	def _createWindow(self, name, im, axis):

		vv.figure()
		vv.gca()
		vv.clf()
		fig = vv.imshow(im)
		dims = im.shape

		''' Change color bounds '''
		if im.dtype == np.uint8:
			fig.clim.Set(0, 255)
		else:
			fig.clim.Set(0., 1.)
		
		fig.GetFigure().title = name
		
		''' Show ticks on axes? '''
		if not axis:
			fig.GetAxes().axis.visible = False
			bgcolor = (0.,0.,0.)
		else:
			fig.GetAxes().axis.showBox = False
			bgcolor = (1.,1.,1.)

		''' Set background color '''
		fig.GetFigure().bgcolor = bgcolor
		fig.GetAxes().bgcolor = bgcolor

		''' Setup keyboard event handler '''
		fig.eventKeyDown.Bind(self._keyHandler)

		win = {'name':name, 'canvas':fig, 'shape':dims, 'keyEvent':None, 'text':[]}
		self.open_windows.append(win)

		return win
开发者ID:MerDane,项目名称:pyKinectTools,代码行数:35,代码来源:VideoViewer.py


示例3: DisplayOptimization

	def DisplayOptimization (self) :
		"""
		Display the progress of optimization
		"""
		wx.Yield()
		# abort, if requested 
		if self.need_abort : return
	
		def GetValueColourIter (d) :
			return izip_longest( d.itervalues(), ['r', 'g', 'b', 'k'],  fillvalue='y' )
	
		visvis.cla(); visvis.clf()
		visvis.subplot(211)
		
		# Plot optimization statistics
		for values, colour in GetValueColourIter(self.optimization_log) :
			try : visvis.plot ( values, lc=colour ) 
			except Exception : pass
		
		visvis.xlabel ('iteration')
		visvis.ylabel ('Objective function')
		visvis.legend( self.optimization_log.keys() )
		
		# Display reference signal
		visvis.subplot(212)
			
		# Plot reference signal
		for values, colour in GetValueColourIter(self.log_reference_signal) :
			try : visvis.plot ( values, lc=colour ) 
			except Exception : pass
		
		visvis.xlabel ('iteration')
		visvis.ylabel ("Signal from reference pulse")
		visvis.legend( ["channel %d" % x for x in self.log_reference_signal.keys()] )
开发者ID:dibondar,项目名称:PyPhotonicReagents,代码行数:34,代码来源:odd_tab.py


示例4: ShowImg

	def ShowImg (self) :
		"""
		Draw image
		"""
		if self._abort_img  :
			# Exit
			return
		
		# Get image
		img = self.dev.StopImgAqusition()
		
		# Display image
		try :
			if img <> RETURN_FAIL :
				self._img_plot.SetData(img)
		except AttributeError :
			visvis.cla()
			visvis.clf()
			self._img_plot = visvis.imshow(img)
			visvis.title ('Camera view')
			ax = visvis.gca()
			ax.axis.xTicks = []
			ax.axis.yTicks = []
		
		# Start acquisition of histogram
		self.dev.StartImgAqusition()
		wx.CallAfter(self.ShowImg)
开发者ID:dibondar,项目名称:PyPhotonicReagents,代码行数:27,代码来源:thorlabs_camera.py


示例5: show

def show(items, normals=None):
    """Function that shows a mesh object.
    """
    for item in items:
        vv.clf()
        # convert to visvis.Mesh class
        new_normals = []
        new_vertices = []
        for k, v in item.vertices.iteritems():
            new_normals.append(item.normal(k))
            new_vertices.append(v)
        mesh = item.to_visvis_mesh()

        mesh.SetVertices(new_vertices)
        mesh.SetNormals(new_normals)
        mesh.faceColor = 'y'
        mesh.edgeShading = 'plain'
        mesh.edgeColor = (0, 0, 1)

    axes = vv.gca()
    if axes.daspectAuto is None:
        axes.daspectAuto = False
    axes.SetLimits()

    if normals is not None:
        for normal in normals:
            sl = solidLine(normal, 0.15)
            sl.faceColor = 'r'

    # Show title and enter main loop
    vv.title('Show')
    app = vv.use()
    app.Run()
开发者ID:simphony,项目名称:nfluid,代码行数:33,代码来源:show.py


示例6: StartInteractivelyMeasureSpectrum

	def StartInteractivelyMeasureSpectrum (self, event) :
		"""
		This method display spectrum
		"""
		button = self.show_spectrum_button
		
		if button.GetLabel() == button.__start_label__ :
			self.StopAllJobs()
			# get spectrometer's settings
			spect_settings = self.SettingsNotebook.Spectrometer.GetSettings()
			
			# Initiate spectrometer
			if self.Spectrometer.SetSettings(spect_settings) == RETURN_FAIL : return
			
			try : self.wavelengths = self.Spectrometer.GetWavelengths()
			except AttributeError : self.wavelengths = None
			
			# Clearing the figure
			visvis.cla(); visvis.clf();		
			
			# Set up timer to draw spectrum
			TIMER_ID = wx.NewId()
			self.spectrum_timer =  wx.Timer (self, TIMER_ID)
			self.spectrum_timer.Start (spect_settings["exposure_time"])
			wx.EVT_TIMER (self, TIMER_ID, self.DrawSpectrum)
			
			# Chose plotting options 
			try :
				self.is_autoscaled_spectrum = not(spect_settings["fix_vertical_axis"])
			except KeyError :
				self.is_autoscaled_spectrum = True
				
			if not self.is_autoscaled_spectrum :
				self.spectrum_plot_limits = ( spect_settings["vertical_axis_min_val"],
											spect_settings["vertical_axis_max_val"] )
			
			# Change button's label
			button.SetLabel (button.__stop_label__)
		
		elif button.GetLabel() == button.__stop_label__ :		
			# Stopping timer
			self.spectrum_timer.Stop()
			del self.spectrum_timer
			# Delete the parameter for auto-scaling
			del self.spectrum_plot_limits, self.is_autoscaled_spectrum
			
			# Delate visvis objects
			try : del self.__interact_2d_spectrum__
			except AttributeError : pass
			try : del self.__interact_1d_spectrum__
			except AttributeError : pass
			
			# Change button's label
			button.SetLabel (button.__start_label__) 
			
		else : raise ValueError("Label is not recognized") 
开发者ID:dibondar,项目名称:PyPhotonicReagents,代码行数:56,代码来源:basic_window.py


示例7: paint

    def paint(self, visvis):
        vv.clf()

        colors = ["r", "g", "b", "c", "m", "y", "k"]
        for index, dataset in enumerate(self._value):
            l = visvis.plot(dataset, ms="o", mc=colors[index % len(colors)], mw="3", ls="", mew=0)
            l.alpha = 0.3

        self._a = vv.gca()
        self._a.daspectAuto = True
开发者ID:UmSenhorQualquer,项目名称:pyforms,代码行数:10,代码来源:ControlVisVis.py


示例8: _Plot

 def _Plot(self, event):
     # Make sure our figure is the active one
     # If only one figure, this is not necessary.
     #vv.figure(self.fig.nr)
     
     # Clear it:
     vv.clf()
     
     # Plot:
     pcv.drawDisplacements(self.a, self.coords, self.edof, self.dofsPerNode, self.elType, doDrawUndisplacedMesh=True, title="Example 09")
开发者ID:CALFEM,项目名称:calfem-python,代码行数:10,代码来源:Mesh_Ex_09.py


示例9: paint

    def paint(self, visvis):
        vv.clf()  
        
        colors = ['r','g','b','c','m','y','k']
        for index, dataset in enumerate(self._value):
            l = visvis.plot(dataset, ms='o', mc=colors[ index % len(colors) ], mw='3', ls='', mew=0 )
            l.alpha = 0.3

        self._a = vv.gca()
        self._a.daspectAuto = True
开发者ID:ColinBrosseau,项目名称:pyforms,代码行数:10,代码来源:ControlVisVis.py


示例10: MeasureSingleSpectrum

	def MeasureSingleSpectrum (self, event=None) :
		"""
		Button <self.show_spectrum_button> was clicked
		"""
		button = self.show_spectrum_button
		
		if button.GetLabel() == button.__start_label__ :
			self.StopAllJobs()
			# get spectrometer's settings
			spect_settings = self.SettingsNotebook.Spectrometer.GetSettings()
			
			# Initiate spectrometer
			if self.Spectrometer.SetSettings(spect_settings) == RETURN_FAIL : return
			self.wavelengths = self.Spectrometer.GetWavelengths()
			
			# Clearing the figure
			visvis.clf()
		
			def draw_spectrum (event) :
				"""Timer function """
				spectrum = self.Spectrometer.AcquiredData() 
				if spectrum == RETURN_FAIL : return
				# Display the spectrum
				
				############### Take the log of spectrum ##########
				#spectrum = spectrum / float(spectrum.max())
				#np.log10(spectrum, out=spectrum)
				##############################
				
				ax = visvis.gca()
				ax.Clear()	
				visvis.plot (self.wavelengths, spectrum)
				visvis.xlabel("wavelength (nm)")
				visvis.ylabel("counts")
				
				# Display the current temperature
				visvis.title ("Temperature %d (C)" % self.Spectrometer.GetTemperature() )
				
			# Set up timer to draw spectrum
			TIMER_ID = wx.NewId()
			self.spectrum_timer =  wx.Timer (self, TIMER_ID)
			self.spectrum_timer.Start (spect_settings["exposure_time"])
			
			# Change button's label
			button.SetLabel (button.__stop_label__)
			wx.EVT_TIMER (self, TIMER_ID, draw_spectrum)
			
		elif button.GetLabel() == button.__stop_label__ :
			# Stopping timer
			self.spectrum_timer.Stop()
			del self.spectrum_timer
			# Change button's label
			button.SetLabel (button.__start_label__) 
			
		else : raise ValueError("Label is not recognized") 
开发者ID:dibondar,项目名称:PyPhotonicReagents,代码行数:55,代码来源:main.py


示例11: main

def main(select=3, **kwargs):
    """Script main function.

    select: int
        1: Medical data
        2: Blocky data, different every time
        3: Two donuts
        4: Ellipsoid

    """
    import visvis as vv  # noqa: delay import visvis and GUI libraries

    # Create test volume
    if select == 1:
        vol = vv.volread('stent')
        isovalue = kwargs.pop('level', 800)
    elif select == 2:
        vol = vv.aVolume(20, 128)
        isovalue = kwargs.pop('level', 0.2)
    elif select == 3:
        with timer('computing donuts'):
            vol = donuts()
        isovalue = kwargs.pop('level', 0.0)
        # Uncommenting the line below will yield different results for
        # classic MC
        # vol *= -1
    elif select == 4:
        vol = ellipsoid(4, 3, 2, levelset=True)
        isovalue = kwargs.pop('level', 0.0)
    else:
        raise ValueError('invalid selection')

    # Get surface meshes
    with timer('finding surface lewiner'):
        vertices1, faces1 = marching_cubes_lewiner(vol, isovalue, **kwargs)[:2]

    with timer('finding surface classic'):
        vertices2, faces2 = marching_cubes_classic(vol, isovalue, **kwargs)

    # Show
    vv.figure(1)
    vv.clf()
    a1 = vv.subplot(121)
    vv.title('Lewiner')
    m1 = vv.mesh(np.fliplr(vertices1), faces1)
    a2 = vv.subplot(122)
    vv.title('Classic')
    m2 = vv.mesh(np.fliplr(vertices2), faces2)
    a1.camera = a2.camera

    # visvis uses right-hand rule, gradient_direction param uses left-hand rule
    m1.cullFaces = m2.cullFaces = 'front'  # None, front or back

    vv.use().Run()
开发者ID:ThomasWalter,项目名称:scikit-image,代码行数:54,代码来源:visual_test.py


示例12: _Plot

 def _Plot(self, event):
     
     # Make sure our figure is the active one
     # If only one figure, this is not necessary.
     #vv.figure(self.fig.nr)
     
     # Clear it
     vv.clf()
     
     # Plot
     vv.plot([1,2,3,1,6])
     vv.legend(['this is a line'])        
开发者ID:chiluf,项目名称:visvis.dev,代码行数:12,代码来源:embeddingInFLTK.py


示例13: __plot

    def __plot(self, spectrum):
        vv.clf()
        axes = vv.gca()
        axes.axis.showGrid = True
        axes.axis.xLabel = 'Frequency (MHz)'
        axes.axis.yLabel = 'Level (dB)'

        total = len(spectrum)
        count = 0.
        for _time, sweep in spectrum.items():
            alpha = (total - count) / total
            vv.plot(sweep.keys(), sweep.values(), lw=1, alpha=alpha)
            count += 1
开发者ID:PatMart,项目名称:RTLSDR-Scanner,代码行数:13,代码来源:rtlsdr_scan_view.py


示例14: AnalyzeTotalFluorescence

	def AnalyzeTotalFluorescence (self, event=None) :
		"""
		`analyse_button` was clicked
		"""
		# Get current settings
		settings = self.GetSettings()
	
		# Apply peak finding filter
		signal = self.peak_finders[ settings["peak_finder"] ](self.total_fluorescence)
		
		# Scale to (0,1)
		signal -= signal.min()
		signal = signal / signal.max()
		
		##########################################################################
		
		# Partition signal into segments that are above the background noise  
		#signal = gaussian_filter(total_fluorescence, sigma=0.5)
		background_cutoff = settings["background_cutoff"]
		segments = [ [] ]
		for num, is_segment in enumerate( signal > background_cutoff ) :
			if is_segment : 
				# this index is in the segment
				segments[-1].append( num )
			elif len(segments[-1]) : # this condition is not to add empty segments
				# Start new segments
				segments.append( [] )
		
		# Find peaks as weighted average of the segment
		peaks = [ np.average(self.positions[S], weights=self.total_fluorescence[S]) for S in segments if len(S) ]
		
		##########################################################################
		
		# Saving the positions
		self.chanel_positions_ctrl.SetValue( ", ".join( "%2.4f" % p for p in peaks ) )
		
		##########################################################################
		
		# Plot acquired data
		visvis.cla(); visvis.clf()
		
		visvis.plot( self.positions, signal )
		visvis.plot( peaks, background_cutoff*np.ones(len(peaks)), ls=None, ms='+', mc='r', mw=20)
		visvis.plot( [self.positions.min(), self.positions.max()], [background_cutoff, background_cutoff], lc='r', ls='--', ms=None)
		
		visvis.legend( ["measured signal", "peaks found", "background cut-off"] )
		
		visvis.ylabel( "total fluorescence") 
		visvis.xlabel( 'position (mm)')
		
		
开发者ID:dibondar,项目名称:PyPhotonicReagents,代码行数:49,代码来源:sample_switcher.py


示例15: setupAxes

    def setupAxes(self):
        """
            Sets up the axes initially.  Shows a 2d view with a range based 
            on the sensor positions.  Might want to give the user the option to set the range
            in future releases.
            The if statement is for when the sensors got switched.. which only
            happens on 2 subjects, but totally messes up the axes view then.
            
        """
        vv.clf()    
        self.axes = vv.gca()
        self.axisLabeler = self.axes.axis
        self.axes.cameraType = 3
        self.axes.daspectAuto= False

        #.SetLimits(#rangeX = (xmin,xmax),rangeY = (ymin,ymax), rangeZ = (zmin,zmax))
        self.axisLabeler.showGrid = True
开发者ID:MUSpeechLab,项目名称:TOAK,代码行数:17,代码来源:dataController.py


示例16: plot

    def plot(self, new_point):
        vv.clf()
        # checking amount of points
        length = max(len(self.points[0]) - 90, len(self.points_i[0]) - 90, 0)
        if self.check_u.checkState():
            # plots points for voltage if voltage is on
            self.plot_point_set(new_point[:2], 'b', length)
        if self.check_i.checkState():
            # plots points for currency if currency is on
            self.plot_point_set([new_point[0], new_point[2]], 'r', length, i=True)

        first_point = self.points_i[0][0] if self.check_i.checkState() else self.points[0][0]

        # set Axes limits on current time
        self.fig.currentAxes.SetLimits((first_point, first_point+10), (-5, 5))
        self.fig.currentAxes.axis.showGrid = True
        self.fig.DrawNow()
开发者ID:LeaFin,项目名称:meissner-oszillator,代码行数:17,代码来源:meissner_oszillator.py


示例17: DrawSpectrum

	def DrawSpectrum (self, event) :
		"""
		Draw spectrum interactively
		"""		
		spectrum = self.Spectrometer.AcquiredData() 
		if spectrum == RETURN_FAIL : return
		# Display the spectrum
		if len(spectrum.shape) > 1:
			try :
				self.__interact_2d_spectrum__.SetData(spectrum)
			except AttributeError :
				visvis.cla(); visvis.clf(); 	
				# Spectrum is a 2D image
				visvis.subplot(211)
				self.__interact_2d_spectrum__ = visvis.imshow(spectrum, cm=visvis.CM_JET)
				visvis.subplot(212)
				
			# Plot a vertical binning
			spectrum = spectrum.sum(axis=0)
			
		# Linear spectrum
		try :
			self.__interact_1d_spectrum__.SetYdata(spectrum)	
		except AttributeError :
			if self.wavelengths is None : 
				self.__interact_1d_spectrum__ = visvis.plot (spectrum, lw=3)
				visvis.xlabel ("pixels")
			else : 
				self.__interact_1d_spectrum__ = visvis.plot (self.wavelengths, spectrum, lw=3)
				visvis.xlabel("wavelength (nm)")
			visvis.ylabel("counts")
			
		if self.is_autoscaled_spectrum :
			# Smart auto-scale linear plot
			try :
				self.spectrum_plot_limits = GetSmartAutoScaleRange(spectrum, self.spectrum_plot_limits)
			except AttributeError :
				self.spectrum_plot_limits = GetSmartAutoScaleRange(spectrum)
		
		visvis.gca().SetLimits ( rangeY=self.spectrum_plot_limits )
		
		# Display the current temperature
		try : visvis.title ("Temperature %d (C)" % self.Spectrometer.GetTemperature() )
		except AttributeError : pass
开发者ID:dibondar,项目名称:PyPhotonicReagents,代码行数:44,代码来源:basic_window.py


示例18: _Plot

    def _Plot(self, event):
        # Make sure our figure is the active one
        # If only one figure, this is not necessary.
        # vv.figure(self.fig.nr)

        # Clear it
        vv.clf()

        song = wave.open("C:\Users\Mario\Desktop\infoadex antonio\\20150617070001.wav", 'r')
        frames = song.getnframes()
        ch = song.getnchannels()
        song_f = song.readframes(ch*frames)
        data = np.fromstring(song_f, np.int16)

        print data

        # Plot
        # vv.plot([1,2,3,1,6])
        vv.plot(data)
        vv.legend(['this is a line'])
开发者ID:Edasn,项目名称:CaptorRadio-v2,代码行数:20,代码来源:visualizador_visvis.py


示例19: set_mesh

    def set_mesh(self, mesh):
        vv.clf()
        self._vv_widget = vv.gcf()
        self._vv_widget._widget.show()
        self.main_win.setCentralWidget(self.widget())
        if mesh:
            v_mesh = mesh.to_visvis_mesh()
            v_mesh.faceColor = 'y'
            v_mesh.edgeShading = 'plain'
            v_mesh.edgeColor = (0, 0, 1)

            axes = vv.gca()
            if axes.daspectAuto is None:
                axes.daspectAuto = False
            axes.SetLimits()
            axes.legend = 'X', 'Y', 'Z'
            axes.axis.showGrid = True
            axes.axis.xLabel = 'X'
            axes.axis.yLabel = 'Y'
            axes.axis.zLabel = 'Z'
开发者ID:simphony,项目名称:nfluid,代码行数:20,代码来源:visualizer.py


示例20: show

def show(self):
    
    import visvis as vv
    
    # If there are many tests, make a selection
    if len(self._tests) > 1000:
        tests = random.sample(self._tests, 1000)
    else:
        tests = self._tests
    
    # Get ticks
    nn = [test[0] for test in tests]
    
    # Create figure
    vv.figure(1)
    vv.clf()
    
    # Prepare kwargs
    plotKwargsText = {'ms':'.', 'mc':'b', 'mw':5, 'ls':''}
    plotKwargsBin = {'ms':'.', 'mc':'r', 'mw':5, 'ls':''}
    
    # File size against number of elements
    vv.subplot(221)
    vv.plot(nn, [test[2][0] for test in tests], **plotKwargsText)
    vv.plot(nn, [test[2][1] for test in tests], **plotKwargsBin)
    vv.legend('text', 'binary')
    vv.title('File size')
    
    # Speed against number of elements
    vv.subplot(223)
    vv.plot(nn, [test[1][4] for test in tests], **plotKwargsText)
    vv.plot(nn, [test[1][6] for test in tests], **plotKwargsBin)
    vv.legend('text', 'binary')
    vv.title('Save time')
    
    # Speed (file) against number of elements
    vv.subplot(224)
    vv.plot(nn, [test[1][5] for test in tests], **plotKwargsText)
    vv.plot(nn, [test[1][7] for test in tests], **plotKwargsBin)
    vv.legend('text', 'binary')
    vv.title('Load time')
开发者ID:binaryannamolly,项目名称:visvis,代码行数:41,代码来源:test_random.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python visvis.figure函数代码示例发布时间:2022-05-26
下一篇:
Python visualizer.Visualizer类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap