• Facebook
  • Twitter
  • Reddit
  • StumbleUpon
  • Digg
  • email

All Samples(1751)  |  Call(1630)  |  Derive(0)  |  Import(121)
fabs(x)

Return the absolute value of the float x.

src/p/y/pyjamas-0.7/examples/libtest/RandomModuleTest.py   Pyjamas(Download)
    from math import fsum as msum
except:
    # fsum is new in 2.6
    from math import fabs
    def msum(x):
        xx = [(fabs(v), i) for i, v in enumerate(x)]
        xx.sort()

src/p/y/pygtk-HEAD/examples/pygtk-demo/demos/pixbufs.py   pygtk(Download)
            if dest is not None:
                if i % 2 == 0:
                    alpha = int(
                        max(127, math.fabs(255 * math.cos(f * 2.0 * math.pi))))
                else:
                    alpha = int(
                        max(127, math.fabs(255 * math.sin(f * 2.0 * math.pi))))

src/s/h/shedskin-HEAD/examples/mao.py   shedskin(Download)
Original version of AO bench was written by Syoyo Fujita. The original code(Proce55ing version) is licensed under BSD3 license. You can freely modify, port and distribute AO bench
'''
 
from math import sqrt, sin, cos, fabs
import random
from array import array
 
def vnormalize(c):
    length = sqrt(vdot(c, c))
 
    if fabs(length) > 1.0e-17:
        c.x /= length
        c.y /= length
        c.z /= length

src/x/a/xal2-HEAD/trunk/src/jparc/scripts/examples/Lattice.py   xal2(Download)
# $Id $
############################################################################
import sys
from math import fabs
############################################################################
LatticeError="LATTICE_ERROR:"
true =(1>0)  #get true
		if drift_len < -eps:
			#ooops negative length: severe error
			raise LatticeError,"length is negative when appending: "+element.getName()
		elif fabs(drift_len) < eps:
			#too short drift: ignore
			pass
		else:
			el_len=el.getLength()
			next_pos=next.getPosition()
			next_len=next.getLength()
			if fabs(el_pos+(el_len+next_len)*0.5-next_pos) > eps:
				raise LatticeError,"inconsistent distances between "+el.getName()+" and "+next.getName()
#.........................................................
class Element:
	def getSlicePositions(self,cut_pos):
		"""NOT FOR PUBLIC USE"""
		#calculate length and position of sliced parts
		up_len=cut_pos-self.getStartPosition()
		if fabs(up_len) < eps: up_len = 0
		dn_len=self.getLength()-up_len
		if fabs(dn_len) < eps: dn_len = 0
		upstream=CLASS(positions[0],positions[1],self.getName())
		dnstream=CLASS(positions[2],positions[3],self.getName()+"+")
		marker=Marker(cut_pos)
		if fabs(upstream.getLength()) < eps:
			return [insert,marker,self]
		elif fabs(dnstream.getLength()) < eps:
			return [self,marker,insert]
	def getUpstreamDrift(self):
		"""Return the upstream drift space."""
		len=self.getEffLength()*0.5
		position=Element.getPosition(self)
		if fabs(len) < eps:
			return Marker(position)
		else:
	def getDownstreamDrift(self):
		"""Return the downstream drift space."""
		len=self.getEffLength()*0.5
		position=Element.getPosition(self)
		if fabs(len) < eps:
			return Marker(position)
		else:

src/b/a/baum-HEAD/examples/guitest/guitest.py   baum(Download)
           for val in curve1:
               curve3.append( math.cos(val) );
               curve4.append( math.tan(val) );
               curve5.append( math.fabs(val) );
 
           node.AddChild(Baum.Table("5 Column Table", [curve1,curve2, curve3,curve4,curve5], ["Curve 1", "Curve 2","Curve 3", "Curve 4","Curve 5",] ))
 

src/x/a/xal2-HEAD/src/jparc/scripts/examples/Lattice.py   xal2(Download)
# $Id $
############################################################################
import sys
from math import fabs
############################################################################
LatticeError="LATTICE_ERROR:"
true =(1>0)  #get true
		if drift_len < -eps:
			#ooops negative length: severe error
			raise LatticeError,"length is negative when appending: "+element.getName()
		elif fabs(drift_len) < eps:
			#too short drift: ignore
			pass
		else:
			el_len=el.getLength()
			next_pos=next.getPosition()
			next_len=next.getLength()
			if fabs(el_pos+(el_len+next_len)*0.5-next_pos) > eps:
				raise LatticeError,"inconsistent distances between "+el.getName()+" and "+next.getName()
#.........................................................
class Element:
	def getSlicePositions(self,cut_pos):
		"""NOT FOR PUBLIC USE"""
		#calculate length and position of sliced parts
		up_len=cut_pos-self.getStartPosition()
		if fabs(up_len) < eps: up_len = 0
		dn_len=self.getLength()-up_len
		if fabs(dn_len) < eps: dn_len = 0
		upstream=CLASS(positions[0],positions[1],self.getName())
		dnstream=CLASS(positions[2],positions[3],self.getName()+"+")
		marker=Marker(cut_pos)
		if fabs(upstream.getLength()) < eps:
			return [insert,marker,self]
		elif fabs(dnstream.getLength()) < eps:
			return [self,marker,insert]
	def getUpstreamDrift(self):
		"""Return the upstream drift space."""
		len=self.getEffLength()*0.5
		position=Element.getPosition(self)
		if fabs(len) < eps:
			return Marker(position)
		else:
	def getDownstreamDrift(self):
		"""Return the downstream drift space."""
		len=self.getEffLength()*0.5
		position=Element.getPosition(self)
		if fabs(len) < eps:
			return Marker(position)
		else:

src/q/u/quickflash-HEAD/branch_tags/octave-swig/QuickFlash-1.0.0-Octave-1.0/examples/boxcount/rounding.py   quickflash(Download)
def value_close(value, ref_value, precision) :
 
    ret_val = False
 
    delta = math.fabs(value - ref_value)
 
    if (delta < precision) :

src/q/u/quickflash-HEAD/branch_tags/octave-swig/QuickFlash-1.0.0-Octave-1.0/examples/volume_analysis/build_frames.py   quickflash(Download)
 
            plot_data_delta_y = plot_max_data - plot_min_data
 
            plotaxes.set_axis_label_font_size(math.fabs(plot_data_delta_y
                                                        * 0.05))
 
            plotport.add_child_object(plotaxes)

src/q/u/quickflash-HEAD/trunk/examples/volume_analysis/build_frames.py   quickflash(Download)
 
            plot_data_delta_y = plot_max_data - plot_min_data
 
            plotaxes.set_axis_label_font_size(math.fabs(plot_data_delta_y
                                                        * 0.05))
 
            plotport.add_child_object(plotaxes)

src/q/u/quickflash-HEAD/rtflame/examples/volume_analysis/build_frames.py   quickflash(Download)
 
            plot_data_delta_y = plot_max_data - plot_min_data
 
            plotaxes.set_axis_label_font_size(math.fabs(plot_data_delta_y
                                                        * 0.05))
 
            plotport.add_child_object(plotaxes)

  1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9  Next