Index: trunk/stac/src/stacScales.c
===================================================================
--- trunk/stac/src/stacScales.c	(revision 3613)
+++ trunk/stac/src/stacScales.c	(revision 3666)
@@ -54,5 +54,8 @@
 		psVector **offsetsPtr,	// Offsets to return
 		const psArray *images,	// Images on which to measure the scales and offsets
-		const stacConfig *config // Configuration
+		const char *starFile,	// File containing coordinates to photometer
+		const char *starMapFile, // Map for coodinates to the common output frame
+		float xMapDiff, float yMapDiff, // Difference from the map to apply (due to size difference)
+		float aper		// Aperture to use for photometry (radius)
     )
 {
@@ -60,5 +63,4 @@
     assert(offsetsPtr);
     assert(images);
-    assert(config);
     for (int i = 0; i < images->n; i++) {
 	psImage *image = images->data[i];
@@ -99,5 +101,5 @@
 
     // Now the scales
-    if (config->starFile == NULL || config->starMapFile == NULL) {
+    if (starFile == NULL || starMapFile == NULL) {
 	psLogMsg("stac.scales", PS_LOG_INFO,
 		 "No coordinates available to set scales --- assuming all are identical.\n");
@@ -108,12 +110,12 @@
     } else {
 	// Read star coordinates and map
-	psArray *starCoords = stacReadCoords(config->starFile); // Array of star coordinates
-	psPlaneTransform *starMap = stacReadMap(config->starMapFile); // Transformation for star coordinates
+	psArray *starCoords = stacReadCoords(starFile); // Array of star coordinates
+	psPlaneTransform *starMap = stacReadMap(starMapFile); // Transformation for star coordinates
 
 	// Transform the stellar positions to match the transformed reference frame
 	psArray *starCoordsTransformed = psArrayAlloc(starCoords->n); // Transformed positions
 	// Fix up difference between map and output frame
-	starMap->x->coeff[0][0] -= config->xMapDiff;
-	starMap->y->coeff[0][0] -= config->yMapDiff;
+	starMap->x->coeff[0][0] -= xMapDiff;
+	starMap->y->coeff[0][0] -= yMapDiff;
 	for (int i = 0; i < starCoords->n; i++) {
 	    starCoordsTransformed->data[i] = psPlaneTransformApply(NULL, starMap, starCoords->data[i]);
@@ -139,7 +141,7 @@
 		psPlane *coords = starCoordsTransformed->data[j]; // The coordinates of the star
 		
-		if (coords->x < config->aper || coords->y < config->aper ||
-		    coords->x + config->aper > image->numCols - 1 ||
-		    coords->y + config->aper > image->numRows) {
+		if (coords->x < aper || coords->y < aper ||
+		    coords->x + aper > image->numCols - 1 ||
+		    coords->y + aper > image->numRows) {
 		    mask->data.U8[j] = 1;
 		} else {
@@ -147,9 +149,9 @@
 		    float sum = 0.0;
 		    int numPix = 0;
-		    float aper2 = SQUARE(config->aper);
-		    for (int y = (int)floorf(coords->y - config->aper);
-			 y <= (int)ceilf(coords->y + config->aper); y++) {
-			for (int x = (int)floorf(coords->x - config->aper);
-			     x <= (int)ceilf(coords->x + config->aper); x++) {
+		    float aper2 = SQUARE(aper);
+		    for (int y = (int)floorf(coords->y - aper);
+			 y <= (int)ceilf(coords->y + aper); y++) {
+			for (int x = (int)floorf(coords->x - aper);
+			     x <= (int)ceilf(coords->x + aper); x++) {
 			    if (SQUARE((float)x + 0.5 - coords->x) + SQUARE((float)y + 0.5 - coords->y) <=
 				aper2) {
@@ -198,12 +200,4 @@
     }
 
-    // Change the saturation and bad values
-    psVector *saturated = config->saturated; // Saturation limits
-    psVector *bad = config->bad;	// Bad limits
-    for (int i = 0; i < saturated->n; i++) {
-	saturated->data.F32[i] = (saturated->data.F32[i] - offsets->data.F32[i]) / scales->data.F32[i];
-	bad->data.F32[i] = (bad->data.F32[i] - offsets->data.F32[i]) / scales->data.F32[i];
-    }
-
     return true;
 }
