IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 7328


Ignore:
Timestamp:
Jun 2, 2006, 6:06:01 PM (20 years ago)
Author:
eugene
Message:

added psphotDumpSource

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psphot/src/psphotOutput.c

    r6862 r7328  
    2020
    2121    pmMomentsWriteText (sources, output);
     22    return true;
     23}
     24
     25bool psphotDumpSource (pmSource *source, char *name) {
     26
     27    FILE *f = fopen (name, "w");
     28    if (f == NULL) psAbort ("psphot", "can't open file");
     29
     30    for (int i = 0; i < source->pixels->numRows; i++) {
     31        for (int j = 0; j < source->pixels->numCols; j++) {
     32            // skip masked points
     33            if (source->mask->data.U8[i][j]) {
     34                continue;
     35            }
     36            // skip zero-weight points
     37            if (source->weight->data.F32[i][j] == 0) {
     38                continue;
     39            }
     40
     41            fprintf (f, "%d %d %f %f %d\n",
     42                     (j + source->pixels->col0),
     43                     (i + source->pixels->row0),
     44                     source->pixels->data.F32[i][j],
     45                     1.0 / source->weight->data.F32[i][j],
     46                     source->mask->data.U8[i][j]);
     47        }
     48    }
     49    fclose (f);
    2250    return true;
    2351}
Note: See TracChangeset for help on using the changeset viewer.