Index: trunk/psModules/src/pmObjects.c
===================================================================
--- trunk/psModules/src/pmObjects.c	(revision 4030)
+++ trunk/psModules/src/pmObjects.c	(revision 4097)
@@ -5,6 +5,6 @@
  *  @author GLG, MHPCC
  *
- *  @version $Revision: 1.24 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-05-25 20:28:32 $
+ *  @version $Revision: 1.25 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-06-03 21:43:03 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -298,4 +298,7 @@
 XXX: In the output psArray elements, should we use the image row/column offsets?
      Currently, we do not.
+ 
+XXX: Merge with CVS 1.20.  This had the proper code for images with a single
+row or column.
 *****************************************************************************/
 psArray *pmFindImagePeaks(const psImage *image,
@@ -306,4 +309,5 @@
     if ((image->numRows == 1) || (image->numCols == 1)) {
         psError(PS_ERR_UNKNOWN, true, "Currently, input image must have at least 2 rows and 2 columns.");
+        return(NULL);
     }
     psVector *tmpRow = NULL;
@@ -321,5 +325,4 @@
     for (psU32 i = 0 ; i < row1->n ; i++ ) {
         col = row1->data.U32[i];
-
         //
         // Determine if pixel (0,0) is a peak.
@@ -329,4 +332,5 @@
                     (image->data.F32[row][col] >  image->data.F32[row+1][col]) &&
                     (image->data.F32[row][col] >= image->data.F32[row+1][col+1])) {
+
                 if (image->data.F32[row][col] > threshold) {
                     list = MyListAddPeak(list, row, col, image->data.F32[row][col], PM_PEAK_EDGE);
@@ -622,8 +626,8 @@
 
     // XXX EAM : I added this code to stay on the image. So did George
-    psS32 SubImageStartRow  = PS_MAX (0, SubImageCenterRow - outerRadiusS32);
-    psS32 SubImageEndRow    = PS_MIN (image->numRows - 1, SubImageCenterRow + outerRadiusS32);
-    psS32 SubImageStartCol  = PS_MAX (0, SubImageCenterCol - outerRadiusS32);
-    psS32 SubImageEndCol    = PS_MIN (image->numCols - 1, SubImageCenterCol + outerRadiusS32);
+    psS32 SubImageStartRow  = PS_MAX(0, SubImageCenterRow - outerRadiusS32);
+    psS32 SubImageEndRow    = PS_MIN(image->numRows - 1, SubImageCenterRow + outerRadiusS32);
+    psS32 SubImageStartCol  = PS_MAX(0, SubImageCenterCol - outerRadiusS32);
+    psS32 SubImageEndCol    = PS_MIN(image->numCols - 1, SubImageCenterCol + outerRadiusS32);
     // AnulusWidth == number of pixels width in the annulus.  We add one since
     // the pixels at the inner AND outher radius are included.
@@ -670,6 +674,11 @@
     //                                      SubImageEndCol,
     //                                      SubImageEndRow);
-    psImage *subImage = NULL;
     //    printf("pmSourceLocalSky: subimage width/length is (%d, %d)\n", subImage->numCols, subImage->numRows);
+    psRegion tmpRegion = psRegionSet(SubImageStartCol,
+                                     SubImageEndCol,
+                                     SubImageStartRow,
+                                     SubImageEndRow);
+    psImage *subImage = psImageSubset((psImage *) image, tmpRegion);
+
     psImage *subImageMask = psImageAlloc(subImage->numCols,
                                          subImage->numRows,
@@ -1310,4 +1319,14 @@
         psFree(source->models);
     }
+    if (!((model == PS_MODEL_GAUSS) ||
+            (model == PS_MODEL_PGAUSS) ||
+            (model == PS_MODEL_WAUSS) ||
+            (model == PS_MODEL_TWIST_GAUSS) ||
+            (model == PS_MODEL_SERSIC) ||
+            (model == PS_MODEL_SERSIC_CORE))) {
+        psError(PS_ERR_UNKNOWN, true, "Undefined psModelType");
+        return(false);
+    }
+
     source->models = pmModelAlloc(model);
 
@@ -1873,4 +1892,6 @@
                       psVector *x)
 {
+    PS_ASSERT_VECTOR_NON_NULL(params, NAN);
+    PS_ASSERT_VECTOR_NON_NULL(x, NAN);
     psF32 X  = x->data.F32[0] - params->data.F32[2];
     psF32 Y  = x->data.F32[1] - params->data.F32[3];
@@ -1907,4 +1928,6 @@
                             psVector *x)
 {
+    PS_ASSERT_VECTOR_NON_NULL(params, NAN);
+    PS_ASSERT_VECTOR_NON_NULL(x, NAN);
     psF32 X  = x->data.F32[0] - params->data.F32[2];
     psF32 Y  = x->data.F32[1] - params->data.F32[3];
@@ -1945,4 +1968,6 @@
                       psVector *x)
 {
+    PS_ASSERT_VECTOR_NON_NULL(params, NAN);
+    PS_ASSERT_VECTOR_NON_NULL(x, NAN);
     psF32 X = x->data.F32[0] - params->data.F32[2];
     psF32 Y = x->data.F32[1] - params->data.F32[2];
@@ -1991,4 +2016,6 @@
                            psVector *x)
 {
+    PS_ASSERT_VECTOR_NON_NULL(params, NAN);
+    PS_ASSERT_VECTOR_NON_NULL(x, NAN);
     psF32 X = x->data.F32[0] - params->data.F32[2];
     psF32 Y = x->data.F32[1] - params->data.F32[3];
@@ -2047,4 +2074,6 @@
                      psVector *x)
 {
+    PS_ASSERT_VECTOR_NON_NULL(params, NAN);
+    PS_ASSERT_VECTOR_NON_NULL(x, NAN);
     psError(PS_ERR_UNKNOWN, true, "This function is not implemented yet.");
     return(0.0);
@@ -2070,4 +2099,6 @@
                          psVector *x)
 {
+    PS_ASSERT_VECTOR_NON_NULL(params, NAN);
+    PS_ASSERT_VECTOR_NON_NULL(x, NAN);
     psError(PS_ERR_UNKNOWN, true, "This function is not implemented yet.");
     return(0.0);
