Index: /trunk/pois/src/poisCalculateDeviations.c
===================================================================
--- /trunk/pois/src/poisCalculateDeviations.c	(revision 9739)
+++ /trunk/pois/src/poisCalculateDeviations.c	(revision 9740)
@@ -53,5 +53,4 @@
     if (!deviations) {
         deviations = psVectorAlloc(stamps->n, PS_TYPE_F32);
-        deviations->n = stamps->n;
     }
 
Index: /trunk/pois/src/poisCheckKernel.c
===================================================================
--- /trunk/pois/src/poisCheckKernel.c	(revision 9739)
+++ /trunk/pois/src/poisCheckKernel.c	(revision 9740)
@@ -33,5 +33,4 @@
     psVector *radKernel = psVectorAlloc((2*config->xKernel + 1) * (2*config->yKernel + 1), PS_TYPE_F32);
     psVector *radii = psVectorAlloc((2*config->xKernel + 1) * (2*config->yKernel + 1), PS_TYPE_F32); // Radius
-    radKernel->n = radii->n = (2*config->xKernel + 1) * (2*config->yKernel + 1);
     for (int i = 0; i < solution->n - 1; i++) {
         poisKernelBasis *kernel = kernels->data[i]; // The kernel basis function
Index: /trunk/pois/src/poisFindStamps.c
===================================================================
--- /trunk/pois/src/poisFindStamps.c	(revision 9739)
+++ /trunk/pois/src/poisFindStamps.c	(revision 9740)
@@ -51,5 +51,4 @@
     if (stamps == NULL) {
         stamps = psArrayAlloc(nsx * nsy);
-        stamps->n = nsx * nsy;
         // Initialise
         for (int i = 0; i < nsx * nsy; i++) {
Index: /trunk/pois/src/poisKernelBasisFunctions.c
===================================================================
--- /trunk/pois/src/poisKernelBasisFunctions.c	(revision 9739)
+++ /trunk/pois/src/poisKernelBasisFunctions.c	(revision 9740)
@@ -40,5 +40,4 @@
 
     psArray *array = psArrayAlloc(nBF); // Array to hold the basis functions
-    array->n = nBF;
 
     int num = 0;                        // Kernel parameter number
Index: /trunk/pois/src/poisReadStamps.c
===================================================================
--- /trunk/pois/src/poisReadStamps.c	(revision 9739)
+++ /trunk/pois/src/poisReadStamps.c	(revision 9740)
@@ -37,5 +37,4 @@
     if (stamps == NULL) {
         stamps = psArrayAlloc(config->nsx);
-        stamps->n = config->nsx;
         // Initialise
         for (int i = 0; i < config->nsx; i++) {
Index: /trunk/pois/src/poisSolveEquation.c
===================================================================
--- /trunk/pois/src/poisSolveEquation.c	(revision 9739)
+++ /trunk/pois/src/poisSolveEquation.c	(revision 9740)
@@ -40,5 +40,4 @@
     psImage *matrix = psImageAlloc(size, size, PS_TYPE_F64);
     psVector *vector = psVectorAlloc(size, PS_TYPE_F64);
-    vector->n = size;
     for (int j = 0; j < size; j++) {
         for (int i = 0; i < size; i++) {
Index: /trunk/stac/src/combine.c
===================================================================
--- /trunk/stac/src/combine.c	(revision 9739)
+++ /trunk/stac/src/combine.c	(revision 9740)
@@ -29,5 +29,4 @@
     // Make fake errors
     psArray *errors = psArrayAlloc(images->n);
-    errors->n = images->n;
     for (int i = 0; i < images->n; i++) {
         psImage *image = images->data[i];
@@ -49,6 +48,4 @@
     psVector *saturated = psVectorAlloc(images->n, PS_TYPE_F32); // Saturation limits
     psVector *bad = psVectorAlloc(images->n, PS_TYPE_F32); // Bad limits
-    saturated->n = images->n;
-    bad->n = images->n;
     for (int i = 0; i < images->n; i++) {
         saturated->data.F32[i] = (config->saturated - offsets->data.F32[i]) / scales->data.F32[i];
Index: /trunk/stac/src/combineConfig.c
===================================================================
--- /trunk/stac/src/combineConfig.c	(revision 9739)
+++ /trunk/stac/src/combineConfig.c	(revision 9740)
@@ -157,5 +157,4 @@
     config->outName = argv[0];          // Output filename
     config->inNames = psArrayAlloc(argc-1); // Input filenames
-    config->inNames->n = argc-1;
     for (int i = 1; i < argc; i++) {
         config->inNames->data[i-1] = psAlloc(strlen(argv[i]));
Index: /trunk/stac/src/shift.c
===================================================================
--- /trunk/stac/src/shift.c	(revision 9739)
+++ /trunk/stac/src/shift.c	(revision 9740)
@@ -130,5 +130,4 @@
     psArray *maps = psArrayAlloc(1);    // An array of one
     psArray *masks = psArrayAlloc(1);   // An array of one
-    images->n = maps->n = masks->n = 1;
     images->data[0] = image;
     maps->data[0] = map;
@@ -139,6 +138,4 @@
         psVector *xSize = psVectorAlloc(1, PS_TYPE_S32); // A vector of one
         psVector *ySize = psVectorAlloc(1, PS_TYPE_S32); // A vector of one
-        xSize->n = 1;
-        ySize->n = 1;
         xSize->data.S32[0] = image->numCols;
         ySize->data.S32[0] = image->numRows;
Index: /trunk/stac/src/shiftSize.c
===================================================================
--- /trunk/stac/src/shiftSize.c	(revision 9739)
+++ /trunk/stac/src/shiftSize.c	(revision 9740)
@@ -77,5 +77,4 @@
 
     psArray *inputs = psArrayAlloc(argc); // Input filenames
-    inputs->n = argc;
     for (int i = 0; i < argc; i++) {
         inputs->data[i] = psAlloc(strlen(argv[i]));
@@ -87,6 +86,4 @@
     psVector *xSize = psVectorAlloc(inputs->n, PS_TYPE_S32);
     psVector *ySize = psVectorAlloc(inputs->n, PS_TYPE_S32);
-    xSize->n = inputs->n;
-    ySize->n = inputs->n;
     for (int i = 0; i < inputs->n; i++) {
         const char *filename = inputs->data[i]; // Name of FITS file
Index: /trunk/stac/src/stac.c
===================================================================
--- /trunk/stac/src/stac.c	(revision 9739)
+++ /trunk/stac/src/stac.c	(revision 9740)
@@ -49,5 +49,4 @@
     // Generate masks
     psArray *masks = psArrayAlloc(inputs->n);
-    masks->n = inputs->n;
     for (int i = 0; i < inputs->n; i++) {
         psImage *image = inputs->data[i]; // Image for which to get mask
@@ -74,6 +73,4 @@
         psVector *xSize = psVectorAlloc(inputs->n, PS_TYPE_S32); // Sizes of images in x
         psVector *ySize = psVectorAlloc(inputs->n, PS_TYPE_S32); // Sizes of images in y
-        xSize->n = inputs->n;
-        ySize->n = inputs->n;
         for (int i = 0; i < inputs->n; i++) {
             psImage *image = inputs->data[i]; // The i-th image
@@ -169,6 +166,4 @@
     psVector *saturated = psVectorAlloc(transformed->n, PS_TYPE_F32); // Saturation limits
     psVector *bad = psVectorAlloc(transformed->n, PS_TYPE_F32); // Bad limits
-    saturated->n = transformed->n;
-    bad->n = transformed->n;
     float minSaturated = INFINITY;      // The minimum saturation level
     float maxBad = -INFINITY;           // The maximum bad level
@@ -240,5 +235,4 @@
     // Get regions of interest in the source frame
     psArray *regions = psArrayAlloc(inputs->n); // Array of images denoting regions of interest
-    regions->n = inputs->n;
     for (int i = 0; i < inputs->n; i++) {
         regions->data[i] = stacAreaOfInterest(rejected->data[i], inverseMaps->data[i],
Index: /trunk/stac/src/stacCombine.c
===================================================================
--- /trunk/stac/src/stacCombine.c	(revision 9739)
+++ /trunk/stac/src/stacCombine.c	(revision 9740)
@@ -107,7 +107,4 @@
     psVector *deltas = psVectorAlloc(nImages, PS_TYPE_F32); // Will hold the errors in the statistics step
     psVector *mask = psVectorAlloc(nImages, PS_TYPE_U8); // Will hold the mask in the statistics step
-    pixels->n = nImages;
-    deltas->n = nImages;
-    mask->n = nImages;
 
     // Set up rejection masks
@@ -116,5 +113,4 @@
             // Allocate the rejection masks, if required
             *rejected = psArrayAlloc(nImages);
-            (*rejected)->n = nImages;
         } else {
             assert((*rejected)->n != nImages);
Index: /trunk/stac/src/stacErrorImages.c
===================================================================
--- /trunk/stac/src/stacErrorImages.c	(revision 9739)
+++ /trunk/stac/src/stacErrorImages.c	(revision 9740)
@@ -15,5 +15,4 @@
     rn /= gain;                         // Read noise in ADU
     psArray *errors = psArrayAlloc(inputs->n);
-    errors->n = inputs->n;
 
     psTrace("stac.errors", 1, "Calculating error images....\n");
Index: /trunk/stac/src/stacInvertMaps.c
===================================================================
--- /trunk/stac/src/stacInvertMaps.c	(revision 9739)
+++ /trunk/stac/src/stacInvertMaps.c	(revision 9740)
@@ -18,5 +18,4 @@
     int nMaps = maps->n;                // Number of maps
     psArray *inverted = psArrayAlloc(nMaps); // Array of inverted maps for output
-    inverted->n = nMaps;
 
     psTrace("stac.invertMaps", 1, "Inverting maps....\n");
@@ -50,8 +49,4 @@
         psVector *xOut = psVectorAlloc(NUM_GRID * NUM_GRID, PS_TYPE_F32);
         psVector *yOut = psVectorAlloc(NUM_GRID * NUM_GRID, PS_TYPE_F32);
-        xIn->n = NUM_GRID * NUM_GRID;
-        yIn->n = NUM_GRID * NUM_GRID;
-        xOut->n = NUM_GRID * NUM_GRID;
-        yOut->n = NUM_GRID * NUM_GRID;
 
         // Create grid of points
@@ -75,6 +70,4 @@
         psVector *xVector = psVectorAlloc(nCoeff, PS_TYPE_F64); // Vector for solution in x
         psVector *yVector = psVectorAlloc(nCoeff, PS_TYPE_F64); // Vector for solution in y
-        xVector->n = nCoeff;
-        yVector->n = nCoeff;
         for (int i = 0; i < nCoeff; i++) {
             for (int j = 0; j < nCoeff; j++) {
@@ -115,5 +108,4 @@
         // Solution via LU Decomposition
         psVector *permutation = psVectorAlloc(nCoeff, PS_TYPE_F64); // Permutation vector for LU Decomposition
-        permutation->n = nCoeff;
         psImage *luMatrix = psMatrixLUD(NULL, &permutation, matrix); // LU decomposed matrix
         psVector *xSolution = psMatrixLUSolve(NULL, luMatrix, xVector, permutation); // Solution in x
Index: /trunk/stac/src/stacRead.c
===================================================================
--- /trunk/stac/src/stacRead.c	(revision 9739)
+++ /trunk/stac/src/stacRead.c	(revision 9740)
@@ -17,9 +17,7 @@
     int nFiles = filenames->n;          // The number of input files
     psArray *images = psArrayAlloc(nFiles); // The input files, to be returned
-    images->n = nFiles;
     assert(!headers || ! *headers || (*headers)->n == nFiles);
     if (headers && ! *headers) {
         *headers = psArrayAlloc(nFiles);
-        (*headers)->n = nFiles;
     }
 
@@ -75,5 +73,5 @@
     psTrace("stac.read.coords", 5, "Reading coordinate file, %s\n", filename);
 
-    psArray *coords = psArrayAlloc(BUFFER); // The array of coordinates to be returned
+    psArray *coords = psArrayAllocEmpty(BUFFER); // The array of coordinates to be returned
     float x, y;                         // Coordinates to read
     while (fscanf(file, "%f %f\n", &x, &y) == 2) {
@@ -188,5 +186,4 @@
     int nFiles = filenames->n;          // The number of input files
     psArray *maps = psArrayAlloc(nFiles); // The maps, to be returned
-    maps->n = nFiles;
     char mapfile[MAXCHAR];              // Filename of map
 
Index: /trunk/stac/src/stacRejection.c
===================================================================
--- /trunk/stac/src/stacRejection.c	(revision 9739)
+++ /trunk/stac/src/stacRejection.c	(revision 9740)
@@ -17,6 +17,6 @@
 {
     int num = 0;
-    psVector *pixels = psVectorAlloc(8, PS_TYPE_F32); // Array of pixels
-    psVector *mask = psVectorAlloc(8, PS_TYPE_U8); // Corresponding mask
+    psVector *pixels = psVectorAllocEmpty(8, PS_TYPE_F32); // Array of pixels
+    psVector *mask = psVectorAllocEmpty(8, PS_TYPE_U8); // Corresponding mask
 
     // Get limits
@@ -81,10 +81,7 @@
     psVector *grads = psVectorAlloc(nImages, PS_TYPE_F32); // Gradient for each image
     psVector *gradsMask = psVectorAlloc(nImages, PS_TYPE_U8); // Mask for gradient vector
-    grads->n = nImages;
-    gradsMask->n = nImages;
 
     // Transform rejection masks back to source
     psArray *inputRej = psArrayAlloc(nImages);
-    inputRej->n = nImages;
     for (int i = 0; i < nImages; i++) {
         // Size of input image
Index: /trunk/stac/src/stacScales.c
===================================================================
--- /trunk/stac/src/stacScales.c	(revision 9739)
+++ /trunk/stac/src/stacScales.c	(revision 9740)
@@ -23,6 +23,4 @@
     psVector *values = psVectorAlloc(numSamples + 1, PS_TYPE_F32); // Vector containing sub-sample
     psVector *mask = psVectorAlloc(numSamples + 1, PS_TYPE_U8); // Mask for sample
-    values->n = numSamples + 1;
-    mask->n = numSamples + 1;
 
     int offset = 0;                     // Offset from start of the row
@@ -90,5 +88,4 @@
     } else {
         scales = psVectorAlloc(images->n, PS_TYPE_F32);
-        scales->n = images->n;
         *scalesPtr = scales;
     }
@@ -100,5 +97,4 @@
     } else {
         offsets = psVectorAlloc(images->n, PS_TYPE_F32);
-        offsets->n = images->n;
         *offsetsPtr = offsets;
     }
@@ -130,5 +126,4 @@
         // Transform the stellar positions to match the transformed reference frame
         psArray *starCoordsTransformed = psArrayAlloc(starCoords->n); // Transformed positions
-        starCoordsTransformed->n = starCoords->n;
         // Fix up difference between map and output frame
         starMap->x->coeff[0][0] -= xMapDiff;
@@ -141,6 +136,4 @@
         psArray *stars = psArrayAlloc(images->n); // Array of stellar photometry vectors
         psArray *masks = psArrayAlloc(images->n); // Array of masks for stars
-        stars->n = images->n;
-        masks->n = images->n;
 
         // Set scales relative to the first image
@@ -155,6 +148,4 @@
             psVector *photometry = psVectorAlloc(starCoords->n, PS_TYPE_F32); // Photometry of the stars
             psVector *mask = psVectorAlloc(starCoords->n, PS_TYPE_U8); // Mask for the photometry
-            photometry->n = starCoords->n;
-            mask->n = starCoords->n;
             for (int j = 0; j < starCoordsTransformed->n; j++) {
                 psPlane *coords = starCoordsTransformed->data[j]; // The coordinates of the star
Index: /trunk/stac/src/stacTransform.c
===================================================================
--- /trunk/stac/src/stacTransform.c	(revision 9739)
+++ /trunk/stac/src/stacTransform.c	(revision 9740)
@@ -131,5 +131,4 @@
     if (*outputs == NULL) {
         *outputs = psArrayAlloc(nImages);
-        (*outputs)->n = nImages;
         psTrace("stac.transform", 5, "Allocating space for transformed images, %dx%d\n", outnx, outny);
         for (int i = 0; i < nImages; i++) {
@@ -143,5 +142,4 @@
     if (errors && (*outErrors == NULL)) {
         *outErrors = psArrayAlloc(errors->n);
-        (*outErrors)->n = errors->n;
         psTrace("stac.transform", 5, "Allocating space for transformed error images, %dx%d\n", outnx, outny);
         for (int i = 0; i < nImages; i++) {
Index: /trunk/stac/src/sum.c
===================================================================
--- /trunk/stac/src/sum.c	(revision 9739)
+++ /trunk/stac/src/sum.c	(revision 9740)
@@ -14,5 +14,4 @@
     const char *outputName = argv[1];   // Output file name
     psArray *inputNames = psArrayAlloc(argc-2);
-    inputNames->n = argc - 2;
     for (int i = 2; i < argc; i++) {
         inputNames->data[i-2] = psStringCopy(argv[i]);
