IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 19, 2007, 4:40:44 PM (19 years ago)
Author:
Paul Price
Message:

Extensive changes to APIs to allow use of a nominated value to mask
against (the maskVal). Previously, the mask values were either
hard-coded (e.g., PM_MASK_SAT) or taken as anything non-zero. The
code is tested with psModules (which has similar changes) and does not
crash, but neither is it successful in marking all bad pixels. For
this reason, I have left the "gutter" pixels (cell gaps) set to 0
instead of NAN in pmFPAMosaic.

File:
1 edited

Legend:

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

    r13006 r13900  
    11# include "psphotInternal.h"
    22
    3 bool psphotSourcePlots (pmReadout *readout, psArray *sources, psMetadata *recipe) {
     3bool psphotSourcePlots (pmReadout *readout, psArray *sources, psMetadata *recipe, psMaskType maskVal) {
    44
    55    // bool status = false;
     
    1717
    1818    // counters to track the size of the image and area used in a row
    19     int dX = 0;                         // starting corner of next box
    20     int dY = 0;                         // height of row so far
    21     int NX = 20*DX;                     // full width of output image
    22     int NY = 0;                         // total height of output image
     19    int dX = 0;                         // starting corner of next box
     20    int dY = 0;                         // height of row so far
     21    int NX = 20*DX;                     // full width of output image
     22    int NY = 0;                         // total height of output image
    2323
    2424    // first, examine the PSF and SAT stars:
     
    2828        pmSource *source = sources->data[i];
    2929
    30         bool keep = false;
     30        bool keep = false;
    3131        keep |= (source->mode & PM_SOURCE_MODE_PSFSTAR);
    3232        keep |= (source->mode & PM_SOURCE_MODE_SATSTAR);
    33         if (!keep) continue;
     33        if (!keep) continue;
    3434
    35         // how does this subimage get placed into the output image?
    36         // DX = source->pixels->numCols
    37         // DY = source->pixels->numRows
     35        // how does this subimage get placed into the output image?
     36        // DX = source->pixels->numCols
     37        // DY = source->pixels->numRows
    3838
    39         if (dX + DX > NX) {
    40             // too wide for the rest of this row
    41             if (dX == 0) {
    42                 // alone on this row
    43                 NY += DY;
    44                 dX = 0;
    45                 dY = 0;
    46             } else {
    47                 // start the next row
    48                 NY += dY;
    49                 dX = DX;
    50                 dY = DY;
    51             }
    52         } else {
    53             // extend this row
    54             dX += DX;
    55             dY = PS_MAX (dY, DY);
    56         }
     39        if (dX + DX > NX) {
     40            // too wide for the rest of this row
     41            if (dX == 0) {
     42                // alone on this row
     43                NY += DY;
     44                dX = 0;
     45                dY = 0;
     46            } else {
     47                // start the next row
     48                NY += dY;
     49                dX = DX;
     50                dY = DY;
     51            }
     52        } else {
     53            // extend this row
     54            dX += DX;
     55            dY = PS_MAX (dY, DY);
     56        }
    5757    }
    5858
     
    6161    psImage *outsub = psImageAlloc (NX, NY, PS_TYPE_F32);
    6262
    63     int Xo = 0;                         // starting corner of next box
    64     int Yo = 0;                         // starting corner of next box
    65     dY = 0;                             // height of row so far
     63    int Xo = 0;                         // starting corner of next box
     64    int Yo = 0;                         // starting corner of next box
     65    dY = 0;                             // height of row so far
    6666
    6767    int nPSF = 0;
    6868    int nSAT = 0;
    69     int kapa = 0;                       // file descriptor for plotting routine
     69    int kapa = 0;                       // file descriptor for plotting routine
    7070
    7171    // first, examine the PSF and SAT stars:
     
    7676        pmSource *source = sources->data[i];
    7777
    78         bool keep = false;
     78        bool keep = false;
    7979        if (source->mode & PM_SOURCE_MODE_PSFSTAR) {
    80             nPSF ++;
    81             keep = true;
    82         }
     80            nPSF ++;
     81            keep = true;
     82        }
    8383        if (source->mode & PM_SOURCE_MODE_SATSTAR) {
    84             nSAT ++;
    85             keep = true;
    86         }           
    87         if (!keep) continue;
     84            nSAT ++;
     85            keep = true;
     86        }
     87        if (!keep) continue;
    8888
    89         // how does this subimage get placed into the output image?
    90         // DX = source->pixels->numCols
    91         // DY = source->pixels->numRows
     89        // how does this subimage get placed into the output image?
     90        // DX = source->pixels->numCols
     91        // DY = source->pixels->numRows
    9292
    93         if (Xo + DX > NX) {
    94             // too wide for the rest of this row
    95             if (Xo == 0) {
    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);
     93        if (Xo + DX > NX) {
     94            // too wide for the rest of this row
     95            if (Xo == 0) {
     96                // place source alone on this row
     97                psphotAddWithTest (source, true, maskVal); // replace source if subtracted
     98                psphotRadialPlot (&kapa, "radial.plots.ps", source);
     99                psphotMosaicSubimage (outpos, source, Xo, Yo, DX, DY);
    100100
    101                 psphotSubWithTest (source, false); // remove source (force)
    102                 psphotMosaicSubimage (outsub, source, Xo, Yo, DX, DY);
     101                psphotSubWithTest (source, false, maskVal); // remove source (force)
     102                psphotMosaicSubimage (outsub, source, Xo, Yo, DX, DY);
    103103
    104                 psphotSetState (source, false); // replace source (has been subtracted)
    105                 Yo += DY;
    106                 Xo = 0;
    107                 dY = 0;
    108             } else {
    109                 // start the next row
    110                 Yo += dY;
    111                 Xo = 0;
    112                 psphotAddWithTest (source, true); // replace source if subtracted
    113                 psphotRadialPlot (&kapa, "radial.plots.ps", source);
    114                 psphotMosaicSubimage (outpos, source, Xo, Yo, DX, DY);
     104                psphotSetState (source, false, maskVal); // replace source (has been subtracted)
     105                Yo += DY;
     106                Xo = 0;
     107                dY = 0;
     108            } else {
     109                // start the next row
     110                Yo += dY;
     111                Xo = 0;
     112                psphotAddWithTest (source, true, maskVal); // replace source if subtracted
     113                psphotRadialPlot (&kapa, "radial.plots.ps", source);
     114                psphotMosaicSubimage (outpos, source, Xo, Yo, DX, DY);
    115115
    116                 psphotSubWithTest (source, false); // remove source (force)
    117                 psphotMosaicSubimage (outsub, source, Xo, Yo, DX, DY);
    118                 psphotSetState (source, false); // replace source (has been subtracted)
     116                psphotSubWithTest (source, false, maskVal); // remove source (force)
     117                psphotMosaicSubimage (outsub, source, Xo, Yo, DX, DY);
     118                psphotSetState (source, false, maskVal); // replace source (has been subtracted)
    119119
    120                 Xo = DX;
    121                 dY = DY;
    122             }
    123         } else {
    124             // extend this row
    125             psphotAddWithTest (source, true); // replace source if subtracted
    126             psphotRadialPlot (&kapa, "radial.plots.ps", source);
    127             psphotMosaicSubimage (outpos, source, Xo, Yo, DX, DY);
     120                Xo = DX;
     121                dY = DY;
     122            }
     123        } else {
     124            // extend this row
     125            psphotAddWithTest (source, true, maskVal); // replace source if subtracted
     126            psphotRadialPlot (&kapa, "radial.plots.ps", source);
     127            psphotMosaicSubimage (outpos, source, Xo, Yo, DX, DY);
    128128
    129             psphotSubWithTest (source, false); // remove source (force)
    130             psphotMosaicSubimage (outsub, source, Xo, Yo, DX, DY);
    131             psphotSetState (source, false); // replace source (has been subtracted)
     129            psphotSubWithTest (source, false, maskVal); // remove source (force)
     130            psphotMosaicSubimage (outsub, source, Xo, Yo, DX, DY);
     131            psphotSetState (source, false, maskVal); // replace source (has been subtracted)
    132132
    133             Xo += DX;
    134             dY = PS_MAX (dY, DY);
    135         }
     133            Xo += DX;
     134            dY = PS_MAX (dY, DY);
     135        }
    136136    }
    137137
Note: See TracChangeset for help on using the changeset viewer.