Index: /trunk/psLib/psLib.kdevses
===================================================================
--- /trunk/psLib/psLib.kdevses	(revision 2910)
+++ /trunk/psLib/psLib.kdevses	(revision 2911)
@@ -2,14 +2,8 @@
 <!DOCTYPE KDevPrjSession>
 <KDevPrjSession>
- <DocsAndViews NumberOfDocuments="3" >
-  <Doc0 NumberOfViews="1" URL="file:/home/desonia/psLib/test/image/tst_psImageManip.c" >
-   <View0 line="1514" Type="Source" />
+ <DocsAndViews NumberOfDocuments="1" >
+  <Doc0 NumberOfViews="1" URL="file:/home/desonia/psLib/src/image/psImageConvolve.c" >
+   <View0 line="132" Type="Source" />
   </Doc0>
-  <Doc1 NumberOfViews="1" URL="file:/home/desonia/psLib/src/image/psImageManip.c" >
-   <View0 line="770" Type="Source" />
-  </Doc1>
-  <Doc2 NumberOfViews="1" URL="file:/home/desonia/psLib/src/dataManip/psConstants.h" >
-   <View0 line="0" Type="Source" />
-  </Doc2>
  </DocsAndViews>
  <pluginList>
@@ -21,7 +15,4 @@
    </bookmarks>
   </kdevbookmarks>
-  <kdevsubversion>
-   <subversion recurseresolve="1" recurserelocate="1" recursemerge="1" recursecommit="1" base="" recursepropget="1" recurseswitch="1" recurseupdate="1" recursepropset="1" recursediff="1" recurserevert="1" forcemove="1" recursecheckout="1" forceremove="1" recurseadd="1" recurseproplist="1" forcemerge="1" />
-  </kdevsubversion>
   <kdevvalgrind>
    <executable path="" params="" />
Index: /trunk/psLib/src/image/psImageConvolve.c
===================================================================
--- /trunk/psLib/src/image/psImageConvolve.c	(revision 2910)
+++ /trunk/psLib/src/image/psImageConvolve.c	(revision 2911)
@@ -5,8 +5,8 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-11-24 00:05:54 $
+ *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-01-05 21:16:14 $
  *
- *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
+ *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
  */
 
@@ -130,15 +130,18 @@
     }
 
-    // determine the usable length of the shift vector
+    // sizes match?
     length = xShifts->n;
     if (length != yShifts->n ||
             length != tShifts->n) {
-        psLogMsg(__func__,PS_LOG_WARN,"Shift vectors found to be different sizes.");
-        if (yShifts->n < length) {
-            length = yShifts->n;
-        }
-        if (tShifts->n < length) {
-            length = tShifts->n;
-        }
+        psError(PS_ERR_BAD_PARAMETER_SIZE, true,
+                "Shift vectors can not be of different sizes.");
+        return NULL;
+    }
+
+    // if no shifts, the kernel is just a 1 at 0,0
+    if (length < 1) {
+        result = psKernelAlloc(0,0,0,0);
+        result->kernel[0][0] = 1;
+        return result;
     }
 
@@ -148,6 +151,7 @@
         ps##TYPE *xShiftData = xShifts->data.TYPE; \
         ps##TYPE *yShiftData = yShifts->data.TYPE; \
-        lastX =  xShiftData[length-1]; \
-        lastY =  yShiftData[length-1]; \
+        lastX = xShiftData[length-1]; \
+        lastY = yShiftData[length-1]; \
+        lastT = tShiftData[length-1]; \
         \
         for (int lcv = 0; lcv < length; lcv++) { \
@@ -167,16 +171,16 @@
         } \
         \
-        normalizeTime = 1.0 / (psKernelType)(lastT - tShiftData[0]); \
+        normalizeTime = 1.0 / (psKernelType)(tShiftData[length-1]); \
         result = psKernelAlloc(xMin,xMax,yMin,yMax); \
         kernel = result->kernel; \
         \
