From: Philipp Klaus Date: Mon, 29 Oct 2018 10:20:33 +0000 (+0100) Subject: dashboard: fix when value|char_value is numpy.ndarray X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=43bbd1d620f3a29843a6be8844e3e16f050c4835;p=mvd_epics.git dashboard: fix when value|char_value is numpy.ndarray --- diff --git a/python_suite/dashboard/dashboard.py b/python_suite/dashboard/dashboard.py index 98e60ca..e6e09d4 100755 --- a/python_suite/dashboard/dashboard.py +++ b/python_suite/dashboard/dashboard.py @@ -9,6 +9,13 @@ from bottle import jinja2_view as view from requestlogger import WSGILogger, ApacheFormatter from logging.handlers import TimedRotatingFileHandler + +try: + import numpy as np + HAS_NUMPY = True +except ImportError: + HAS_NUMPY = False + CONFIG = None PVS = {} HISTORY = {} @@ -80,6 +87,9 @@ def cb_value_update(**kwargs): if pv['name'] != kwargs['pvname']: continue history_garbage_collection() + for prop in ('value', 'char_value'): + if HAS_NUMPY and isinstance(kwargs[prop], np.ndarray): + kwargs[prop] = kwargs[prop].tolist() class_map = { epics.NO_ALARM : "", epics.MINOR_ALARM : "minor_alarm",