IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 9740 for trunk/stac/src


Ignore:
Timestamp:
Oct 24, 2006, 2:27:29 PM (20 years ago)
Author:
Paul Price
Message:

Changed definition of psVectorAlloc and psArrayAlloc

Location:
trunk/stac/src
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/stac/src/combine.c

    r8783 r9740  
    2929    // Make fake errors
    3030    psArray *errors = psArrayAlloc(images->n);
    31     errors->n = images->n;
    3231    for (int i = 0; i < images->n; i++) {
    3332        psImage *image = images->data[i];
     
    4948    psVector *saturated = psVectorAlloc(images->n, PS_TYPE_F32); // Saturation limits
    5049    psVector *bad = psVectorAlloc(images->n, PS_TYPE_F32); // Bad limits
    51     saturated->n = images->n;
    52     bad->n = images->n;
    5350    for (int i = 0; i < images->n; i++) {
    5451        saturated->data.F32[i] = (config->saturated - offsets->data.F32[i]) / scales->data.F32[i];
  • trunk/stac/src/combineConfig.c

    r8783 r9740  
    157157    config->outName = argv[0];          // Output filename
    158158    config->inNames = psArrayAlloc(argc-1); // Input filenames
    159     config->inNames->n = argc-1;
    160159    for (int i = 1; i < argc; i++) {
    161160        config->inNames->data[i-1] = psAlloc(strlen(argv[i]));
  • trunk/stac/src/shift.c

    r8783 r9740  
    130130    psArray *maps = psArrayAlloc(1);    // An array of one
    131131    psArray *masks = psArrayAlloc(1);   // An array of one
    132     images->n = maps->n = masks->n = 1;
    133132    images->data[0] = image;
    134133    maps->data[0] = map;
     
    139138        psVector *xSize = psVectorAlloc(1, PS_TYPE_S32); // A vector of one
    140139        psVector *ySize = psVectorAlloc(1, PS_TYPE_S32); // A vector of one
    141         xSize->n = 1;
    142         ySize->n = 1;
    143140        xSize->data.S32[0] = image->numCols;
    144141        ySize->data.S32[0] = image->numRows;
  • trunk/stac/src/shiftSize.c

    r8783 r9740  
    7777
    7878    psArray *inputs = psArrayAlloc(argc); // Input filenames
    79     inputs->n = argc;
    8079    for (int i = 0; i < argc; i++) {
    8180        inputs->data[i] = psAlloc(strlen(argv[i]));
     
    8786    psVector *xSize = psVectorAlloc(inputs->n, PS_TYPE_S32);
    8887    psVector *ySize = psVectorAlloc(inputs->n, PS_TYPE_S32);
    89     xSize->n = inputs->n;
    90     ySize->n = inputs->n;
    9188    for (int i = 0; i < inputs->n; i++) {
    9289        const char *filename = inputs->data[i]; // Name of FITS file
  • trunk/stac/src/stac.c

    r8783 r9740  
    4949    // Generate masks
    5050    psArray *masks = psArrayAlloc(inputs->n);
    51     masks->n = inputs->n;
    5251    for (int i = 0; i < inputs->n; i++) {
    5352        psImage *image = inputs->data[i]; // Image for which to get mask
     
    7473        psVector *xSize = psVectorAlloc(inputs->n, PS_TYPE_S32); // Sizes of images in x
    7574        psVector *ySize = psVectorAlloc(inputs->n, PS_TYPE_S32); // Sizes of images in y
    76         xSize->n = inputs->n;
    77         ySize->n = inputs->n;
    7875        for (int i = 0; i < inputs->n; i++) {
    7976            psImage *image = inputs->data[i]; // The i-th image
     
    169166    psVector *saturated = psVectorAlloc(transformed->n, PS_TYPE_F32); // Saturation limits
    170167    psVector *bad = psVectorAlloc(transformed->n, PS_TYPE_F32); // Bad limits
    171     saturated->n = transformed->n;
    172     bad->n = transformed->n;
    173168    float minSaturated = INFINITY;      // The minimum saturation level
    174169    float maxBad = -INFINITY;           // The maximum bad level
     
    240235    // Get regions of interest in the source frame
    241236    psArray *regions = psArrayAlloc(inputs->n); // Array of images denoting regions of interest
    242     regions->n = inputs->n;
    243237    for (int i = 0; i < inputs->n; i++) {
    244238        regions->data[i] = stacAreaOfInterest(rejected->data[i], inverseMaps->data[i],
  • trunk/stac/src/stacCombine.c

    r8783 r9740  
    107107    psVector *deltas = psVectorAlloc(nImages, PS_TYPE_F32); // Will hold the errors in the statistics step
    108108    psVector *mask = psVectorAlloc(nImages, PS_TYPE_U8); // Will hold the mask in the statistics step
    109     pixels->n = nImages;
    110     deltas->n = nImages;
    111     mask->n = nImages;
    112109
    113110    // Set up rejection masks
     
    116113            // Allocate the rejection masks, if required
    117114            *rejected = psArrayAlloc(nImages);
    118             (*rejected)->n = nImages;
    119115        } else {
    120116            assert((*rejected)->n != nImages);
  • trunk/stac/src/stacErrorImages.c

    r8783 r9740  
    1515    rn /= gain;                         // Read noise in ADU
    1616    psArray *errors = psArrayAlloc(inputs->n);
    17     errors->n = inputs->n;
    1817
    1918    psTrace("stac.errors", 1, "Calculating error images....\n");
  • trunk/stac/src/stacInvertMaps.c

    r8783 r9740  
    1818    int nMaps = maps->n;                // Number of maps
    1919    psArray *inverted = psArrayAlloc(nMaps); // Array of inverted maps for output
    20     inverted->n = nMaps;
    2120
    2221    psTrace("stac.invertMaps", 1, "Inverting maps....\n");
     
    5049        psVector *xOut = psVectorAlloc(NUM_GRID * NUM_GRID, PS_TYPE_F32);
    5150        psVector *yOut = psVectorAlloc(NUM_GRID * NUM_GRID, PS_TYPE_F32);
    52         xIn->n = NUM_GRID * NUM_GRID;
    53         yIn->n = NUM_GRID * NUM_GRID;
    54         xOut->n = NUM_GRID * NUM_GRID;
    55         yOut->n = NUM_GRID * NUM_GRID;
    5651
    5752        // Create grid of points
     
    7570        psVector *xVector = psVectorAlloc(nCoeff, PS_TYPE_F64); // Vector for solution in x
    7671        psVector *yVector = psVectorAlloc(nCoeff, PS_TYPE_F64); // Vector for solution in y
    77         xVector->n = nCoeff;
    78         yVector->n = nCoeff;
    7972        for (int i = 0; i < nCoeff; i++) {
    8073            for (int j = 0; j < nCoeff; j++) {
     
    115108        // Solution via LU Decomposition
    116109        psVector *permutation = psVectorAlloc(nCoeff, PS_TYPE_F64); // Permutation vector for LU Decomposition
    117         permutation->n = nCoeff;
    118110        psImage *luMatrix = psMatrixLUD(NULL, &permutation, matrix); // LU decomposed matrix
    119111        psVector *xSolution = psMatrixLUSolve(NULL, luMatrix, xVector, permutation); // Solution in x
  • trunk/stac/src/stacRead.c

    r8783 r9740  
    1717    int nFiles = filenames->n;          // The number of input files
    1818    psArray *images = psArrayAlloc(nFiles); // The input files, to be returned
    19     images->n = nFiles;
    2019    assert(!headers || ! *headers || (*headers)->n == nFiles);
    2120    if (headers && ! *headers) {
    2221        *headers = psArrayAlloc(nFiles);
    23         (*headers)->n = nFiles;
    2422    }
    2523
     
    7573    psTrace("stac.read.coords", 5, "Reading coordinate file, %s\n", filename);
    7674
    77     psArray *coords = psArrayAlloc(BUFFER); // The array of coordinates to be returned
     75    psArray *coords = psArrayAllocEmpty(BUFFER); // The array of coordinates to be returned
    7876    float x, y;                         // Coordinates to read
    7977    while (fscanf(file, "%f %f\n", &x, &y) == 2) {
     
    188186    int nFiles = filenames->n;          // The number of input files
    189187    psArray *maps = psArrayAlloc(nFiles); // The maps, to be returned
    190     maps->n = nFiles;
    191188    char mapfile[MAXCHAR];              // Filename of map
    192189
  • trunk/stac/src/stacRejection.c

    r8783 r9740  
    1717{
    1818    int num = 0;
    19     psVector *pixels = psVectorAlloc(8, PS_TYPE_F32); // Array of pixels
    20     psVector *mask = psVectorAlloc(8, PS_TYPE_U8); // Corresponding mask
     19    psVector *pixels = psVectorAllocEmpty(8, PS_TYPE_F32); // Array of pixels
     20    psVector *mask = psVectorAllocEmpty(8, PS_TYPE_U8); // Corresponding mask
    2121
    2222    // Get limits
     
    8181    psVector *grads = psVectorAlloc(nImages, PS_TYPE_F32); // Gradient for each image
    8282    psVector *gradsMask = psVectorAlloc(nImages, PS_TYPE_U8); // Mask for gradient vector
    83     grads->n = nImages;
    84     gradsMask->n = nImages;
    8583
    8684    // Transform rejection masks back to source
    8785    psArray *inputRej = psArrayAlloc(nImages);
    88     inputRej->n = nImages;
    8986    for (int i = 0; i < nImages; i++) {
    9087        // Size of input image
  • trunk/stac/src/stacScales.c

    r8783 r9740  
    2323    psVector *values = psVectorAlloc(numSamples + 1, PS_TYPE_F32); // Vector containing sub-sample
    2424    psVector *mask = psVectorAlloc(numSamples + 1, PS_TYPE_U8); // Mask for sample
    25     values->n = numSamples + 1;
    26     mask->n = numSamples + 1;
    2725
    2826    int offset = 0;                     // Offset from start of the row
     
    9088    } else {
    9189        scales = psVectorAlloc(images->n, PS_TYPE_F32);
    92         scales->n = images->n;
    9390        *scalesPtr = scales;
    9491    }
     
    10097    } else {
    10198        offsets = psVectorAlloc(images->n, PS_TYPE_F32);
    102         offsets->n = images->n;
    10399        *offsetsPtr = offsets;
    104100    }
     
    130126        // Transform the stellar positions to match the transformed reference frame
    131127        psArray *starCoordsTransformed = psArrayAlloc(starCoords->n); // Transformed positions
    132         starCoordsTransformed->n = starCoords->n;
    133128        // Fix up difference between map and output frame
    134129        starMap->x->coeff[0][0] -= xMapDiff;
     
    141136        psArray *stars = psArrayAlloc(images->n); // Array of stellar photometry vectors
    142137        psArray *masks = psArrayAlloc(images->n); // Array of masks for stars
    143         stars->n = images->n;
    144         masks->n = images->n;
    145138
    146139        // Set scales relative to the first image
     
    155148            psVector *photometry = psVectorAlloc(starCoords->n, PS_TYPE_F32); // Photometry of the stars
    156149            psVector *mask = psVectorAlloc(starCoords->n, PS_TYPE_U8); // Mask for the photometry
    157             photometry->n = starCoords->n;
    158             mask->n = starCoords->n;
    159150            for (int j = 0; j < starCoordsTransformed->n; j++) {
    160151                psPlane *coords = starCoordsTransformed->data[j]; // The coordinates of the star
  • trunk/stac/src/stacTransform.c

    r8783 r9740  
    131131    if (*outputs == NULL) {
    132132        *outputs = psArrayAlloc(nImages);
    133         (*outputs)->n = nImages;
    134133        psTrace("stac.transform", 5, "Allocating space for transformed images, %dx%d\n", outnx, outny);
    135134        for (int i = 0; i < nImages; i++) {
     
    143142    if (errors && (*outErrors == NULL)) {
    144143        *outErrors = psArrayAlloc(errors->n);
    145         (*outErrors)->n = errors->n;
    146144        psTrace("stac.transform", 5, "Allocating space for transformed error images, %dx%d\n", outnx, outny);
    147145        for (int i = 0; i < nImages; i++) {
  • trunk/stac/src/sum.c

    r8783 r9740  
    1414    const char *outputName = argv[1];   // Output file name
    1515    psArray *inputNames = psArrayAlloc(argc-2);
    16     inputNames->n = argc - 2;
    1716    for (int i = 2; i < argc; i++) {
    1817        inputNames->data[i-2] = psStringCopy(argv[i]);
Note: See TracChangeset for help on using the changeset viewer.