distribute: Partition a number following a given distribution

maelzel.distribute Module

distribute

This module provides functionality to partition a number in multiple ways, (partitionFib, partitionExpon) or to subdivide it following a given distribution or curve.

Since many functions make use of curves, we rely heavily on the package bpf4, which allows to define and compute break-point-functions

Functions

chooseBestDistribution(values, possibleValues)

Reconstruct the given sequence with items from possibleValues

dataclass([cls, init, repr, eq, order, ...])

Returns the same class as was passed in, with dunder methods added based on the fields defined in the class.

ditherCurve(curve, numsamples[, resolution])

Sample curve applying dithering to smooth transitions

dohndt(numseats, votesPerParty)

Perform a D'Ohndt distribution

interleave(A, B[, weight])

interleave the elements of A and B

interleaveWithDynamicWeights(streamSizes, ...)

Interleave items of multiple streams based on dynamic weights

onepulse(x, resolution[, entropy])

Represents x as a seq.

partitionCurvedSpace(x, numpart, curve[, ...])

Partition a number x into numpart partitions following a curve

partitionExpon(n, numpart[, exp])

Partition n into numpart following an exponential curve

partitionFib(n, numpart)

Partition n into numpart partitions with fibonacci proportions

partitionFollowingCurve(n, curve[, ratio, ...])

Partition n following curve

partitionWithCurve(x, numpart, curve[, method])

Partition x in numparts parts following curve

plotFrames(xs[, ids, top, bottom, durs, ...])

Plot a seq.

pulseCurve(curve, n[, resolution, entropy, ...])

Generates a list of 0s/1s of length n, following the curve

roundSeqPreservingSum(seq[, maxdelta, ...])

Round sequence preserving its integer sum