Did I find the right examples for you? yes no

All Samples(87330)  |  Call(86697)  |  Derive(632)  |  Import(1)
float(x) -> floating point number

Convert a string or number to a floating point number, if possible.

src/p/y/PyNN-0.7.5/examples/IF_cond_alpha.py   PyNN(Download)
                                'e_rev_E'  : 0.,     'e_rev_I'    : -80.})
 
spike_sourceE = create(SpikeSourceArray, {'spike_times': [float(i) for i in range(5,105,10)]})
spike_sourceI = create(SpikeSourceArray, {'spike_times': [float(i) for i in range(155,255,10)]})
 

src/s/h/shedskin-HEAD/examples/go.py   shedskin(Download)
    def score(self, color):
        if color == WHITE:
            count = KOMI + self.black_dead
        else:
            count = self.white_dead
    def score(self):
        winrate = self.wins/float(self.wins+self.losses)
        parentvisits = self.parent.wins+self.parent.losses
        if not parentvisits:
            return winrate
        if not amafvisits:
            return uct_score
        amafwinrate = self.parent.pos_amaf_wins[self.pos]/float(amafvisits)
        uct_amaf = amafwinrate + math.sqrt((math.log(self.parent.amafvisits))/(5*amafvisits))
 

src/s/h/shedskin-HEAD/examples/path_tracing.py   shedskin(Download)
    def trace(self, ray, n):
        mint = float("inf")
 
        # trace no more than 5 bounces
        if n > 4:

src/k/a/kamaelia-HEAD/trunk/Code/Python/Kamaelia/Examples/SoC2006/THF/Checkers/Checkers.py   kamaelia(Download)
            for j in range(3):
                if (i+j) %2 == 0:
                    x = float(i)-3.5
                    y = float(j)-3.5
                    piece = CheckersPiece(position=(x, y, -15), colour=(0.6,0,0)).activate()
            for j in range(5,8):
                if (i+j) %2 == 0:
                    x = float(i)-3.5
                    y = float(j)-3.5
                    piece = CheckersPiece(position=(x, y, -15), colour=(0,0,0.6)).activate()

src/n/i/nipy-HEAD/examples/labs/bayesian_structural_analysis.py   nipy(Download)
 
# set various parameters
theta = float(st.t.isf(0.01, 100))
dmax = 4. / 1.5
ths = n_subj / 4

src/q/u/quickflash-HEAD/netcdf/examples/flame_slicer/metadata_reader.py   quickflash(Download)
                if (current_metadata.has_key("Time")) :
 
                    time = float(current_metadata["Time"])
                    datafile_group.add_keyword_value("Time", time)
 
                elif (current_metadata.has_key("Flame pos")) :
 
                    pos = float(current_metadata["Flame pos"])
 
                    for elem in min_coords_str :
                        min_coords.append(float(elem))
 
                    datafile_group.add_keyword_value("Grid_Min_Coords",
 
                    for elem in max_coords_str :
                        max_coords.append(float(elem))
 
                    datafile_group.add_keyword_value("Grid_Max_Coords",
 
                    for elem in center_coords_str :
                        center_coords.append(float(elem))
 
                    datafile_group.add_keyword_value("Grid_Center",

src/l/a/Langtangen-HEAD/src/py/examples/canvas/planet3.py   Langtangen(Download)
    def __init__(self, x, y, radius=10, color='red', canvas=None):
        self.x = x; self.y = y;   # current physical center coordinates
        self.rc = radius;         # radius in canvas coords
        self.r = float(radius/C.xy_scale); # radius in physical coords
        self.color = color;

src/b/i/big-data-tools-HEAD/samplen.py   big-data-tools(Download)
    if i < N:
        sample.append(line)
    elif i >= N and random.random() < N/float(i+1):
        replace = random.randint(0,len(sample)-1)
        sample[replace] = line

src/g/d/GDAL-1.9.1/samples/ogr2ogr.py   GDAL(Download)
            oRing = ogr.Geometry(ogr.wkbLinearRing)
 
            oRing.AddPoint_2D( float(args[iArg+1]), float(args[iArg+2]) )
            oRing.AddPoint_2D( float(args[iArg+1]), float(args[iArg+4]) )
            oRing.AddPoint_2D( float(args[iArg+3]), float(args[iArg+4]) )

src/l/a/Langtangen-HEAD/src/py/examples/efficiency/pyefficiency.py   Langtangen(Download)
    e1.add('linspace(0, 1, n)',
           timeit.Timer('linspace(0, 1, %d)' % n,
                        setup='from numpy import linspace').timeit(rep)/float(rep))
    e1.add('zeros(n, float) (from numpy)',
           timeit.Timer('zeros(%d, float)' % n,
                        setup='from numpy import zeros').timeit(rep)/float(rep))
    e2.add('numpy.random.random(n)',
           timeit.Timer('random.random(%d)' % n,
                        setup='from numpy import random').timeit(rep)/float(rep))
    e2.add('RandomArray.random(n) (from Numeric)',
           timeit.Timer('RandomArray.random(%d)' % n,
                        setup='import RandomArray').timeit(rep)/float(rep))
 
    for module in 'numpy', 'Numeric', 'numarray':
        try:
            e1.add('arange(0, 1, 1./(n-1)) (from %s)' % module,
                   timeit.Timer('arange(0, 1, 1.0/(%d-1))' % n,
                   setup='from %s import arange' % module).timeit(rep)/float(rep))

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