WellformednessManager

class systemtools.WellformednessManager(allow_percussion_clef=None)

Wellformedness manager.

>>> import abjad
>>> abjad.WellformednessManager()
WellformednessManager()

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_systemtools { graph [label=systemtools]; "abjad.tools.systemtools.WellformednessManager.WellformednessManager" [color=black, fontcolor=white, group=2, label=<<B>WellformednessManager</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.systemtools.WellformednessManager.WellformednessManager"; "builtins.object" -> "abjad.tools.abctools.AbjadObject.AbstractBase"; }

Bases

Attribute summary

allow_percussion_clef Is true when manager allows percussion clef.
check_beamed_quarter_notes([argument]) Checks to make sure there are no beamed quarter notes.
check_conflicting_clefs([argument]) Checks for conflicting clefs.
check_discontiguous_spanners([argument]) Checks for discontiguous spanners.
check_duplicate_ids([argument]) Checks to make sure there are no components with duplicated IDs.
check_empty_containers([argument]) Checks to make sure there are no empty containers in score.
check_intermarked_hairpins([argument]) Checks to make sure there are no hairpins in score with intervening dynamic marks.
check_misdurated_measures([argument]) Checks to make sure there are no misdurated measures in score.
check_misfilled_measures([argument]) Checks that time signature duration equals measure contents duration for every measure.
check_mismatched_enchained_hairpins([argument]) Checks mismatched enchained hairpins.
check_mispitched_ties([argument]) Checks for mispitched notes.
check_misrepresented_flags([argument]) Checks to make sure there are no misrepresented flags in score.
check_missing_parents([argument]) Checks to make sure there are no components in score with missing parent.
check_nested_measures([argument]) Checks to make sure there are no nested measures in score.
check_notes_on_wrong_clef([argument]) Checks notes and chords on wrong clef.
check_out_of_range_notes([argument]) Checks to make sure notes and chords are within traditional instrument ranges.
check_overlapping_beams([argument]) Checks to make sure there are no overlapping beams in score.
check_overlapping_glissandi([argument]) Checks to make sure there are no overlapping glissandi in score.
check_overlapping_hairpins([argument]) Checks to make sure there are no overlapping hairpins in score.
check_overlapping_octavation_spanners([argument]) Checks to make sure there are no overlapping octavation spanners in score.
check_overlapping_ties([argument]) Checks to make sure there are no overlapping ties in score.
check_short_hairpins([argument]) Checks to make sure that hairpins span at least two leaves.
check_tied_rests([argument]) Checks to make sure there are no tied rests.
__call__([argument]) Calls all wellformedness checks on argument.
__eq__(argument) Is true when ID of argument equals ID of Abjad object.
__format__([format_specification]) Formats Abjad object.
__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

WellformednessManager.allow_percussion_clef

Is true when manager allows percussion clef. Otherwise false.

Returns true, false or none.

Methods

WellformednessManager.check_beamed_quarter_notes(argument=None)

Checks to make sure there are no beamed quarter notes.

Returns violators and total.

WellformednessManager.check_conflicting_clefs(argument=None)

Checks for conflicting clefs.

Conflicting clefs defined equal to the situation in which a first clef is attached to a container and a second clef is attached to a child of the container that starts at the same time as the container.

Situation does not usually arise because an exception raises on attempt to attach a clef to any component that starts at the same time as some other component in the score tree.

But advanced users can stumble into this situation as described in the following examples.

Returns violators and total.

WellformednessManager.check_discontiguous_spanners(argument=None)

Checks for discontiguous spanners.

There are now two different types of spanner. Most spanners demand that spanner components be logical-voice-contiguous. But a few special spanners (like MetronomeMark) do not make such a demand. The check here consults the experimental _contiguity_constraint.

Returns violators and total.

WellformednessManager.check_duplicate_ids(argument=None)

Checks to make sure there are no components with duplicated IDs.

Returns violators and total.

WellformednessManager.check_empty_containers(argument=None)

Checks to make sure there are no empty containers in score.

Returns violators and total.

WellformednessManager.check_intermarked_hairpins(argument=None)

Checks to make sure there are no hairpins in score with intervening dynamic marks.

Returns violators and total.

WellformednessManager.check_misdurated_measures(argument=None)

Checks to make sure there are no misdurated measures in score.

Returns violators and total.

WellformednessManager.check_misfilled_measures(argument=None)

Checks that time signature duration equals measure contents duration for every measure.

Returns violators and total.

WellformednessManager.check_mismatched_enchained_hairpins(argument=None)

Checks mismatched enchained hairpins.

Checks mismatched enchained hairpins:

>>> staff = abjad.Staff("c'4 d' e' f'")
>>> abjad.attach(abjad.Hairpin('p < f'), staff[:2])
>>> abjad.attach(abjad.Hairpin('p > pp'), staff[1:])
>>> agent = abjad.inspect(staff)
>>> print(agent.tabulate_well_formedness_violations())
0 /	4 beamed quarter notes
0 /	1 conflicting clefs
0 /	2 discontiguous spanners
0 /	5 duplicate ids
0 /	1 empty containers
0 /	2 intermarked hairpins
0 /	0 misdurated measures
0 /	0 misfilled measures
2 /	2 mismatched enchained hairpins
0 /	0 mispitched ties
0 /	4 misrepresented flags
0 /	5 missing parents
0 /	0 nested measures
0 /	4 notes on wrong clef
0 /	4 out of range notes
0 /	0 overlapping beams
0 /	0 overlapping glissandi
0 /	2 overlapping hairpins
0 /	0 overlapping octavation spanners
0 /	0 overlapping ties
0 /	2 short hairpins
0 /	0 tied rests

Enchained hairpins are fine so long as hairpin ends match.

Returns violators and total.

WellformednessManager.check_mispitched_ties(argument=None)

Checks for mispitched notes.

Checks for mispitched ties attached to notes:

>>> staff = abjad.Staff("c'4 ~ c'")
>>> staff[1].written_pitch = abjad.NamedPitch("d'")
>>> agent = abjad.inspect(staff)
>>> print(agent.tabulate_well_formedness_violations())
0 /	2 beamed quarter notes
0 /	1 conflicting clefs
0 /	1 discontiguous spanners
0 /	3 duplicate ids
0 /	1 empty containers
0 /	0 intermarked hairpins
0 /	0 misdurated measures
0 /	0 misfilled measures
0 /	0 mismatched enchained hairpins
1 /	1 mispitched ties
0 /	2 misrepresented flags
0 /	3 missing parents
0 /	0 nested measures
0 /	2 notes on wrong clef
0 /	2 out of range notes
0 /	0 overlapping beams
0 /	0 overlapping glissandi
0 /	0 overlapping hairpins
0 /	0 overlapping octavation spanners
0 /	1 overlapping ties
0 /	0 short hairpins
0 /	0 tied rests

Checks for mispitched ties attached to chords:

>>> staff = abjad.Staff("<c' d' bf'>4 ~ <c' d' bf'>")
>>> staff[1].written_pitches = [6, 9, 10]
>>> agent = abjad.inspect(staff)
>>> print(agent.tabulate_well_formedness_violations())
0 /	2 beamed quarter notes
0 /	1 conflicting clefs
0 /	1 discontiguous spanners
0 /	3 duplicate ids
0 /	1 empty containers
0 /	0 intermarked hairpins
0 /	0 misdurated measures
0 /	0 misfilled measures
0 /	0 mismatched enchained hairpins
1 /	1 mispitched ties
0 /	2 misrepresented flags
0 /	3 missing parents
0 /	0 nested measures
0 /	2 notes on wrong clef
0 /	2 out of range notes
0 /	0 overlapping beams
0 /	0 overlapping glissandi
0 /	0 overlapping hairpins
0 /	0 overlapping octavation spanners
0 /	1 overlapping ties
0 /	0 short hairpins
0 /	0 tied rests

Does not check tied rests, chords or skips.

Returns violator ties together with total number of ties.

WellformednessManager.check_misrepresented_flags(argument=None)

Checks to make sure there are no misrepresented flags in score.

Returns violators and total.

WellformednessManager.check_missing_parents(argument=None)

Checks to make sure there are no components in score with missing parent.

Returns violators and total.

WellformednessManager.check_nested_measures(argument=None)

Checks to make sure there are no nested measures in score.

Returns violators and total.

WellformednessManager.check_notes_on_wrong_clef(argument=None)

Checks notes and chords on wrong clef.

>>> staff = abjad.Staff("c'8 d'8 e'8 f'8")
>>> clef = abjad.Clef(name='alto')
>>> abjad.attach(clef, staff[0])
>>> violin = abjad.instrumenttools.Violin()
>>> abjad.attach(violin, staff[0])
>>> show(staff) 
>>> agent = abjad.inspect(staff)
>>> print(agent.tabulate_well_formedness_violations())
0 /	4 beamed quarter notes
0 /	1 conflicting clefs
0 /	0 discontiguous spanners
0 /	5 duplicate ids
0 /	1 empty containers
0 /	0 intermarked hairpins
0 /	0 misdurated measures
0 /	0 misfilled measures
0 /	0 mismatched enchained hairpins
0 /	0 mispitched ties
0 /	4 misrepresented flags
0 /	5 missing parents
0 /	0 nested measures
4 /	4 notes on wrong clef
0 /	4 out of range notes
0 /	0 overlapping beams
0 /	0 overlapping glissandi
0 /	0 overlapping hairpins
0 /	0 overlapping octavation spanners
0 /	0 overlapping ties
0 /	0 short hairpins
0 /	0 tied rests

Allows percussion clef:

>>> staff = abjad.Staff("c'8 d'8 e'8 f'8")
>>> clef = abjad.Clef(name='percussion')
>>> abjad.attach(clef, staff[0])
>>> violin = abjad.instrumenttools.Violin()
>>> abjad.attach(violin, staff[0])
>>> show(staff) 
>>> agent = abjad.inspect(staff)
>>> print(agent.tabulate_well_formedness_violations(
...     allow_percussion_clef=True,
...     ))
0 /	4 beamed quarter notes
0 /	1 conflicting clefs
0 /	0 discontiguous spanners
0 /	5 duplicate ids
0 /	1 empty containers
0 /	0 intermarked hairpins
0 /	0 misdurated measures
0 /	0 misfilled measures
0 /	0 mismatched enchained hairpins
0 /	0 mispitched ties
0 /	4 misrepresented flags
0 /	5 missing parents
0 /	0 nested measures
0 /	4 notes on wrong clef
0 /	4 out of range notes
0 /	0 overlapping beams
0 /	0 overlapping glissandi
0 /	0 overlapping hairpins
0 /	0 overlapping octavation spanners
0 /	0 overlapping ties
0 /	0 short hairpins
0 /	0 tied rests

Forbids percussion clef:

>>> agent = abjad.inspect(staff)
>>> print(agent.tabulate_well_formedness_violations(
...     allow_percussion_clef=False,
...     ))
0 /	4 beamed quarter notes
0 /	1 conflicting clefs
0 /	0 discontiguous spanners
0 /	5 duplicate ids
0 /	1 empty containers
0 /	0 intermarked hairpins
0 /	0 misdurated measures
0 /	0 misfilled measures
0 /	0 mismatched enchained hairpins
0 /	0 mispitched ties
0 /	4 misrepresented flags
0 /	5 missing parents
0 /	0 nested measures
4 /	4 notes on wrong clef
0 /	4 out of range notes
0 /	0 overlapping beams
0 /	0 overlapping glissandi
0 /	0 overlapping hairpins
0 /	0 overlapping octavation spanners
0 /	0 overlapping ties
0 /	0 short hairpins
0 /	0 tied rests

Returns true or false.

WellformednessManager.check_out_of_range_notes(argument=None)

Checks to make sure notes and chords are within traditional instrument ranges.

Out of range:

>>> staff = abjad.Staff("c'8 r8 <d fs>8 r8")
>>> violin = abjad.instrumenttools.Violin()
>>> abjad.attach(violin, staff[0])
>>> show(staff) 
>>> agent = abjad.inspect(staff)
>>> print(agent.tabulate_well_formedness_violations())
0 /	4 beamed quarter notes
0 /	1 conflicting clefs
0 /	0 discontiguous spanners
0 /	5 duplicate ids
0 /	1 empty containers
0 /	0 intermarked hairpins
0 /	0 misdurated measures
0 /	0 misfilled measures
0 /	0 mismatched enchained hairpins
0 /	0 mispitched ties
0 /	4 misrepresented flags
0 /	5 missing parents
0 /	0 nested measures
0 /	4 notes on wrong clef
1 /	2 out of range notes
0 /	0 overlapping beams
0 /	0 overlapping glissandi
0 /	0 overlapping hairpins
0 /	0 overlapping octavation spanners
0 /	0 overlapping ties
0 /	0 short hairpins
0 /	2 tied rests

Returns true or false.

WellformednessManager.check_overlapping_beams(argument=None)

Checks to make sure there are no overlapping beams in score.

Returns violators and total.

WellformednessManager.check_overlapping_glissandi(argument=None)

Checks to make sure there are no overlapping glissandi in score.

Returns violators and total.

WellformednessManager.check_overlapping_hairpins(argument=None)

Checks to make sure there are no overlapping hairpins in score.

Checks overlapping hairpins:

>>> staff = abjad.Staff("c'4 d' e' f'")
>>> abjad.attach(abjad.Hairpin('<'), staff[:])
>>> abjad.attach(abjad.Hairpin('>'), staff[:])
>>> agent = abjad.inspect(staff)
>>> print(agent.tabulate_well_formedness_violations())
0 /	4 beamed quarter notes
0 /	1 conflicting clefs
0 /	2 discontiguous spanners
0 /	5 duplicate ids
0 /	1 empty containers
0 /	2 intermarked hairpins
0 /	0 misdurated measures
0 /	0 misfilled measures
0 /	2 mismatched enchained hairpins
0 /	0 mispitched ties
0 /	4 misrepresented flags
0 /	5 missing parents
0 /	0 nested measures
0 /	4 notes on wrong clef
0 /	4 out of range notes
0 /	0 overlapping beams
0 /	0 overlapping glissandi
2 /	2 overlapping hairpins
0 /	0 overlapping octavation spanners
0 /	0 overlapping ties
0 /	2 short hairpins
0 /	0 tied rests

Enchained hairpins are fine so long as hairpin ends match.

Returns violators and total.

WellformednessManager.check_overlapping_octavation_spanners(argument=None)

Checks to make sure there are no overlapping octavation spanners in score.

Returns violators and total.

WellformednessManager.check_overlapping_ties(argument=None)

Checks to make sure there are no overlapping ties in score.

Checks overlapping ties:

>>> staff = abjad.Staff("c'4 c' c' c''")
>>> abjad.attach(abjad.Tie(), staff[:2])
>>> tie = abjad.Tie()
>>> tie._ignore_attachment_test = True
>>> abjad.attach(tie, staff[1:3])
>>> agent = abjad.inspect(staff)
>>> print(agent.tabulate_well_formedness_violations())
0 /	4 beamed quarter notes
0 /	1 conflicting clefs
0 /	2 discontiguous spanners
0 /	5 duplicate ids
0 /	1 empty containers
0 /	0 intermarked hairpins
0 /	0 misdurated measures
0 /	0 misfilled measures
0 /	0 mismatched enchained hairpins
0 /	2 mispitched ties
0 /	4 misrepresented flags
0 /	5 missing parents
0 /	0 nested measures
0 /	4 notes on wrong clef
0 /	4 out of range notes
0 /	0 overlapping beams
0 /	0 overlapping glissandi
0 /	0 overlapping hairpins
0 /	0 overlapping octavation spanners
2 /	2 overlapping ties
0 /	0 short hairpins
0 /	0 tied rests

Returns violators and count of total ties.

WellformednessManager.check_short_hairpins(argument=None)

Checks to make sure that hairpins span at least two leaves.

Returns violators and total.

WellformednessManager.check_tied_rests(argument=None)

Checks to make sure there are no tied rests.

Returns violators and total.

Special methods

WellformednessManager.__call__(argument=None)

Calls all wellformedness checks on argument.

Returns triples.

(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.