Index: /branches/eam_branches/ipp-20250626/psModules/test/objects/Makefile.am
===================================================================
--- /branches/eam_branches/ipp-20250626/psModules/test/objects/Makefile.am	(revision 42953)
+++ /branches/eam_branches/ipp-20250626/psModules/test/objects/Makefile.am	(revision 42954)
@@ -12,6 +12,7 @@
 
 TEST_PROGS = \
-	tap_pmSourceFitModel
+	tap_pmSourceTrace
 
+#       tap_pmSourceFitModel
 #	tap_pmPeaks \
 #	tap_pmGrowthCurve \
Index: /branches/eam_branches/ipp-20250626/psModules/test/objects/tap_pmSourceTrace.c
===================================================================
--- /branches/eam_branches/ipp-20250626/psModules/test/objects/tap_pmSourceTrace.c	(revision 42954)
+++ /branches/eam_branches/ipp-20250626/psModules/test/objects/tap_pmSourceTrace.c	(revision 42954)
@@ -0,0 +1,179 @@
+#include <stdio.h>
+#include <string.h>
+#include <pslib.h>
+#include <pmSourceTrace.h>
+#include "tap.h"
+#include "pstap.h"
+
+#define VERBOSE                 0
+#define ERR_TRACE_LEVEL         0
+
+bool insertTrace (float x, float y, float posangle, float sigma, int n) {
+
+  // generate a sample source trace
+  pmSourceTrace *mySource = pmSourceTraceAlloc(x, y, posangle, sigma);
+  // ok(mySource, "source allocated");
+	
+  // generate a trace which has a triangular profile (as an example)
+  mySource->profile = psVectorAlloc(50, PS_TYPE_F32);
+  for (int i = 0; i < mySource->profile->n; i++) {
+    mySource->profile->data.F32[i] = 50 - i;
+  }
+
+  psImage *myImage = psImageAlloc(200, 200, PS_TYPE_F32);
+  psImageInit (myImage, 0.0);
+	
+  pmSourceTraceAdd (myImage, mySource);
+
+  char name[64];
+  sprintf (name, "test.%03d.fits", n);
+  psFits *fits = psFitsOpen (name, "w");
+  psFitsWriteImage (fits, NULL, myImage, 0, NULL);
+  psFitsClose (fits);
+
+  psFree (mySource);
+  psFree (myImage);
+
+  return true;
+}
+
+int main(int argc, char* argv[])
+{
+    psLogSetFormat("HLNM");
+    psLogSetLevel(PS_LOG_INFO);
+    // psTraceSetLevel("err", ERR_TRACE_LEVEL);
+    // plan_tests(70);
+
+    if (1) {
+        psMemId id = psMemGetId();
+
+	int n = 0;
+	insertTrace (100.0, 100.5,   0.0, 1.0, n); n ++;
+	insertTrace (100.0, 100.5,  45.0, 1.0, n); n ++;
+	insertTrace (100.0, 100.5,  90.0, 1.0, n); n ++;
+	insertTrace (100.0, 100.5, -45.0, 1.0, n); n ++;
+
+	insertTrace (100.0, 100.5,   0.0, 2.0, n); n ++;
+	insertTrace (100.0, 100.5,  45.0, 2.0, n); n ++;
+	insertTrace (100.0, 100.5,  90.0, 2.0, n); n ++;
+	insertTrace (100.0, 100.5, -45.0, 2.0, n); n ++;
+
+	// XXX this works, but there is a little ambiguity about what should be the
+	// centroid at the 0.5 pixel level.
+
+	// 90 degree version seems to be slightly off : line at 100 turns on suddenly
+
+        // ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+    if (1) {
+
+      float x = 100.5;
+      float y = 100.5;
+      float posangle = 0.0;
+      float sigma = 1.0;
+      int n = 0;
+
+      // generate a sample source trace
+      pmSourceTrace *mySource = pmSourceTraceAlloc(x, y, posangle, sigma);
+      // ok(mySource, "source allocated");
+	
+      mySource->dP = 55;
+      mySource->dQ = 11;
+
+      // generate a trace which has a triangular profile (as an example)
+      mySource->profile = psVectorAlloc(50, PS_TYPE_F32);
+      for (int i = 0; i < mySource->profile->n; i++) {
+	mySource->profile->data.F32[i] = 50 - i;
+      }
+
+      psImage *myImage = psImageAlloc(200, 200, PS_TYPE_F32);
+      psImageInit (myImage, 0.0);
+	
+      // insert trace into image
+      pmSourceTraceAdd (myImage, mySource);
+
+      // save the full image
+      char name[64];
+      sprintf (name, "testout.%03d.fits", n);
+      psFits *f1 = psFitsOpen (name, "w");
+      psFitsWriteImage (f1, NULL, myImage, 0, NULL);
+      psFitsClose (f1);
+
+      psImage *window = pmSourceTraceGet (myImage, mySource);
+
+      // save the full image
+      sprintf (name, "testwin.%03d.fits", n);
+      psFits *f2 = psFitsOpen (name, "w");
+      psFitsWriteImage (f2, NULL, window, 0, NULL);
+      psFitsClose (f2);
+      
+      psVector *crosscut = pmSourceTraceExtractProfile (window, mySource);
+
+      sprintf (name, "testvec.%03d.dat", n);
+      FILE *fv = fopen (name, "w");
+      int fd = fileno(fv);
+      p_psVectorPrint (fd, crosscut, "crosscut");
+      fclose (fv);
+
+      psFree (crosscut);
+
+      psFree (window);
+      psFree (mySource);
+      psFree (myImage);
+    }
+
+    if (0) {
+
+      float x = 100.5;
+      float y = 100.5;
+      
+      float posangle = 0.0;
+      float sigma = 1.0;
+      int n = 1;
+
+      // generate a sample source trace
+      pmSourceTrace *mySource = pmSourceTraceAlloc(x, y, posangle, sigma);
+      // ok(mySource, "source allocated");
+	
+      mySource->dP = 55;
+      mySource->dQ = 11;
+
+      // generate a trace which has a triangular profile (as an example)
+      mySource->profile = psVectorAlloc(50, PS_TYPE_F32);
+      for (int i = 0; i < mySource->profile->n; i++) {
+	mySource->profile->data.F32[i] = 50 - i;
+      }
+
+      psImage *myImage = psImageAlloc(200, 200, PS_TYPE_F32);
+      psImageInit (myImage, 0.0);
+	
+      // insert trace into image
+      // pmSourceTraceAdd (myImage, mySource);
+
+      myImage->data.F32[100][103] = 10;
+
+      // save the full image
+      char name[64];
+      sprintf (name, "testout.%03d.fits", n);
+      psFits *f1 = psFitsOpen (name, "w");
+      psFitsWriteImage (f1, NULL, myImage, 0, NULL);
+      psFitsClose (f1);
+
+      psImage *window = pmSourceTraceGet (myImage, mySource);
+
+      // save the full image
+      sprintf (name, "testwin.%03d.fits", n);
+      psFits *f2 = psFitsOpen (name, "w");
+      psFitsWriteImage (f2, NULL, window, 0, NULL);
+      psFitsClose (f2);
+      
+      psFree (window);
+      psFree (mySource);
+      psFree (myImage);
+    }
+
+
+    return true;
+}
+
