Partition integer n into parts such that the sum of all parts in parts equals n and such that the proportions between the parts in parts equals the the proportions in ratio with some rounding magic.
abjad> mathtools.partition_integer_by_ratio(10, [1])
[10]
abjad> mathtools.partition_integer_by_ratio(10, [1, 1])
[5, 5]
abjad> mathtools.partition_integer_by_ratio(10, [1, 1, 1])
[3, 4, 3]
abjad> mathtools.partition_integer_by_ratio(10, [1, 1, 1, 1])
[3, 2, 3, 2]
abjad> mathtools.partition_integer_by_ratio(10, [1, 1, 1, 1, 1])
[2, 2, 2, 2, 2]
abjad> ratio(10, [1, 2])
[3, 7]
abjad> ratio(10, [3, 1])
[8, 2]
abjad> ratio(10, [3, 2])
[6, 4]
Raise TypeError on noninteger n:
abjad> mathtools.partition_integer_by_ratio('foo', [1, 1, 3])
TypeError
Raise ValueError on nonpositive n:
abjad> mathtools.partition_integer_by_ratio(-1, [1, 1, 3])
ValueError