Index: trunk/psModules/src/objects/pmSourceGroups.c
===================================================================
--- trunk/psModules/src/objects/pmSourceGroups.c	(revision 26182)
+++ trunk/psModules/src/objects/pmSourceGroups.c	(revision 26190)
@@ -60,4 +60,16 @@
     pmSourceGroups *groups = psAlloc(sizeof(pmSourceGroups)); // Groups, to return
     psMemSetDeallocator(groups, (psFreeFunc)sourceGroupsFree);
+
+    groups->Xo = readout->image->col0;
+    groups->Yo = readout->image->row0;
+
+    if (nThreads == 0 || nThreads == 1) {
+        // Trivial case
+        groups->Cx = groups->Cy = 1;
+        groups->Nx = readout->image->numCols;
+        groups->Ny = readout->image->numRows;
+        groups->groups = psArrayAlloc(1);
+        return groups;
+    }
 
     int nCells = nThreads * 2*2;        // number of cells in a single set
@@ -83,5 +95,4 @@
     groups->Cx = Cx;
     groups->Cy = Cy;
-    groups->Xo = readout->image->col0, groups->Yo = readout->image->row0; // Offsets
     groups->Nx = readout->image->numCols / (Cx*2);
     groups->Ny = readout->image->numRows / (Cy*2);
@@ -155,6 +166,7 @@
     PS_ASSERT_VECTORS_SIZE_EQUAL(x, y, NULL);
 
+    int numSources = x->n;                // Number of sources
+
     // Populate the groups
-    int numSources = x->n;                // Number of sources
     long total = groups->Cx * groups->Cy; // Total size
     for (int i = 0; i < groups->groups->n; i++) {
@@ -167,13 +179,22 @@
 
     // Populate the cells
-    for (int i = 0; i < numSources; i++) {
-        int group = 0, cell = 0;        // Group and cell index for source
-        pmSourceGroupsCoordToCell(&group, &cell, x->data.F32[i], y->data.F32[i], groups);
-
-        psArray *cells = groups->groups->data[group]; // Cells for group
-        psVector *cellSources = cells->data[cell];    // Indices of sources for cell within group
-        psVectorAppend(cellSources, i);
-    }
-
-    return groups;
-}
+    if (total == 1) {
+        // Trivial case: Cx == Cy == 1
+        psArray *cells = groups->groups->data[0]; // Cell
+        psVector *cellSources = cells->data[0];   // Indices of sources for cell
+        for (int i = 0; i < numSources; i++) {
+            cellSources->data.S32[i] = i;
+        }
+    } else {
+        for (int i = 0; i < numSources; i++) {
+            int group = 0, cell = 0;        // Group and cell index for source
+            pmSourceGroupsCoordToCell(&group, &cell, x->data.F32[i], y->data.F32[i], groups);
+
+            psArray *cells = groups->groups->data[group]; // Cells for group
+            psVector *cellSources = cells->data[cell];    // Indices of sources for cell within group
+            psVectorAppend(cellSources, i);
+        }
+    }
+
+    return groups;
+}
