CompoundOperator

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.CompoundOperator.CompoundOperator" [URL="../api/abjad/pitch/CompoundOperator.html#abjad.pitch.CompoundOperator.CompoundOperator", color=black, fontcolor=white, label="Compound\nOperator", 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.CompoundOperator.CompoundOperator"; "builtins.object" -> "abjad.system.AbjadObject.AbjadObject"; }

class abjad.pitch.CompoundOperator.CompoundOperator(operators=None, *, show_identity_operators=None)

Compound operator.

Rotation followed by transposition:

>>> operator = abjad.CompoundOperator()
>>> operator = operator.rotate(n=1, stravinsky=True)
>>> operator = operator.transpose(n=2)
>>> str(operator)
'T2rs1'
>>> pitch_classes = abjad.PitchClassSegment([0, 1, 4, 7])
>>> operator(pitch_classes)
PitchClassSegment([2, 7, 8, 11])

Attributes Summary

__add__ Composes compound operator and operator.
__call__ Calls compound operator on argument.
__radd__ Composes operator and compound operator.
__str__ Gets string representation of compound operator.
duplicate Configures compound operator to duplicate pitches by counts, with optional indices and period.
invert Configures compound operator to invert pitches about axis.
multiply Configures compound operator to multiply pitch-classes by index n.
operators Gets operators.
retrograde Configures compound operator to retrograde pitches.
rotate Configures compound operator to rotate pitches by index n.
show_identity_operators Is true when string representation of operator should show identity operators.
transpose Configures compound operator to transpose pitches by index n.

Special methods

__add__(operator)

Composes compound operator and operator.

>>> operator = abjad.CompoundOperator()
>>> operator = operator.transpose(n=1)
>>> operator = operator.multiply(n=5)
>>> str(operator)
'M5T1'
>>> inversion = abjad.Inversion()
>>> retrograde = abjad.Retrograde()
>>> transposition = abjad.Transposition(n=1)
>>> operator_1 = inversion + retrograde
>>> str(operator_1)
'IR'
>>> operator_2 = inversion + transposition
>>> str(operator_2)
'IT1'
>>> operator_3 = operator_1 + operator_2
>>> str(operator_3)
'IRIT1'
>>> abjad.f(operator_3)
abjad.CompoundOperator(
    operators=[
        abjad.Transposition(
            n=1,
            ),
        abjad.Inversion(),
        abjad.Retrograde(),
        abjad.Inversion(),
        ],
    )

Returns new compound operator.

__call__(argument)

Calls compound operator on argument.

>>> operator = abjad.CompoundOperator()
>>> operator = operator.rotate(n=1, stravinsky=True)
>>> operator = operator.transpose(n=2)
>>> str(operator)
'T2rs1'
>>> segment = abjad.PitchClassSegment([0, 1, 4, 7])
>>> abjad.show(segment) 
>>> transform = operator(segment)
>>> abjad.show(transform) 
>>> transform
PitchClassSegment([2, 7, 8, 11])

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.

__radd__(operator)

Composes operator and compound operator.

Returns new compound operator.

(AbjadObject).__repr__()

Gets interpreter representation of Abjad object.

Returns string.

__str__()

Gets string representation of compound operator.

Gets string:

>>> operator = abjad.CompoundOperator()
>>> operator = operator.rotate(n=1)
>>> operator = operator.transpose(n=2)
>>> str(operator)
'T2r1'

Gets string of empty operator:

>>> operator = abjad.CompoundOperator()
>>> str(operator)
''

Returns string.


Methods

duplicate(counts=None, indices=None, period=None)

Configures compound operator to duplicate pitches by counts, with optional indices and period.

>>> operator = abjad.CompoundOperator()
>>> operator = operator.duplicate(counts=1)
>>> abjad.f(operator)
abjad.CompoundOperator(
    operators=[
        abjad.Duplication(
            counts=1,
            ),
        ],
    )

Returns new compound operator.

invert(axis=None)

Configures compound operator to invert pitches about axis.

>>> operator = abjad.CompoundOperator()
>>> operator = operator.invert(axis=2)
>>> abjad.f(operator)
abjad.CompoundOperator(
    operators=[
        abjad.Inversion(
            axis=abjad.NamedPitch("d'"),
            ),
        ],
    )

Returns new compound operator.

multiply(n=1)

Configures compound operator to multiply pitch-classes by index n.

>>> operator = abjad.CompoundOperator()
>>> operator = operator.multiply(n=3)
>>> abjad.f(operator)
abjad.CompoundOperator(
    operators=[
        abjad.Multiplication(
            n=3,
            ),
        ],
    )

Returns new compound operator.

retrograde(period=None)

Configures compound operator to retrograde pitches.

>>> operator = abjad.CompoundOperator()
>>> operator = operator.retrograde()
>>> abjad.f(operator)
abjad.CompoundOperator(
    operators=[
        abjad.Retrograde(),
        ],
    )

Returns new compound operator.

rotate(n=0, period=None, stravinsky=None)

Configures compound operator to rotate pitches by index n.

>>> operator = abjad.CompoundOperator()
>>> operator = operator.rotate(n=-1)
>>> abjad.f(operator)
abjad.CompoundOperator(
    operators=[
        abjad.Rotation(
            n=-1,
            ),
        ],
    )

Returns new compound operator.

transpose(n=0)

Configures compound operator to transpose pitches by index n.

>>> operator = abjad.CompoundOperator()
>>> operator = operator.transpose(n=1)
>>> abjad.f(operator)
abjad.CompoundOperator(
    operators=[
        abjad.Transposition(
            n=1,
            ),
        ],
    )

Returns new compound operator.


Read-only properties

operators

Gets operators.

Gets operators:

>>> operator = abjad.CompoundOperator()
>>> operator = operator.rotate(n=1)
>>> operator = operator.transpose(n=2)
>>> for operator_ in operator.operators:
...     operator_
... 
Rotation(n=1)
Transposition(n=2)

Returns list of operators.

show_identity_operators

Is true when string representation of operator should show identity operators.

Does not show identity operators:

>>> operator = abjad.CompoundOperator()
>>> operator = operator.transpose(n=0)
>>> operator = operator.multiply(n=5)
>>> str(operator)
'M5'

Shows identity operators:

>>> operator = abjad.CompoundOperator(
...     show_identity_operators=True,
...     )
>>> operator = operator.transpose(n=0)
>>> operator = operator.multiply(n=5)
>>> str(operator)
'M5T0'

Defaults to none.

Set to true, false or none.

Returns true, false or none.