componenttools.copy_governed_component_subtree_from_prolated_offset_to

abjad.tools.componenttools.copy_governed_component_subtree_from_prolated_offset_to.copy_governed_component_subtree_from_prolated_offset_to(component, start=0, stop=None)[source]

New in version 1.1.

Clone governed component subtree from start prolated duration to stop prolated duration.

Governed subtree refers to component together with the children of component:

abjad> voice = Voice(notetools.make_repeated_notes(2))
abjad> voice.append(tuplettools.FixedDurationTuplet(Duration(2, 8), notetools.make_repeated_notes(3)))
abjad> pitchtools.set_ascending_named_diatonic_pitches_on_nontied_pitched_components_in_expr(voice)
abjad> f(voice)
\new Voice {
   c'8
   d'8
   \times 2/3 {
      e'8
      f'8
      g'8
   }
}
abjad> new = componenttools.copy_governed_component_subtree_from_prolated_offset_to(voice, (0, 8), (3, 8))
abjad> f(new)
\new Voice {
   c'8
   d'8
   \times 2/3 {
      e'8
      f'16
   }
}

Raise contiguity error if asked to slice a parallel container.

abjad> staff = Staff(Voice("c'8 d'8") * 2)
abjad> staff.is_parallel = True
abjad> f(staff)
\new Staff <<
\new Voice {
    c'8
    d'8
}
\new Voice {
    c'8
    d'8
}
>>

Raise contiguity error when attempting to copy fleaves from parallel container.

But note that cases with 0 = start work correctly:

abjad> new = componenttools.copy_governed_component_subtree_from_prolated_offset_to(voice, (0, 8), (1, 8))
abjad> f(new)
\new Voice {
    c'8
}

Cases with 0 < start do not work correctly:

abjad> new = componenttools.copy_governed_component_subtree_from_prolated_offset_to(voice, (1, 8), (2, 8))
abjad> f(new)
\new Voice {
    c'8
    d'8
}

Create ad hoc tuplets as required:

abjad> voice = Voice([Note("c'4")])
abjad> new = componenttools.copy_governed_component_subtree_from_prolated_offset_to(voice, 0, (1, 12))
abjad> f(new)
\new Voice {
    \times 2/3 {
        c'8
    }
}

Function does NOT clone parentage of component when component is a leaf:

abjad> voice = Voice([Note("c'4")])
abjad> new_leaf = componenttools.copy_governed_component_subtree_from_prolated_offset_to(voice[0], 0, (1, 8))
abjad> f(new_leaf)
c'8
abjad> new_leaf._parentage.parent is None
True

Return (untrimmed_copy, first_dif, second_dif).

Changed in version 2.0: renamed componenttools.clone_governed_component_subtree_from_prolated_duration_to() to componenttools.copy_governed_component_subtree_from_prolated_offset_to().

This Page