IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 24, 2006, 12:55:05 PM (20 years ago)
Author:
Paul Price
Message:

Following today's meeting, we agreed that psVectorAlloc (and therefore
psArrayAlloc also) shall set the number of elements in use to equal the
number of elements allocated. We introduce new functions,
psVectorAllocEmpty and psArrayAllocEmpty, that allocate a vector and set
the length to zero.

Location:
trunk/psModules/src/detrend
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/detrend/pmFlatNormalize.c

    r9614 r9730  
    3232        } else {
    3333            *expFluxesPtr = psVectorAlloc(numExps, PS_TYPE_F32);
    34             (*expFluxesPtr)->n = numExps;
    3534        }
    3635        expFluxes = psMemIncrRefCounter(*expFluxesPtr);
    3736    } else {
    3837        expFluxes = psVectorAlloc(numExps, PS_TYPE_F32);
    39         expFluxes->n = numExps;
    4038    }
    4139
     
    4745        } else {
    4846            *chipGainsPtr = psVectorAlloc(numChips, PS_TYPE_F32);
    49             (*chipGainsPtr)->n = numChips;
    5047            psVectorInit(*chipGainsPtr, 1.0);
    5148        }
     
    5350    } else {
    5451        chipGains = psVectorAlloc(numChips, PS_TYPE_F32);
    55         chipGains->n = numChips;
    5652        psVectorInit(chipGains, 1.0);
    5753    }
     
    6258    psImageInit(fluxMask, 0);
    6359    psVector *gainMask = psVectorAlloc(numChips, PS_TYPE_U8); // Mask for bad gains
    64     gainMask->n = numChips;
    6560    psVectorInit(gainMask, 0);
    6661    psVector *expMask = psVectorAlloc(numExps, PS_TYPE_U8); // Mask for bad exposures
    67     expMask->n = numExps;
    6862    psVectorInit(expMask, 0);
    6963    for (int i = 0; i < numChips; i++) {
  • trunk/psModules/src/detrend/pmFringeStats.c

    r9615 r9730  
    133133
    134134    psArray *table = psArrayAlloc(numRows); // The table
    135     table->n = numRows;
    136135    // Translate the vectors into the required format for psFitsWriteTable()
    137136    for (long i = 0; i < numRows; i++) {
     
    205204    psVector *y = psVectorAlloc(numRows, PS_TYPE_F32); // y position
    206205    psVector *mask = psVectorAlloc(numRows, PS_TYPE_U8); // mask
    207     x->n = y->n = mask->n = numRows;
    208206    regions->x = x;
    209207    regions->y = y;
     
    253251    stats->f = psVectorAlloc(numRegions, PS_TYPE_F32);
    254252    stats->df = psVectorAlloc(numRegions, PS_TYPE_F32);
    255     stats->f->n = stats->df->n = numRegions;
    256253
    257254    return stats;
     
    365362    // Vectors: f, df
    366363    psArray *table = psArrayAlloc(numRows); // The table
    367     table->n = numRows;
    368364    // Translate the vectors into the required format for psFitsWriteTable()
    369365    for (long i = 0; i < numRows; i++) {
     
    527523    scale->coeff = psVectorAlloc(nFringeFrames + 1, PS_TYPE_F32);
    528524    scale->coeffErr = psVectorAlloc(nFringeFrames + 1, PS_TYPE_F32);
    529     scale->coeff->n = nFringeFrames + 1;
    530     scale->coeff->n = nFringeFrames + 1;
    531525
    532526    return scale;
     
    551545    psImage *A = psImageAlloc(numCoeffs, numCoeffs, PS_TYPE_F64); // The least-squares matrix
    552546    psVector *B = psVectorAlloc(numCoeffs, PS_TYPE_F64); // The least-squares vector
    553     B->n = numCoeffs;
    554547
    555548    // Generate the least-squares matrix and vector
     
    718711    if (!regions->mask) {
    719712        regions->mask = psVectorAlloc(numRegions, PS_TYPE_U8);
    720         regions->mask->n = numRegions;
    721713        psVectorInit(regions->mask, 0);
    722714    }
     
    725717    unsigned int numClipped = 0;        // Total number clipped
    726718    psVector *diff = psVectorAlloc(numRegions, PS_TYPE_F32); // The differences between obs. and pred.
    727     diff->n = numRegions;
    728719
    729720    pmFringeScale *scale = pmFringeScaleAlloc(fringes->n); // The fringe scales
  • trunk/psModules/src/detrend/pmShutterCorrection.c

    r9618 r9730  
    104104    psVector *tmpX = psVectorAlloc(2, PS_TYPE_F32);
    105105    psVector *tmpY = psVectorAlloc(2, PS_TYPE_F32);
    106     tmpX->n = tmpY->n = 2;
    107106
    108107    long index;
     
    210209    psVector *x = psVectorAlloc(exptime->n, PS_TYPE_F32);
    211210    psVector *y = psVectorAlloc(exptime->n, PS_TYPE_F32);
    212     x->n = y->n = exptime->n;
    213211
    214212    for (long i = 0; i < exptime->n; i++) {
     
    301299    params->data.F32[1] = guess->offset;
    302300    params->data.F32[2] = guess->offref;
    303     params->n = 3;
    304301
    305302    // XXX for the moment, don't set any constraints
     
    317314    // construct the coordinate and value entries (y is counts)
    318315    psArray *x = psArrayAlloc(exptime->n); // Coordinates
    319     x->n = exptime->n;
    320316
    321317    for (long i = 0; i < exptime->n; i++) {
    322318        psVector *coord = psVectorAlloc(1, PS_TYPE_F32);
    323         coord->n = 1;
    324319        coord->data.F32[0] = exptime->data.F32[i];
    325320        x->data[i] = coord;
     
    371366    psRegion refRegion;                 // Reference region
    372367    psVector *refs = psVectorAlloc(num, PS_TYPE_F32); // Reference measurements
    373     refs->n = num;
    374368    psVectorInit(refs, 0);
    375369    psArray *regions = psArrayAlloc(MEASURE_SAMPLES); // Array of sample regions, made on each image
    376     regions->n = MEASURE_SAMPLES;
    377370    psImage *samplesMean = psImageAlloc(num, MEASURE_SAMPLES, PS_TYPE_F32); // Measurements for each file
    378371    psImage *samplesStdev = psImageAlloc(num, MEASURE_SAMPLES, PS_TYPE_F32); // Errors for each file
     
    505498    psImage *pattern = psImageAlloc(numCols, numRows, PS_TYPE_F32); // Illumination pattern
    506499    psVector *mask = psVectorAlloc(num, PS_TYPE_U8); // Mask for each image
    507     mask->n = num;
    508500    psVectorInit(mask, 0);
    509501    psTrace("psModules.detrend", 2, "Performing linear fit on individual pixels...\n");
  • trunk/psModules/src/detrend/pmSubtractBias.c

    r9619 r9730  
    129129    psVector *ordinate = psVectorAlloc(pixels->n, PS_TYPE_F32); // Ordinate
    130130    psVector *mask = psVectorAlloc(pixels->n, PS_TYPE_U8); // Mask for fitting
    131     reduced->n = ordinate->n = mask->n = pixels->n;
    132131
    133132    for (int i = 0; i < pixels->n; i++) {
     
    268267                // The read direction is rows
    269268                psArray *pixels = psArrayAlloc(image->numRows); // Array of vectors containing pixels
    270                 pixels->n = image->numRows;
    271269                for (int i = 0; i < pixels->n; i++) {
    272270                    psVector *values = psVectorAlloc(0, PS_TYPE_F32);
     
    312310                // The read direction is columns
    313311                psArray *pixels = psArrayAlloc(image->numCols); // Array of vectors containing pixels
    314                 pixels->n = image->numCols;
    315312                for (int i = 0; i < pixels->n; i++) {
    316313                    psVector *values = psVectorAlloc(0, PS_TYPE_F32);
  • trunk/psModules/src/detrend/pmSubtractSky.c

    r9541 r9730  
    66 *  @author GLG, MHPCC
    77 *
    8  *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2006-10-13 22:11:02 $
     8 *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2006-10-24 22:55:05 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    345345    psImage *Aout = psImageAlloc(localPolyTerms, localPolyTerms, PS_TYPE_F64);
    346346    psVector *B = psVectorAlloc(localPolyTerms, PS_TYPE_F64);
    347     B->n = B->nalloc;
    348347    psVector *outPerm = NULL;
    349348
     
    412411    PS_ASSERT_IMAGE_NON_EMPTY(Aout, NULL);
    413412    psVector *C = psVectorAlloc(localPolyTerms, PS_TYPE_F64);
    414     C->n = C->nalloc;
    415413    psMatrixLUSolve(C, Aout, B, outPerm);
    416414
Note: See TracChangeset for help on using the changeset viewer.