Abjad / abjad

Abjad is a Python API for building LilyPond files. Use Abjad to make PDFs of music notation.
https://abjad.github.io
GNU General Public License v3.0
239 stars 39 forks source link

Cleaned up pcollections.py. #1427

Closed trevorbaca closed 2 years ago

trevorbaca commented 2 years ago

Remove to-pitch methods:

REMOVED: abjad.PitchClassSegment.to_named_pitch_classes()
REMOVED: abjad.PitchClassSegment.to_named_pitches()
REMOVED: abjad.PitchClassSegment.to_numbered_pitch_classes()
REMOVED: abjad.PitchClassSegment.to_numbered_pitches()
REMOVED: abjad.PitchClassSegment.to_pitch_classes()
REMOVED: abjad.PitchClassSegment.to_pitches()
REMOVED: abjad.PitchSegment.to_named_pitch_classes()
REMOVED: abjad.PitchSegment.to_named_pitches()
REMOVED: abjad.PitchSegment.to_numbered_pitch_classes()
REMOVED: abjad.PitchSegment.to_numbered_pitches()
REMOVED: abjad.PitchSegment.to_pitch_classes()
REMOVED: abjad.PitchSegment.to_pitches()

Restrict abjad.PitchSegment to numbered pitches:

OLD: abjad.PitchSegment(..., item_class=abjad.NamedPitch)
NEW: tuple(abjad.NamedPitch(_) for _ in ...)

OLD: abjad.PitchSegment(..., item_class=abjad.NumberedPitch)
NEW: abjad.NumberedPitchSegment(...)

Restrict abjad.PitchClassSegment to numbered pcs:

OLD: abjad.PitchClassSegment(..., item_class=abjad.NamedPitchClass)
NEW: tuple(abjad.NamedPitchClass(_) for _ in ...)

OLD: abjad.PitchClassSegment(..., item_class=abjad.NumberedPitchClass)
NEW: abjad.NumberedPitchClassSegment(...)

Restrict abjad.PitchSet to numbered pitches:

OLD: abjad.PitchSet(..., item_class=abjad.NamedPitch)
NEW: frozenset(abjad.NamedPitch(_) for _ in ...)

OLD: abjad.PitchSet(..., item_class=abjad.NumberedPitch)
NEW: abjad.NumberedPitchSet(...)

Restrict abjad.PitchClassSet to numbered pcs:

OLD: abjad.PitchClassSet(..., item_class=abjad.NamedPitchClass)
NEW: frozenset(abjad.NamedPitchClass(_) for _ in ...)

OLD: abjad.PitchClassSet(..., item_class=abjad.NumberedPitchClass)
NEW: abjad.NumberedPitchClassSet(...)

Remove abjad.IntervalSegment:

OLD: abjad.IntervalSegment(..., item_class=abjad.NamedInterval)
NEW: tuple(abjad.NamedInterval(_) for _ in ...)

OLD: abjad.IntervalSegment(..., item_class=abjad.NumberedInterval)
NEW: tuple(abjad.NumberedInterval(_) for _ in ...)

Remove abjad.IntervalClassSegment:

OLD: abjad.IntervalClassSegment(..., item_class=abjad.NamedIntervalClass)
NEW: tuple(abjad.NamedIntervalClass(_) for _ in ...)

OLD: abjad.IntervalClassSegment(..., item_class=abjad.NumberedIntervalClass)
NEW: tuple(abjad.NumberedIntervalClass(_) for _ in ...)

Remove abjad.IntervalSet:

OLD: abjad.IntervalSet(..., item_class=abjad.NamedInterval)
NEW: frozenset(abjad.NamedInterval(_) for _ in ...)

OLD: abjad.IntervalSet(..., item_class=abjad.NumberedInterval)
NEW: frozenset(abjad.NumberedInterval(_) for _ in ...)

Remove abjad.IntervalClassSet:

OLD: abjad.IntervalClassSet(..., item_class=abjad.NamedIntervalClass)
NEW: frozenset(abjad.NamedIntervalClass(_) for _ in ...)

OLD: abjad.IntervalClassSet(..., item_class=abjad.NumberedIntervalClass)
NEW: frozenset(abjad.NumberedIntervalClass(_) for _ in ...)

Remove base classes:

REMOVED: abjad.Counter
REMOVED: abjad.Segment
REMOVED: abjad.Set

Remove properties and methods:

OLD: abjad.PitchSet(...).is_pitch_class_unique()
NEW: len(pitch_set) == len(set(_.pitch_class for _ in pitch_set))

OLD: abjad.PitchSegment.hertz
OLD: abjad.PitchSet.hertz
NEW: [_.hertz for _ in segment]

REMOVED: abjad.PitchClassSet.is_transposed_subset()
REMOVED: abjad.PitchClassSet.is_transposed_superset()

REMOVED: abjad.PitchSegment.inflection_point_count
REMOVED: abjad.PitchSegment.local_minima
REMOVED: abjad.PitchSegment.local_maxima

Remove from_pitches() constructors:

REMOVED: abjad.PitchClassSegment.from_pitches()
REMOVED: abjad.PitchClassSet.from_pitches()
REMOVED: abjad.PitchSegment.from_pitches()
REMOVED: abjad.PitchSet.from_pitches()

Replace has_duplicates() methods with abjad.sequence.has_duplicates() function:

OLD: abjad.PitchClassSegment(...).has_duplicates()
OLD: abjad.PitchClassSet(...).has_duplicates()
OLD: abjad.PitchSegment(...).has_duplicates()
OLD: abjad.PitchSet(...).has_duplicates()
OLD: abjad.IntervalSegment(...).has_duplicates()
OLD: abjad.IntervalSet(...).has_duplicates()
OLD: abjad.IntervalClassSegment(...).has_duplicates()
OLD: abjad.IntervalClassSet(...).has_duplicates()
NEW: abjad.sequence.has_duplicates(...)

Restrict numeric operations on named pitches and named pitch-classes:

OLD: abjad.NamedPitch("c'").transpose(n=1)
NEW: abjad.NamedPitch("c'").transpose(n="m2")

OLD: abjad.NamedPitchClass("c").transpose(n=1)
NEW: abjad.NamedPitchClass("c").transpose(n="m2")

OLD: abjad.PitchSegment(..., item_class=abjad.NamedPitch).transpose(n=1)
NEW: abjad.NamedPitchSegment(...).transpose(n="m2")

OLD: abjad.PitchClassSegment(..., item_class=abjad.NamedPitchClass).transpose(n=1)
NEW: abjad.NamedPitchClassSegment(...).transpose(n="m2")

OLD: abjad.PitchClassSet(..., item_class=abjad.NamedPitchClass).transpose(n=1)
NEW: abjad.NamedPitchClassSet(...).transpose(n="m2")

Replace abjad.PitchClassSegment.permute(row) in favor of abjad.TwelveToneRow.permute(segment):

OLD: abjad.PitchClassSegment(...)(row)
NEW: abjad.TwelveToneRow(...)(segment)

Move pitch-class voicing from methods to functions:

OLD: abjad.PitchClassSegment.voice_horizontally()
NEW: abjad.pcollections.voice_horizontally(pcs)

OLD: abjad.PitchClassSegment.voice_vertically()
NEW: abjad.pcollections.voice_vertically(pcs)

Closes #1423.