Changeset 19869
- Timestamp:
- Oct 2, 2008, 11:49:42 AM (18 years ago)
- Location:
- trunk/psphot/src
- Files:
-
- 1 added
- 13 edited
-
Makefile.am (modified) (1 diff)
-
psphot.h (modified) (2 diffs)
-
psphotArguments.c (modified) (1 diff)
-
psphotBlendFit.c (modified) (1 diff)
-
psphotFindDetections.c (modified) (1 diff)
-
psphotFindFootprints.c (modified) (1 diff)
-
psphotFitSourcesLinear.c (modified) (1 diff)
-
psphotMosaicSubimage.c (modified) (2 diffs)
-
psphotReadout.c (modified) (9 diffs)
-
psphotReplaceUnfit.c (modified) (3 diffs)
-
psphotSavePSFStars.c (modified) (3 diffs)
-
psphotSourceFits.c (modified) (3 diffs)
-
psphotSourcePlots.c (modified) (3 diffs)
-
psphotVisual.c (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/src/Makefile.am
r19566 r19869 74 74 psphotMakeFluxScale.c \ 75 75 psphotCheckStarDistribution.c \ 76 psphotVisual.c \ 76 77 psphotAddNoise.c 77 78 -
trunk/psphot/src/psphot.h
r18838 r19869 113 113 bool psphotRadialPlot (int *kapa, const char *filename, pmSource *source); 114 114 bool psphotSourcePlots (pmReadout *readout, psArray *sources, psMetadata *recipe); 115 bool psphotMosaicSubimage (psImage *outImage, pmSource *source, int Xo, int Yo, int DX, int DY );115 bool psphotMosaicSubimage (psImage *outImage, pmSource *source, int Xo, int Yo, int DX, int DY, bool normalize); 116 116 117 117 bool psphotAddWithTest (pmSource *source, bool useState, psMaskType maskVal); … … 132 132 bool psphotAnnuli (pmSource *source, psMetadata *recipe, psMaskType maskVal); 133 133 bool psphotKron (pmSource *source, psMetadata *recipe, psMaskType maskVal); 134 135 // psphotVisual functions 136 bool psphotSetVisual (bool mode); 137 bool psphotVisualShowImage (pmConfig *config, pmReadout *readout); 138 bool psphotVisualShowBackground (pmConfig *config, const pmFPAview *view, pmReadout *readout); 139 bool psphotVisualShowSignificance (psImage *image); 140 bool psphotVisualShowPeaks (pmConfig *config, const pmFPAview *view, pmDetections *detections); 141 bool psphotVisualShowFootprints (pmConfig *config, const pmFPAview *view, pmDetections *detections); 142 bool psphotVisualShowMoments (pmConfig *config, const pmFPAview *view, psArray *sources); 143 bool psphotVisualShowRoughClass (pmConfig *config, const pmFPAview *view, psArray *sources); 144 bool psphotVisualShowPSFStars (pmConfig *config, const pmFPAview *view, pmPSF *psf, psArray *sources); 145 bool psphotVisualShowSatStars (pmConfig *config, const pmFPAview *view, pmPSF *psf, psArray *sources); 146 bool psphotVisualShowLinearFit (pmConfig *config, pmReadout *readout); 147 bool psphotVisualShowPSFModel (pmConfig *config, pmReadout *readout, pmPSF *psf); 134 148 135 149 // structures & functions to support psf-convolved model fitting -
trunk/psphot/src/psphotArguments.c
r13416 r19869 67 67 } 68 68 69 // visual : interactive display mode 70 if ((N = psArgumentGet (argc, argv, "-visual"))) { 71 psArgumentRemove (N, &argc, argv); 72 psphotSetVisual (true); 73 } 74 69 75 // break : used from recipe throughout psphotReadout 70 76 if ((N = psArgumentGet (argc, argv, "-break"))) { -
trunk/psphot/src/psphotBlendFit.c
r18555 r19869 83 83 Nfit ++; 84 84 85 // XXX TEST 86 // if ((fabs(source->peak->x - 1202) < 2) && (fabs(source->peak->y - 1065) < 2)) { 87 // psTraceSetLevel ("psLib.math.psMinimizeLMChi2", 6); 88 // } 89 85 90 // try fitting PSFs, then try extended sources 86 91 // these functions subtract the resulting fitted source (XXX and update the modelFlux?) -
trunk/psphot/src/psphotFindDetections.c
r17870 r19869 41 41 psImage *significance = psphotSignificanceImage (readout, recipe, pass, maskVal); 42 42 43 // display the backsub and backgnd images 44 psphotVisualShowSignificance (significance); 45 43 46 // detect the peaks in the significance image 44 47 detections->peaks = psphotFindPeaks (significance, readout, recipe, threshold, NMAX); -
trunk/psphot/src/psphotFindFootprints.c
r17870 r19869 33 33 // find the raw footprints & assign the peaks to those footprints 34 34 psArray *footprints = pmFootprintsFind (significance, threshold, npixMin); 35 35 36 pmFootprintsAssignPeaks(footprints, detections->peaks); 36 37 // XXX handle the error conditions here -
trunk/psphot/src/psphotFitSourcesLinear.c
r18555 r19869 66 66 if (source->type == PM_SOURCE_TYPE_DEFECT) continue; 67 67 if (source->type == PM_SOURCE_TYPE_SATURATED) continue; 68 if (source->type == PM_SOURCE_TYPE_STAR && 69 source->mode & PM_SOURCE_MODE_SATSTAR) continue; 68 69 // if (source->type == PM_SOURCE_TYPE_STAR && 70 // source->mode & PM_SOURCE_MODE_SATSTAR) continue; 71 70 72 if (final) { 71 73 if (source->mode & PM_SOURCE_MODE_SUBTRACTED) continue; -
trunk/psphot/src/psphotMosaicSubimage.c
r14953 r19869 2 2 3 3 // insert the source image into the outimage at Xo, Yo 4 bool psphotMosaicSubimage (psImage *outImage, pmSource *source, int Xo, int Yo, int DX, int DY ) {4 bool psphotMosaicSubimage (psImage *outImage, pmSource *source, int Xo, int Yo, int DX, int DY, bool normalize) { 5 5 6 6 psRegion inRegion, outRegion; … … 35 35 for (int iy = 0; iy < newImage->numRows; iy++) { 36 36 for (int ix = 0; ix < newImage->numCols; ix++) { 37 newImage->data.F32[iy][ix] = subImage->data.F32[iy][ix] / peak; 37 if (normalize) { 38 newImage->data.F32[iy][ix] = subImage->data.F32[iy][ix] / peak; 39 } else { 40 newImage->data.F32[iy][ix] = subImage->data.F32[iy][ix] / peak; 41 } 38 42 } 39 43 } -
trunk/psphot/src/psphotReadout.c
r18973 r19869 36 36 } 37 37 38 // set up the Visual display, display the image, weight, mask (ch 1,2,3) 39 psphotVisualShowImage (config, readout); 40 38 41 // generate a background model (median, smoothed image) 39 42 if (!psphotModelBackground (config, view, "PSPHOT.INPUT")) { … … 46 49 return psphotReadoutCleanup (config, readout, recipe, NULL, NULL, NULL); 47 50 } 51 52 // display the backsub and backgnd images 53 psphotVisualShowBackground (config, view, readout); 48 54 49 55 // run a single-model test if desired (exits from here if test is run) … … 63 69 } 64 70 71 // display the backsub and backgnd images 72 psphotVisualShowPeaks (config, view, detections); 73 psphotVisualShowFootprints (config, view, detections); 74 65 75 // XXX test write out the footprint image 66 76 if (0) { … … 68 78 psphotSaveImage (NULL, footprintImage, "footprints.1.fits"); 69 79 psFree (footprintImage); 70 }71 72 // XXX test write out the footprint image73 if (0) {74 psImage *footprintImage = pmSetFootprintArrayIDs (detections->footprints, true);75 psphotSaveImage (NULL, footprintImage, "footprints.1.fits");76 psFree (footprintImage);77 80 } 78 81 … … 84 87 } 85 88 89 psphotVisualShowMoments (config, view, sources); 90 86 91 // find blended neighbors of very saturated stars 87 92 // XXX merge this with Basic Deblend? … … 102 107 return psphotReadoutCleanup(config, readout, recipe, detections, psf, sources); 103 108 } 109 110 psphotVisualShowRoughClass (config, view, sources); 104 111 105 112 // if we were not supplied a PSF, choose one here … … 119 126 } 120 127 128 psphotVisualShowPSFModel (config, readout, psf); 129 121 130 // Define source fitting parameters for everything that follows PSF fits 122 131 // This allows different parameters to be used from the PSF fitting … … 158 167 psphotFitSourcesLinear (readout, sources, recipe, psf, FALSE); 159 168 169 // XXX we have to place this here because the models are not realized until psphotGuessModels 170 // or fitted until psphotFitSourcesLinear. There is an example of generating a residual image 171 // in pmPSFtry.c 172 173 psphotVisualShowPSFStars (config, view, psf, sources); 174 psphotVisualShowSatStars (config, view, psf, sources); 175 psphotVisualShowLinearFit (config, readout); 176 160 177 if (0) { 161 178 FILE *out = fopen ("out.pass1.dat", "w"); … … 184 201 } 185 202 203 // XXX psphotVisualShowSourceSize (config, view, sources); 204 186 205 // non-linear PSF and EXT fit to brighter sources 187 206 psphotBlendFit (readout, sources, recipe, psf); 207 208 // XXX psphotVisualShowNonLinearFit (config, view, sources); 188 209 189 210 // replace all sources -
trunk/psphot/src/psphotReplaceUnfit.c
r17828 r19869 71 71 } 72 72 73 // add source, if the source has been subtracted (or if we ignore the state)73 // add source, if the source has been subtracted; do not modify state 74 74 bool psphotAddWithTest (pmSource *source, bool useState, psMaskType maskVal) { 75 75 … … 78 78 if (state && useState) return true; 79 79 80 // replace the model if 1) state says it is missing or 2) useState is false (just do it) 81 if (!state || !useState) { 82 pmSourceAdd (source, PM_MODEL_OP_FULL, maskVal); 83 } 80 pmSourceAdd (source, PM_MODEL_OP_FULL, maskVal); 84 81 return true; 85 82 } 86 83 87 // sub source, if the source has been added (or if we ignore the state)84 // sub source, if the source has been added; do not modify state 88 85 bool psphotSubWithTest (pmSource *source, bool useState, psMaskType maskVal) { 89 86 … … 92 89 if (state && useState) return true; 93 90 94 // replace the model if 1) state says it is missing or 2) useState is false (just do it) 95 if (!state || !useState) { 96 pmSourceSub (source, PM_MODEL_OP_FULL, maskVal); 97 } 91 pmSourceSub (source, PM_MODEL_OP_FULL, maskVal); 98 92 return true; 99 93 } 100 94 101 // add or sub source replace or if the source has95 // add or sub source to match recorded state: supply current state as true (add) or false (sub) 102 96 bool psphotSetState (pmSource *source, bool curState, psMaskType maskVal) { 103 97 -
trunk/psphot/src/psphotSavePSFStars.c
r13219 r19869 100 100 psphotAddWithTest (source, true); // replace source if subtracted 101 101 psphotRadialPlot (&kapa, "radial.plots.ps", source); 102 psphotMosaicSubimage (outpos, source, Xo, Yo, DX, DY );102 psphotMosaicSubimage (outpos, source, Xo, Yo, DX, DY, true); 103 103 104 104 psphotSubWithTest (source, false); // remove source (force) 105 psphotMosaicSubimage (outsub, source, Xo, Yo, DX, DY );105 psphotMosaicSubimage (outsub, source, Xo, Yo, DX, DY, true); 106 106 107 107 psphotSetState (source, false); // replace source (has been subtracted) … … 115 115 psphotAddWithTest (source, true); // replace source if subtracted 116 116 psphotRadialPlot (&kapa, "radial.plots.ps", source); 117 psphotMosaicSubimage (outpos, source, Xo, Yo, DX, DY );117 psphotMosaicSubimage (outpos, source, Xo, Yo, DX, DY, true); 118 118 119 119 psphotSubWithTest (source, false); // remove source (force) 120 psphotMosaicSubimage (outsub, source, Xo, Yo, DX, DY );120 psphotMosaicSubimage (outsub, source, Xo, Yo, DX, DY, true); 121 121 psphotSetState (source, false); // replace source (has been subtracted) 122 122 … … 128 128 psphotAddWithTest (source, true); // replace source if subtracted 129 129 psphotRadialPlot (&kapa, "radial.plots.ps", source); 130 psphotMosaicSubimage (outpos, source, Xo, Yo, DX, DY );130 psphotMosaicSubimage (outpos, source, Xo, Yo, DX, DY, true); 131 131 132 132 psphotSubWithTest (source, false); // remove source (force) 133 psphotMosaicSubimage (outsub, source, Xo, Yo, DX, DY );133 psphotMosaicSubimage (outsub, source, Xo, Yo, DX, DY, true); 134 134 psphotSetState (source, false); // replace source (has been subtracted) 135 135 -
trunk/psphot/src/psphotSourceFits.c
r18555 r19869 16 16 bool psphotFitSummary () { 17 17 18 fprintf (stderr, "fitted %5d psf, %5d blend, %5d ext, %5d dbl : %6.2f sec\n",18 psLogMsg ("psphot.pspsf", PS_LOG_INFO, "fitted %5d psf, %5d blend, %5d ext, %5d dbl : %6.2f sec\n", 19 19 NfitPSF, NfitBlend, NfitEXT, NfitDBL, psTimerMark ("psphot.fits")); 20 20 return true; … … 47 47 psArray *sourceSet = psArrayAllocEmpty (source->blends->n + 1); 48 48 psArrayAdd (sourceSet, 16, source); 49 50 psTrace ("psphot", 4, "fitting blended source at %f %f : %f\n", source->peak->xf, source->peak->yf, source->peak->flux); 49 51 50 52 // we need to include all blends in the fit (unless primary is saturated?) … … 77 79 psArrayAdd (modelSet, 16, model); 78 80 psArrayAdd (sourceSet, 16, blend); 81 82 psTrace ("psphot", 5, "adding source at %f %f : %f\n", blend->peak->xf, blend->peak->yf, blend->peak->flux); 79 83 80 84 // free to avoid double counting model -
trunk/psphot/src/psphotSourcePlots.c
r16820 r19869 113 113 psphotAddWithTest (source, true, maskVal); // replace source if subtracted 114 114 psphotRadialPlot (&kapa, "radial.plots.ps", source); 115 psphotMosaicSubimage (outpos, source, Xo, Yo, DX, DY );115 psphotMosaicSubimage (outpos, source, Xo, Yo, DX, DY, true); 116 116 117 117 psphotSubWithTest (source, false, maskVal); // remove source (force) 118 psphotMosaicSubimage (outsub, source, Xo, Yo, DX, DY );118 psphotMosaicSubimage (outsub, source, Xo, Yo, DX, DY, true); 119 119 120 120 psphotSetState (source, false, maskVal); // replace source (has been subtracted) … … 128 128 psphotAddWithTest (source, true, maskVal); // replace source if subtracted 129 129 psphotRadialPlot (&kapa, "radial.plots.ps", source); 130 psphotMosaicSubimage (outpos, source, Xo, Yo, DX, DY );130 psphotMosaicSubimage (outpos, source, Xo, Yo, DX, DY, true); 131 131 132 132 psphotSubWithTest (source, false, maskVal); // remove source (force) 133 psphotMosaicSubimage (outsub, source, Xo, Yo, DX, DY );133 psphotMosaicSubimage (outsub, source, Xo, Yo, DX, DY, true); 134 134 psphotSetState (source, false, maskVal); // replace source (has been subtracted) 135 135 … … 141 141 psphotAddWithTest (source, true, maskVal); // replace source if subtracted 142 142 psphotRadialPlot (&kapa, "radial.plots.ps", source); 143 psphotMosaicSubimage (outpos, source, Xo, Yo, DX, DY );143 psphotMosaicSubimage (outpos, source, Xo, Yo, DX, DY, true); 144 144 145 145 psphotSubWithTest (source, false, maskVal); // remove source (force) 146 psphotMosaicSubimage (outsub, source, Xo, Yo, DX, DY );146 psphotMosaicSubimage (outsub, source, Xo, Yo, DX, DY, true); 147 147 psphotSetState (source, false, maskVal); // replace source (has been subtracted) 148 148
Note:
See TracChangeset
for help on using the changeset viewer.