-        lastT = 0; \
+        psS32 prevT = 0; \
         for (int i = 0; i < length; i++) { \
-            t = tShiftData[i] - lastT; \
+            t = tShiftData[i] - prevT; \
             x = lastX - xShiftData[i]; \
             y = lastY - yShiftData[i]; \
             \
-            kernel[y][x] += (psKernelType)t * normalizeTime; \
-            lastT = t; \
+            kernel[y][x] += (psKernelType)t / (psKernelType)lastT; \
+            prevT = tShiftData[i]; \
         } \
         break; \
@@ -206,6 +210,6 @@
                 yMax = y; \
             } \
-            x += xShiftData[lcv]; \
-            y += yShiftData[lcv]; \
+            x -= xShiftData[lcv]; \
+            y -= yShiftData[lcv]; \
             \
         } \
@@ -218,6 +222,6 @@
         for (psS32 i = length-1; i >= 0; i--) { \
             kernel[y][x] += (psKernelType)(tShiftData[i]) * normalizeTime; \
-            x += xShiftData[i]; \
-            y += yShiftData[i]; \
+            x -= xShiftData[i]; \
+            y -= yShiftData[i]; \
             \
         } \
Index: /trunk/psLib/src/image/psImageIO.c
===================================================================
--- /trunk/psLib/src/image/psImageIO.c	(revision 2910)
+++ /trunk/psLib/src/image/psImageIO.c	(revision 2911)
@@ -7,6 +7,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-11-04 01:05:00 $
+ *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-01-05 21:16:14 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -33,8 +33,8 @@
 {
     fitsfile *fptr = NULL;      /* Pointer to the FITS file */
-    psS32 status = 0;             /* CFITSIO file vars */
+    psS32 status = 0;           /* CFITSIO file vars */
     psS32 nAxis = 0;
     psS32 anynull = 0;
-    psS32 bitPix = 0;             /* Pixel type */
+    psS32 bitPix = 0;           /* Pixel type */
     long nAxes[3];
     long firstPixel[3];         /* lower-left corner of image subset */
@@ -160,28 +160,28 @@
         fitsDatatype = TBYTE;
         break;
-        /*    case SBYTE_IMG:                  Not a requirement
-                datatype = PS_TYPE_S8;
-                fitsDatatype = TSBYTE;
-                break;     */
-        /*    case USHORT_IMG:                 Not a requirement
-                datatype = PS_TYPE_U16;
-                fitsDatatype = TUSHORT;
-                break;     */
+    case SBYTE_IMG:
+        datatype = PS_TYPE_S8;
+        fitsDatatype = TSBYTE;
+        break;
+    case USHORT_IMG:
+        datatype = PS_TYPE_U16;
+        fitsDatatype = TUSHORT;
+        break;
     case SHORT_IMG:
         datatype = PS_TYPE_S16;
         fitsDatatype = TSHORT;
         break;
-        /*    case ULONG_IMG:                  Not a requirement
-                datatype = PS_TYPE_U32;
-                fitsDatatype = TUINT;
-                break;    */
+    case ULONG_IMG:
+        datatype = PS_TYPE_U32;
+        fitsDatatype = TUINT;
+        break;
     case LONG_IMG:
         datatype = PS_TYPE_S32;
         fitsDatatype = TINT;
         break;
-        /*    case LONGLONG_IMG:               Not a requirement
-                datatype = PS_TYPE_S64;
-                fitsDatatype = TLONGLONG;
-                break;    */
+    case LONGLONG_IMG:
+        datatype = PS_TYPE_S64;
+        fitsDatatype = TLONGLONG;
+        break;
     case FLOAT_IMG:
         datatype = PS_TYPE_F32;
@@ -256,23 +256,23 @@
         datatype = TBYTE;
         break;
-        /*    case PS_TYPE_S8:            Not a requirement
-                bitPix = BYTE_IMG;
-                bzero = INT8_MIN;
-                datatype = TSBYTE;
-                break;      */
-        /*    case PS_TYPE_U16:           Not a requirement
-                bitPix = SHORT_IMG;
-                bzero = -1.0f * INT16_MIN;
-                datatype = TUSHORT;
-                break;      */
+    case PS_TYPE_S8:
+        bitPix = BYTE_IMG;
+        bzero = INT8_MIN;
+        datatype = TSBYTE;
+        break;
+    case PS_TYPE_U16:
+        bitPix = SHORT_IMG;
+        bzero = -1.0f * INT16_MIN;
+        datatype = TUSHORT;
+        break;
     case PS_TYPE_S16:
         bitPix = SHORT_IMG;
         datatype = TSHORT;
         break;
-        /*    case PS_TYPE_U32:           Not a requirement
-                bitPix = LONG_IMG;
-                bzero = -1.0f * INT32_MIN;
-                datatype = TUINT;
-                break;      */
+    case PS_TYPE_U32:
+        bitPix = LONG_IMG;
+        bzero = -1.0f * INT32_MIN;
+        datatype = TUINT;
+        break;
     case PS_TYPE_S32:
         bitPix = LONG_IMG;
@@ -344,8 +344,6 @@
         }
 
