utilities

animation

gif_from_images

Create an animated GIF from a series of images.

async

await_callback

Wait for the completion of an asynchronous code that uses callbacks to signal completion.

datetime

timestamp

now

decorators

memoize

Decorator to wrap a function with a memoizing callable.

functions

fibonacci

binomial_coefficient

Returns the binomial coefficient of the \(x^k\) term in the polynomial expansion of the binomial power \((1 + x)^n\) [wikipedia2017j].

itertools

take

Return first n items of the iterable as a list

tabulate

Return function(0), function(1), …

tail

Return an iterator over the last n items

consume

Advance the iterator n-steps ahead.

nth

Returns the nth item or a default value

all_equal

Returns True if all the elements are equal to each other

quantify

Count how many times the predicate is true

padnone

Returns the sequence elements and then returns None indefinitely.

ncycles

Returns the sequence elements n times

dotproduct

flatten

Flatten one level of nesting

repeatfunc

Repeat calls to func with specified arguments.

pairwise

s -> (s0,s1), (s1,s2), (s2, s3), …

window

Returns a sliding window (of width n) over data from the iterable.

roundrobin

roundrobin(‘ABC’, ‘D’, ‘EF’) –> A D E B F C

powerset

unique_justseen

List unique elements, preserving order.

iter_except

Call a function repeatedly until an exception is raised.

first_true

Returns the first true value in the iterable.

random_permutation

Random selection from itertools.permutations(iterable, r)

random_combination

Random selection from itertools.combinations(iterable, r)

random_combination_with_replacement

Random selection from itertools.combinations_with_replacement(iterable, r)

maps

geometric_key

Convert XYZ coordinates to a string that can be used as a dict key.

reverse_geometric_key

Reverse a geometric key string into xyz coordinates.

geometric_key2

Convert XY coordinates to a string that can be used as a dict key.

normalize_values

Normalize a list of numbers to the range between new_min and new_max.

profiling

print_profile

Decorate a function with automatic profile printing.

remote

statistics

average

Average of a list.

variance

Variance of a list.

standard_deviation

Standard deviation of a list.

xfunc

XFunc

Wrapper for functions that turns them into externally run processes.