# Rotation¶

class `abjad.pitch.Rotation.``Rotation`(*, n=0, period=None, stravinsky=None)

Rotation operator.

```>>> abjad.Rotation()
Rotation(n=0)
```
```>>> abjad.Rotation(n=1)
Rotation(n=1)
```

Object model of the twelve-tone rotation operator.

Attributes Summary

 `__add__` Composes rotation and operator. `__call__` Calls rotation on argument. `__radd__` Right-addition not defined on rotation. `__str__` Gets string representation of operator. `n` Gets index of rotation. `period` Gets period of rotation. `stravinsky` Is true when rotation uses Stravinsky-style back-transposition to zero.

Special methods

`__add__`(operator)

Composes rotation and operator.

Example segment:

```>>> items = [0, 2, 4, 5]
```

Example operators:

```>>> rotation = abjad.Rotation(n=-1)
```

Transposition followed by rotation:

```>>> operator = rotation + transposition
>>> str(operator)
'r-1T3'
```
```>>> segment_ = operator(segment)
```

Same as above because rotation and transposition commute:

```>>> operator = transposition + rotation
>>> str(operator)
'T3r-1'
```
```>>> segment_ = operator(segment)
```

Returns compound operator:

```>>> abjad.f(operator)
operators=[
n=-1,
),
n=3,
),
],
)
```
`__call__`(argument)

Calls rotation on argument.

Rotates pitch classes:

```>>> rotation = abjad.Rotation(n=1)
>>> pitch_classes = abjad.PitchClassSegment([0, 1, 4, 7])
>>> rotation(pitch_classes)
PitchClassSegment([7, 0, 1, 4])
```

Rotates pitch classes with Stravinsky-style back-transposition to zero:

```>>> rotation = abjad.Rotation(n=1, stravinsky=True)
>>> pitch_classes = abjad.PitchClassSegment([0, 1, 4, 7])
>>> rotation(pitch_classes)
PitchClassSegment([0, 5, 6, 9])
```

Does not rotate single pitches or pitch-classes:

```>>> rotation = abjad.Rotation(n=1)
>>> rotation(pitch_class)
NumberedPitchClass(6)
```

Periodic rotation:

Todo

Deprecated.

```>>> rotation = abjad.Rotation(n=1, period=3)
>>> pitches = abjad.PitchSegment("c' d' e' f' g' a' b' c''")
>>> rotation(pitches)
PitchSegment("e' c' d' a' f' g' c'' b'")
```

Stravinsky-style periodic rotation:

Todo

Deprecated.

```>>> rotation = abjad.Rotation(
...     n=1,
...     period=3,
...     stravinsky=True,
...     )
>>> pitches = abjad.PitchSegment("c' d' e' f' g' a' b' c''")
>>> rotation(pitches)
PitchSegment("c' af bf f' df' ef' b' as'")
```

Returns new object with type equal to that of argument.

`(AbjadValueObject).``__copy__`(*arguments)

`(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='')

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

Returns string.

`(AbjadValueObject).``__hash__`()

Returns integer.

`__radd__`(operator)

```>>> abjad.Rotation().__radd__(abjad.Rotation())
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
raise NotImplementedError(message)
NotImplementedError: right-addition not defined on Rotation.
```

Raises not implemented error.

`(AbjadObject).``__repr__`()

Gets interpreter representation of Abjad object.

Returns string.

`__str__`()

Gets string representation of operator.

```>>> str(abjad.Rotation())
'r0'
```
```>>> str(abjad.Rotation(n=1))
'r1'
```
```>>> str(abjad.Rotation(stravinsky=True))
'rs0'
```
```>>> str(abjad.Rotation(n=1, stravinsky=True))
'rs1'
```

`n`

Gets index of rotation.

```>>> rotation = abjad.Rotation()
>>> rotation.n
0
```
```>>> rotation = abjad.Rotation(n=2)
>>> rotation.n
2
```

Returns integer.

`period`

Gets period of rotation.

Todo

Deprecated.

```>>> rotation = abjad.Rotation(n=2, period=3)
>>> rotation.period
3
```

Returns integer or none.

`stravinsky`

Is true when rotation uses Stravinsky-style back-transposition to zero.

```>>> rotation = abjad.Rotation(n=2, stravinsky=False)
>>> rotation.stravinsky
False
```

Returns true or false.