mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-05 09:42:39 +02:00
Exception fixes for Python 3 compat
This commit is contained in:
parent
2b8ef1041b
commit
74f8caba2b
8 changed files with 15 additions and 15 deletions
|
|
@ -133,7 +133,7 @@ def x_frame1D(X,plot_limits=None,resolution=None):
|
|||
elif len(plot_limits)==2:
|
||||
xmin, xmax = plot_limits
|
||||
else:
|
||||
raise ValueError, "Bad limits for plotting"
|
||||
raise ValueError("Bad limits for plotting")
|
||||
|
||||
Xnew = np.linspace(xmin,xmax,resolution or 200)[:,None]
|
||||
return Xnew, xmin, xmax
|
||||
|
|
@ -149,7 +149,7 @@ def x_frame2D(X,plot_limits=None,resolution=None):
|
|||
elif len(plot_limits)==2:
|
||||
xmin, xmax = plot_limits
|
||||
else:
|
||||
raise ValueError, "Bad limits for plotting"
|
||||
raise ValueError("Bad limits for plotting")
|
||||
|
||||
resolution = resolution or 50
|
||||
xx,yy = np.mgrid[xmin[0]:xmax[0]:1j*resolution,xmin[1]:xmax[1]:1j*resolution]
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ def most_significant_input_dimensions(model, which_indices):
|
|||
try:
|
||||
input_1, input_2 = np.argsort(model.input_sensitivity())[::-1][:2]
|
||||
except:
|
||||
raise ValueError, "cannot automatically determine which dimensions to plot, please pass 'which_indices'"
|
||||
raise ValueError("cannot automatically determine which dimensions to plot, please pass 'which_indices'")
|
||||
else:
|
||||
input_1, input_2 = which_indices
|
||||
return input_1, input_2
|
||||
|
|
@ -133,7 +133,7 @@ def plot_latent(model, labels=None, which_indices=None,
|
|||
try:
|
||||
xmin, xmax, ymin, ymax = plot_limits
|
||||
except (TypeError, ValueError) as e:
|
||||
raise e.__class__, "Wrong plot limits: {} given -> need (xmin, xmax, ymin, ymax)".format(plot_limits)
|
||||
raise e.__class__("Wrong plot limits: {} given -> need (xmin, xmax, ymin, ymax)".format(plot_limits))
|
||||
view = ImshowController(ax, plot_function,
|
||||
(xmin, ymin, xmax, ymax),
|
||||
resolution, aspect=aspect, interpolation='bilinear',
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ def plot(kernel,x=None, fignum=None, ax=None, title=None, plot_limits=None, reso
|
|||
elif len(plot_limits) == 2:
|
||||
xmin, xmax = plot_limits
|
||||
else:
|
||||
raise ValueError, "Bad limits for plotting"
|
||||
raise ValueError("Bad limits for plotting")
|
||||
|
||||
Xnew = np.linspace(xmin, xmax, resolution or 201)[:, None]
|
||||
Kx = kernel.K(Xnew, x)
|
||||
|
|
@ -154,7 +154,7 @@ def plot(kernel,x=None, fignum=None, ax=None, title=None, plot_limits=None, reso
|
|||
elif len(plot_limits) == 2:
|
||||
xmin, xmax = plot_limits
|
||||
else:
|
||||
raise ValueError, "Bad limits for plotting"
|
||||
raise ValueError("Bad limits for plotting")
|
||||
|
||||
resolution = resolution or 51
|
||||
xx, yy = np.mgrid[xmin[0]:xmax[0]:1j * resolution, xmin[1]:xmax[1]:1j * resolution]
|
||||
|
|
@ -168,4 +168,4 @@ def plot(kernel,x=None, fignum=None, ax=None, title=None, plot_limits=None, reso
|
|||
ax.set_ylabel("x2")
|
||||
ax.set_title("k(x1,x2 ; %0.1f,%0.1f)" % (x[0, 0], x[0, 1]))
|
||||
else:
|
||||
raise NotImplementedError, "Cannot plot a kernel with more than two input dimensions"
|
||||
raise NotImplementedError("Cannot plot a kernel with more than two input dimensions")
|
||||
|
|
|
|||
|
|
@ -81,4 +81,4 @@ def plot_mapping(self, plot_limits=None, which_data='all', which_parts='all', re
|
|||
ax.set_ylim(xmin[1], xmax[1])
|
||||
|
||||
else:
|
||||
raise NotImplementedError, "Cannot define a frame with more than two input dimensions"
|
||||
raise NotImplementedError("Cannot define a frame with more than two input dimensions")
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ def plot_fit(model, plot_limits=None, which_data_rows='all',
|
|||
plots['inducing_inputs'] = ax.plot(Zu[:,0], Zu[:,1], 'wo')
|
||||
|
||||
else:
|
||||
raise NotImplementedError, "Cannot define a frame with more than two input dimensions"
|
||||
raise NotImplementedError("Cannot define a frame with more than two input dimensions")
|
||||
return plots
|
||||
|
||||
def plot_fit_f(model, *args, **kwargs):
|
||||
|
|
|
|||
|
|
@ -29,4 +29,4 @@ def plot(prior):
|
|||
pb.contour(xx, yy, zz, linewidths=2)
|
||||
|
||||
else:
|
||||
raise NotImplementedError, "Cannot define a frame with more than two input dimensions"
|
||||
raise NotImplementedError("Cannot define a frame with more than two input dimensions")
|
||||
|
|
|
|||
|
|
@ -25,10 +25,10 @@ class data_show:
|
|||
# If no axes are defined, create some.
|
||||
|
||||
def modify(self, vals):
|
||||
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 close(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 vpython_show(data_show):
|
||||
"""
|
||||
|
|
@ -403,7 +403,7 @@ class mocap_data_show_vpython(vpython_show):
|
|||
self.modify_vertices()
|
||||
|
||||
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):
|
||||
"""Base class for visualizing motion capture data."""
|
||||
|
|
@ -455,7 +455,7 @@ class mocap_data_show(matplotlib_show):
|
|||
self.axes.figure.canvas.draw()
|
||||
|
||||
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, boundary=0.05):
|
||||
"""Set up the axes with the right limits and scaling."""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue