def make_territoires_parts(): ratio = [1] * 9 lengths = mathtools.partition_integer_by_ratio(164, ratio) parts = sequencetools.partition_by_lengths(fully_labelled_cells, lengths) parts = sequencetools.rotate(parts, -3) territoires_parts = parts[:2] + parts[3:8] originals = range(1, 9 + 1) ## territoires part numbers are [(4, 5), 6, (7, 8, 9, 1, 2), 3] territoires_part_numbers = [4, 5, 7, 8, 9, 1, 2] original_territoires_part_numbers = zip(originals, territoires_part_numbers) parts = sequencetools.rotate(parts, -3) manifolds_parts = parts[:4] + parts[5:] ## manifolds part numbers are [(7, 8, 9, 1), 2, (3, 4, 5, 6)] manifolds_part_numbers = [7, 8, 9, 1, 3, 4, 5, 6] original_manifolds_part_numbers = zip(originals, manifolds_part_numbers) return territoires_parts, original_territoires_part_numbers, \ manifolds_parts, original_manifolds_part_numbers
mask = sequencetools.flatten_sequence(mask) window = sequencetools.repeat_sequence_to_length(window, count) #mask = tools.rout(mask, window) window_period = len(window) window_true_indices = sequencetools.true_indices(window) mask = sequencetools.negate_elements( mask, absolute=True, indices=window_true_indices, period=window_period, ) mask = sequencetools.split_sequence(mask, measures, cyclic=True, overhang=True) mask = [transforms.lengths_to_joined_positive_counts(row) for row in mask] mask = sequencetools.rotate(mask, -int(len(reflections) / 2)) print('reflect ...') # Reflection cuts measure out one staff and back into other staves. # For example: # the very first (reflection, mask) pair is this ... # [('pitches-vl', 'pitches-fl')] # [[37], [43], [50], [124], [130, 131, 132], [138], [198], [203]] # ... which says to grab measure 37 from the violin pitch staff, # copy that measure, and then paste the copy into # measure 37 of the flute pitch staff. # The result is that whatever was sitting in # measure 37 of the flute pitch gets blown away and replaced with the # source material from the violin pitch staff; # the violin and flute pitch staves are now