mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-07 19:12:40 +02:00
fix the bug in mocap demos
This commit is contained in:
parent
3ee2dc920c
commit
a796b7bc81
2 changed files with 15 additions and 10 deletions
|
|
@ -414,9 +414,10 @@ def stick(kernel=None, optimize=True, verbose=True, plot=True):
|
||||||
ax = m.plot_latent()
|
ax = m.plot_latent()
|
||||||
y = m.Y[0, :]
|
y = m.Y[0, :]
|
||||||
data_show = GPy.plotting.matplot_dep.visualize.stick_show(y[None, :], connect=data['connect'])
|
data_show = GPy.plotting.matplot_dep.visualize.stick_show(y[None, :], connect=data['connect'])
|
||||||
vis = GPy.plotting.matplot_dep.visualize.lvm(m.X[:1, :].copy(), m, data_show, latent_axes=ax)
|
lvm_visualizer = GPy.plotting.matplot_dep.visualize.lvm(m.X[:1, :].copy(), m, data_show, latent_axes=ax)
|
||||||
raw_input('Press enter to finish')
|
raw_input('Press enter to finish')
|
||||||
|
lvm_visualizer.close()
|
||||||
|
data_show.close()
|
||||||
return m
|
return m
|
||||||
|
|
||||||
def bcgplvm_linear_stick(kernel=None, optimize=True, verbose=True, plot=True):
|
def bcgplvm_linear_stick(kernel=None, optimize=True, verbose=True, plot=True):
|
||||||
|
|
@ -515,9 +516,10 @@ def cmu_mocap(subject='35', motion=['01'], in_place=True, optimize=True, verbose
|
||||||
ax = m.plot_latent()
|
ax = m.plot_latent()
|
||||||
y = m.Y[0, :]
|
y = m.Y[0, :]
|
||||||
data_show = GPy.plotting.matplot_dep.visualize.skeleton_show(y[None, :], data['skel'])
|
data_show = GPy.plotting.matplot_dep.visualize.skeleton_show(y[None, :], data['skel'])
|
||||||
lvm_visualizer = GPy.plotting.matplot_dep.visualize.lvm(m.X[0, :].copy(), m, data_show, ax)
|
lvm_visualizer = GPy.plotting.matplot_dep.visualize.lvm(m.X[0].copy(), m, data_show, latent_axes=ax)
|
||||||
raw_input('Press enter to finish')
|
raw_input('Press enter to finish')
|
||||||
lvm_visualizer.close()
|
lvm_visualizer.close()
|
||||||
|
data_show.close()
|
||||||
|
|
||||||
return m
|
return m
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,8 @@ class lvm(matplotlib_show):
|
||||||
vals = param_to_array(model.X.mean)
|
vals = param_to_array(model.X.mean)
|
||||||
else:
|
else:
|
||||||
vals = param_to_array(model.X)
|
vals = param_to_array(model.X)
|
||||||
|
if len(vals.shape)==1:
|
||||||
|
vals = vals[None,:]
|
||||||
matplotlib_show.__init__(self, vals, axes=latent_axes)
|
matplotlib_show.__init__(self, vals, axes=latent_axes)
|
||||||
|
|
||||||
if isinstance(latent_axes,mpl.axes.Axes):
|
if isinstance(latent_axes,mpl.axes.Axes):
|
||||||
|
|
@ -393,14 +394,13 @@ class mocap_data_show_vpython(vpython_show):
|
||||||
def process_values(self):
|
def process_values(self):
|
||||||
raise NotImplementedError, "this needs to be implemented to use the data_show class"
|
raise NotImplementedError, "this needs to be implemented to use the data_show class"
|
||||||
|
|
||||||
|
|
||||||
class mocap_data_show(matplotlib_show):
|
class mocap_data_show(matplotlib_show):
|
||||||
"""Base class for visualizing motion capture data."""
|
"""Base class for visualizing motion capture data."""
|
||||||
|
|
||||||
def __init__(self, vals, axes=None, connect=None):
|
def __init__(self, vals, axes=None, connect=None):
|
||||||
if axes==None:
|
if axes==None:
|
||||||
fig = plt.figure()
|
fig = plt.figure()
|
||||||
axes = fig.add_subplot(111, projection='3d')
|
axes = fig.add_subplot(111, projection='3d',aspect='equal')
|
||||||
matplotlib_show.__init__(self, vals, axes)
|
matplotlib_show.__init__(self, vals, axes)
|
||||||
|
|
||||||
self.connect = connect
|
self.connect = connect
|
||||||
|
|
@ -445,11 +445,12 @@ class mocap_data_show(matplotlib_show):
|
||||||
def process_values(self):
|
def process_values(self):
|
||||||
raise NotImplementedError, "this needs to be implemented to use the data_show class"
|
raise NotImplementedError, "this needs to be implemented to use the data_show class"
|
||||||
|
|
||||||
def initialize_axes(self):
|
def initialize_axes(self, boundary=0.05):
|
||||||
"""Set up the axes with the right limits and scaling."""
|
"""Set up the axes with the right limits and scaling."""
|
||||||
self.x_lim = np.array([self.vals[:, 0].min(), self.vals[:, 0].max()])
|
bs = [(self.vals[:, i].max()-self.vals[:, i].min())*boundary for i in xrange(3)]
|
||||||
self.y_lim = np.array([self.vals[:, 1].min(), self.vals[:, 1].max()])
|
self.x_lim = np.array([self.vals[:, 0].min()-bs[0], self.vals[:, 0].max()+bs[0]])
|
||||||
self.z_lim = np.array([self.vals[:, 2].min(), self.vals[:, 2].max()])
|
self.y_lim = np.array([self.vals[:, 1].min()-bs[1], self.vals[:, 1].max()+bs[1]])
|
||||||
|
self.z_lim = np.array([self.vals[:, 2].min()-bs[2], self.vals[:, 2].max()+bs[2]])
|
||||||
|
|
||||||
def initialize_axes_modify(self):
|
def initialize_axes_modify(self):
|
||||||
self.points_handle.remove()
|
self.points_handle.remove()
|
||||||
|
|
@ -472,6 +473,8 @@ class mocap_data_show(matplotlib_show):
|
||||||
class stick_show(mocap_data_show):
|
class stick_show(mocap_data_show):
|
||||||
"""Show a three dimensional point cloud as a figure. Connect elements of the figure together using the matrix connect."""
|
"""Show a three dimensional point cloud as a figure. Connect elements of the figure together using the matrix connect."""
|
||||||
def __init__(self, vals, connect=None, axes=None):
|
def __init__(self, vals, connect=None, axes=None):
|
||||||
|
if len(vals.shape)==1:
|
||||||
|
vals = vals[None,:]
|
||||||
mocap_data_show.__init__(self, vals, axes=axes, connect=connect)
|
mocap_data_show.__init__(self, vals, axes=axes, connect=connect)
|
||||||
|
|
||||||
def process_values(self):
|
def process_values(self):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue