music.Peals¶
- class music.Peals(nelements=4, method='dimino')[source]¶
Bases:
InterestingPermutations,GenericPealUses permutations to make peals and represents peals as permutations.
Holds peals by name, which is the model
GenericPealprovidesactandact_allfor –act("some_peal", domain). That is a different operation fromPlainChanges.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.
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.
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.
Placeholder for a 20 all over peal implementation.
Attributes
permutations_by_sizespermutationsneighbor_swapsswaps_by_stepsizesswaps_as_comesswapsrotationsmirrorsdihedralpealsname -> list of permutations.
acted_peals- transpositions_peal(permutation, peal_name='transposition_peal')[source]¶
Generates a peal from transpositions of a permutation.
- Parameters:
- permutation
Permutation The permutation to generate transpositions from.
- peal_name
str,optional The name of the peal. Defaults to “transposition_peal”.
- permutation
- Returns:
listThe 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.