RatioPartsExpression¶
- class evans.consort.RatioPartsExpression.RatioPartsExpression(parts=0, ratio=(1, 1), mask_timespan=None)[source]¶
Ratio parts expression.
>>> expression = evans.RatioPartsExpression( ... ratio=(1, 2, 1), ... parts=(0, 2), ... ) >>> print(repr(expression)) evans.RatioPartsExpression( parts=(0, 2), ratio=abjad.Ratio((1, 2, 1)), )
>>> timespan = abjad.Timespan( ... start_offset=abjad.Duration(1, 2), ... stop_offset=abjad.Duration(3, 2), ... ) >>> for x in expression(timespan): ... x ... Timespan(Offset((1, 2)), Offset((3, 4))) Timespan(Offset((5, 4)), Offset((3, 2)))
>>> expression = evans.RatioPartsExpression( ... ratio=(1, 2, 1), ... parts=(0, 2), ... mask_timespan=abjad.Timespan( ... start_offset=(1, 4), ... ), ... ) >>> timespan = abjad.Timespan(0, 4) >>> for x in expression(timespan): ... x ... Timespan(Offset((1, 4)), Offset((1, 1))) Timespan(Offset((3, 1)), Offset((4, 1)))
Attributes Summary
Call self as a function.
Creates a ratio parts expression from sequence.
Special methods
-
(
AbjadObject
).__eq__(argument)¶ Is true when ID of argument equals ID of Abjad object. Otherwise false. Returns true or false.
-
(
AbjadObject
).__format__(format_specification='')¶ Formats Abjad object. Set format_specification to ‘’ or ‘storage’. Interprets ‘’ equal to ‘storage’. Returns string.
-
(
AbjadObject
).__hash__()¶ Hashes Abjad object. Required to be explicitly redefined on Python 3 if __eq__ changes. Returns integer.
-
(
AbjadObject
).__ne__(argument)¶ Is true when Abjad object does not equal argument. Otherwise false. Returns true or false.
-
(
AbjadObject
).__repr__()¶ Gets interpreter representation of Abjad object. Returns string.
-
(
AbjadObject
).__str__()¶ Return str(self).
Class & static methods
- static from_sequence(sequence)[source]¶
Creates a ratio parts expression from sequence.
>>> ratio = [-1, 2, -1, 1, -1] >>> expression = evans.RatioPartsExpression.from_sequence(ratio) >>> print(abjad.storage(expression)) evans.RatioPartsExpression( parts=(1, 3), ratio=abjad.Ratio((1, 2, 1, 1, 1)), )
Returns new ratio parts expression.
Read-only properties
- mask_timespan¶
- parts¶
- ratio¶
-
(