-    } else {                               // file
-        // does
-        // not
-        // exist
+    } else {
+        // file does not exist
 
         (void)fits_create_file(&fptr, filename, &status);
Index: /trunk/psLib/src/imageops/psImageConvolve.c
===================================================================
--- /trunk/psLib/src/imageops/psImageConvolve.c	(revision 2910)
+++ /trunk/psLib/src/imageops/psImageConvolve.c	(revision 2911)
@@ -5,8 +5,8 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-11-24 00:05:54 $
+ *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-01-05 21:16:14 $
  *
- *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
+ *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
  */
 
@@ -130,15 +130,18 @@
     }
 
-    // determine the usable length of the shift vector
+    // sizes match?
     length = xShifts->n;
     if (length != yShifts->n ||
             length != tShifts->n) {
-        psLogMsg(__func__,PS_LOG_WARN,"Shift vectors found to be different sizes.");
-        if (yShifts->n < length) {
-            length = yShifts->n;
-        }
-        if (tShifts->n < length) {
-            length = tShifts->n;
-        }
+        psError(PS_ERR_BAD_PARAMETER_SIZE, true,
+                "Shift vectors can not be of different sizes.");
+        return NULL;
+    }
+
+    // if no shifts, the kernel is just a 1 at 0,0
+    if (length < 1) {
+        result = psKernelAlloc(0,0,0,0);
+        result->kernel[0][0] = 1;
+        return result;
     }
 
@@ -148,6 +151,7 @@
         ps##TYPE *xShiftData = xShifts->data.TYPE; \
         ps##TYPE *yShiftData = yShifts->data.TYPE; \
-        lastX =  xShiftData[length-1]; \
-        lastY =  yShiftData[length-1]; \
+        lastX = xShiftData[length-1]; \
+        lastY = yShiftData[length-1]; \
+        lastT = tShiftData[length-1]; \
         \
         for (int lcv = 0; lcv < length; lcv++) { \
@@ -167,16 +171,16 @@
         } \
         \
-        normalizeTime = 1.0 / (psKernelType)(lastT - tShiftData[0]); \
+        normalizeTime = 1.0 / (psKernelType)(tShiftData[length-1]); \
         result = psKernelAlloc(xMin,xMax,yMin,yMax); \
         kernel = result->kernel; \
         \
-        lastT = 0; \
+        psS32 prevT = 0; \
         for (int i = 0; i < length; i++) { \
-            t = tShiftData[i] - lastT; \
+            t = tShiftData[i] - prevT; \
             x = lastX - xShiftData[i]; \
             y = lastY - yShiftData[i]; \
             \
-            kernel[y][x] += (psKernelType)t * normalizeTime; \
-            lastT = t; \
+            kernel[y][x] += (psKernelType)t / (psKernelType)lastT; \
+            prevT = tShiftData[i]; \
         } \
         break; \
@@ -206,6 +210,6 @@
                 yMax = y; \
             } \
