IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 28, 2007, 5:20:02 PM (19 years ago)
Author:
eugene
Message:

adding source plots

File:
1 edited

Legend:

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

    r12627 r12665  
    33bool psphotSourcePlots (pmReadout *readout, psArray *sources, psMetadata *recipe) {
    44
    5     bool status = false;
     5    // bool status = false;
    66    psTimerStart ("psphot");
    77
    88    // the source images are written to an image 10x the size of a PSF object
    9     float OUTER = psMetadataLookupF32 (&status, recipe, "SKY_OUTER_RADIUS");
    10     PS_ASSERT (status);
     9    // float OUTER = psMetadataLookupF32 (&status, recipe, "SKY_OUTER_RADIUS");
     10    // PS_ASSERT (status, false);
     11
     12    int DX = 21;
     13    int DY = 21;
    1114
    1215    // examine PSF sources in S/N order (brightest first)
     
    1619    int dX = 0;                         // starting corner of next box
    1720    int dY = 0;                         // height of row so far
    18     int NX = 10*(2*OUTER+1);            // full width of output image
     21    int NX = 20*DX;                     // full width of output image
    1922    int NY = 0;                         // total height of output image
    2023
    2124    // first, examine the PSF and SAT stars:
    22     // - generate radial plots (PS plots)
    2325    // - determine bounding boxes for summary image
    2426    for (int i = 0; i < sources->n; i++) {
     
    3234
    3335        // how does this subimage get placed into the output image?
    34         if (dX + source->pixels->numCols >= NX) {
     36        // DX = source->pixels->numCols
     37        // DY = source->pixels->numRows
     38
     39        if (dX + DX > NX) {
    3540            // too wide for the rest of this row
    3641            if (dX == 0) {
    3742                // alone on this row
    38                 NY += source->pixels->numRows;
     43                NY += DY;
    3944                dX = 0;
    4045                dY = 0;
     
    4247                // start the next row
    4348                NY += dY;
    44                 dX = source->pixels->numCols;
    45                 dY = source->pixels->numRows;
     49                dX = DX;
     50                dY = DY;
    4651            }
    4752        } else {
    4853            // extend this row
    49             dX += source->pixels->numCols;
    50             dY = PS_MAX (dY, source->pixels->numRows);
     54            dX += DX;
     55            dY = PS_MAX (dY, DY);
    5156        }
    52         psphotRadialPlot ("radial.plots.ps", source);
    5357    }
    5458
     
    5963    int Xo = 0;                         // starting corner of next box
    6064    int Yo = 0;                         // starting corner of next box
    61     int dY = 0;                         // height of row so far
     65    dY = 0;                             // height of row so far
     66
     67    int nPSF = 0;
     68    int nSAT = 0;
     69    int kapa = 0;                       // file descriptor for plotting routine
    6270
    6371    // first, examine the PSF and SAT stars:
    6472    // - generate radial plots (PS plots)
    65     // - determine bounding boxes for summary image
     73    // - create output image array
    6674    for (int i = 0; i < sources->n; i++) {
    6775
     
    6977
    7078        bool keep = false;
    71         keep |= (source->mode & PM_SOURCE_MODE_PSFSTAR);
    72         keep |= (source->mode & PM_SOURCE_MODE_SATSTAR);
     79        if (source->mode & PM_SOURCE_MODE_PSFSTAR) {
     80            nPSF ++;
     81            keep = true;
     82        }
     83        if (source->mode & PM_SOURCE_MODE_SATSTAR) {
     84            nSAT ++;
     85            keep = true;
     86        }           
    7387        if (!keep) continue;
    7488
    7589        // how does this subimage get placed into the output image?
    76         if (Xo + source->pixels->numCols >= NX) {
     90        // DX = source->pixels->numCols
     91        // DY = source->pixels->numRows
     92
     93        if (Xo + DX > NX) {
    7794            // too wide for the rest of this row
    7895            if (Xo == 0) {
    79                 // alone on this row
    80                 PlaceImage (source, Xo, Yo);
    81                 Yo += source->pixels->numRows;
     96                // place source alone on this row
     97                psphotAddWithTest (source, true); // replace source if subtracted
     98                psphotRadialPlot (&kapa, "radial.plots.ps", source);
     99                psphotMosaicSubimage (outpos, source, Xo, Yo, DX, DY);
     100
     101                psphotSubWithTest (source, false); // remove source (force)
     102                psphotMosaicSubimage (outsub, source, Xo, Yo, DX, DY);
     103
     104                psphotSetState (source, false); // replace source (has been subtracted)
     105                Yo += DY;
    82106                Xo = 0;
    83107                dY = 0;
     
    86110                Yo += dY;
    87111                Xo = 0;
    88                 PlaceImage (source, Xo, Yo);
    89                 Xo = source->pixels->numCols;
    90                 dY = source->pixels->numRows;
     112                psphotAddWithTest (source, true); // replace source if subtracted
     113                psphotRadialPlot (&kapa, "radial.plots.ps", source);
     114                psphotMosaicSubimage (outpos, source, Xo, Yo, DX, DY);
     115
     116                psphotSubWithTest (source, false); // remove source (force)
     117                psphotMosaicSubimage (outsub, source, Xo, Yo, DX, DY);
     118                psphotSetState (source, false); // replace source (has been subtracted)
     119
     120                Xo = DX;
     121                dY = DY;
    91122            }
    92123        } else {
    93124            // extend this row
    94             PlaceImage (source, Xo, Yo);
    95             Xo += source->pixels->numCols;
    96             dY = PS_MAX (dY, source->pixels->numRows);
     125            psphotAddWithTest (source, true); // replace source if subtracted
     126            psphotRadialPlot (&kapa, "radial.plots.ps", source);
     127            psphotMosaicSubimage (outpos, source, Xo, Yo, DX, DY);
     128
     129            psphotSubWithTest (source, false); // remove source (force)
     130            psphotMosaicSubimage (outsub, source, Xo, Yo, DX, DY);
     131            psphotSetState (source, false); // replace source (has been subtracted)
     132
     133            Xo += DX;
     134            dY = PS_MAX (dY, DY);
    97135        }
    98136    }
    99137
    100     psLogMsg ("psphot", PS_LOG_INFO, "%ld sources, %d moments, %d failed: %f sec\n", sources->n, Nmoments, Nfail, psTimerMark ("psphot"));
     138    psphotSaveImage (NULL, outpos, "outpos.fits");
     139    psphotSaveImage (NULL, outsub, "outsub.fits");
     140    psLogMsg ("psphot", PS_LOG_INFO, "plotted %d sources (%d psf, %d sat): %f sec\n", nPSF + nSAT, nPSF, nSAT, psTimerMark ("psphot"));
     141
     142    psFree (outpos);
     143    psFree (outsub);
    101144    return (sources);
    102145}
Note: See TracChangeset for help on using the changeset viewer.