Duplication

digraph InheritanceGraph { graph [bgcolor=transparent, color=lightsteelblue2, fontname=Arial, fontsize=10, outputorder=edgesfirst, overlap=prism, penwidth=2, rankdir=LR, splines=spline, style="dashed, rounded", truecolor=true]; node [colorscheme=pastel19, fontname=Arial, fontsize=10, height=0, penwidth=2, shape=box, style="filled, rounded", width=0]; edge [color=lightslategrey, penwidth=1]; subgraph "cluster_abjad.pitch" { graph [label="abjad.pitch"]; node [color=1]; "abjad.pitch.Duplication.Duplication" [URL="../api/abjad/pitch/Duplication.html#abjad.pitch.Duplication.Duplication", color=black, fontcolor=white, label=Duplication, target=_top]; } subgraph "cluster_abjad.system" { graph [label="abjad.system"]; node [color=2]; "abjad.system.AbjadObject.AbjadObject" [URL="../api/abjad/pitch/../system/AbjadObject.html#abjad.system.AbjadObject.AbjadObject", label="Abjad\nObject", target=_top]; "abjad.system.AbjadValueObject.AbjadValueObject" [URL="../api/abjad/pitch/../system/AbjadValueObject.html#abjad.system.AbjadValueObject.AbjadValueObject", label="Abjad\nValue\nObject", target=_top]; "abjad.system.AbjadObject.AbjadObject" -> "abjad.system.AbjadValueObject.AbjadValueObject"; } subgraph cluster_builtins { graph [label=builtins]; node [color=3]; "builtins.object" [URL="https://docs.python.org/3.6/library/functions.html#object", label=object, target=_top]; } "abjad.system.AbjadValueObject.AbjadValueObject" -> "abjad.pitch.Duplication.Duplication"; "builtins.object" -> "abjad.system.AbjadObject.AbjadObject"; }

class abjad.pitch.Duplication.Duplication(*, counts=None, indices=None, period=None)

Duplication.

>>> operator_ = abjad.Duplication(counts=2, period=4)
>>> abjad.f(operator_)
abjad.Duplication(
    counts=2,
    period=4,
    )

Attributes Summary

__call__ Calls rotation on argument.
counts Gets counts of duplication.
indices Gets indices of duplication.
period Gets period of duplication.

Special methods

__call__(argument)

Calls rotation on argument.

Duplicates once without period:

>>> operator_ = abjad.Duplication(counts=1)
>>> numbers = [1, 2, 3, 4]
>>> operator_(numbers)
[1, 2, 3, 4, 1, 2, 3, 4]

Duplicates twice without period:

>>> operator_ = abjad.Duplication(counts=2)
>>> pitch_classes = abjad.PitchClassSegment([0, 1, 4, 7])
>>> operator_(pitch_classes)
PitchClassSegment([0, 1, 4, 7, 0, 1, 4, 7, 0, 1, 4, 7])

Duplicates periodically:

>>> operator_ = abjad.Duplication(counts=1, period=3)
>>> pitches = abjad.PitchSegment("c' d' e' f' g' a' b' c''")
>>> for pitch in operator_(pitches):
...     pitch
...
NamedPitch("c'")
NamedPitch("d'")
NamedPitch("e'")
NamedPitch("c'")
NamedPitch("d'")
NamedPitch("e'")
NamedPitch("f'")
NamedPitch("g'")
NamedPitch("a'")
NamedPitch("f'")
NamedPitch("g'")
NamedPitch("a'")
NamedPitch("b'")
NamedPitch("c''")
NamedPitch("b'")
NamedPitch("c''")

Duplicate indices:

>>> operator_ = abjad.Duplication(
...     counts=1,
...     indices=(0, -1),
...     )
>>> pitch_classes = abjad.PitchClassSegment([0, 1, 4, 7])
>>> operator_(pitch_classes)
PitchClassSegment([0, 0, 1, 4, 7, 7])

Duplicate indices periodically:

>>> operator_ = abjad.Duplication(
...     counts=1,
...     indices=(0,),
...     period=2,
...     )
>>> pitch_classes = abjad.PitchClassSegment([0, 1, 4, 7, 9])
>>> operator_(pitch_classes)
PitchClassSegment([0, 0, 1, 4, 4, 7, 9, 9])

Duplicate indices periodically with different counts:

>>> operator_ = abjad.Duplication(
...     counts=(1, 2),
...     indices=(0,),
...     period=2,
...     )
>>> pitch_classes = abjad.PitchClassSegment([0, 1, 4, 7, 9])
>>> operator_(pitch_classes)
PitchClassSegment([0, 0, 1, 4, 4, 4, 7, 9, 9])

Cyclic counts:

>>> operator_ = abjad.Duplication(counts=(0, 1, 2, 3))
>>> pitch_classes = abjad.PitchClassSegment([0, 1, 4, 7, 9])
>>> operator_(pitch_classes)
PitchClassSegment([0, 1, 1, 4, 4, 4, 7, 7, 7, 7, 9])

Returns new object with type equal to that of argument.

(AbjadValueObject).__copy__(*arguments)

Copies Abjad value object.

Returns new Abjad value object.

(AbjadValueObject).__eq__(argument)

Is true when all initialization values of Abjad value object equal the initialization values of argument.

Returns true or false.

(AbjadObject).__format__(format_specification='')

Formats Abjad object.

Set format_specification to '' or 'storage'. Interprets '' equal to 'storage'.

Returns string.

(AbjadValueObject).__hash__()

Hashes Abjad value object.

Returns integer.

(AbjadObject).__repr__()

Gets interpreter representation of Abjad object.

Returns string.


Read-only properties

counts

Gets counts of duplication.

>>> operator_ = abjad.Duplication(counts=1, period=3)
>>> operator_.counts
1

Returns integer or none.

indices

Gets indices of duplication.

>>> operator_ = abjad.Duplication(
...     counts=1,
...     indices=(0, -1),
...     )
>>> operator_.indices
(0, -1)

Returns integer or none.

period

Gets period of duplication.

>>> operator_ = abjad.Duplication(counts=1, period=3)
>>> operator_.period
3

Returns integer or none.