Index: trunk/psModules/test/objects/Makefile.am
===================================================================
--- trunk/psModules/test/objects/Makefile.am	(revision 9722)
+++ trunk/psModules/test/objects/Makefile.am	(revision 9877)
@@ -1,6 +1,21 @@
-AM_LDFLAGS = -L$(top_builddir)/src -lpsmodules $(PSMODULES_LIBS)
-AM_CFLAGS  = @AM_CFLAGS@ $(PSMODULES_CFLAGS) $(SRCINC)
 
-check_PROGRAMS =
+AM_CPPFLAGS = \
+	$(SRCINC) \
+	-I$(top_srcdir)/test/tap/src \
+	-I$(top_srcdir)/test/pstap/src \
+	$(PSMODULES_CFLAGS)
+
+AM_LDFLAGS = \
+	$(top_builddir)/src/libpsmodules.la  \
+	$(top_builddir)/test/tap/src/libtap.la \
+	$(top_builddir)/test/pstap/src/libpstap.la \
+	$(PSMODULES_LIBS)
+
+# XXX is this desired?
+# AM_CFLAGS  = @AM_CFLAGS@ $(PSMODULES_CFLAGS) $(SRCINC)
+
+check_PROGRAMS = \
+	tap_pmSourcePhotometry \
+	tap_pmGrowthCurve
 
 test: check
