IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 3, 2006, 3:01:34 PM (20 years ago)
Author:
drobbin
Message:

Updated files to reflect psArray, psVector, & psPixels changes in psLib that set n=0 upon allocation.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/objects/pmObjects.c

    r6329 r6511  
    66 *  @author EAM, IfA: significant modifications.
    77 *
    8  *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2006-02-06 22:17:54 $
     8 *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2006-03-04 01:01:33 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    9696
    9797    psVector *tmpVector = psVectorAlloc(image->numCols, PS_TYPE_F32);
     98    tmpVector->n = tmpVector->nalloc;
    9899    for (psU32 col = 0; col < image->numCols ; col++) {
    99100        tmpVector->data.F32[col] = image->data.F32[row][col];
     
    282283    tmp->params  = psVectorAlloc(Nparams, PS_TYPE_F32);
    283284    tmp->dparams = psVectorAlloc(Nparams, PS_TYPE_F32);
     285    tmp->params->n = tmp->params->nalloc;
     286    tmp->dparams->n = tmp->dparams->nalloc;
    284287
    285288    for (psS32 i = 0; i < tmp->params->n; i++) {
     
    348351        if (vector->data.F32[0] > threshold) {
    349352            tmpVector = psVectorAlloc(1, PS_TYPE_U32);
     353            tmpVector->n = 1;
    350354            tmpVector->data.U32[0] = 0;
    351355        } else {
     
    388392    //
    389393    psVector *tmpVector = psVectorAlloc(count, PS_TYPE_U32);
     394    tmpVector->n = tmpVector->nalloc;
    390395    count = 0;
    391396
     
    14281433    //
    14291434    psVector *x = psVectorAlloc(2, PS_TYPE_F32);
     1435    x->n = x->nalloc;
    14301436    x->data.F32[0] = (psF32) (col + image->col0);
    14311437    x->data.F32[1] = (psF32) (row + image->row0);
     
    14721478    psVector *xVec = psVectorAlloc(2 * source->pixels->numRows, PS_TYPE_F32);
    14731479    psVector *yVec = psVectorAlloc(2 * source->pixels->numRows, PS_TYPE_F32);
    1474 
     1480    xVec->n = xVec->nalloc;
     1481    yVec->n = yVec->nalloc;
    14751482    //
    14761483    // Start at the row with peak pixel, then decrement.
     
    15521559    //
    15531560    psArray *tmpArray = psArrayAlloc(2);
     1561    tmpArray->n = 2;
    15541562    tmpArray->data[0] = (psPtr *) yVec;
    15551563    tmpArray->data[1] = (psPtr *) xVec;
     
    16161624    psVector *y = psVectorAlloc(count, PS_TYPE_F32);
    16171625    psVector *yErr = psVectorAlloc(count, PS_TYPE_F32);
     1626    x->n = x->nalloc;
     1627    y->n = y->nalloc;
     1628    yErr->n = yErr->nalloc;
    16181629    psS32 tmpCnt = 0;
    16191630    for (psS32 i = 0; i < source->pixels->numRows; i++) {
     
    16211632            if (source->mask->data.U8[i][j] == 0) {
    16221633                psVector *coord = psVectorAlloc(2, PS_TYPE_F32);
     1634                coord->n = 2;
    16231635                // XXX: Convert i/j to image space:
    16241636                // XXX EAM: coord order is (x,y) == (col,row)
     
    16411653    if (PSF) {
    16421654        paramMask = psVectorAlloc (params->n, PS_TYPE_U8);
     1655        paramMask->n = paramMask->nalloc;
    16431656        for (int i = 0; i < 4; i++) {
    16441657            paramMask->data.U8[i] = 0;
     
    16731686    if (paramMask != NULL) {
    16741687        psVector *delta = psVectorAlloc (params->n, PS_TYPE_F64);
     1688        delta->n = delta->nalloc;
    16751689        psMinimizeGaussNewtonDelta (delta, params, NULL, x, y, yErr, modelFunc);
    16761690        for (int i = 0; i < dparams->n; i++) {
     
    17631777    psVector *y = psVectorAlloc(count, PS_TYPE_F32);
    17641778    psVector *yErr = psVectorAlloc(count, PS_TYPE_F32);
     1779    x->n = x->nalloc;
     1780    y->n = y->nalloc;
     1781    yErr->n = yErr->nalloc;
    17651782    psS32 tmpCnt = 0;
    17661783    for (psS32 i = 0; i < source->pixels->numRows; i++) {
     
    17681785            if (source->mask->data.U8[i][j] == 0) {
    17691786                psVector *coord = psVectorAlloc(2, PS_TYPE_F32);
     1787                coord->n = 2;
    17701788                // XXX: Convert i/j to image space:
    17711789                // XXX EAM: coord order is (x,y) == (col,row)
     
    17791797
    17801798                // this test enhances the weight based on deviation from the model flux
    1781                 Ro = 1.0 + fabs (y->data.F32[tmpCnt] - ymodel) / sqrt(PS_SQR(ymodel - So) + PS_SQR(So));
     1799                Ro = 1.0 + fabs (y->data.F32[tmpCnt] - ymodel) / sqrt(PS_SQR(ymodel - So)
     1800                        + PS_SQR(So));
    17821801
    17831802                // psMinimizeLMChi2_EAM takes wt = 1/dY^2
     
    17981817    if (PSF) {
    17991818        paramMask = psVectorAlloc (params->n, PS_TYPE_U8);
     1819        paramMask->n = paramMask->nalloc;
    18001820        for (int i = 0; i < 4; i++) {
    18011821            paramMask->data.U8[i] = 0;
     
    18461866    if (paramMask != NULL) {
    18471867        psVector *delta = psVectorAlloc (params->n, PS_TYPE_F64);
     1868        delta->n = delta->nalloc;
    18481869        psMinimizeGaussNewtonDelta(delta, params, NULL, x, y, yErr, modelFunc);
    18491870        for (int i = 0; i < dparams->n; i++) {
     
    18971918
    18981919    psVector *x = psVectorAlloc(2, PS_TYPE_F32);
     1920    x->n = 2;
    18991921    psVector *params = model->params;
    19001922    pmModelFunc modelFunc = pmModelFunc_GetFunction (model->type);
Note: See TracChangeset for help on using the changeset viewer.