mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-06-08 15:05:15 +02:00
pickling now allways binary as well as protocol -1
This commit is contained in:
parent
2aa78e5cfc
commit
be8dad89a6
2 changed files with 9 additions and 10 deletions
|
|
@ -31,14 +31,9 @@ class Parameterized(object):
|
|||
# """ Override for which names to print out, when using print m """
|
||||
# return self._get_param_names()
|
||||
|
||||
def pickle(self, filename, protocol=None):
|
||||
if protocol is None:
|
||||
if self._has_get_set_state():
|
||||
protocol = 0
|
||||
else:
|
||||
protocol = -1
|
||||
with open(filename, 'w') as f:
|
||||
cPickle.dump(self, f, protocol)
|
||||
def pickle(self, filename, protocol=-1):
|
||||
with open(filename, 'wb') as f:
|
||||
cPickle.dump(self, f, protocol=protocol)
|
||||
|
||||
def copy(self):
|
||||
"""Returns a (deep) copy of the current model """
|
||||
|
|
|
|||
|
|
@ -114,8 +114,12 @@ class BufferedAxisChangedController(AxisChangedController):
|
|||
raise NotImplementedError('update view given in here')
|
||||
|
||||
def get_grid(self):
|
||||
xmin, xmax = self._compute_buffered(*self._x_lim)
|
||||
ymin, ymax = self._compute_buffered(*self._y_lim)
|
||||
if self._not_init:
|
||||
xmin, xmax = self._compute_buffered(*self._x_lim)
|
||||
ymin, ymax = self._compute_buffered(*self._y_lim)
|
||||
else:
|
||||
xmin, xmax = self._x_lim
|
||||
ymin, ymax = self._y_lim
|
||||
x, y = numpy.mgrid[xmin:xmax:1j * self.resolution, ymin:ymax:1j * self.resolution]
|
||||
return numpy.hstack((x.flatten()[:, None], y.flatten()[:, None]))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue