logical_selections¶
- auxjad.select.logical_selections(container: Union[abjad.score.Container, abjad.select.Selection]) → abjad.select.Selection[source]¶
Takes an
abjad.Container
(or child class). Returns the logical selections of a container, that is the logical ties but with consecutive rests grouped together. Return value is in the form of aabjad.Selection
ofabjad.Selection
’s.- Basic usage:
Usage is similar to
abjad.select.logical_ties()
:>>> container = abjad.Container(r"c'4 ~ c'16 r8. r4.. d'16 ~ d'4") >>> logical_selections = auxjad.select.logical_selections(container) >>> for logical_selection in logical_selections: ... print(logical_selection.leaves()) Selection([Note("c'4"), Note("c'16")]) Selection([Rest('r8.'), Rest('r4..')]) Selection([Note("d'16"), Note("d'4")])
Note
Auxjad automatically adds this function as an extension function to
abjad.select
. It can thus be used from eitherauxjad.select
orabjad.select
namespaces. Therefore, the two lines below are equivalent:>>> container = abjad.Container(r"c'4 ~ c'16 r8. r4.. d'16 ~ d'4") >>> for logical_sel in auxjad.select.logical_selections(container): ... print(logical_sel.leaves()) Selection([Note("c'4"), Note("c'16")]) Selection([Rest('r8.'), Rest('r4..')]) Selection([Note("d'16"), Note("d'4")]) >>> for logical_sel in abjad.select.logical_selections(container): ... print(logical_sel.leaves()) Selection([Note("c'4"), Note("c'16")]) Selection([Rest('r8.'), Rest('r4..')]) Selection([Note("d'16"), Note("d'4")])
- Multi-measure rests:
It also handles multi-measure rests.
>>> container = abjad.Container(r"c'2. ~ c'16 r8. R1 r4.. d'16 ~ d'2.") >>> logical_selections = auxjad.select.logical_selections(container) >>> for logical_selection in logical_selections: ... print(logical_selection.leaves()) Selection([Note("c'2."), Note("c'16")]) Selection([Rest('r8.'), MultimeasureRest('R1'), Rest('r4..')]) Selection([Note("d'16"), Note("d'2.")])