IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 31, 2011, 4:37:24 PM (15 years ago)
Author:
bills
Message:

Removed psFitsTableGetCellF32 functions, just poke straight into the table.
Check that the column type for X_PSF and Y_PSF are PS_DATA_F32

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/magic/remove/src/streaksremove.c

    r32252 r32264  
    983983        // XXX: Handle case where numCols == 0 Can that happen?
    984984        // Previously we were writing a blank extension
    985         int xCol = psFitsTableGetColumnIndex(table, "X_PSF");
     985
     986        // For speed we get intimate with the table
     987        // avoid 2 * numRows lookups of the column number by looking
     988        // it up ahead of time and verifying that the type is what we
     989        // expect.
     990        int xCol = psFitsTableGetColumnNumber(table, "X_PSF");
    986991        assert(xCol >= 0 && xCol < table->numCols);
    987 
    988         int yCol = psFitsTableGetColumnIndex(table, "Y_PSF");
     992        assert(table->columns[xCol].type == PS_DATA_F32);
     993
     994        int yCol = psFitsTableGetColumnNumber(table, "Y_PSF");
    989995        assert(yCol >= 0 && yCol < table->numCols);
    990 
     996        assert(table->columns[yCol].type == PS_DATA_F32);
     997
     998        // We mark censored rows in this array.
    991999        bool *rowCensored = psAlloc(table->numRows * sizeof(bool));
     1000        memset(rowCensored, 0, table->numRows * sizeof(bool));
    9921001        int numCensored = 0;
    9931002
    9941003        for (int i = 0 ; i < table->numRows; i++) {
    995             psF32 x = psFitsTableGetCellF32(table, i, xCol);
    996             psF32 y = psFitsTableGetCellF32(table, i, yCol);
    997 
     1004
     1005#ifndef GO_SLOWER
     1006            psF32 x = table->columns[xCol].data.F32[i];
     1007            psF32 y = table->columns[yCol].data.F32[i];
     1008#else
     1009            psF32 x = psFitsTableGetF32(NULL, table, i, "X_PSF");
     1010            psF32 y = psFitsTableGetF32(NULL, table, i, "Y_PSF");
     1011#endif
    9981012            psImageMaskType mask;
    9991013            if ((x >= maskImage->numCols) || (y >= maskImage->numRows) || (x <  0) || (y < 0) || isnan(x) || isnan(y)) {
     
    10041018
    10051019            // Key the source if the center pixel is not masked with maskStreak
    1006             if (!(mask & maskStreak) ) {
    1007                 // psArraySet(outTable, j++, row);
    1008                 rowCensored[i] = false;
    1009             } else {
     1020            if (mask & maskStreak) {
    10101021                rowCensored[i] = true;
    10111022                numCensored++;
     
    10131024        }
    10141025
     1026        // remove the censored rows from the table
    10151027        if (!psFitsTableCensor(table, rowCensored)) {
    10161028            streaksExit("", PS_EXIT_PROG_ERROR);
Note: See TracChangeset for help on using the changeset viewer.