From df118a404df4ce8c3997b08bfe968e6fd922b3da Mon Sep 17 00:00:00 2001 From: James Hensman Date: Wed, 13 Nov 2013 11:41:58 +0000 Subject: [PATCH 1/5] changed how we search for config files on windows --- GPy/util/config.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/GPy/util/config.py b/GPy/util/config.py index d2ed7543..6fd4d005 100644 --- a/GPy/util/config.py +++ b/GPy/util/config.py @@ -5,7 +5,8 @@ import ConfigParser import os config = ConfigParser.ConfigParser() -user_file = os.path.join(os.getenv('HOME'),'.gpy_config.cfg') +home = os.getenv('HOME') or os.getenv('USERPROFILE') +user_file = os.path.join(home,'.gpy_config.cfg') default_file = os.path.join('..','gpy_config.cfg') # 1. check if the user has a ~/.gpy_config.cfg From 68709cfa77f3c90dc17b9ddf5de555b0d34889fd Mon Sep 17 00:00:00 2001 From: James Hensman Date: Wed, 13 Nov 2013 12:46:02 +0000 Subject: [PATCH 2/5] more fiddling with the windows path for config. Where is the windows guru? out playing beach volley? --- GPy/util/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GPy/util/config.py b/GPy/util/config.py index 6fd4d005..960d6690 100644 --- a/GPy/util/config.py +++ b/GPy/util/config.py @@ -7,7 +7,7 @@ config = ConfigParser.ConfigParser() home = os.getenv('HOME') or os.getenv('USERPROFILE') user_file = os.path.join(home,'.gpy_config.cfg') -default_file = os.path.join('..','gpy_config.cfg') +default_file = os.path.abspath(os.path.join(os.path.dirname( __file__ ), '..', 'gpy_config.cfg')) # 1. check if the user has a ~/.gpy_config.cfg if os.path.isfile(user_file): From 0fa287c044af8c2bbbe9118cef66e18bf5343d64 Mon Sep 17 00:00:00 2001 From: James Hensman Date: Wed, 13 Nov 2013 12:46:59 +0000 Subject: [PATCH 3/5] allowing the passing of 1D X to a GP. with warning of course --- GPy/core/gp_base.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/GPy/core/gp_base.py b/GPy/core/gp_base.py index cb968520..548e2924 100644 --- a/GPy/core/gp_base.py +++ b/GPy/core/gp_base.py @@ -14,8 +14,11 @@ class GPBase(Model): Here we define some functions that are use """ def __init__(self, X, likelihood, kernel, normalize_X=False): + if len(X.shape)==1: + X = X.reshape(-1,1) + warning.warn("One dimension output (N,) being reshaped to (N,1)") self.X = X - assert len(self.X.shape) == 2 + assert len(self.X.shape) == 2, "too many dimensions for X input" self.num_data, self.input_dim = self.X.shape assert isinstance(kernel, kern.kern) self.kern = kernel From 280f6560513d03f29ff6ee76adadc03a9f9895f5 Mon Sep 17 00:00:00 2001 From: James Hensman Date: Wed, 13 Nov 2013 13:34:10 +0000 Subject: [PATCH 4/5] debugging the config paths --- GPy/util/config.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/GPy/util/config.py b/GPy/util/config.py index 960d6690..cd29a8af 100644 --- a/GPy/util/config.py +++ b/GPy/util/config.py @@ -8,11 +8,12 @@ config = ConfigParser.ConfigParser() home = os.getenv('HOME') or os.getenv('USERPROFILE') user_file = os.path.join(home,'.gpy_config.cfg') default_file = os.path.abspath(os.path.join(os.path.dirname( __file__ ), '..', 'gpy_config.cfg')) +print user_file, os.path.isfile(user_file) +print default_file, os.path.isfile(default_file) # 1. check if the user has a ~/.gpy_config.cfg if os.path.isfile(user_file): config.read(user_file) else: # 2. if not, use the default one - path = os.path.dirname(__file__) - config.read(os.path.join(path,default_file)) + config.read(default_file) From df97f7814efb0589868cfe9e6ef4026414fb5a83 Mon Sep 17 00:00:00 2001 From: James Hensman Date: Wed, 13 Nov 2013 13:40:44 +0000 Subject: [PATCH 5/5] better handling of missing config files --- GPy/util/config.py | 5 ++++- MANIFEST.in | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/GPy/util/config.py b/GPy/util/config.py index cd29a8af..02796e0b 100644 --- a/GPy/util/config.py +++ b/GPy/util/config.py @@ -14,6 +14,9 @@ print default_file, os.path.isfile(default_file) # 1. check if the user has a ~/.gpy_config.cfg if os.path.isfile(user_file): config.read(user_file) -else: +elif os.path.isfile(default_file): # 2. if not, use the default one config.read(default_file) +else: + #3. panic + raise ValueError, "no configuration file found" diff --git a/MANIFEST.in b/MANIFEST.in index c89284cd..8d5b2304 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -2,3 +2,5 @@ include *.txt recursive-include doc *.txt include *.md recursive-include doc *.md +include *.cfg +recursive-include doc *.cfg