quantizationjob

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_abjadext.nauert.quantizationjob" { graph [label="abjadext.nauert.quantizationjob"]; node [color=1]; "abjadext.nauert.quantizationjob.QuantizationJob" [URL="../api/abjadext/nauert/quantizationjob.html#abjadext.nauert.quantizationjob.QuantizationJob", color=black, fontcolor=white, label="Quantization\nJob", target=_top]; } subgraph cluster_builtins { graph [label=builtins]; node [color=2]; "builtins.object" [URL="https://docs.python.org/3.10/library/functions.html#object", label=object, target=_top]; } "builtins.object" -> "abjadext.nauert.quantizationjob.QuantizationJob"; }


Classes

QuantizationJob

Quantization job.

class abjadext.nauert.quantizationjob.QuantizationJob(job_id=1, search_tree=None, q_event_proxies=None, q_grids=None)[source]

Quantization job.

Copiable, picklable class for generating all QGrids which are valid under a given SearchTree for a sequence of QEventProxies.

>>> q_event_a = nauert.PitchedQEvent(250, [0, 1])
>>> q_event_b = nauert.SilentQEvent(500)
>>> q_event_c = nauert.PitchedQEvent(750, [3, 7])
>>> proxy_a = nauert.QEventProxy(q_event_a, 0.25)
>>> proxy_b = nauert.QEventProxy(q_event_b, 0.5)
>>> proxy_c = nauert.QEventProxy(q_event_c, 0.75)
>>> definition = {2: {2: None}, 3: None, 5: None}
>>> search_tree = nauert.UnweightedSearchTree(definition)
>>> job = nauert.QuantizationJob(1, search_tree, [proxy_a, proxy_b, proxy_c])

QuantizationJob generates QGrids when called, and stores those QGrids on its q_grids attribute, allowing them to be recalled later, even if pickled:

>>> job()
>>> for q_grid in job.q_grids:
...     print(q_grid.rtm_format)
... 
1
(1 (1 1 1 1 1))
(1 (1 1 1))
(1 (1 1))
(1 ((1 (1 1)) (1 (1 1))))

QuantizationJob is intended to be useful in multiprocessing-enabled environments.


Attributes Summary

__call__

Calls quantization job.

__eq__

Is true when argument is a quantization job with job ID, search tree, q-event proxies and q-grids equal to those of this quantization job.

__hash__

Hashes quantization job.

__repr__

Gets repr.

job_id

The job id of the QuantizationJob.

q_event_proxies

The QEventProxies the QuantizationJob was instantiated with.

q_grids

The generated QGrids.

search_tree

The search tree the QuantizationJob was instantiated with.


Special methods

overridden __call__()[source]

Calls quantization job.

Returns none.

Return type:

None

overridden __eq__(argument)[source]

Is true when argument is a quantization job with job ID, search tree, q-event proxies and q-grids equal to those of this quantization job. Otherwise false.

Return type:

bool

overridden __hash__()[source]

Hashes quantization job.

Required to be explicitly redefined on Python 3 if __eq__ changes.

Return type:

int

overridden __repr__()[source]

Gets repr.


Read-only properties

job_id

The job id of the QuantizationJob.

Only meaningful when the job is processed via multiprocessing, as the job id is necessary to reconstruct the order of jobs.

q_event_proxies

The QEventProxies the QuantizationJob was instantiated with.

>>> q_event_a = nauert.PitchedQEvent(250, [0, 1])
>>> q_event_b = nauert.SilentQEvent(500)
>>> q_event_c = nauert.PitchedQEvent(750, [3, 7])
>>> proxy_a = nauert.QEventProxy(q_event_a, 0.25)
>>> proxy_b = nauert.QEventProxy(q_event_b, 0.5)
>>> proxy_c = nauert.QEventProxy(q_event_c, 0.75)
>>> definition = {2: {2: None}, 3: None, 5: None}
>>> search_tree = nauert.UnweightedSearchTree(definition)
>>> job = nauert.QuantizationJob(1, search_tree, [proxy_a, proxy_b, proxy_c])
>>> job()
>>> for q_event_proxy in job.q_event_proxies:
...     q_event_proxy
... 
QEventProxy(q_event=PitchedQEvent(offset=Offset((250, 1)), pitches=(NamedPitch("c'"), NamedPitch("cs'")), index=None, attachments=()), offset=Offset((1, 4)))
QEventProxy(q_event=SilentQEvent(offset=Offset((500, 1)), index=None, attachments=()), offset=Offset((1, 2)))
QEventProxy(q_event=PitchedQEvent(offset=Offset((750, 1)), pitches=(NamedPitch("ef'"), NamedPitch("g'")), index=None, attachments=()), offset=Offset((3, 4)))
q_grids

The generated QGrids.

>>> q_event_a = nauert.PitchedQEvent(250, [0, 1])
>>> q_event_b = nauert.SilentQEvent(500)
>>> q_event_c = nauert.PitchedQEvent(750, [3, 7])
>>> proxy_a = nauert.QEventProxy(q_event_a, 0.25)
>>> proxy_b = nauert.QEventProxy(q_event_b, 0.5)
>>> proxy_c = nauert.QEventProxy(q_event_c, 0.75)
>>> definition = {2: {2: None}, 3: None, 5: None}
>>> search_tree = nauert.UnweightedSearchTree(definition)
>>> job = nauert.QuantizationJob(1, search_tree, [proxy_a, proxy_b, proxy_c])
>>> job()
>>> for q_grid in job.q_grids:
...     print(q_grid.rtm_format)
... 
1
(1 (1 1 1 1 1))
(1 (1 1 1))
(1 (1 1))
(1 ((1 (1 1)) (1 (1 1))))
search_tree

The search tree the QuantizationJob was instantiated with.