Skip to content

Commit

Permalink
pickling now allways binary as well as protocol -1
Browse files Browse the repository at this point in the history
  • Loading branch information
mzwiessele committed Jan 10, 2014
1 parent 2aa78e5 commit be8dad8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
11 changes: 3 additions & 8 deletions GPy/core/parameterized.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,9 @@ def _get_param_names(self):
# """ 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 """
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,12 @@ def update_view(self, view, X, xmin, xmax, ymin, ymax):
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]))

Expand Down

0 comments on commit be8dad8

Please sign in to comment.