QTargetMeasure

class quantizationtools.QTargetMeasure(offset_in_ms=None, search_tree=None, time_signature=None, tempo=None, use_full_measure=False)

Representation of a single “measure” in a measure-wise quantization target:

>>> search_tree = quantizationtools.UnweightedSearchTree({2: None})
>>> tempo = Tempo((1, 4), 60)
>>> time_signature = TimeSignature((4, 4))
>>> q_target_measure = quantizationtools.QTargetMeasure(
...     offset_in_ms=1000,
...     search_tree=search_tree,
...     tempo=tempo,
...     time_signature=time_signature,
...     )
>>> print(format(q_target_measure, 'storage'))
quantizationtools.QTargetMeasure(
    offset_in_ms=durationtools.Offset(1000, 1),
    search_tree=quantizationtools.UnweightedSearchTree(
        definition={   2: None,
            },
        ),
    time_signature=indicatortools.TimeSignature((4, 4)),
    tempo=indicatortools.Tempo(
        reference_duration=durationtools.Duration(1, 4),
        units_per_minute=60,
        ),
    use_full_measure=False,
    )

QTargetMeasures group QTargetBeats:

>>> for q_target_beat in q_target_measure.beats:
...     print(q_target_beat.offset_in_ms, q_target_beat.duration_in_ms)
1000 1000
2000 1000
3000 1000
4000 1000

If use_full_measure is set, the QTargetMeasure will only ever contain a single QTargetBeat instance:

>>> another_q_target_measure = quantizationtools.QTargetMeasure(
...     offset_in_ms=1000,
...     search_tree=search_tree,
...     tempo=tempo,
...     time_signature=time_signature,
...     use_full_measure=True,
...     )
>>> for q_target_beat in another_q_target_measure.beats:
...     print(q_target_beat.offset_in_ms, q_target_beat.duration_in_ms)
1000 4000

Not composer-safe.

Used internally by Quantizer.

Return QTargetMeasure instance.

Lineage

digraph InheritanceGraph { graph [background=transparent, bgcolor=transparent, color=lightslategrey, fontname=Arial, outputorder=edgesfirst, overlap=prism, penwidth=2, rankdir=LR, root="__builtin__.object", splines=spline, style="dotted, rounded", truecolor=true]; node [colorscheme=pastel19, fontname=Arial, fontsize=12, penwidth=2, style="filled, rounded"]; edge [color=lightsteelblue2, penwidth=2]; subgraph cluster_abctools { graph [label=abctools]; "abjad.tools.abctools.AbjadObject.AbjadObject" [color=1, group=0, label=AbjadObject, shape=box]; "abjad.tools.abctools.AbjadObject.AbstractBase" [color=1, group=0, label=AbstractBase, shape=box]; "abjad.tools.abctools.AbjadObject.AbstractBase" -> "abjad.tools.abctools.AbjadObject.AbjadObject"; } subgraph cluster_quantizationtools { graph [label=quantizationtools]; "abjad.tools.quantizationtools.QTargetMeasure.QTargetMeasure" [color=black, fontcolor=white, group=2, label=<<B>QTargetMeasure</B>>, shape=box, style="filled, rounded"]; } subgraph cluster_builtins { graph [label=builtins]; "builtins.object" [color=2, group=1, label=object, shape=box]; } "abjad.tools.abctools.AbjadObject.AbjadObject" -> "abjad.tools.quantizationtools.QTargetMeasure.QTargetMeasure"; "builtins.object" -> "abjad.tools.abctools.AbjadObject.AbstractBase"; }

Bases

Attribute summary

beats The tuple of QTargetBeats contained by the QTargetMeasure:
duration_in_ms The duration in milliseconds of the QTargetMeasure:
offset_in_ms The offset in milliseconds of the QTargetMeasure:
search_tree The search tree of the QTargetMeasure:
tempo The tempo of the QTargetMeasure:
time_signature The time signature of the QTargetMeasure:
use_full_measure The use_full_measure flag of the QTargetMeasure:
__eq__(argument) Is true when ID of argument equals ID of Abjad object.
__format__([format_specification]) Formats q-event.
__hash__() Hashes Abjad object.
__ne__(argument) Is true when Abjad object does not equal argument.
__repr__() Gets interpreter representation of Abjad object.

Read-only properties

QTargetMeasure.beats

The tuple of QTargetBeats contained by the QTargetMeasure:

>>> for q_target_beat in q_target_measure.beats:
...     print(format(q_target_beat, 'storage'))
...
quantizationtools.QTargetBeat(
    beatspan=durationtools.Duration(1, 4),
    offset_in_ms=durationtools.Offset(1000, 1),
    search_tree=quantizationtools.UnweightedSearchTree(
        definition={   2: None,
            },
        ),
    tempo=indicatortools.Tempo(
        reference_duration=durationtools.Duration(1, 4),
        units_per_minute=60,
        ),
    )
quantizationtools.QTargetBeat(
    beatspan=durationtools.Duration(1, 4),
    offset_in_ms=durationtools.Offset(2000, 1),
    search_tree=quantizationtools.UnweightedSearchTree(
        definition={   2: None,
            },
        ),
    tempo=indicatortools.Tempo(
        reference_duration=durationtools.Duration(1, 4),
        units_per_minute=60,
        ),
    )
quantizationtools.QTargetBeat(
    beatspan=durationtools.Duration(1, 4),
    offset_in_ms=durationtools.Offset(3000, 1),
    search_tree=quantizationtools.UnweightedSearchTree(
        definition={   2: None,
            },
        ),
    tempo=indicatortools.Tempo(
        reference_duration=durationtools.Duration(1, 4),
        units_per_minute=60,
        ),
    )
quantizationtools.QTargetBeat(
    beatspan=durationtools.Duration(1, 4),
    offset_in_ms=durationtools.Offset(4000, 1),
    search_tree=quantizationtools.UnweightedSearchTree(
        definition={   2: None,
            },
        ),
    tempo=indicatortools.Tempo(
        reference_duration=durationtools.Duration(1, 4),
        units_per_minute=60,
        ),
    )

Returns tuple.

QTargetMeasure.duration_in_ms

The duration in milliseconds of the QTargetMeasure:

>>> q_target_measure.duration_in_ms
Duration(4000, 1)

Returns Duration.

QTargetMeasure.offset_in_ms

The offset in milliseconds of the QTargetMeasure:

>>> q_target_measure.offset_in_ms
Offset(1000, 1)

Returns Offset.

QTargetMeasure.search_tree

The search tree of the QTargetMeasure:

>>> q_target_measure.search_tree
UnweightedSearchTree(definition={2: None})

Return SearchTree instance.

QTargetMeasure.tempo

The tempo of the QTargetMeasure:

>>> q_target_measure.tempo
Tempo(reference_duration=Duration(1, 4), units_per_minute=60)

Return Tempo instance.

QTargetMeasure.time_signature

The time signature of the QTargetMeasure:

>>> q_target_measure.time_signature
TimeSignature((4, 4))

Return `TimeSignature instance.

QTargetMeasure.use_full_measure

The use_full_measure flag of the QTargetMeasure:

>>> q_target_measure.use_full_measure
False

Returns true or false.

Special methods

(AbjadObject).__eq__(argument)

Is true when ID of argument equals ID of Abjad object. Otherwise false.

Returns true or false.

QTargetMeasure.__format__(format_specification='')

Formats q-event.

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.