Changeset 12665 for trunk/psphot/src/psphotSourcePlots.c
- Timestamp:
- Mar 28, 2007, 5:20:02 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/psphot/src/psphotSourcePlots.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/src/psphotSourcePlots.c
r12627 r12665 3 3 bool psphotSourcePlots (pmReadout *readout, psArray *sources, psMetadata *recipe) { 4 4 5 bool status = false;5 // bool status = false; 6 6 psTimerStart ("psphot"); 7 7 8 8 // 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; 11 14 12 15 // examine PSF sources in S/N order (brightest first) … … 16 19 int dX = 0; // starting corner of next box 17 20 int dY = 0; // height of row so far 18 int NX = 10*(2*OUTER+1);// full width of output image21 int NX = 20*DX; // full width of output image 19 22 int NY = 0; // total height of output image 20 23 21 24 // first, examine the PSF and SAT stars: 22 // - generate radial plots (PS plots)23 25 // - determine bounding boxes for summary image 24 26 for (int i = 0; i < sources->n; i++) { … … 32 34 33 35 // 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) { 35 40 // too wide for the rest of this row 36 41 if (dX == 0) { 37 42 // alone on this row 38 NY += source->pixels->numRows;43 NY += DY; 39 44 dX = 0; 40 45 dY = 0; … … 42 47 // start the next row 43 48 NY += dY; 44 dX = source->pixels->numCols;45 dY = source->pixels->numRows;49 dX = DX; 50 dY = DY; 46 51 } 47 52 } else { 48 53 // 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); 51 56 } 52 psphotRadialPlot ("radial.plots.ps", source);53 57 } 54 58 … … 59 63 int Xo = 0; // starting corner of next box 60 64 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 62 70 63 71 // first, examine the PSF and SAT stars: 64 72 // - generate radial plots (PS plots) 65 // - determine bounding boxes for summary image73 // - create output image array 66 74 for (int i = 0; i < sources->n; i++) { 67 75 … … 69 77 70 78 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 } 73 87 if (!keep) continue; 74 88 75 89 // 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) { 77 94 // too wide for the rest of this row 78 95 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; 82 106 Xo = 0; 83 107 dY = 0; … … 86 110 Yo += dY; 87 111 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; 91 122 } 92 123 } else { 93 124 // 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); 97 135 } 98 136 } 99 137 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); 101 144 return (sources); 102 145 }
Note:
See TracChangeset
for help on using the changeset viewer.
