All Samples(2983) | Call(2466) | Derive(0) | Import(517)
ceil(x) Return the ceiling of x as a float. This is the smallest integral value >= x.
src/p/y/pygrace-HEAD/trunk/Examples/example_tools.py pygrace(Download)
def colorplot():
from random import normalvariate
from math import floor,ceil
# generate some synthetic data from eliptical Gaussian
data = []
for i in range(10000):
# create quick and dirty histogram
delta = 0.2
f = lambda zs: floor(min(zs)/delta)*delta
g = lambda zs: ceil(max(zs)/delta)*delta
xmin,ymin = map(f,zip(*data))
xmax,ymax = map(g,zip(*data))
bins = []
src/p/y/pygrace-HEAD/Examples/example_tools.py pygrace(Download)
def colorplot():
from random import normalvariate
from math import floor,ceil
# generate some synthetic data from eliptical Gaussian
data = []
for i in range(10000):
# create quick and dirty histogram
delta = 0.2
f = lambda zs: floor(min(zs)/delta)*delta
g = lambda zs: ceil(max(zs)/delta)*delta
xmin,ymin = map(f,zip(*data))
xmax,ymax = map(g,zip(*data))
bins = []
src/s/h/shedskin-HEAD/examples/sieve.py shedskin(Download)
from math import sqrt, ceil
from sys import argv
def sieveOfAtkin(end):
"""sieveOfAtkin(end): return a list of all the prime numbers <end
using the Sieve of Atkin."""
# Code by Steve Krenzel, <Sgk284@gmail.com>, improved
for x in xrange(1, x_max + 1):
x2 += xd
xd += 6
if x2 >= end: y_min = (((int(ceil(sqrt(x2 - end))) - 1) << 1) - 2) << 1
n, n_diff = ((x*x + x) << 1) - 1, (((x-1) << 1) - 2) << 1
for d in xrange(n_diff, y_min, -8):
if n % 12 == 11:
src/b/o/boost_music-HEAD/examples/eventreceiver.py boost_music(Download)
#!/usr/bin/python import sys import boostmusic as music import numpy from math import floor,ceil
music.nanosleep(s)
elif Dt<0:
n = int(ceil(-Dt / dt))
print "Warning: recv lag of %f seconds, skipping %d ticks" % (-Dt,n)
for i in range(n):
runtime.tick()
src/b/o/boost_music-HEAD/examples/eventgenerator.py boost_music(Download)
#!/usr/bin/python import sys import boostmusic as music import numpy from math import floor,ceil
#print "Warning: gen lead of %f seconds, sleeping %f s" % (Dt,s)
music.nanosleep(s)
elif Dt<0:
n = ceil(-Dt / dt)
print "Warning: gen lag of %f seconds, skipping %d ticks" % (-Dt,n)
for i in range(n):
runtime.tick()
src/s/h/shedskin-HEAD/examples/sudoku2.py shedskin(Download)
# (c) Peter Goodspeed # --- coriolinus@gmail.com # # sudoku solver from math import ceil from time import time
def cell(self, num):
return int(ceil((num + 1) / 3.0)) - 1
def __str__(self):
ret = ""
for row in xrange(9):
if row == 3 or row == 6: ret += (((3 * "---") + "+") * 3)[:-1] + "\n"
src/e/m/emulica-HEAD/trunk/doc/examples/scripting.py emulica(Download)
from emulica import emulation, plot from emulica.emulation import Process, put, get, Report, Request, Store from math import ceil
(destination, date_fin) = dates_fin[0]
print "duree de production", date_fin - t - tsetup
print "qte a faire:", q_todo, "qte calculee", ceil((date_fin - t - tsetup) / uta[type_choisi])
q = min(q_todo, max(q_min, ceil((date_fin - t - tsetup) / uta[type_choisi])))
print "q=", q
schedule.append_lot(type_choisi, q, destination)
src/e/m/emulica-HEAD/doc/examples/scripting.py emulica(Download)
from emulica import emulation, plot from emulica.emulation import Process, put, get, Report, Request, Store from math import ceil
(destination, date_fin) = dates_fin[0]
print "duree de production", date_fin - t - tsetup
print "qte a faire:", q_todo, "qte calculee", ceil((date_fin - t - tsetup) / uta[type_choisi])
q = min(q_todo, max(q_min, ceil((date_fin - t - tsetup) / uta[type_choisi])))
print "q=", q
schedule.append_lot(type_choisi, q, destination)
src/p/y/PyProp-HEAD/examples/tensor/helium_stabilization/submit.py PyProp(Download)
from math import ceil #------------------------------------------------------------------------------------ # Job Submit Functions #------------------------------------------------------------------------------------
jscript.walltime = timedelta(hours=args.get("runHours",1), minutes=0, seconds=0)
jscript.ppn = args.get("ppn", 4)
jscript.proc_memory = args.get("proc_memory", "1000mb")
jscript.nodes = int(ceil(numProcs / float(jscript.ppn)))
jscript.interconnect = args.get("interconnect", "ib")
if installation == "stallo":
jscript.workingdir = args.get("workingDir", "/home/nepstad/proj/argon/")
src/s/p/spasmos-HEAD/trunk/src/Spasmos/Factories/SPH.py spasmos(Download)
def __iter__(self):
from math import pi, ceil, cos, sin, sqrt
if isinstance(self.center, XY.Vector):
if self.height is not None:
raise RuntimeError, \
'Height of cylinder cannot be given in XY coordinates.'
# Compute the cylinder's volume and mass (assuming unit height).
lastxij = self.center
ri = (0.5+i)*dr
dphi = dr/ri
Nphi = int(ceil(2 * pi / dphi))
for j in xrange(Nphi):
phi = j*dphi
dx = dr*cos(phi)
lastxij = self.center + XYZ.Vector(0, 0, zk)
ri = (0.5+i)*dr
dphi = dr/ri
Nphi = int(ceil(2 * pi / dphi))
for j in xrange(Nphi):
phi = j*dphi
dx = dr*cos(phi)
def __iter__(self):
from math import pi, ceil, cos, sin
if isinstance(self.center, R.Vector):
# Compute the sphere's volume and nodal mass. Here, each node
# represents a spherical shell.
nodes = []
V = 4.0/3.0 * pi*self.radius**3
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 Next