IntervalSet

class pitchtools.IntervalSet(items=None, item_class=None)

Interval set.

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_datastructuretools { graph [label=datastructuretools]; "abjad.tools.datastructuretools.TypedCollection.TypedCollection" [color=3, group=2, label=TypedCollection, shape=oval, style=bold]; "abjad.tools.datastructuretools.TypedFrozenset.TypedFrozenset" [color=3, group=2, label=TypedFrozenset, shape=box]; "abjad.tools.datastructuretools.TypedCollection.TypedCollection" -> "abjad.tools.datastructuretools.TypedFrozenset.TypedFrozenset"; } subgraph cluster_pitchtools { graph [label=pitchtools]; "abjad.tools.pitchtools.IntervalSet.IntervalSet" [color=black, fontcolor=white, group=3, label=<<B>IntervalSet</B>>, shape=box, style="filled, rounded"]; "abjad.tools.pitchtools.Set.Set" [color=4, group=3, label=Set, shape=oval, style=bold]; "abjad.tools.pitchtools.Set.Set" -> "abjad.tools.pitchtools.IntervalSet.IntervalSet"; } subgraph cluster_builtins { graph [label=builtins]; "builtins.object" [color=2, group=1, label=object, shape=box]; } "abjad.tools.abctools.AbjadObject.AbjadObject" -> "abjad.tools.datastructuretools.TypedCollection.TypedCollection"; "abjad.tools.datastructuretools.TypedFrozenset.TypedFrozenset" -> "abjad.tools.pitchtools.Set.Set"; "builtins.object" -> "abjad.tools.abctools.AbjadObject.AbstractBase"; }

Attribute summary

cardinality Gets cardinality of set.
copy() Copies typed frozen set.
difference(argument) Typed frozen set set-minus argument.
from_selection(class_, selection[, item_class]) Initialize interval set from component selection:
intersection(argument) Set-theoretic intersection of typed frozen set and argument.
isdisjoint(argument) Is true when typed frozen set shares no elements with argument.
issubset(argument) Is true when typed frozen set is a subset of argument.
issuperset(argument) Is true when typed frozen set is a superset of argument.
item_class Gets item class of collection.
items Gets items in collection.
symmetric_difference(argument) Symmetric difference of typed frozen set and argument.
union(argument) Union of typed frozen set and argument.
__and__(argument) Logical AND of typed frozen set and argument.
__contains__(item) Is true when typed collection contains item.
__eq__(argument) Is true when argument is a typed collection with items that compare equal to those of this typed collection.
__format__([format_specification]) Formats Abjad object.
__ge__(argument) Is true when typed frozen set is greater than or equal to argument.
__gt__(argument) Is true when typed frozen set is greater than argument.
__hash__() Hashes typed frozen set.
__iter__() Iterates typed collection.
__le__(argument) Is true when typed frozen set is less than or equal to argument.
__len__() Gets length of typed collection.
__lt__(argument) Is true when typed frozen set is less than argument.
__ne__(argument) Is true when typed frozen set is not equal to argument.
__or__(argument) Logical OR of typed frozen set and argument.
__repr__() Gets interpreter representation of Abjad object.
__str__() Gets string representation.
__sub__(argument) Subtracts argument from typed frozen set.
__xor__(argument) Logical XOR of typed frozen set and argument.

Read-only properties

(Set).cardinality

Gets cardinality of set.

Defined equal to length of set.

Returns nonnegative integer.

(TypedCollection).item_class

Gets item class of collection.

Collection coerces items according to item_class.

Returns class.

(TypedCollection).items

Gets items in collection.

Returns list.

Methods

(TypedFrozenset).copy()

Copies typed frozen set.

Returns new typed frozen set.

(TypedFrozenset).difference(argument)

Typed frozen set set-minus argument.

Returns new typed frozen set.

(TypedFrozenset).intersection(argument)

Set-theoretic intersection of typed frozen set and argument.

Returns new typed frozen set.

(TypedFrozenset).isdisjoint(argument)

Is true when typed frozen set shares no elements with argument. Otherwise false.

Returns true or false.

(TypedFrozenset).issubset(argument)

Is true when typed frozen set is a subset of argument. Otherwise false.

Returns true or false.

(TypedFrozenset).issuperset(argument)

Is true when typed frozen set is a superset of argument. Otherwise false.

Returns true or false.

(TypedFrozenset).symmetric_difference(argument)

Symmetric difference of typed frozen set and argument.

Returns new typed frozen set.

(TypedFrozenset).union(argument)

Union of typed frozen set and argument.

Returns new typed frozen set.

Class & static methods

classmethod IntervalSet.from_selection(class_, selection, item_class=None)

Initialize interval set from component selection:

>>> staff_1 = Staff("c'4 <d' fs' a'>4 b2")
>>> staff_2 = Staff("c4. r8 g2")
>>> selection = select((staff_1, staff_2))
>>> intervals = pitchtools.IntervalSet.from_selection(
...     selection)
>>> for interval in sorted(intervals):
...     interval
...
NamedInterval('-M6')
NamedInterval('-P5')
NamedInterval('-aug4')
NamedInterval('-M3')
NamedInterval('-m3')
NamedInterval('-M2')
NamedInterval('+m2')
NamedInterval('+m3')
NamedInterval('+M3')
NamedInterval('+P4')
NamedInterval('+P5')
NamedInterval('+m7')
NamedInterval('+M7')
NamedInterval('+P8')
NamedInterval('+M9')
NamedInterval('+aug11')
NamedInterval('+M13')

Returns interval set.

Special methods

(TypedFrozenset).__and__(argument)

Logical AND of typed frozen set and argument.

Returns new typed frozen set.

(TypedCollection).__contains__(item)

Is true when typed collection contains item. Otherwise false.

Returns true or false.

(TypedCollection).__eq__(argument)

Is true when argument is a typed collection with items that compare equal to those of this typed collection. 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.

(TypedFrozenset).__ge__(argument)

Is true when typed frozen set is greater than or equal to argument. Otherwise false.

Returns true or false.

(TypedFrozenset).__gt__(argument)

Is true when typed frozen set is greater than argument. Otherwise false.

Returns true or false.

(TypedFrozenset).__hash__()

Hashes typed frozen set.

Returns integer.

(TypedCollection).__iter__()

Iterates typed collection.

Returns generator.

(TypedFrozenset).__le__(argument)

Is true when typed frozen set is less than or equal to argument. Otherwise false.

Returns true or false.

(TypedCollection).__len__()

Gets length of typed collection.

Returns nonnegative integer.

(TypedFrozenset).__lt__(argument)

Is true when typed frozen set is less than argument. Otherwise false.

Returns true or false.

(TypedFrozenset).__ne__(argument)

Is true when typed frozen set is not equal to argument. Otherwise false.

Returns true or false.

(TypedFrozenset).__or__(argument)

Logical OR of typed frozen set and argument.

Returns new typed frozen set.

(AbjadObject).__repr__()

Gets interpreter representation of Abjad object.

Returns string.

(Set).__str__()

Gets string representation.

Returns string.

(TypedFrozenset).__sub__(argument)

Subtracts argument from typed frozen set.

Returns new typed frozen set.

(TypedFrozenset).__xor__(argument)

Logical XOR of typed frozen set and argument.

Returns new typed frozen set.