partitionFollowingCurve

maelzel.distribute.partitionFollowingCurve(n, curve, ratio=0.5, margin=0.1, method='brentq')[source]

Partition n following curve

The difference with partitionWithCurve() is that in that function you determine the number of partitions manually whereas here the number of partitions is determined as a ratio of the possible number of partitions. This ensures that you always get a valid result (albeit a trivial one if, for example, n can only be split in 1 partition of n)

Parameters:
  • n (int) – the number to partition

  • curve (BpfInterface) – a bpf

  • ratio – ratio indicates the number of partitions, where 0 means the least number of partitions possible and 1 means the most number of partitions possible

  • margin – sets the max and min possible partitions as a ratio between the max and min value of the given curve.

Return type:

list[float]

Returns:

the list of the partitions

See also

partitionWithCurve(), roundSeroundSeqPreservingSum()