envision.client module¶
-
class
envision.client.
Client
(endpoint: Optional[str] = None, wait_between_retries: float = 0.5, output_dir: Optional[str] = None, sim_name: Optional[str] = None, headless: bool = False)[source]¶ Used to push state from SMARTS to Envision server while the simulation is running.
-
static
read_and_send
(path: str, endpoint: str = 'ws://localhost:8081', timestep_sec: float = 0.1, wait_between_retries: float = 0.5)[source]¶
-
send
(state: envision.types.State)[source]¶
-
static
-
class
envision.client.
JSONEncoder
(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None)[source]¶ This custom encoder is to support serializing more complex data from SMARTS including numpy arrays, NaNs, and Infinity which don’t have standarized handling according to the JSON spec.
-
default
(obj)[source]¶ Implement this method in a subclass such that it returns a serializable object for
o
, or calls the base implementation (to raise aTypeError
).For example, to support arbitrary iterators, you could implement default like this:
def default(self, o): try: iterable = iter(o) except TypeError: pass else: return list(iterable) # Let the base class default method raise the TypeError return JSONEncoder.default(self, o)
-