quantizationjob¶
Classes
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 givenSearchTree
for a sequence ofQEventProxies
.>>> 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
generatesQGrids
when called, and stores thoseQGrids
on itsq_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
Calls quantization job.
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.
Hashes quantization job.
Gets repr.
The job id of the
QuantizationJob
.The
QEventProxies
theQuantizationJob
was instantiated with.The generated
QGrids
.The search tree the
QuantizationJob
was instantiated with.Special methods
- 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:
- overridden __hash__()[source]¶
Hashes quantization job.
Required to be explicitly redefined on Python 3 if __eq__ changes.
- Return type:
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
theQuantizationJob
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.