libvis package¶
Submodules¶
libvis.VisVars module¶
-
class
libvis.VisVars.VisHooks(value)[source]¶ Bases:
libvis.VisVars.VisVars-
name= 'VisVar'¶
-
-
class
libvis.VisVars.VisObject(value)[source]¶ Bases:
libvis.VisVars.VisVars-
name= 'VisVar'¶
-
libvis.VisWorker module¶
-
class
libvis.VisWorker.Vis(ws_port=7700, vis_port=7000, nb_name=None, debug=False, allow_remote=False)[source]¶ Bases:
object-
configure_logging(level, sink=<_io.TextIOWrapper name='<stderr>' mode='w' encoding='UTF-8'>)[source]¶ Sets up logging verbosity.
- Parameters
level (str) – ERROR, WARNING, INFO, DEBUG, TRACE
sink – stream or file for logs
-
start()[source]¶ Start visualization process.
Main entry point of legimens. Called upon initialization of this class.
Starts an http server with dashboard app on vis_port.
Starts the legimens app using Vis.app.run().
- Raises
Exception – Something went wrong when starting http or websocket server in legimens.
-
watch(obj, key, serializer=None)[source]¶ Sets libvis to watch an object.
- Parameters
obj – the object to watch, has to be serializable.
key (str) – name of the object variable.
serializer (callable) – optional function that converts objects of type(obj) to serializable.
For sending updates we can use existing channel created for
vis.vars, but this would introduce overhead. Hence, a new channel is created by creating alibvis.VisVars.VisObject()of typelegimens.Object(). It is a wrapper that has singlebodyattribute. Legimens will send serializedlegimens.Object()everyvis.app._watch_poll_delayseconds.Returns ref of the proxy
VisObject.
-
libvis.http_server module¶
Very simple HTTP server in python. Usage:
./dummy-web-server.py [<port>]
- Send a HEAD request::
curl -I http://localhost
- Send a POST request::
curl -d “foo=bar&bin=baz” http://localhost
-
class
libvis.http_server.Server(request, client_address, server)[source]¶ Bases:
http.server.BaseHTTPRequestHandler
-
libvis.http_server.create_server(server_class=<class 'http.server.HTTPServer'>, handler_class=<class 'libvis.http_server.Server'>, addr='', port=80)[source]¶
libvis.interface module¶
-
class
libvis.interface.NumpyEncoder(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None)[source]¶ Bases:
json.encoder.JSONEncoder-
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)
-
-
libvis.interface.reset_IFC()[source]¶ Reinitialize global value of IFC
Should I have global IFC or local to Vis obj? For:
Different Vis instances might share set up visualization so no need to configure them separately.
- Against:
Different Vis may serve different purposes, so there might be a need to configure them
differently.