Index: trunk/psModules/test/objects/tap_pmGrowthCurve.c
===================================================================
--- trunk/psModules/test/objects/tap_pmGrowthCurve.c	(revision 9877)
+++ trunk/psModules/test/objects/tap_pmGrowthCurve.c	(revision 9877)
@@ -0,0 +1,126 @@
+#include <stdio.h>
+#include <string.h>
+#include <pslib.h>
+#include <psmodules.h>
+
+#include "tap.h"
+
+int main (void)
+{
+    plan_tests(143);
+
+    diag("pmGrowthCurve tests");
+
+    // test allocation
+    diag("pmGrowthCurveAlloc tests");
+    {
+        psMemId id = psMemGetId();
+
+        pmGrowthCurve *growth = pmGrowthCurveAlloc (2.0, 100.0, 15.0);
+
+        ok(growth != NULL, "growth curve allocated");
+        skip_start(growth == NULL, 0, "Skipping tests because pmShutterCorrParsAlloc() failed");
+
+        ok(growth->radius->n == (100.0 - 2.0), "correct number of growth radii");
+        ok(growth->apMag->n == (100.0 - 2.0), "correct number of growth apMags");
+
+        ok_float(growth->refRadius, 15.0, "correct refRadius");
+        ok_float(growth->maxRadius, 100.0, "correct maxRadius");
+
+        // does the growth curve correctly fix aperture mags?
+        pmModelGroupInit ();
+
+        // generate a simple readout
+        pmReadout *readout = pmReadoutAlloc (NULL);
+        readout->image = psImageAlloc (64, 64, PS_TYPE_F32);
+        readout->mask  = psImageAlloc (64, 64, PS_TYPE_U8);
+
+        // generate a simple psf
+        pmPSF *psf = pmPSFBuildSimple ("PS_MODEL_GAUSS", 1.5, 1.5, 0.0);
+        psf->growth = growth;
+
+        pmGrowthCurveGenerate (readout, psf, false);
+
+        // check ap mags for a few radii set by hand
+        ok_float(growth->apMag->data.F32[0],  0.0, "apMag at radius 0: %f", growth->apMag->data.F32[0]);
+        ok_float(growth->apMag->data.F32[3],  0.0, "apMag at radius 3: %f", growth->apMag->data.F32[3]);
+        ok_float(growth->apMag->data.F32[10], 0.0, "apMag at radius 10: %f", growth->apMag->data.F32[10]);
+        ok_float(growth->apMag->data.F32[30], 0.0, "apMag at radius 30: %f", growth->apMag->data.F32[30]);
+
+        ok_float(growth->apRef, 0.0, "apMag at ref radius : %f", growth->apRef);
+        ok_float(growth->apLoss, 0.0, "apLoss : %f", growth->apLoss);
+        ok_float(growth->fitMag, 0.0, "fitMag : %f", growth->fitMag);
+
+        // create template model and measure apMag at fractional offsets
+        // XXX note model is at 0.5,0.5 subpix center
+        pmModel *modelRef = pmModelAlloc(psf->type);
+        modelRef->params->data.F32[PM_PAR_SKY] = 0;
+        modelRef->params->data.F32[PM_PAR_I0] = 1000;
+        modelRef->params->data.F32[PM_PAR_XPOS] = 32.5;
+        modelRef->params->data.F32[PM_PAR_YPOS] = 32.5;
+
+        // create modelPSF from this model
+        pmModel *model = pmModelFromPSF (modelRef, psf);
+        model->radiusFit = radius;
+
+        // create an empty reference image
+        psImageInit (readout->image, 0.0);
+        psImageInit (readout->mask, 0);
+
+        // we generate a subtracted model, pmSourceMagnitude will insert and remove it
+        // pmModelAdd (readout->image, readout->mask, model, false, false);
+
+        // measure growth-corrected photometry:
+        pmSource *source = pmSourceAlloc ();
+        source->modelPSF = model;
+        source->type = PM_SOURCE_TYPE_STAR;
+        source->pixels = readout->image;
+        source->mask = readout->mask;
+
+        source->modelPSF->dparams->data.F32[PM_PAR_I0] = 1;
+        source->mode = PM_SOURCE_SUBTRACTED;
+
+        source->modelPSF->radiusFit = 10.0
+                                      pmSourceMagnitudes (source, psf, PM_SOURCE_PHOT_GROWTH | PM_SOURCE_PHOT_INTERP);
+
+        ok_float_tol(source->fitMag, -10.0, 0.1, "source fitMag is %f", source->fitMag);
+        ok_float_tol(source->apMag,  -10.0, 0.1, "source apMag is %f", source->apMag);
+        ok_float_tol(source->errMag,   0.1, 0.01, "source errMag is %f", source->errMag);
+
+        source->modelPSF->radiusFit = 8.0
+                                      pmSourceMagnitudes (source, psf, PM_SOURCE_PHOT_GROWTH | PM_SOURCE_PHOT_INTERP);
+
+        ok_float_tol(source->fitMag, -10.0, 0.1, "source fitMag is %f", source->fitMag);
+        ok_float_tol(source->apMag,  -10.0, 0.1, "source apMag is %f", source->apMag);
+        ok_float_tol(source->errMag,   0.1, 0.01, "source errMag is %f", source->errMag);
+
+        source->modelPSF->radiusFit = 6.0
+                                      pmSourceMagnitudes (source, psf, PM_SOURCE_PHOT_GROWTH | PM_SOURCE_PHOT_INTERP);
+
+        ok_float_tol(source->fitMag, -10.0, 0.1, "source fitMag is %f", source->fitMag);
+        ok_float_tol(source->apMag,  -10.0, 0.1, "source apMag is %f", source->apMag);
+        ok_float_tol(source->errMag,   0.1, 0.01, "source errMag is %f", source->errMag);
+
+        source->modelPSF->radiusFit = 4.0
+                                      pmSourceMagnitudes (source, psf, PM_SOURCE_PHOT_GROWTH | PM_SOURCE_PHOT_INTERP);
+
+        ok_float_tol(source->fitMag, -10.0, 0.1, "source fitMag is %f", source->fitMag);
+        ok_float_tol(source->apMag,  -10.0, 0.1, "source apMag is %f", source->apMag);
+        ok_float_tol(source->errMag,   0.1, 0.01, "source errMag is %f", source->errMag);
+
+        source->modelPSF->radiusFit = 2.0
+                                      pmSourceMagnitudes (source, psf, PM_SOURCE_PHOT_GROWTH | PM_SOURCE_PHOT_INTERP);
+
+        ok_float_tol(source->fitMag, -10.0, 0.1, "source fitMag is %f", source->fitMag);
+        ok_float_tol(source->apMag,  -10.0, 0.1, "source apMag is %f", source->apMag);
+        ok_float_tol(source->errMag,   0.1, 0.01, "source errMag is %f", source->errMag);
+
+        // XXX include some apertures outside of growth correction range
+
+        skip_end();
+        psFree(growth);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+    return exit_status();
+}
Index: trunk/psModules/test/objects/tap_pmSourcePhotometry.c
===================================================================
--- trunk/psModules/test/objects/tap_pmSourcePhotometry.c	(revision 9877)
+++ trunk/psModules/test/objects/tap_pmSourcePhotometry.c	(revision 9877)
@@ -0,0 +1,90 @@
+#include <stdio.h>
+#include <string.h>
+#include <pslib.h>
+#include <psmodules.h>
+
+#include "tap.h"
+
+int main (void)
+{
+
+    pmModelGroupInit ();
+
+    plan_tests(143);
+
+    diag("pmSourcePhotometry tests");
+
+    // test allocation, free of pmShutterCorrPars
+    {
+        psMemId id = psMemGetId();
+
+        diag("pmSourcePhotometry basic tests");
+
+        // generate a simple readout
+        pmReadout *readout = pmReadoutAlloc (NULL);
+        readout->image = psImageAlloc (64, 64, PS_TYPE_F32);
+        readout->mask  = psImageAlloc (64, 64, PS_TYPE_U8);
+
+        // create an empty reference image
+        psImageInit (readout->image, 0.0);
+        psImageInit (readout->mask, 0);
+
+        // generate a simple psf
+        pmPSF *psf = pmPSFBuildSimple ("PS_MODEL_GAUSS", 1.5, 1.5, 0.0);
+
+        // create a source
+        pmSource *source = pmSourceAlloc ();
+        source->pixels = readout->image;
+        source->mask   = readout->mask;
+        source->type   = PM_SOURCE_TYPE_STAR;
+        source->mode   = PM_SOURCE_SUBTRACTED;
+
+        // create template model and measure apMag at fractional offsets
+        pmModel *modelRef = pmModelAlloc(psf->type);
+        modelRef->params->data.F32[PM_PAR_SKY] = 0;
+        modelRef->params->data.F32[PM_PAR_I0] = 1000;
+        modelRef->params->data.F32[PM_PAR_XPOS] = 32.5;
+        modelRef->params->data.F32[PM_PAR_YPOS] = 32.5;
+
+        // create modelPSF from this model
+        source->modelPSF = pmModelFromPSF (modelRef, psf);
+        source->modelPSF->radiusFit = radius;
+        source->modelPSF->dparams->data.F32[PM_PAR_I0] = 1;
+        source->modelPSF->radiusFit = 10.0
+
+                                      // measure growth-corrected photometry:
+                                      pmSourceMagnitudes (source, psf, PM_SOURCE_PHOT_GROWTH | PM_SOURCE_PHOT_INTERP);
+
+        ok_float_tol(source->fitMag, -10.0, 0.1, "source fitMag is %f", source->fitMag);
+        ok_float_tol(source->apMag,  -10.0, 0.1, "source apMag is %f", source->apMag);
+        ok_float_tol(source->errMag,   0.1, 0.01, "source errMag is %f", source->errMag);
+        float refMag = source->apMag;
+
+        // use a sub-pixel offset position
+        source->modelPSF->params->data.F32[PM_PAR_XPOS] = 32.3;
+        source->modelPSF->params->data.F32[PM_PAR_YPOS] = 32.3;
+
+        // measure growth-corrected photometry:
+        pmSourceMagnitudes (source, psf, PM_SOURCE_PHOT_GROWTH | PM_SOURCE_PHOT_INTERP);
+        ok_float_tol(refMag - source->apMag,  0.0, 0.1, "source apMag is %f", source->apMag);
+
+        psFree (source);
+        psFree (model);
+
+        psFree (modelRef);
+        psFree (psf);
+        psFree (readout);
+
+        ok(pars != NULL, "pmShutterCorrPars successfully allocated");
+        skip_start(pars == NULL, 0, "Skipping tests because pmShutterCorrParsAlloc() failed");
+        skip_end();
+
+        skip_end();
+
+        psFree(growth);
+        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+    }
+
+
+    return exit_status();
+}
