scamp.utilities

Various and sundry utility functions used by SCAMP.

Classes

NoteProperty()

Parent class for class for classes like SpellingPolicy, StaffText and NotePlaybackAdjustment, which can be passed to the properties argument of play_note().

Functions

ceil_to_multiple(x, factor)

Returns the multiple of factor that is closest above x.

ceil_x_to_pow_of_y(x, y)

Returns the integer power of y that is closest above x.

floor_to_multiple(x, factor)

Returns the multiple of factor that is closest below x.

floor_x_to_pow_of_y(x, y)

Returns the integer power of y that is closest below x.

get_average_square_correlation(test_string, ...)

A test of the similarity of two strings via a (squared) cross-correlation of their characters.

get_standard_indispensability_array(...[, ...])

Returns a list of the indispensabilities of different pulses in a meter defined by the rhythmic_strata.

indigestibility(n)

Returns the indigestibility of a number per the theories of Clarence Barlow.

is_multiple(x, y)

Checks if x is a multiple of y.

is_prime(a)

Checks if a is a prime number.

is_x_pow_of_y(x, y)

Checks if x is an integer (including negative) power of y

iterate_all_subclasses(type_name)

Iterates all generations of subclasses of a type

make_flat_list(l[, indivisible])

Flattens a list, including ones containing multiple levels of nesting.

memoize(obj)

Decorator used for memoization (see https://en.wikipedia.org/wiki/Memoization)

prime_factor(n)

Returns a list of the prime factors of n.

resolve_package_path(path)

resolve_path(path)

Resolves the given path based on a variety of prefixes.

rotate(l, n)

Rotates a list such that it starts at the nth index and loops back to end at the (n-1)st

round_to_multiple(x, factor)

Returns the multiple of factor that is closest to x (above or below).

round_x_to_pow_of_y(x, y)

Returns the integer power of y that is closest to x (above or below).

sum_nested_list(l)

Sums up all of the values within a nested list.