diff bindings/python/pyadbmodule.c @ 743:63a75a2b5fa6

Added insert featureData and powerData from numpy ndarray pathway
author mas01mc
date Tue, 09 Nov 2010 08:21:49 +0000
parents 2fad8cfdb2d8
children 124ae047b968
line wrap: on
line diff
--- a/bindings/python/pyadbmodule.c	Wed Sep 22 15:56:14 2010 +0000
+++ b/bindings/python/pyadbmodule.c	Tue Nov 09 08:21:49 2010 +0000
@@ -160,7 +160,10 @@
 	static char *kwlist[]  = { "db", "features", "nDim", "nVect", "power", "key", "times" , NULL};
 	
 	ok =  PyArg_ParseTupleAndKeywords(args, keywds, "OO!II|O!sO!", kwlist, &incoming, &PyArray_Type, &features, &nDims, &nVect, &PyArray_Type,  &power, &key, &PyArray_Type, &times);
-	if (!ok){return NULL;}
+	if (!ok){
+	  PyErr_SetString(PyExc_TypeError, "Failed at PyArg_ParseTupleAndKeywords");
+	  return NULL;
+	}
 	//check our arrays
 	// if (!PyArray_Check(features)){
 	// 	PyErr_SetString(PyExc_TypeError, "features must be a numpy array (of floats or doubles)");
@@ -186,7 +189,7 @@
 			return NULL;
 		}
 		// power = (PyArrayObject *)PyCObject_AsVoidPtr(incomingPow);
-		if (PyArray_NDIM(features) != 1 || PyArray_DIMS(power)[0] == nVect){
+		if (PyArray_NDIM(features) != 1 || PyArray_DIMS(power)[0] != nVect){
 			PyErr_SetString(PyExc_ValueError, "power, if given must be a 1d numpy array with shape =  (numVectors,)");
 			return NULL;
 		}