Changeset 5718
- Timestamp:
- Dec 6, 2005, 9:55:31 PM (20 years ago)
- Location:
- trunk/psphot
- Files:
-
- 1 added
- 10 deleted
- 11 edited
-
Makefile (modified) (1 diff)
-
src/models/pmModel_TAUSS.c (added)
-
src/models/pmModel_WAUSS.c (modified) (2 diffs)
-
src/pmModelGroup.c (deleted)
-
src/pmModelGroup.h (deleted)
-
src/pmObjects_EAM.c (deleted)
-
src/pmObjects_EAM.h (deleted)
-
src/pmPSF.c (deleted)
-
src/pmPSF.h (deleted)
-
src/pmPSFtry.c (deleted)
-
src/pmPSFtry.h (deleted)
-
src/pmSourceContour.c (modified) (7 diffs)
-
src/psEllipse.c (deleted)
-
src/psEllipse.h (deleted)
-
src/psModulesUtils.h (modified) (1 diff)
-
src/psphot.c (modified) (1 diff)
-
src/psphot.h (modified) (1 diff)
-
src/psphotBasicDeblend.c (modified) (1 diff)
-
src/psphotEnsemblePSF.c (modified) (6 diffs)
-
src/psphotImageBackground.c (modified) (2 diffs)
-
src/psphotModelGroupInit.c (modified) (2 diffs)
-
src/psphotReapplyPSF.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/Makefile
r5672 r5718 39 39 $(SRC)/psphotMagnitudes.$(ARCH).o \ 40 40 $(SRC)/psphotImageBackground.$(ARCH).o \ 41 $(SRC)/psphotBasicDeblend.$(ARCH).o \ 42 $(SRC)/psphotModelGroupInit.$(ARCH).o \ 43 $(SRC)/pmSourceContour.$(ARCH).o \ 41 44 $(SRC)/psLine.$(ARCH).o \ 42 45 $(SRC)/psModulesUtils.$(ARCH).o \ -
trunk/psphot/src/models/pmModel_WAUSS.c
r4954 r5718 59 59 if (flux <= 0) return (1.0); 60 60 if (params->data.F32[1] <= 0) return (1.0); 61 if (flux >= params->data.F32[1] <= 0) return (1.0);62 61 63 62 psF64 sigma = sqrt(2.0) * hypot (1.0 / params->data.F32[4], 1.0 / params->data.F32[5]); … … 66 65 } 67 66 68 bool psModelGuess_WAUSS (psModel *model, p sSource *source) {67 bool psModelGuess_WAUSS (psModel *model, pmSource *source) { 69 68 70 69 psVector *params = model->params; -
trunk/psphot/src/pmSourceContour.c
r5672 r5718 100 100 new implementation of source contour function 101 101 *****************************************************************************/ 102 psArray *pmSourceContour_EAM (psImage *image, int x , int y, float threshold) {102 psArray *pmSourceContour_EAM (psImage *image, int xc, int yc, float threshold) { 103 103 104 104 int xR, yR, x0, x1, x0s, x1s; … … 106 106 psTrace(__func__, 3, "---- %s() begin ----\n", __func__); 107 107 PS_ASSERT_PTR_NON_NULL(image, false); 108 109 int x = xc - image->col0; 110 int y = yc - image->row0; 108 111 109 112 // the requested point must be within the contour … … 141 144 x0 = findContourPos (image, threshold, xR, yR, RIGHT, x1); 142 145 if (x0 == x1) { 143 fprintf (stderr, "top: %d (%d - %d)\n", yR, xR, x1);146 // fprintf (stderr, "top: %d (%d - %d)\n", yR, xR, x1); 144 147 goto pt1; 145 148 } … … 150 153 x1 = findContourNeg (image, threshold, xR, yR, RIGHT); 151 154 } 152 fprintf (stderr, "pos: %d (%d - %d)\n", yR, x0, x1);155 // fprintf (stderr, "pos: %d (%d - %d)\n", yR, x0, x1); 153 156 154 157 xVec->data.F32[Npt + 0] = image->col0 + x0; … … 175 178 x0 = findContourPos (image, threshold, xR, yR, RIGHT, x1); 176 179 if (x0 == x1) { 177 fprintf (stderr, "top: %d (%d - %d)\n", yR, xR, x1);180 // fprintf (stderr, "top: %d (%d - %d)\n", yR, xR, x1); 178 181 goto pt2; 179 182 } … … 184 187 x1 = findContourNeg (image, threshold, xR, yR, RIGHT); 185 188 } 186 fprintf (stderr, "neg: %d (%d - %d)\n", yR, x0, x1);189 // fprintf (stderr, "neg: %d (%d - %d)\n", yR, x0, x1); 187 190 188 191 xVec->data.F32[Npt + 0] = image->col0 + x0; … … 202 205 yVec->n = Npt; 203 206 204 fprintf (stderr, "done\n");207 // fprintf (stderr, "done\n"); 205 208 psArray *tmpArray = psArrayAlloc(2); 206 209 tmpArray->data[0] = (psPtr *) xVec; -
trunk/psphot/src/psModulesUtils.h
r5125 r5718 5 5 # include <strings.h> // for strcasecmp 6 6 # include <pslib.h> 7 # include <pmObjects.h> 8 # include <pmModelGroup.h> 7 9 # include "psLibUtils.h" 8 # include "pmObjects_EAM.h"9 # include "pmModelGroup.h"10 10 11 11 // psModule extra utilities -
trunk/psphot/src/psphot.c
r5672 r5718 47 47 if (!strcasecmp (breakPt, "CLASS")) exit (0); 48 48 49 psphotBasicDeblend (sources, config, sky); 50 if (!strcasecmp (breakPt, "DEBLEND")) exit (0); 51 49 52 // source analysis is done in S/N order (brightest first) 50 53 sources = psArraySort (sources, psphotSortBySN); -
trunk/psphot/src/psphot.h
r5672 r5718 21 21 22 22 // top-level psphot functions 23 psMetadata *psphotArguments (int *argc, char **argv);24 eamReadout *psphotSetup (psMetadata *config);25 psStats *psphotImageStats (eamReadout *imdata, psMetadata *config);26 psArray *psphotSourceStats (eamReadout *imdata, psMetadata *config, psArray *allpeaks);27 pmPSF *psphotChoosePSF (psMetadata *config, psArray *sources, psStats *sky);28 bool psphotApplyPSF (eamReadout *imdata, psMetadata *config, psArray *sources, pmPSF *psf, psStats *sky);29 bool psphotFixedPSF (eamReadout *imdata, psMetadata *config, psArray *sources, pmPSF *psf, psStats *sky);30 bool psphotFitGalaxies (eamReadout *imdata, psMetadata *config, psArray *sources, psStats *skyStats);31 void psphotOutput (eamReadout *imdata, psMetadata *config, psArray *sources, pmPSF *psf, psStats *sky);23 psMetadata *psphotArguments (int *argc, char **argv); 24 eamReadout *psphotSetup (psMetadata *config); 25 psStats *psphotImageStats (eamReadout *imdata, psMetadata *config); 26 psArray *psphotSourceStats (eamReadout *imdata, psMetadata *config, psArray *allpeaks); 27 pmPSF *psphotChoosePSF (psMetadata *config, psArray *sources, psStats *sky); 28 bool psphotApplyPSF (eamReadout *imdata, psMetadata *config, psArray *sources, pmPSF *psf, psStats *sky); 29 bool psphotFixedPSF (eamReadout *imdata, psMetadata *config, psArray *sources, pmPSF *psf, psStats *sky); 30 bool psphotFitGalaxies (eamReadout *imdata, psMetadata *config, psArray *sources, psStats *skyStats); 31 void psphotOutput (eamReadout *imdata, psMetadata *config, psArray *sources, pmPSF *psf, psStats *sky); 32 32 33 bool psphotMarkPSF (pmSource *source, float shapeNsigma, float minSN, float maxChi, float SATURATE); 34 bool psphotSubtractPSF (pmSource *source); 35 int psphotSortBySN (const void **a, const void **b); 36 int psphotSortByY (const void **a, const void **b); 37 int psphotSaveImage (psMetadata *header, psImage *image, char *filename); 38 bool psphotDefinePixels (pmSource *mySource, const eamReadout *imdata, psF32 x, psF32 y, psF32 Radius); 33 bool psphotMarkPSF (pmSource *source, float shapeNsigma, float minSN, float maxChi, float SATURATE); 34 bool psphotSubtractPSF (pmSource *source); 35 int psphotSortBySN (const void **a, const void **b); 36 int psphotSortByY (const void **a, const void **b); 37 int psphotSaveImage (psMetadata *header, psImage *image, char *filename); 38 bool psphotDefinePixels (pmSource *mySource, const eamReadout *imdata, psF32 x, psF32 y, psF32 Radius); 39 void psphotModelGroupInit (void); 39 40 40 bool pmSourceFitFixed (pmSource *source, pmModel *model);41 psArray *pmPeaksSigmaLimit (eamReadout *imdata, psMetadata *config, psStats *sky);42 pmModel *pmSourceMagnitudes (pmSource *source, pmPSF *psf, float apRadius);43 pmModel *pmSourceSelectModel (pmSource *source);41 bool pmSourceFitFixed (pmSource *source, pmModel *model); 42 psArray *pmPeaksSigmaLimit (eamReadout *imdata, psMetadata *config, psStats *sky); 43 pmModel *pmSourceMagnitudes (pmSource *source, pmPSF *psf, float apRadius); 44 pmModel *pmSourceSelectModel (pmSource *source); 44 45 45 46 // eamReadout functions 46 eamReadout *eamReadoutAlloc (psImage *image, psImage *noise, psImage *mask, psMetadata *header);47 eamReadout *eamReadoutAlloc (psImage *image, psImage *noise, psImage *mask, psMetadata *header); 47 48 48 49 // output functions 49 bool pmSourcesWriteText (eamReadout *imdata, psMetadata *config, char *filename, psArray *sources, pmPSF *psf, psStats *sky);50 bool pmSourcesWriteOBJ (eamReadout *imdata, psMetadata *config, char *filename, psArray *sources, pmPSF *psf, psStats *sky);51 bool pmSourcesWriteCMP (eamReadout *imdata, psMetadata *config, char *filename, psArray *sources, pmPSF *psf, psStats *sky);52 bool pmSourcesWriteCMF (eamReadout *imdata, psMetadata *config, char *filename, psArray *sources, pmPSF *psf, psStats *sky);53 bool pmSourcesWriteSX (eamReadout *imdata, psMetadata *config, char *filename, psArray *sources, pmPSF *psf, psStats *sky);50 bool pmSourcesWriteText (eamReadout *imdata, psMetadata *config, char *filename, psArray *sources, pmPSF *psf, psStats *sky); 51 bool pmSourcesWriteOBJ (eamReadout *imdata, psMetadata *config, char *filename, psArray *sources, pmPSF *psf, psStats *sky); 52 bool pmSourcesWriteCMP (eamReadout *imdata, psMetadata *config, char *filename, psArray *sources, pmPSF *psf, psStats *sky); 53 bool pmSourcesWriteCMF (eamReadout *imdata, psMetadata *config, char *filename, psArray *sources, pmPSF *psf, psStats *sky); 54 bool pmSourcesWriteSX (eamReadout *imdata, psMetadata *config, char *filename, psArray *sources, pmPSF *psf, psStats *sky); 54 55 55 bool pmPeaksWriteText (psArray *sources, char *filename);56 bool pmMomentsWriteText (psArray *sources, char *filename);57 bool pmModelWritePSFs (psArray *sources, psMetadata *config, char *filename, pmPSF *psf);58 bool pmModelWriteFLTs (psArray *sources, char *filename);59 bool pmModelWriteNULLs (psArray *sources, char *filename);56 bool pmPeaksWriteText (psArray *sources, char *filename); 57 bool pmMomentsWriteText (psArray *sources, char *filename); 58 bool pmModelWritePSFs (psArray *sources, psMetadata *config, char *filename, pmPSF *psf); 59 bool pmModelWriteFLTs (psArray *sources, char *filename); 60 bool pmModelWriteNULLs (psArray *sources, char *filename); 60 61 61 int pmSourcesDophotType (pmSource *source);62 int pmSourcesDophotType (pmSource *source); 62 63 63 64 // psphotModelTest functions 64 psMetadata *modelTestArguments (int *argc, char **argv);65 bool modelTestFitSource (eamReadout *imdata, psMetadata *config);66 bool psphotEnsemblePSF (eamReadout *imdata, psMetadata *config, psArray *sources, pmPSF *psf, psStats *sky);67 float psphotCrossProduct (pmSource *Mi, pmSource *Mj);65 psMetadata *modelTestArguments (int *argc, char **argv); 66 bool modelTestFitSource (eamReadout *imdata, psMetadata *config); 67 bool psphotEnsemblePSF (eamReadout *imdata, psMetadata *config, psArray *sources, pmPSF *psf, psStats *sky); 68 float psphotCrossProduct (pmSource *Mi, pmSource *Mj); 68 69 psPolynomial2D *psphotImageBackground (eamReadout *imdata, psMetadata *config, psStats *sky); 69 bool psphotReapplyPSF (eamReadout *imdata, psMetadata *config, psArray *sources, pmPSF *psf, psStats *sky);70 bool psphotReapplyPSF (eamReadout *imdata, psMetadata *config, psArray *sources, pmPSF *psf, psStats *sky); 70 71 71 pmModel *pmModelCopy (pmModel *model); 72 psArray *pmSourceContour_EAM (psImage *image, int x, int y, float threshold); 73 psMetadata *psphotTestArguments (int *argc, char **argv); 72 pmModel *pmModelCopy (pmModel *model); 73 psArray *pmSourceContour_EAM (psImage *image, int x, int y, float threshold); 74 psMetadata *psphotTestArguments (int *argc, char **argv); 75 bool psphotBasicDeblend (psArray *sources, psMetadata *config, psStats *sky); -
trunk/psphot/src/psphotBasicDeblend.c
r5704 r5718 1 1 # include "psphot.h" 2 2 3 // try PSF models and select best option 3 bool psphotBasicDeblend (psArray *sources, psMetadata *config, psStats *sky) { 4 4 5 pmPSF *psphotBasicDeblend (psMetadata *config, psArray *sources, psStats *skystats) 6 { 5 int N; 6 bool status; 7 float threshold; 8 pmSource *source, *testSource; 7 9 8 // source analysis is done in S/N order (brightest first) 10 FILE *f = fopen ("deblend.dat", "w"); 11 if (f == NULL) psAbort ("psphot", "can't open deblend.dat output file"); 12 int Nblend = 0; 13 14 psTimerStart ("psphot"); 15 16 // this should be added to the PM_SOURCE flags: 17 int PM_SOURCE_BLEND = PM_SOURCE_OTHER + 1; 18 19 float FRACTION = psMetadataLookupF32 (&status, config, "DEBLEND_PEAK_FRACTION"); 20 float NSIGMA = psMetadataLookupF32 (&status, config, "DEBLEND_SKY_NSIGMA"); 21 float minThreshold = NSIGMA*sky->sampleStdev; 22 fprintf (stderr, "min threshold: %f\n", minThreshold); 23 24 // we need sources spatially-sorted to find overlaps 9 25 sources = psArraySort (sources, psphotSortByY); 10 26 27 // source analysis is done in peak order (brightest first) 28 // we use an index for this so the spatial sorting is kept 11 29 psVector *SN = psVectorAlloc (sources->n, PS_DATA_F32); 12 30 for (int i = 0; i < SN->n; i++) { 13 source = sources->data[i];14 SN->data.F32[i] = source->moments->SN;31 source = sources->data[i]; 32 SN->data.F32[i] = source->peak->counts; 15 33 } 16 34 psVector *index = psVectorSortIndex (NULL, SN); 17 35 // this results in an index of increasing SN 36 37 // temporary array for overlapping objects we find 18 38 psArray *overlap = psArrayAlloc (100); 19 39 20 for (int i = 0; i < sources->n; i++) {21 N = index->data.U32[i];22 source = sources->data[N];23 overlap->n = 0;40 // XXX make sure this results in decreasing, not increasing, SN 41 for (int i = sources->n - 1; i >= 0; i--) { 42 N = index->data.U32[i]; 43 source = sources->data[N]; 24 44 25 // search backwards for overlapping sources 26 for (int j = N - 1; j >= 0; j--) { 27 testSource = sources->data[j]; 28 if (testSource->moments->x < source->pixels->col0) continue; 29 if (testSource->moments->x >= source->pixels->col0 + source->pixels->numCols) continue; 30 if (testSource->moments->y < source->pixels->row0) break; 31 if (testSource->moments->y >= source->pixels->row0 + source->pixels->numRows) { 32 fprintf (stderr, "warning: invalid condition\n"); 33 continue; 45 if (source->type == PM_SOURCE_BLEND) continue; 46 47 overlap->n = 0; 48 49 // search backwards for overlapping sources 50 for (int j = N - 1; j >= 0; j--) { 51 testSource = sources->data[j]; 52 if (testSource->peak->x < source->pixels->col0) continue; 53 if (testSource->peak->x >= source->pixels->col0 + source->pixels->numCols) continue; 54 if (testSource->peak->y < source->pixels->row0) break; 55 if (testSource->peak->y >= source->pixels->row0 + source->pixels->numRows) { 56 fprintf (stderr, "warning: invalid condition\n"); 57 continue; 58 } 59 psArrayAdd (overlap, 100, testSource); 34 60 } 35 psArrayAdd (overlap, 100, testSource);36 }37 61 38 // search forwards for overlapping sources 39 for (int j = N + 1; j < sources->n; j++) { 40 testSource = sources->data[j]; 41 if (testSource->moments->x < source->pixels->col0) continue; 42 if (testSource->moments->x >= source->pixels->col0 + source->pixels->numCols) continue; 43 if (testSource->moments->y < source->pixels->row0) { 44 fprintf (stderr, "warning: invalid condition\n"); 45 continue; 62 // search forwards for overlapping sources 63 for (int j = N + 1; j < sources->n; j++) { 64 testSource = sources->data[j]; 65 if (testSource->peak->x < source->pixels->col0) continue; 66 if (testSource->peak->x >= source->pixels->col0 + source->pixels->numCols) continue; 67 if (testSource->peak->y < source->pixels->row0) { 68 fprintf (stderr, "warning: invalid condition\n"); 69 continue; 70 } 71 if (testSource->peak->y >= source->pixels->row0 + source->pixels->numRows) break; 72 psArrayAdd (overlap, 100, testSource); 46 73 } 47 if (testSource->moments->y >= source->pixels->row0 + source->pixels->numRows) break;48 psArrayAdd (overlap, 100, testSource);49 }50 74 51 // generate source contour (1/4 peak counts) 52 if (overlap->n > 0) { 53 // XXX EAM : make the 1/4 user-defined. 54 threshold = 0.25 * (source->moments->Peak - source->moments->Sky) + source->moments->Sky); 55 psArray *contour = pmSourceContour_EAM (source->pixels, source->moments->x, source->moments->x, threshold); 75 // generate source contour (1/4 peak counts) 76 if (overlap->n > 0) { 77 // XXX EAM : make the 1/4 user-defined. 78 // XXX keep threshold from dropping too low (N*sky.sigma) 79 threshold = FRACTION * (source->peak->counts - source->moments->Sky) + source->moments->Sky; 80 threshold = PS_MAX (threshold, minThreshold); 56 81 57 // XXX EAM : the order is wrong: need to check j, j+1 contour points 58 psVector *xv = contour->data[0]; 59 psVector *yv = contour->data[1]; 60 for (int j = 0; j < xv->n; j++) { 61 for (int k = 0; k < overlap->n; k++) { 62 testSource = overlap->data[k]; 63 if (fabs(yv->data.F32[j] - testSource->moments->y) > 0.5) continue; 64 if (xv->data.F32[j] > testSource->moments->x) continue; 65 if (xv->data.F32[j] < testSource->moments->x) continue; 66 // XXX EAM : mark source with flag (blended) 67 } 68 } 82 // XXX EAM : should the contour input coordinate be in parent or subimage coords? parent, for now 83 psArray *contour = pmSourceContour_EAM (source->pixels, source->peak->x, source->peak->y, threshold); 84 if (contour == NULL) { 85 fprintf (stderr, "below threshold? invalid peak?\n"); 86 continue; 87 } 88 89 // the source contour consists of two vectors, xv and yv. the contour is 90 // a series of coordinate pairs, (xv[i],yv[i]) & (xv[i+1],yv[i+1]). both 91 // coordinate pairs have the same yv[] value, with xv[i] corresponding to 92 // the left boundary and xv[i+1] corresponding to the right boundary 93 94 psVector *xv = contour->data[0]; 95 psVector *yv = contour->data[1]; 96 for (int k = 0; k < overlap->n; k++) { 97 testSource = overlap->data[k]; 98 if (testSource->peak->counts > source->peak->counts) continue; 99 for (int j = 0; j < xv->n; j+=2) { 100 if (fabs(yv->data.F32[j] - testSource->peak->y) > 0.5) continue; 101 if (xv->data.F32[j+0] > testSource->peak->x) break; 102 if (xv->data.F32[j+1] < testSource->peak->x) break; 103 104 int xp0 = source->moments->x - source->pixels->col0; 105 int xp1 = source->peak->x - source->pixels->col0; 106 int xp2 = testSource->moments->x - source->pixels->col0; 107 int xp3 = testSource->peak->x - source->pixels->col0; 108 109 int yp0 = source->moments->y - source->pixels->row0; 110 int yp1 = source->peak->y - source->pixels->row0; 111 int yp2 = testSource->moments->y - testSource->pixels->row0; 112 int yp3 = testSource->peak->y - testSource->pixels->row0; 113 114 fprintf (f, "%d %d (%f, %f) : %d %d (%f, %f) vs %f\n", 115 source->peak->x, source->peak->y, 116 source->pixels->data.F32[yp0][xp0], source->pixels->data.F32[yp1][xp1], 117 testSource->peak->x, testSource->peak->y, 118 testSource->pixels->data.F32[yp2][xp2], testSource->pixels->data.F32[yp3][xp3], threshold 119 ); 120 121 testSource->type = PM_SOURCE_BLEND; 122 Nblend ++; 123 j = xv->n; 124 } 125 } 126 } 69 127 } 128 fclose (f); 129 psLogMsg ("psphot.deblend", 3, "identified %d blended objects (%f)\n", Nblend, psTimerMark ("psphot")); 130 return true; 131 } 70 132 71 psLogMsg ("psphot.pspsf", 3, "selected psf model %s, ApResid: %f +/- %f\n", modelName, psf->ApResid, psf->dApResid);72 133 73 return (psf); 74 } 134 -
trunk/psphot/src/psphotEnsemblePSF.c
r5704 r5718 13 13 sources = psArraySort (sources, psphotSortByY); 14 14 15 // this should be added to the PM_SOURCE flags: 16 int PM_SOURCE_BLEND = PM_SOURCE_OTHER + 1; 17 15 18 float OUTER_RADIUS = psMetadataLookupF32 (&status, config, "SKY_OUTER_RADIUS"); 16 19 float PSF_FIT_NSIGMA = psMetadataLookupF32 (&status, config, "PSF_FIT_NSIGMA"); … … 23 26 // pre-calculate all model pixels 24 27 psArray *models = psArrayAlloc (sources->n); 28 psVector *index = psVectorAlloc (sources->n, PS_TYPE_U32); 29 models->n = 0; 30 index->n = 0; 31 25 32 for (int i = 0; i < sources->n; i++) { 26 33 pmSource *inSource = sources->data[i]; 34 35 // skip non-astronomical objects (very likely defects) 36 // XXX EAM : should we try these anyway? 37 if (inSource->type == PM_SOURCE_BLEND) continue; 38 if (inSource->type == PM_SOURCE_DEFECT) continue; 39 if (inSource->type == PM_SOURCE_SATURATED) continue; 40 27 41 pmSource *otSource = pmSourceAlloc (); 28 42 … … 72 86 // save source in list 73 87 otSource->modelPSF = model; 74 models->data[i] = otSource; 88 index->data.U32[models->n] = i; 89 psArrayAdd (models, 100, otSource); 75 90 } 76 91 psLogMsg ("psphot.emsemble", 4, "built models: %f (%d objects)\n", psTimerMark ("psphot"), sources->n); … … 79 94 80 95 // fill out the sparse matrix 81 psSparse *sparse = psSparseAlloc (sources->n, 100); 82 for (int i = 0; i < sources->n; i++) { 83 pmSource *Fi = sources->data[i]; 96 psSparse *sparse = psSparseAlloc (models->n, 100); 97 for (int i = 0; i < models->n; i++) { 98 int N = index->data.U32[i]; 99 pmSource *Fi = sources->data[N]; 84 100 pmSource *Mi = models->data[i]; 85 101 … … 93 109 94 110 // loop over all other stars following this one 95 for (int j = i + 1; j < sources->n; j++) {111 for (int j = i + 1; j < models->n; j++) { 96 112 pmSource *Mj = models->data[j]; 97 113 98 // XXX double check that this is working! should not break here 99 check me here; 100 if (Mi->pixels->col0 + Mi->pixels->numCols < Mj->pixels->col0) break; 114 // skip over disjoint source images, break after last possible overlap 115 if (Mi->pixels->row0 + Mi->pixels->numRows < Mj->pixels->row0) break; 116 if (Mj->pixels->row0 + Mj->pixels->numRows < Mi->pixels->row0) continue; 117 if (Mi->pixels->col0 + Mi->pixels->numCols < Mj->pixels->col0) continue; 101 118 if (Mj->pixels->col0 + Mj->pixels->numCols < Mi->pixels->col0) continue; 102 if (Mi->pixels->row0 + Mi->pixels->numRows < Mj->pixels->row0) continue;103 if (Mj->pixels->row0 + Mj->pixels->numRows < Mi->pixels->row0) continue;104 119 105 120 // got an overlap; calculate cross-product and add to output array … … 115 130 116 131 // adjust models, set sources and subtract 117 for (int i = 0; i < sources->n; i++) { 118 pmSource *Fi = sources->data[i]; 132 for (int i = 0; i < models->n; i++) { 133 int N = index->data.U32[i]; 134 pmSource *Fi = sources->data[N]; 119 135 pmSource *Mi = models->data[i]; 120 136 -
trunk/psphot/src/psphotImageBackground.c
r5672 r5718 58 58 for (int j = 0; j < image->numRows; j++) { 59 59 for (int i = 0; i < image->numCols; i++) { 60 if (mask->data.U8[j][i]) { 61 image->data.F32[j][i] = 0; 62 } else { 60 if (!mask->data.U8[j][i]) { 63 61 Sky = psPolynomial2DEval (skyModel, i, j); 64 62 image->data.F32[j][i] -= Sky; … … 66 64 } 67 65 } 66 68 67 psLogMsg ("psphot", 5, "back: %f sec (fit model)\n", psTimerMark ("psphot")); 69 68 -
trunk/psphot/src/psphotModelGroupInit.c
r5672 r5718 1 1 # include "psphot.h" 2 2 3 # include "models/pmModel_ WAUSS.c"3 # include "models/pmModel_TAUSS.c" 4 4 5 5 static pmModelGroup userModels[] = { 6 {"PS_MODEL_ WAUSS", 9, pmModelFunc_WAUSS, pmModelFlux_WAUSS, pmModelRadius_WAUSS, pmModelLimits_WAUSS, pmModelGuess_WAUSS, pmModelFromPSF_WAUSS, pmModelFitStatus_WAUSS},6 {"PS_MODEL_TAUSS", 9, pmModelFunc_TAUSS, pmModelFlux_TAUSS, pmModelRadius_TAUSS, pmModelLimits_TAUSS, pmModelGuess_TAUSS, pmModelFromPSF_TAUSS, pmModelFitStatus_TAUSS}, 7 7 }; 8 8 … … 17 17 pmModelGroupAdd (&userModels[i]); 18 18 } 19 return true;19 return; 20 20 } -
trunk/psphot/src/psphotReapplyPSF.c
r5672 r5718 14 14 sources = psArraySort (sources, psphotSortBySN); 15 15 16 // we may set this differently here from the value used to mark likely saturated stars 16 // this should be added to the PM_SOURCE flags: 17 int PM_SOURCE_BLEND = PM_SOURCE_OTHER + 1; 18 19 // we may set this differently here from the value used to mark likely saturated stars 17 20 float SATURATION = psMetadataLookupF32 (&status, config, "SATURATION"); 18 21 float PSF_MIN_SN = psMetadataLookupF32 (&status, config, "PSF_MIN_SN"); … … 26 29 // skip non-astronomical objects (very likely defects) 27 30 // XXX EAM : should we try these anyway? 31 if (source->type == PM_SOURCE_BLEND) continue; 28 32 if (source->type == PM_SOURCE_DEFECT) continue; 29 33 if (source->type == PM_SOURCE_SATURATED) continue;
Note:
See TracChangeset
for help on using the changeset viewer.
