envision.client module
- class envision.client.Client(endpoint: str | None = None, wait_between_retries: float = 0.5, output_dir: str | None = None, sim_name: str | None = None, headless: bool = False, envision_state_filter: EnvisionStateFilter | None = None, data_formatter_args: EnvisionDataFormatterArgs | None = None)[source]
Used to push state from SMARTS to Envision server while the simulation is running.
- property envision_state_filter: EnvisionStateFilter
Filtering options for data.
- property headless
Indicates if this client is disconnected from the remote.
- static read_and_send(path: str, endpoint: str = 'ws://localhost:8081', fixed_timestep_sec: float = 0.1, wait_between_retries: float = 0.5)[source]
Send recorded envision simulation data to the envision server.
- class envision.client.CustomJSONEncoder(*, 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 standardized 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)