ADCS.helpers.animations.godot.client module

class ADCS.helpers.animations.godot.client.VizClient(host, port, token, name='python-reference')[source]

Bases: object

Reference client for the visualization stream (what a viewer does).

Used by the tests and as the model for viewer implementations: connect, present the token, read HELLO, then consume BLOCK/ROW/END messages, acknowledging rows when the session is in lockstep mode.

Parameters:
  • host (str) – Server host.

  • port (int) – Server port.

  • token (str) – Session token printed or passed by the launcher.

  • name (str) – Client name sent in CONNECT.

close()[source]
Return type:

None

connect(timeout=10.0)[source]

Connect and read HELLO.

Returns:

The HELLO content (protocol, mode, manifest, scene).

Raises:

ConnectionRefusedError – If the server rejects the client.

Parameters:

timeout (float)

Return type:

Dict[str, Any]

messages(timeout=None)[source]

Yield decoded messages until the session END.

  • (BLOCK, (run_id, row_start, {channel: array (n, width)}))

  • (ROW, (run_id, {channel: array (width,)}))

  • (END, run_id) for the end of a run

Parameters:

timeout (float | None) – Socket timeout per message (None waits forever).

Return type:

Iterator[Tuple[MsgType, Any]]

read_all(timeout=None)[source]

Collect a whole session.

Returns:

{run_id: {channel: array (n_rows, width)}}.

Parameters:

timeout (float | None)

Return type:

Dict[str, Dict[str, ndarray]]

split_row(values)[source]

Split a concatenated row into {channel: values}.

Parameters:

values (ndarray)

Return type:

Dict[str, ndarray]

assets: Dict[str, Tuple[Dict[str, Any], bytes]]

{name: (meta, bytes)}.

Type:

Files received as ASSET messages

property lockstep: bool