compas_acoustics.worker
¶
Run compas_acoustics in a second interpreter, the worker, and call it over HTTP with protobuf payloads.
For a Python 3.9 host, where the binaural and ambisonics methods, STI and G are not available. client starts
the worker (service, in the Python >= 3.11 that install creates) on first use, on a free port of
127.0.0.1 with a random token; it stops with the session.
Classes¶
Client
¶
A running worker: client.simulate(...) calls compas_acoustics.worker.api.simulate there.
Methods:¶
call
¶
cancel
¶
Ask the call call_id to stop at its next stage; False if the worker has no such call.
progress
¶
The call's last stage, {"stage", "done", "of", "cancelled"}; None once it answered.
start
classmethod
¶
Start a worker with python and wait until it answers; refuse one that runs other sources.
WorkerError
¶
Bases: RuntimeError
An error the worker answered with: status is the HTTP status, the message the worker's text.
Functions:¶
analyse
¶
Analyse ir here, with STI and G from the worker when this Python's pyrato cannot compute them.
STI and G need pyrato >= 1.0, which needs Python >= 3.11. Returns the Analyser, its
analysis_data filled, and the messages of the UserWarnings raised in the worker.
client
¶
This session's worker, started on first use; None if no worker interpreter is configured.
fingerprint
¶
A hash of the package's Python sources: two installations of one development version can differ.
simulate
¶
Run method ("binaural", "ambisonics" or "mono") with settings on scene in the worker.
The responses are stored on scene.ir_graph under the method's name, as Scene.simulate stores them;
references ({key: ImpulseResponse}) is the method's reference. Returns the responses by key and the
messages of the UserWarnings raised in the worker.
stop_running_workers
¶
Ask every worker recorded in WORKERS to shut down, and forget those that are gone.
On Windows a running worker holds the files of the environment that install replaces.
worker_python
¶
$COMPAS_ACOUSTICS_WORKER_PYTHON, else the interpreter in CONFIG; None if neither exists.