From 74fab170d1d986ff34762ce18fcea94e37fba60f Mon Sep 17 00:00:00 2001 From: Neil Lawrence Date: Fri, 21 May 2021 08:01:39 +0100 Subject: [PATCH] Update visualize stick_show for Python 3 and with clear error message for failure. --- GPy/plotting/matplot_dep/visualize.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/GPy/plotting/matplot_dep/visualize.py b/GPy/plotting/matplot_dep/visualize.py index 7c62f60e..16f9fc5f 100644 --- a/GPy/plotting/matplot_dep/visualize.py +++ b/GPy/plotting/matplot_dep/visualize.py @@ -499,7 +499,13 @@ class stick_show(mocap_data_show): super(stick_show, self).__init__(vals, axes=axes, connect=connect) def process_values(self): - self.vals = self.vals.reshape((3, self.vals.shape[1]//3)).T + """Convert vector of values into a matrix for use as a 3-D point cloud.""" + try: + self.vals = self.vals.reshape((3, self.vals.shape[1]//3)).T + except ValueError as e: + print('Passed values to data_show need to have a dimension which is divisible by 3 for display as they should be a point cloud of 3-D points.') + raise(e) + class skeleton_show(mocap_data_show): """data_show class for visualizing motion capture data encoded as a skeleton with angles."""