A utility class for defining the permissible divisions of a collection of QGrid objects.
The search tree is defined by a nested dictionary structure, whose keys must be prime integers, and whose values must be None (indicating no further possible divisions) or another dictionary following the same rules.
abjad> from abjad.tools.quantizationtools import QGridSearchTree
For example, In the following tree, the beat may be divided into 2 or into 5. If divided into 2, it may be divided again into 2 or into 3.
abjad> search_tree = QGridSearchTree({2: {2: None, 3: None}, 5: None})
Return a new QGridSearchTree.
An ordered tuple of all Offset objects which those QGrid objects governed by a specific QGridSearchTree can contain.
abjad> from abjad.tools.quantizationtools import QGridSearchTree
abjad> qst = QGridSearchTree({2: {3: None}})
abjad> qst.offsets
(Offset(0, 1), Offset(1, 6), Offset(1, 3), Offset(1, 2), Offset(2, 3), Offset(5, 6), Offset(1, 1))
Returns a tuple.
Note
Inherited from __builtin__.dict
Note
Inherited from __builtin__.dict
Given a parentage signature, defining some subtree of a QGridSearchTree, return a tuple of permitted divisions of that subtree.
abjad> from abjad.tools.quantizationtools import QGridSearchTree
abjad> qst = QGridSearchTree({2: {2: None, 3: {7: None, 11: None}}, 5: None})
abjad> qst.find_subtree_divisibility((2,))
(2, 3)
abjad> qst.find_subtree_divisibility((2, 2))
()
abjad> qst.find_subtree_divisibility((2, 3))
(7, 11)
abjad> qst.find_subtree_divisibility((2, 3, 7))
()
Returns a tuple.
Note
Inherited from __builtin__.dict
Note
Inherited from __builtin__.dict
Note
Inherited from __builtin__.dict
Note
Inherited from __builtin__.dict
Note
Inherited from __builtin__.dict
Note
Inherited from __builtin__.dict
Note
Inherited from __builtin__.dict
If key is not found, d is returned if given, otherwise KeyError is raised
Note
Inherited from __builtin__.dict
2-tuple; but raise KeyError if D is empty.
Note
Inherited from __builtin__.dict
Prune those subtrees of a QGridSearchTree whose divisions in milliseconds, given beatspan and tempo, would be less than threshold.
This allows a composer to specify the maximum speed any quantization operation will permit.
abjad> from abjad.tools.quantizationtools import QGridSearchTree
abjad> qst = QGridSearchTree({2: {2: {2: {2: None}}}})
abjad> beatspan = Fraction(1, 4)
abjad> tempo = contexttools.TempoMark((1, 4), 60)
abjad> qst.prune(beatspan, tempo, 100)
{2: {2: {2: None}}}
abjad> qst.prune(beatspan, tempo, 200)
{2: {2: None}}
abjad> qst.prune(beatspan, tempo, 400)
{2: None}
Returns a new QGridSearchTree.
Note
Inherited from __builtin__.dict
If E has a .keys() method, does: for k in E: D[k] = E[k] If E lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]
Note
Inherited from __builtin__.dict
Note
Inherited from __builtin__.dict
Note
Inherited from __builtin__.dict
Note
Inherited from __builtin__.dict
Note
Inherited from __builtin__.dict
Note
Inherited from __builtin__.dict
Note
Inherited from __builtin__.dict
x.__delattr__(‘name’) <==> del x.name
Note
Inherited from __builtin__.object
Note
Inherited from datastructuretools.ImmutableDictionary
x.__eq__(y) <==> x==y
Note
Inherited from __builtin__.dict
x.__ge__(y) <==> x>=y
Note
Inherited from __builtin__.dict
x.__getitem__(y) <==> x[y]
Note
Inherited from __builtin__.dict
x.__gt__(y) <==> x>y
Note
Inherited from __builtin__.dict
Note
Inherited from __builtin__.dict
x.__le__(y) <==> x<=y
Note
Inherited from __builtin__.dict
Note
Inherited from __builtin__.dict
x.__lt__(y) <==> x<y
Note
Inherited from __builtin__.dict
x.__ne__(y) <==> x!=y
Note
Inherited from __builtin__.dict
Note
Inherited from __builtin__.dict
x.__setattr__(‘name’, value) <==> x.name = value
Note
Inherited from __builtin__.object
Note
Inherited from datastructuretools.ImmutableDictionary
Note
Inherited from __builtin__.object