music.Peals

class music.Peals(nelements=4, method='dimino')[source]

Bases: InterestingPermutations, GenericPeal

Uses permutations to make peals and represents peals as permutations.

Holds peals by name, which is the model GenericPeal provides act and act_all for – act("some_peal", domain). That is a different operation from PlainChanges.act(), which acts the one peal the object was built from and takes the domain first.

Notes

Core reference: - http://www.gutenberg.org/files/18567/18567-h/18567-h.htm

Also check peal rules, such as conditions for trueness. - Wikipedia seemed ok last time.

__init__(nelements=4, method='dimino')[source]

Initializes a Peals object.

Parameters:
nelementsint, optional

How many elements the permutations act on, by default 4. This also sizes the default domain that act and act_all build.

methodstr, optional

The generation method passed to InterestingPermutations.

Methods

__init__([nelements, method])

Initializes a Peals object.

act(peal[, domain])

Acts a specific peal on the specified domain.

act_all([domain])

Acts all peals on the specified domain.

an_eight_and_forty()

Placeholder for an eight and forty peal implementation.

even_odd(sequence)

Determines if a permutation is even or odd.

get_alternating()

Generates permutations in the alternating group.

get_full_symmetry()

Generates permutations with full symmetry.

get_mirrors()

Generates mirror permutations.

get_rotations()

Generates rotations of permutations.

get_swaps()

Generates swap permutations.

transpositions_peal(permutation[, peal_name])

Generates a peal from transpositions of a permutation.

twenty_all_over()

Placeholder for a 20 all over peal implementation.

Attributes

permutations_by_sizes

permutations

neighbor_swaps

swaps_by_stepsizes

swaps_as_comes

swaps

rotations

mirrors

dihedral

peals

name -> list of permutations.

acted_peals

transpositions_peal(permutation, peal_name='transposition_peal')[source]

Generates a peal from transpositions of a permutation.

Parameters:
permutationPermutation

The permutation to generate transpositions from.

peal_namestr, optional

The name of the peal. Defaults to “transposition_peal”.

Returns:
list

The transpositions, as permutations over the same domain.

Notes

sympy’s transpositions() yields index pairs, which are cycle notation rather than array form: Permutation((0, 1)) is the identity and Permutation((0, 2)) raises. The pairs are expanded with the original size, so composing them in reverse rebuilds the permutation they came from.

twenty_all_over()[source]

Placeholder for a 20 all over peal implementation.

an_eight_and_forty()[source]

Placeholder for an eight and forty peal implementation.