RatioPartsExpression

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_builtins { graph [label=builtins]; node [color=1]; "builtins.object" [URL="https://docs.python.org/3.7/library/functions.html#object", label=object, target=_top]; } subgraph "cluster_evans.consort" { graph [label="evans.consort"]; node [color=2]; "evans.consort.AbjadObject.AbjadObject" [URL="../api/evans/consort/AbjadObject.html#evans.consort.AbjadObject.AbjadObject", label="Abjad\nObject", target=_top]; "evans.consort.RatioPartsExpression.RatioPartsExpression" [URL="../api/evans/consort/RatioPartsExpression.html#evans.consort.RatioPartsExpression.RatioPartsExpression", color=black, fontcolor=white, label="Ratio\nParts\nExpression", target=_top]; "evans.consort.AbjadObject.AbjadObject" -> "evans.consort.RatioPartsExpression.RatioPartsExpression"; } "builtins.object" -> "evans.consort.AbjadObject.AbjadObject"; }

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__

Call self as a function.

from_sequence

Creates a ratio parts expression from sequence.

mask_timespan

parts

ratio


Special methods

overridden __call__(timespan)[source]

Call self as a function.

(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