-            x += xShiftData[lcv]; \
-            y += yShiftData[lcv]; \
+            x -= xShiftData[lcv]; \
+            y -= yShiftData[lcv]; \
             \
         } \
@@ -218,6 +222,6 @@
         for (psS32 i = length-1; i >= 0; i--) { \
             kernel[y][x] += (psKernelType)(tShiftData[i]) * normalizeTime; \
-            x += xShiftData[i]; \
-            y += yShiftData[i]; \
+            x -= xShiftData[i]; \
+            y -= yShiftData[i]; \
             \
         } \
Index: /trunk/psLib/test/image/tst_psImageConvolve.c
===================================================================
--- /trunk/psLib/test/image/tst_psImageConvolve.c	(revision 2910)
+++ /trunk/psLib/test/image/tst_psImageConvolve.c	(revision 2911)
@@ -5,8 +5,8 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-11-04 01:05:00 $
+ *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-01-05 21:16:15 $
  *
- *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
+ *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
  */
 
@@ -117,8 +117,8 @@
 static psS32 testKernelGenerate(void)
 {
-    psS32 size = 4;
-    psS32 t[] = { 1, 2, 8, 10 };
-    psS32 x[] = { 0, 1, 0, -1 };
-    psS32 y[] = { 2, 1, -1, -2 };
+    psS32 size = 5;
+    psS32 t[] = { 1, 2, 8, 9, 10 };
+    psS32 x[] = { 0, 1, 0, -1, 0 };
+    psS32 y[] = { 2, 1, -1, -2, 0 };
     psKernelType sum;
 
@@ -142,5 +142,5 @@
     if (result->xMin != -1 || result->xMax != 1 ||
             result->yMin != -2 || result->yMax != 2) {
-        psError(PS_ERR_UNKNOWN, true,"psKernelGenerate result had a range of [%d:%d,%d:%d].  Suppose to be [0:1,1:2].",
+        psError(PS_ERR_UNKNOWN, true,"psKernelGenerate result had a range of [%d:%d,%d:%d].  Suppose to be [-2:2,-1:1].",
                 result->xMin, result->xMax, result->yMin, result->yMax);
         return 2;
@@ -148,8 +148,11 @@
 
     sum = 0.0;
+    printf("Resulting kernel:\n");
     for (psS32 y = result->yMin; y <= result->yMax; y++) {
         for (psS32 x = result->xMin; x <= result->xMax; x++) {
+            printf(" %6.2f ", result->kernel[y][x]);
             sum += result->kernel[y][x];
         }
+        printf("\n");
     }
     if (fabsf(1.0 - sum) > FLT_EPSILON) {
@@ -161,12 +164,11 @@
     }
 
-    if (fabsf(result->kernel[2][0] - 1.0/10.0) > FLT_EPSILON ||
-            fabsf(result->kernel[ 1][ 1] - 6.0/10.0) > FLT_EPSILON ||
-            fabsf(result->kernel[ 0][ 0] - 1.0/10.0) > FLT_EPSILON ||
-            fabsf(result->kernel[-1][ 0] - 2.0/10.0) > FLT_EPSILON ||
-            fabsf(result->kernel[-2][-1] - 0.0/10.0) > FLT_EPSILON) {
-        psError(PS_ERR_UNKNOWN, true,"psKernelGenerate result values, %g,%g;%g,%g, are wrong. Suppose to be 2,6;1,0.",
-                result->kernel[-1][0], result->kernel[1][1],
-                result->kernel[2][0], result->kernel[-2][-1]);
+    if (fabsf(result->kernel[-2][0] - 0.1) > FLT_EPSILON ||
+            fabsf(result->kernel[ -1][ -1] - 0.1) > FLT_EPSILON ||
+            fabsf(result->kernel[ 1][ 0] - 0.6) > FLT_EPSILON ||
+            fabsf(result->kernel[2][1] - 0.1) > FLT_EPSILON) {
+        psError(PS_ERR_UNKNOWN, true,"psKernelGenerate result values, %g,%g,%g,%g, are wrong. Suppose to be 0.1,0.1,0.6,0.1",
+                result->kernel[-2][0], result->kernel[-1][-1],
+                result->kernel[1][0], result->kernel[2][1]);
 
         return 4;
@@ -203,8 +205,11 @@
 
     sum = 0.0;
+    printf("Resulting kernel (relative=true):\n");
     for (psS32 y = result->yMin; y <= result->yMax; y++) {
         for (psS32 x = result->xMin; x <= result->xMax; x++) {
+            printf(" %6.2f ", result->kernel[y][x]);
             sum += result->kernel[y][x];
         }
+        printf("\n");
     }
     if (fabsf(1.0 - sum) > FLT_EPSILON) {
@@ -216,11 +221,11 @@
     }
 
-    if (fabsf(result->kernel[0][0] - 1.0/21.0) > FLT_EPSILON ||
-            fabsf(result->kernel[2][0] - 2.0/21.0) > FLT_EPSILON ||
-            fabsf(result->kernel[3][1] - 8.0/21.0) > FLT_EPSILON ||
-            fabsf(result->kernel[2][1] - 10.0/21.0) > FLT_EPSILON) {
+    if (fabsf(result->kernel[0][0] - 19.0/30.0) > FLT_EPSILON ||
+            fabsf(result->kernel[2][0] - 1.0/30.0) > FLT_EPSILON ||
+            fabsf(result->kernel[2][1] - 8.0/30.0) > FLT_EPSILON ||
+            fabsf(result->kernel[3][1] - 2.0/30.0) > FLT_EPSILON) {
         psError(PS_ERR_UNKNOWN, true,"psKernelGenerate result values, %g,%g;%g,%g, are wrong. Suppose to be 2,6;1,0.",
-                result->kernel[1][0], result->kernel[1][1],
-                result->kernel[2][0], result->kernel[2][1]);
+                result->kernel[0][0], result->kernel[2][0],
+                result->kernel[2][1], result->kernel[3][1]);
 
         return 8;
@@ -243,18 +248,9 @@
 
     tVec->n--; // decrease size by one to make vectors unequal in length.
-    psLogMsg(__func__,PS_LOG_INFO, "Following should be a warning - not automatically tested.");
+    psLogMsg(__func__,PS_LOG_INFO, "Following should be an error.");
     result = psKernelGenerate(tVec, xVec, yVec, false);
-    if (result == NULL) {
-        psError(PS_ERR_UNKNOWN, true,"psKernelGenerate returned NULL.");
+    if (result != NULL) {
+        psError(PS_ERR_UNKNOWN, true,"psKernelGenerate returned non-NULL given differing sized vectors.");
         return 9;
-    }
-
-    // make sure last sample is not used
-    if (fabsf(result->kernel[2][0] - 1.0/8.0) > FLT_EPSILON ||
-            fabsf(result->kernel[ 1][ 1] - 6.0/8.0) > FLT_EPSILON ||
-            fabsf(result->kernel[ 0][ 0] - 1.0/8.0) > FLT_EPSILON) {
-        psError(PS_ERR_UNKNOWN, true,"psKernelGenerate result values wrong for truncated time vector.");
-
-        return 10;
     }
 
Index: /trunk/psLib/test/image/verified/tst_psImageConvolve.stderr
===================================================================
--- /trunk/psLib/test/image/verified/tst_psImageConvolve.stderr	(revision 2910)
+++ /trunk/psLib/test/image/verified/tst_psImageConvolve.stderr	(revision 2911)
@@ -23,7 +23,7 @@
 
 <DATE><TIME>|<HOST>|I|testKernelGenerate
-    Following should be a warning - not automatically tested.
-<DATE><TIME>|<HOST>|W|psKernelGenerate
-    Shift vectors found to be different sizes.
+    Following should be an error.
+<DATE><TIME>|<HOST>|E|psKernelGenerate (psImageConvolve.c:<LINENO>)
+    Shift vectors can not be of different sizes.
 <DATE><TIME>|<HOST>|I|testKernelGenerate
     Following should be a error (time vector NULL).
