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/g/d/GDAL-1.7.1/samples/densify.py GDAL(Download)
if self.options.remainder.upper() == "UNIFORM":
if d != 0.0:
threshold = float(d)/math.ceil(d/threshold)
else:
# duplicate point... throw it out
continue
if (d > threshold):
if self.options.remainder.upper() == "UNIFORM":
segcount = int(math.ceil(d/threshold))
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/v/t/VT-USRP-daughterboard-drivers_python-HEAD/gnuradio-examples/python/usrp/usrp_spectrum_sense.py VT-USRP-daughterboard-drivers_python(Download)
self.freq_step = 0.75 * usrp_rate
self.min_center_freq = self.min_freq + self.freq_step/2
nsteps = math.ceil((self.max_freq - self.min_freq) / self.freq_step)
self.max_center_freq = self.min_center_freq + (nsteps * self.freq_step)
self.next_freq = self.min_center_freq
src/c/u/CUV-HEAD/examples/rbm/helper_functions.py CUV(Download)
for step, row in enumerate(trans[200:200+maxp,:]):
img = row[0:28*28].reshape(28,28)
if (pltn-1 >= len(ax)):
ax.append(plt.subplot(math.ceil(maxp / 16), maxp / math.ceil(maxp/16), pltn))
ax[pltn-1].set_axis_off()
ax[pltn-1].matshow(img, cmap=plt.cm.bone_r)
plt.title( str(step) )
def visualization_grid_size(num_imgs):
v = math.sqrt(num_imgs)
if v==int(v):
return v,v
else:
return math.ceil(v),math.ceil(v)
#while v > 3:
src/p/y/python-cookbook-HEAD/cb2_examples/cb2_18_15_sol_1.py python-cookbook(Download)
def sum_with_partials(arr):
arr = list(arr)
size = len(arr)
iters = int(math.ceil(math.log(size) / math.log(2)))
step = 1
for itr in xrange(iters):
for i in xrange(0, size-step, step+step):
src/p/y/pyobjc-framework-Quartz-2.3/Examples/Core Image/CITransitionSelectorSample/TransitionSelectorView.py pyobjc-framework-Quartz(Download)
self.transitions = [None] * TRANSITION_COUNT
self.setupTransitions()
w = int(math.ceil(math.sqrt(TRANSITION_COUNT)))
origin = CGPoint()
for i in xrange(TRANSITION_COUNT):
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()
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 Next