deepdrrzmq.utils package

Submodules

deepdrrzmq.utils.drr_util module

deepdrrzmq.utils.server_util module

exception deepdrrzmq.utils.server_util.DeepDRRServerException(code, message)

Bases: Exception

Exception class for server errors.

status_response()
deepdrrzmq.utils.server_util.capnp_optional(optional)

Convert a capnp optional to a python value.

Parameters:

optional – The capnp optional.

Returns:

The value of the optional, or None if the optional is not set.

deepdrrzmq.utils.server_util.capnp_square_matrix(optional)

Convert a capnp optional to a square numpy array.

Parameters:

optional – The capnp optional.

Returns:

The value of the optional, or None if the optional is not set.

deepdrrzmq.utils.server_util.make_response(code, message)

Create a StatusResponse message with the given code and message.

Parameters:
  • code – The status code.

  • message – The status message.

Returns:

The StatusResponse message.

deepdrrzmq.utils.timer_util module

class deepdrrzmq.utils.timer_util.FPS(print_every_seconds=1)

Bases: object

A simple FPS counter.

deepdrrzmq.utils.typer_util module

deepdrrzmq.utils.typer_util.no_option_conversion()
Do not perform any conversion of option names. In particular:
  • do not make them lowercase

  • do not change underscores to hyphens

(Useful for libraries which may require options to be valid variable names, eg. wandb)

deepdrrzmq.utils.typer_util.unwrap_typer_param(f: Callable)

Unwraps the default values from typer.Argument or typer.Option to allow function to be called normally. See: https://github.com/tiangolo/typer/issues/279

deepdrrzmq.utils.zmq_util module

deepdrrzmq.utils.zmq_util.zmq_no_linger_context(context)
async deepdrrzmq.utils.zmq_util.zmq_poll_latest(sub_socket, max_skip=1000)

Polls the latest messages from a zmq socket.

Parameters:
  • sub_socket – the socket to poll

  • max_skip – the maximum number of messages to skip

Returns:

a dictionary mapping topics to messages

Module contents