Changeset 12689
- Timestamp:
- Mar 29, 2007, 4:48:20 PM (19 years ago)
- Location:
- trunk/psphot/src
- Files:
-
- 1 added
- 7 edited
-
Makefile.am (modified) (1 diff)
-
psphot.h (modified) (1 diff)
-
psphotAddNoise.c (modified) (4 diffs)
-
psphotBasicDeblend.c (modified) (1 diff)
-
psphotDeblendSatstars.c (added)
-
psphotEvalPSF.c (modified) (4 diffs)
-
psphotFindPeaks.c (modified) (2 diffs)
-
psphotReadout.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/src/Makefile.am
r12665 r12689 51 51 psphotSourcePlots.c \ 52 52 psphotRadialPlot.c \ 53 psphotDeblendSatstars.c \ 53 54 psphotMosaicSubimage.c \ 54 55 psphotAddNoise.c \ -
trunk/psphot/src/psphot.h
r12665 r12689 111 111 bool psphotSubWithTest (pmSource *source, bool useState); 112 112 bool psphotSetState (pmSource *source, bool curState); 113 bool psphotDeblendSatstars (psArray *sources, psMetadata *recipe); -
trunk/psphot/src/psphotAddNoise.c
r12635 r12689 4 4 5 5 bool status = false; 6 psTimerStart ("psphot"); 6 psEllipseShape oldshape; 7 psEllipseShape newshape; 8 psEllipseAxes axes; 7 9 8 10 PS_ASSERT (readout, false); 9 11 PS_ASSERT (readout->parent, false); 10 12 PS_ASSERT (readout->parent->concepts, false); 13 14 psTimerStart ("psphot"); 11 15 12 16 // increase variance by factor*(object noise): … … 15 19 16 20 float FACTOR = psMetadataLookupF32 (&status, recipe, "NOISE.FACTOR"); 21 PS_ASSERT (status, false); 22 float SIZE = psMetadataLookupF32 (&status, recipe, "NOISE.SIZE"); 17 23 PS_ASSERT (status, false); 18 24 … … 39 45 } 40 46 41 model->params->data.F32[PM_PAR_I0] *= FACTOR; 47 psF32 *PAR = model->params->data.F32; 48 49 // save original values 50 float oldI0 = PAR[PM_PAR_I0]; 51 oldshape.sx = PAR[PM_PAR_SXX]; 52 oldshape.sy = PAR[PM_PAR_SYY]; 53 oldshape.sxy = PAR[PM_PAR_SXY]; 54 55 // increase size and height of source 56 axes = psEllipseShapeToAxes (oldshape, 20.0); 57 axes.major *= SIZE; 58 axes.minor *= SIZE; 59 newshape = psEllipseAxesToShape (axes); 60 PAR[PM_PAR_I0] = FACTOR*PS_SQR(oldI0); 61 PAR[PM_PAR_SXX] = newshape.sx; 62 PAR[PM_PAR_SYY] = newshape.sy; 63 PAR[PM_PAR_SXY] = newshape.sxy; 64 42 65 if (add) { 43 66 pmModelAdd (source->weight, source->mask, model, false, false); … … 45 68 pmModelSub (source->weight, source->mask, model, false, false); 46 69 } 70 71 // restore original values 72 PAR[PM_PAR_I0] = oldI0; 73 PAR[PM_PAR_SXX] = oldshape.sx; 74 PAR[PM_PAR_SYY] = oldshape.sy; 75 PAR[PM_PAR_SXY] = oldshape.sxy; 47 76 } 48 77 if (add) { -
trunk/psphot/src/psphotBasicDeblend.c
r11164 r12689 1 1 # include "psphot.h" 2 2 3 // 2006.02.07 : no leaks4 3 bool psphotBasicDeblend (psArray *sources, psMetadata *recipe) { 5 4 -
trunk/psphot/src/psphotEvalPSF.c
r11167 r12689 73 73 case PM_MODEL_UNTRIED: 74 74 source->mode &= ~PM_SOURCE_MODE_FITTED; 75 if (source->mode & PM_SOURCE_MODE_SATSTAR) { 76 psTrace ("psphot", 5, "satstar was not fitted"); 77 } 75 78 return false; 76 79 case PM_MODEL_BADARGS: … … 79 82 default: 80 83 source->mode |= PM_SOURCE_MODE_FAIL; 84 if (source->mode & PM_SOURCE_MODE_SATSTAR) { 85 psTrace ("psphot", 5, "satstar failed fit"); 86 } 81 87 return false; 82 88 } … … 103 109 if (model->params->data.F32[PM_PAR_I0] <= 0) { 104 110 source->mode |= PM_SOURCE_MODE_FAIL; 111 if (source->mode & PM_SOURCE_MODE_SATSTAR) { 112 psTrace ("psphot", 5, "satstar failed fit (peak below 0)"); 113 } 105 114 return false; 106 115 } … … 130 139 keep &= (SN > PSF_MIN_SN); 131 140 keep &= (Chi < PSF_MAX_CHI); 141 142 if (source->mode & PM_SOURCE_MODE_SATSTAR) { 143 psTrace ("psphot", 5, "satstar fit results: %f, %f %d : %f %f : %f %f : %f %f\n", 144 model->params->data.F32[PM_PAR_XPOS], model->params->data.F32[PM_PAR_YPOS], keep, 145 dSX, nSx, dSY, nSy, SN, Chi); 146 } 147 132 148 if (keep) { 133 149 if (source->mode & PM_SOURCE_MODE_PSFSTAR) { -
trunk/psphot/src/psphotFindPeaks.c
r12372 r12689 39 39 // optionally save example images under trace 40 40 if (psTraceGetLevel("psphot") > 5) { 41 psphotSaveImage (NULL, smooth_im, "imsmooth.fits"); 42 psphotSaveImage (NULL, smooth_wt, "wtsmooth.fits"); 41 char name[64]; 42 sprintf (name, "imsmooth.v%d.fits", pass); 43 psphotSaveImage (NULL, smooth_im, name); 44 sprintf (name, "wtsmooth.v%d.fits", pass); 45 psphotSaveImage (NULL, smooth_wt, name); 43 46 } 44 47 … … 58 61 // optionally save example images under trace 59 62 if (psTraceGetLevel("psphot") > 5) { 60 psphotSaveImage (NULL, smooth_im, "snsmooth.fits"); 63 char name[64]; 64 sprintf (name, "snsmooth.v%d.fits", pass); 65 psphotSaveImage (NULL, smooth_im, name); 61 66 } 62 67 -
trunk/psphot/src/psphotReadout.c
r12665 r12689 61 61 return psphotReadoutCleanup (config, readout, recipe, NULL, NULL); 62 62 } 63 pmPeaksWriteText (peaks, "oldpeaks.dat"); 63 64 64 65 // construct sources and measure basic stats … … 70 71 return psphotReadoutCleanup(config, readout, recipe, NULL, sources); 71 72 } 73 74 psphotDeblendSatstars (sources, recipe); 72 75 73 76 // mark blended peaks PS_SOURCE_BLEND … … 102 105 psphotGuessModels (readout, sources, recipe, psf); 103 106 107 psphotSaveImage (NULL, readout->image, "image.v0.fits"); 108 104 109 // linear PSF fit to peaks 105 110 psphotEnsemblePSF (readout, sources, recipe, psf, FALSE); 111 psphotSaveImage (NULL, readout->image, "image.v1.fits"); 106 112 if (!strcasecmp (breakPt, "ENSEMBLE")) { 107 113 goto finish; 108 114 } 109 115 110 // plot positive + negative sources (replace, then remove)111 psphotSourcePlots (readout, sources, recipe);112 113 116 // non-linear PSF and EXT fit to brighter sources 114 117 psphotBlendFit (readout, sources, recipe, psf); 118 psphotSaveImage (NULL, readout->image, "image.v2.fits"); 115 119 116 120 // replace all sources 117 121 psphotReplaceAll (sources); 118 119 // plot positive sources 120 // psphotSourcePlots (readout, sources, recipe); 122 psphotSaveImage (NULL, readout->image, "image.v3.fits"); 121 123 122 124 // linear PSF fit to remaining peaks 123 125 psphotEnsemblePSF (readout, sources, recipe, psf, TRUE); 126 psphotSaveImage (NULL, readout->image, "image.v4.fits"); 124 127 if (!strcasecmp (breakPt, "PASS1")) { 125 128 goto finish; … … 137 140 // find the peaks in the image 138 141 psArray *newPeaks = psphotFindPeaks (readout, recipe, 2); 142 pmPeaksWriteText (newPeaks, "newpeaks.dat"); 139 143 140 144 // remove noise for subtracted objects … … 153 157 // replace all sources 154 158 psphotReplaceAll (sources); 159 psphotSaveImage (NULL, readout->image, "image.v5.fits"); 155 160 156 161 // merge the newly selected peaks into the existing list … … 160 165 // linear PSF fit to remaining peaks 161 166 psphotEnsemblePSF (readout, sources, recipe, psf, TRUE); 167 psphotSaveImage (NULL, readout->image, "image.v6.fits"); 162 168 163 169 finish: 170 171 // plot positive sources 172 psphotSourcePlots (readout, sources, recipe); 164 173 165 174 // measure aperture photometry corrections
Note:
See TracChangeset
for help on using the changeset viewer.
