mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-15 06:52:39 +02:00
Exception fixes for Python 3 compat
This commit is contained in:
parent
74f8caba2b
commit
c6b43d91da
8 changed files with 10 additions and 10 deletions
|
|
@ -282,7 +282,7 @@ class KernelGradientTestsContinuous(unittest.TestCase):
|
|||
try:
|
||||
k.K(self.X)
|
||||
except AssertionError:
|
||||
raise AssertionError, "k.K(X) should run on self.D-1 dimension"
|
||||
raise AssertionError("k.K(X) should run on self.D-1 dimension")
|
||||
|
||||
def test_Matern52(self):
|
||||
k = GPy.kern.Matern52(self.D)
|
||||
|
|
|
|||
|
|
@ -148,10 +148,10 @@ class Cacher(object):
|
|||
return Cacher(self.operation, self.limit, self.ignore_args, self.force_kwargs)
|
||||
|
||||
def __getstate__(self, memo=None):
|
||||
raise NotImplementedError, "Trying to pickle Cacher object with function {}, pickling functions not possible.".format(str(self.operation))
|
||||
raise NotImplementedError("Trying to pickle Cacher object with function {}, pickling functions not possible.".format(str(self.operation)))
|
||||
|
||||
def __setstate__(self, memo=None):
|
||||
raise NotImplementedError, "Trying to pickle Cacher object with function {}, pickling functions not possible.".format(str(self.operation))
|
||||
raise NotImplementedError("Trying to pickle Cacher object with function {}, pickling functions not possible.".format(str(self.operation)))
|
||||
|
||||
@property
|
||||
def __name__(self):
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ def safe_root(N):
|
|||
i = np.sqrt(N)
|
||||
j = int(i)
|
||||
if i != j:
|
||||
raise ValueError, "N is not square!"
|
||||
raise ValueError("N is not square!")
|
||||
return j
|
||||
|
||||
def flat_to_triang(flat):
|
||||
|
|
|
|||
|
|
@ -20,4 +20,4 @@ user_file = os.path.join(home,'.gpy_user.cfg')
|
|||
config.readfp(open(default_file))
|
||||
config.read([local_file, user_file])
|
||||
if not config:
|
||||
raise ValueError, "No configuration file found at either " + user_file + " or " + local_file + " or " + default_file + "."
|
||||
raise ValueError("No configuration file found at either " + user_file + " or " + local_file + " or " + default_file + ".")
|
||||
|
|
|
|||
|
|
@ -785,7 +785,7 @@ def hapmap3(data_set='hapmap3'):
|
|||
from sys import stdout
|
||||
import bz2
|
||||
except ImportError as i:
|
||||
raise i, "Need pandas for hapmap dataset, make sure to install pandas (http://pandas.pydata.org/) before loading the hapmap dataset"
|
||||
raise i("Need pandas for hapmap dataset, make sure to install pandas (http://pandas.pydata.org/) before loading the hapmap dataset")
|
||||
|
||||
dir_path = os.path.join(data_path,'hapmap3')
|
||||
hapmap_file_name = 'hapmap3_r2_b36_fwd.consensus.qc.poly'
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ def jitchol(A, maxtries=5):
|
|||
else:
|
||||
diagA = np.diag(A)
|
||||
if np.any(diagA <= 0.):
|
||||
raise linalg.LinAlgError, "not pd: non-positive diagonal elements"
|
||||
raise linalg.LinAlgError("not pd: non-positive diagonal elements")
|
||||
jitter = diagA.mean() * 1e-6
|
||||
num_tries = 1
|
||||
while num_tries <= maxtries and np.isfinite(jitter):
|
||||
|
|
@ -105,7 +105,7 @@ def jitchol(A, maxtries=5):
|
|||
import traceback
|
||||
logging.warning('\n'.join(['Added {} rounds of jitter, jitter of {:.10e}'.format(num_tries-1, jitter),
|
||||
' in '+traceback.format_list(traceback.extract_stack(limit=2)[-2:-1])[0][2:]]))
|
||||
raise linalg.LinAlgError, "not positive definite, even with jitter."
|
||||
raise linalg.LinAlgError("not positive definite, even with jitter.")
|
||||
|
||||
# def dtrtri(L, lower=1):
|
||||
# """
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ def ln_diff_erfs(x1, x2, return_sign=False):
|
|||
elif x2.size==1:
|
||||
v = np.zeros(x1.shape)
|
||||
else:
|
||||
raise ValueError, "This function does not broadcast unless provided with a scalar."
|
||||
raise ValueError("This function does not broadcast unless provided with a scalar.")
|
||||
|
||||
if x1.size == 1:
|
||||
x1 = np.tile(x1, x2.shape)
|
||||
|
|
|
|||
|
|
@ -174,7 +174,7 @@ class skeleton(tree):
|
|||
return connection
|
||||
|
||||
def to_xyz(self, channels):
|
||||
raise NotImplementedError, "this needs to be implemented to use the skeleton class"
|
||||
raise NotImplementedError("this needs to be implemented to use the skeleton class")
|
||||
|
||||
|
||||
def finalize(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue