IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 26305


Ignore:
Timestamp:
Dec 2, 2009, 3:49:31 AM (16 years ago)
Author:
Paul Price
Message:

Dump sources before generating fake image.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/pap/ppStack/src/ppStackMatch.c

    r26218 r26305  
    1818#define COVAR_FRAC 0.01                 // Truncation fraction for covariance matrix
    1919
    20 //#define TESTING                         // Enable debugging output
     20#define TESTING                         // Enable debugging output
    2121
    2222#ifdef TESTING
     
    6464    return;
    6565}
     66
     67#ifdef TESTING
     68static void dumpSources(const char *root, // Root name for source file
     69                        psArray *sources// Sources to dump
     70    )
     71{
     72    static int number = 0;              // Index of sources
     73    psString name = NULL;               // Output name
     74    psStringAppend(&name, "%s_%d.sources", root, number);
     75    FILE file = fopen(name, "w");       // File to write
     76    psFree(name);
     77    for (int i = 0; i < sources->n; i++) {
     78        pmSource *source = sources->data[i]; // Source of interest
     79        if (!source) {
     80            continue;
     81        }
     82        float x, y;                     // Coordinates of source
     83        coordsFromSource(&x, &y, source);
     84        float mag = source->psfMag;     // Magnitude of source
     85        fprintf(file, "%f %f %f\n", x, y, mag);
     86    }
     87    fclose(file);
     88    return;
     89}
     90#endif
     91
    6692
    6793static psArray *stackSourcesFilter(psArray *sources, // Source list to filter
     
    343369            psArray *stampSources = stackSourcesFilter(options->sourceLists->data[index],
    344370                                                       footprint); // Filtered list of sources
    345 
     371#ifdef TESTING
     372            dumpSources("fakeSources", stampSources);
     373#endif
    346374            if (!pmReadoutFakeFromSources(fake, readout->image->numCols, readout->image->numRows,
    347375                                          stampSources, SOURCE_MASK, NULL, NULL, options->psf,
     
    356384            fake->mask = psImageCopy(NULL, readout->mask, PS_TYPE_IMAGE_MASK);
    357385
     386#if 0
    358387            // Add the background into the target image
     388            // XXX Is this desirable?  There should be zero background on the input!
    359389            psImage *bgImage = stackBackgroundModel(readout, config); // Image of background
    360390            psBinaryOp(fake->image, fake->image, "+", bgImage);
    361391            psFree(bgImage);
     392#endif
    362393
    363394#ifdef TESTING
Note: See TracChangeset for help on using the changeset viewer.