Ejemplo n.º 1
0
def spatio_data_generator(territory={'x':100,'y':100}, seeds=[{'x':20,'y':20}, {'x':70,'y':70}, {'x':70,'y':40}], pts = [30, 20, 10], noise=10, eps=10):
    spatio = [] # result
    counter = itertools.count()
    # designated data
    for seed in seeds:
        for j in range(pts[next(counter)]):
            pos = []
            for coord, value in seed.items():
                pos.append(random.uniform(value-eps, value+eps))
            spatio.append(pos)
    # noise
    for i in range(0, noise):
        pos = []
        for coord, value in territory.items():
            pos.append(random.uniform(0, value))
        spatio.append(pos)
        
    return spatio
Ejemplo n.º 2
0
test = "google"
compress_ex(test)
ret = compress(test)
r1, r2 = itertools.tee(ret)
r3, r4 = itertools.tee(r1)
print list(r2)
print ''.join(decompress(r3))
decompress_ex(r4)

a = 'google'
b = 'yahoo'
iterm = itertools.chain(a, b)
for i in iterm:
    print i
iterm = itertools.count(11)
for i in iterm:
    if i == 21:
        break
    print i

iterm = itertools.cycle(a)
for i, n in enumerate(iterm):
    if i == 21:
        break
    print n
L = [
    "Marc Bolan", "David Bowie", "Mick Ronson", "Ian Hunter", "Morgan Fisher",
    "Brian Ferry", "Brian Eno", "Phil Manzanera", "Andy Mackay"
]
it = itertools.dropwhile(lambda item: item != 'Mick Ronson', L)
Ejemplo n.º 3
0
from functools import wraps
from timeit import itertools
import matplotlib.pyplot as plt_kd
import datetime
from matplotlib.path import Path
import matplotlib.patches as patches
import matplotlib.cm as cm
import matplotlib.colors as colors
import numpy
import dill
import pickle

id_label = 0
#fig_kd, ax1 = plt_kd.subplots() 
        
itertools.count(0)


__author__ = u'Stefan Kögl <*****@*****.**>'
__version__ = '0.12'
__website__ = 'https://github.com/stefankoegl/kdtree'
__license__ = 'ISC license'


# maps child position to its comparison operator
COMPARE_CHILD = {
    0: (operator.le, operator.sub),
    1: (operator.ge, operator.add),
}