Changeset 4949
- Timestamp:
- Sep 5, 2005, 8:44:00 PM (21 years ago)
- Location:
- trunk/psphot/src
- Files:
-
- 2 added
- 13 edited
-
pmObjects_EAM.c (added)
-
pmObjects_EAM.h (added)
-
pmSourceUtils.c (modified) (4 diffs)
-
psModulesUtils.c (modified) (6 diffs)
-
psphot.h (modified) (8 diffs)
-
psphotApplyPSF.c (modified) (3 diffs)
-
psphotChoosePSF.c (modified) (4 diffs)
-
psphotFitGalaxies.c (modified) (4 diffs)
-
psphotMarkPSF.c (modified) (1 diff)
-
psphotOutput.c (modified) (18 diffs)
-
psphotSetup.c (modified) (1 diff)
-
psphotSortBySN.c (modified) (1 diff)
-
psphotSourceStats.c (modified) (1 diff)
-
psphotSubtractPSF.c (modified) (1 diff)
-
pspsf.c (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/src/pmSourceUtils.c
r4946 r4949 1 1 # include "psphot.h" 2 2 3 bool pmSourceDefinePixels(p sSource *mySource,3 bool pmSourceDefinePixels(pmSource *mySource, 4 4 const psImageData *imdata, 5 5 psF32 x, … … 26 26 } 27 27 28 bool pmSourcePhotometry (float *fitMag, float *obsMag, p sModel *model, psImage *image, psImage *mask) {28 bool pmSourcePhotometry (float *fitMag, float *obsMag, pmModel *model, psImage *image, psImage *mask) { 29 29 30 30 float obsSum = 0; … … 32 32 float sky = model->params->data.F32[0]; 33 33 34 p sModelFlux modelFluxFunc = psModelFlux_GetFunction (model->type);34 pmModelFlux modelFluxFunc = pmModelFlux_GetFunction (model->type); 35 35 fitSum = modelFluxFunc (model->params); 36 36 … … 39 39 if (mask->data.U8[iy][ix]) continue; 40 40 obsSum += image->data.F32[iy][ix] - sky; 41 // fitSum += psModelEval (model, image, ix, iy) - sky;42 41 } 43 42 } -
trunk/psphot/src/psModulesUtils.c
r4946 r4949 4 4 5 5 // this sets and clears bit 0x80 6 bool pmSourceLocalSky_EAM (p sSource *source,6 bool pmSourceLocalSky_EAM (pmSource *source, 7 7 psStatsOptions statsOptions, 8 8 psF32 Radius) … … 36 36 # define PM_SOURCE_FIT_MODEL_NUM_ITERATIONS 15 37 37 # define PM_SOURCE_FIT_MODEL_TOLERANCE 0.1 38 bool pmSourceFitModel_EAM (psSource *source,39 psModel *model,40 const bool PSF)38 bool pmSourceFitModel_EAM (pmSource *source, 39 pmModel *model, 40 const bool PSF) 41 41 { 42 42 PS_PTR_CHECK_NULL(source, false); … … 55 55 // tests below could be conditions (!NULL) 56 56 57 p sModelFunc modelFunc = psModelFunc_GetFunction (model->type);58 p sModelLimits modelLimits = psModelLimits_GetFunction (model->type);57 pmModelFunc modelFunc = pmModelFunc_GetFunction (model->type); 58 pmModelLimits modelLimits = pmModelLimits_GetFunction (model->type); 59 59 60 60 psVector *params = model->params; … … 177 177 /****************************************************************************** 178 178 pmSourceMoments(source, radius): this function takes a subImage defined in the 179 p sSource data structure, along with the peak location, and determines the179 pmSource data structure, along with the peak location, and determines the 180 180 various moments associated with that peak. 181 181 182 182 Requires the following to have been created: 183 p sSource184 p sSource->peak185 p sSource->pixels183 pmSource 184 pmSource->peak 185 pmSource->pixels 186 186 187 187 XXX: The peak calculations are done in image coords, not subImage coords. … … 191 191 # define VALID_RADIUS(X,Y) (((R2) >= (PS_SQR(X) + PS_SQR(Y))) ? 1 : 0) 192 192 193 bool pmSourceMoments_EAM(p sSource *source,193 bool pmSourceMoments_EAM(pmSource *source, 194 194 psF32 radius) 195 195 { … … 310 310 } 311 311 312 bool pmModelFitStatus (p sModel *model) {312 bool pmModelFitStatus (pmModel *model) { 313 313 314 314 bool status; 315 315 316 p sModelFitStatusFunc statusFunc = psModelFitStatusFunc_GetFunction (model->type);316 pmModelFitStatusFunc statusFunc = pmModelFitStatusFunc_GetFunction (model->type); 317 317 status = statusFunc (model); 318 318 -
trunk/psphot/src/psphot.h
r4946 r4949 1 1 # include <pslib.h> 2 # include <pmObjects.h> 2 // # include <pmObjects.h> 3 // my additions and modifications: 4 # include "pmObjects_EAM.h" 3 5 # include <string.h> 4 6 # include <strings.h> … … 7 9 # include <math.h> 8 10 9 # define M_PI 3.14159265358979323846264338328 /* pi */11 // # define M_PI 3.14159265358979323846264338328 /* pi */ 10 12 11 13 typedef struct { … … 18 20 // data to test a given PSF model type 19 21 typedef struct { 20 p sModelType modelType;22 pmModelType modelType; 21 23 pmPSF *psf; 22 24 psArray *sources; // pointers to the original sources … … 61 63 void psphotOutput (psImageData *imdata, psMetadata *config, psArray *sources); 62 64 63 bool psphotMarkPSF (p sSource *source, float shapeNsigma, float minSN, float maxChi, float SATURATE);64 bool psphotSubtractPSF (p sSource *source);65 bool psphotMarkPSF (pmSource *source, float shapeNsigma, float minSN, float maxChi, float SATURATE); 66 bool psphotSubtractPSF (pmSource *source); 65 67 int psphotSortBySN (const void **a, const void **b); 66 68 … … 69 71 70 72 // psf utilities 71 pmPSF *pmPSFAlloc (p sModelType type);73 pmPSF *pmPSFAlloc (pmModelType type); 72 74 pmPSF_Test *pmPSF_TestAlloc (psArray *stars, char *modelName); 73 75 pmPSF_Test *pmPSF_TestModel (psArray *sources, char *modelName, float radius); 74 76 bool pmPSFFromModels (pmPSF *psf, psArray *models, psVector *mask); 75 p sModel *psModelFromPSF (psModel *model, pmPSF *psf);76 bool pmSourcePhotometry (float *fitMag, float *obsMag, p sModel *model, psImage *image, psImage *mask);77 pmModel *pmModelFromPSF (pmModel *model, pmPSF *psf); 78 bool pmSourcePhotometry (float *fitMag, float *obsMag, pmModel *model, psImage *image, psImage *mask); 77 79 bool pmPSFMetricModel (pmPSF_Test *test, float RADIUS); 78 80 … … 83 85 bool pmSourcesWriteCMF (psImageData *imdata, char *filename, psArray *sources); 84 86 bool pmSourcesWriteSX (psImageData *imdata, char *filename, psArray *sources); 85 int pmSourcesDophotType (p sSource *source);86 bool p sPeaksWriteText (psArray *sources, char *filename);87 bool p sMomentsWriteText (psArray *sources, char *filename);88 bool p sModelWritePSFs (psArray *sources, char *filename);89 bool p sModelWriteFLTs (psArray *sources, char *filename);90 bool p sModelWriteNULLs (psArray *sources, char *filename);87 int pmSourcesDophotType (pmSource *source); 88 bool pmPeaksWriteText (psArray *sources, char *filename); 89 bool pmMomentsWriteText (psArray *sources, char *filename); 90 bool pmModelWritePSFs (psArray *sources, char *filename); 91 bool pmModelWriteFLTs (psArray *sources, char *filename); 92 bool pmModelWriteNULLs (psArray *sources, char *filename); 91 93 92 94 // psModule extra utilities 93 bool pmSourceDefinePixels(p sSource *mySource, const psImageData *imdata, psF32 x, psF32 y, psF32 Radius);94 bool pmSourceLocalSky_EAM (p sSource *source, psStatsOptions statsOptions, psF32 Radius);95 bool pmSourceFitModel_EAM(p sSource *source, psModel *model, const bool PSF);96 bool pmSourceMoments_EAM(p sSource *source, psF32 radius);97 bool pmModelFitStatus (p sModel *model);98 int pmSourceDophotType (p sSource *source);95 bool pmSourceDefinePixels(pmSource *mySource, const psImageData *imdata, psF32 x, psF32 y, psF32 Radius); 96 bool pmSourceLocalSky_EAM (pmSource *source, psStatsOptions statsOptions, psF32 Radius); 97 bool pmSourceFitModel_EAM(pmSource *source, pmModel *model, const bool PSF); 98 bool pmSourceMoments_EAM(pmSource *source, psF32 radius); 99 bool pmModelFitStatus (pmModel *model); 100 int pmSourceDophotType (pmSource *source); 99 101 100 102 // minimize … … 114 116 psF32 pmConfigLookupF32 (bool *status, psMetadata *config, psMetadata *header, char *name); 115 117 psVector *psVectorCreate (double lower, double upper, double delta, psElemType type); 116 void psImageMaskRegion (psImage *image, psRegion *region, bool logical_and, int maskValue);117 void psImageKeepRegion (psImage *image, psRegion *region, bool logical_and, int maskValue);118 void psImageMaskCircle (psImage *image, double x, double y, double radius, bool logical_and, int maskValue);119 void psImageKeepCircle (psImage *image, double x, double y, double radius, bool logical_and, int maskValue);118 //void psImageMaskRegion (psImage *image, psRegion *region, bool logical_and, int maskValue); 119 //void psImageKeepRegion (psImage *image, psRegion *region, bool logical_and, int maskValue); 120 //void psImageMaskCircle (psImage *image, double x, double y, double radius, bool logical_and, int maskValue); 121 //void psImageKeepCircle (psImage *image, double x, double y, double radius, bool logical_and, int maskValue); 120 122 psVector *psGetRowVectorFromImage(psImage *image, psU32 row); 121 123 122 124 // basic image functions 123 125 bool psImageInit (psImage *image,...); 124 void psImageSmooth (psImage *image, float sigma, float Nsigma);125 psRegion *psRegionForImage (psRegion *out, psImage *image, psRegion *in);126 //void psImageSmooth (psImage *image, float sigma, float Nsigma); 127 //psRegion *psRegionForImage (psRegion *out, psImage *image, psRegion *in); 126 128 psRegion *psRegionSquare (psF32 x, psF32 y, psF32 radius); 127 129 int psphotSaveImage (psMetadata *header, psImage *image, char *filename); … … 153 155 int fs_usage (); 154 156 bool DumpImage (psImage *image, char *filename); 155 156 // deprecated157 // void pmSourceMaskRegion (psSource *source, psRegion *region);158 //psVector *p_psGetRowVectorFromImage(psImage *image, psU32 row); -
trunk/psphot/src/psphotApplyPSF.c
r4946 r4949 31 31 32 32 // this function specifies the radius at this the model hits the given flux 33 p sModelRadius modelRadius = psModelRadius_GetFunction (psf->type);33 pmModelRadius modelRadius = pmModelRadius_GetFunction (psf->type); 34 34 35 35 for (int i = 0; i < sources->n; i++) { 36 36 37 p sSource *source = sources->data[i];37 pmSource *source = sources->data[i]; 38 38 39 39 // skip non-astronomical objects (very likely defects) … … 43 43 44 44 // use the source moments, etc to guess basic model parameters 45 p sModel *modelFLT = pmSourceModelGuess (source, psf->type);45 pmModel *modelFLT = pmSourceModelGuess (source, psf->type); 46 46 47 47 // set PSF parameters for this model 48 p sModel *model = psModelFromPSF (modelFLT, psf);48 pmModel *model = pmModelFromPSF (modelFLT, psf); 49 49 x = model->params->data.F32[2]; 50 50 y = model->params->data.F32[3]; … … 66 66 67 67 // fit PSF model (set/unset the pixel mask) 68 psImageKeepCircle (source->mask, x, y, model->radius, OR, PSPHOT_MASK_KEEP);68 psImageKeepCircle (source->mask, x, y, model->radius, "or", PSPHOT_MASK_KEEP); 69 69 status = pmSourceFitModel (source, model, true); 70 psImageKeepCircle (source->mask, x, y, model->radius, AND, ~PSPHOT_MASK_KEEP);70 psImageKeepCircle (source->mask, x, y, model->radius, "and", ~PSPHOT_MASK_KEEP); 71 71 if (!status || (model->params->data.F32[1] < 0)) { 72 72 psLogMsg ("psphot", 3, "PSF fit failed for %f, %f (%d iterations)\n", x, y, model->nIter); -
trunk/psphot/src/psphotChoosePSF.c
r4946 r4949 17 17 // select the candidate PSF stars (pointers to original sources) 18 18 for (int i = 0; i < sources->n; i++) { 19 p sSource *source = sources->data[i];19 pmSource *source = sources->data[i]; 20 20 if (source->type != PS_SOURCE_PSFSTAR) continue; 21 21 psArrayAdd (stars, 200, source); … … 35 35 36 36 // set up an array to store the test results 37 psArray *tests = psArrayAlloc (list->size); 38 // XXX EAM : new value : psArray *tests = psArrayAlloc (list->n); 37 psArray *tests = psArrayAlloc (list->n); 39 38 40 39 // test each model option listed in config … … 68 67 // keep only the selected test: 69 68 test = tests->data[bestN]; 70 modelName = p sModelGetType (test->modelType);69 modelName = pmModelGetType (test->modelType); 71 70 psLogMsg ("psphot.pspsf", 3, "selected psf model %s, ApResid: %f +/- %f\n", modelName, test->ApResid, test->dApResid); 72 71 … … 77 76 // set source->model based on best psf model fit 78 77 for (int i = 0; i < test->sources->n; i++) { 79 p sSource *source = test->sources->data[i];78 pmSource *source = test->sources->data[i]; 80 79 // drop masked sources from PSFSTAR list 81 80 if (test->mask->data.U8[i]) { -
trunk/psphot/src/psphotFitGalaxies.c
r4946 r4949 21 21 22 22 char *modelName = psMetadataLookupPtr (&status, config, "GAL_MODEL"); 23 p sModelType modelType = psModelSetType (modelName);24 p sModelRadius modelRadius = psModelRadius_GetFunction (modelType);23 pmModelType modelType = pmModelSetType (modelName); 24 pmModelRadius modelRadius = pmModelRadius_GetFunction (modelType); 25 25 26 26 psTimerStart ("psphot"); 27 27 28 28 for (int i = 0; i < sources->n; i++) { 29 p sSource *source = sources->data[i];29 pmSource *source = sources->data[i]; 30 30 31 31 // sources which should not be fitted … … 50 50 51 51 // recalculate the source moments using the larger galaxy moments radius 52 status = pmSourceMoments _EAM(source, GAL_MOMENTS_RAD);52 status = pmSourceMoments (source, GAL_MOMENTS_RAD); 53 53 if (!status) { 54 54 source->type = PS_SOURCE_DROP_GALAXY; // better choice? … … 57 57 58 58 // use the source moments, etc to guess basic model parameters 59 p sModel *model = pmSourceModelGuess (source, modelType);59 pmModel *model = pmSourceModelGuess (source, modelType); 60 60 x = model->params->data.F32[2]; 61 61 y = model->params->data.F32[3]; … … 75 75 // fit FLT (not PSF) model (set/unset the pixel mask) 76 76 psImageKeepCircle (source->mask, x, y, model->radius, OR, PSPHOT_MASK_KEEP); 77 status = pmSourceFitModel _EAM(source, model, false);77 status = pmSourceFitModel (source, model, false); 78 78 psImageKeepCircle (source->mask, x, y, model->radius, AND, ~PSPHOT_MASK_KEEP); 79 79 if (!status) { -
trunk/psphot/src/psphotMarkPSF.c
r4946 r4949 24 24 # define MIN_DS 0.01 25 25 26 bool psphotMarkPSF (p sSource *source, float shapeNsigma, float minSN, float maxChi, float SATURATE)26 bool psphotMarkPSF (pmSource *source, float shapeNsigma, float minSN, float maxChi, float SATURATE) 27 27 { 28 28 int keep; -
trunk/psphot/src/psphotOutput.c
r4946 r4949 52 52 53 53 sprintf (name, "%s.psf.dat", filename); 54 p sModelWritePSFs (sources, name);54 pmModelWritePSFs (sources, name); 55 55 56 56 sprintf (name, "%s.flt.dat", filename); 57 p sModelWriteFLTs (sources, name);57 pmModelWriteFLTs (sources, name); 58 58 59 59 sprintf (name, "%s.nul.dat", filename); 60 p sModelWriteNULLs (sources, name);60 pmModelWriteNULLs (sources, name); 61 61 62 62 sprintf (name, "%s.mnt.dat", filename); 63 p sMomentsWriteText (sources, name);63 pmMomentsWriteText (sources, name); 64 64 65 65 psFree (name); … … 71 71 72 72 int i, type, status; 73 p sModel *model;73 pmModel *model; 74 74 psF32 *PAR, *dPAR; 75 75 float sky, dmag, apMag, fitMag; … … 85 85 // write sources with models first 86 86 for (i = 0; i < sources->n; i++) { 87 p sSource *source = (psSource *) sources->data[i];87 pmSource *source = (pmSource *) sources->data[i]; 88 88 89 89 // use the correct model … … 162 162 163 163 int i, status, flags; 164 p sModel *model;164 pmModel *model; 165 165 psF32 *PAR, *dPAR; 166 166 float sky, dmag, apMag, fitMag; … … 176 176 // write sources with models first 177 177 for (i = 0; i < sources->n; i++) { 178 p sSource *source = (psSource *) sources->data[i];178 pmSource *source = (pmSource *) sources->data[i]; 179 179 flags = 0; 180 180 … … 260 260 261 261 int i, type, status; 262 p sModel *model;262 pmModel *model; 263 263 psF32 *PAR, *dPAR; 264 264 float sky, dmag, apMag, fitMag, lsky, Theta; … … 282 282 // write sources with models first 283 283 for (i = 0; i < sources->n; i++) { 284 p sSource *source = (psSource *) sources->data[i];284 pmSource *source = (pmSource *) sources->data[i]; 285 285 286 286 // use the correct model … … 395 395 396 396 // write the moments to an output file 397 bool p sMomentsWriteText (psArray *sources, char *filename) {397 bool pmMomentsWriteText (psArray *sources, char *filename) { 398 398 399 399 int i; 400 400 FILE *f; 401 p sSource *source;401 pmSource *source; 402 402 403 403 f = fopen (filename, "w"); 404 404 if (f == NULL) { 405 psLogMsg ("p sMomentsWriteText", 3, "can't open output file for moments%s\n", filename);406 return false; 407 } 408 409 for (i = 0; i < sources->n; i++) { 410 source = (p sSource *) sources->data[i];405 psLogMsg ("pmMomentsWriteText", 3, "can't open output file for moments%s\n", filename); 406 return false; 407 } 408 409 for (i = 0; i < sources->n; i++) { 410 source = (pmSource *) sources->data[i]; 411 411 if (source->moments == NULL) continue; 412 412 fprintf (f, "%5d %5d %7.1f %7.1f %7.1f %6.3f %6.3f %8.1f %7.1f %7.1f %7.1f %4d %2d\n", … … 423 423 424 424 // dump the sources to an output file 425 bool p sModelWritePSFs (psArray *sources, char *filename) {425 bool pmModelWritePSFs (psArray *sources, char *filename) { 426 426 427 427 double dP, flux; … … 430 430 psVector *params; 431 431 psVector *dparams; 432 p sModel *model;432 pmModel *model; 433 433 434 434 f = fopen (filename, "w"); 435 435 if (f == NULL) { 436 psLogMsg ("p sModelWritePSFs", 3, "can't open output file for moments%s\n", filename);436 psLogMsg ("pmModelWritePSFs", 3, "can't open output file for moments%s\n", filename); 437 437 return false; 438 438 } … … 440 440 // write sources with models first 441 441 for (i = 0; i < sources->n; i++) { 442 p sSource *source = (psSource *) sources->data[i];443 model = (p sModel *) source->modelPSF;442 pmSource *source = (pmSource *) sources->data[i]; 443 model = (pmModel *) source->modelPSF; 444 444 if (model == NULL) continue; 445 445 … … 459 459 dP = sqrt (dP); 460 460 461 p sModelFlux modelFluxFunc = psModelFlux_GetFunction (model->type);461 pmModelFlux modelFluxFunc = pmModelFlux_GetFunction (model->type); 462 462 flux = modelFluxFunc (params); 463 463 … … 489 489 490 490 // dump the sources to an output file 491 bool p sModelWriteFLTs (psArray *sources, char *filename) {491 bool pmModelWriteFLTs (psArray *sources, char *filename) { 492 492 493 493 double dP; … … 496 496 psVector *params; 497 497 psVector *dparams; 498 p sModel *model;498 pmModel *model; 499 499 500 500 f = fopen (filename, "w"); 501 501 if (f == NULL) { 502 psLogMsg ("p sModelWriteFLTs", 3, "can't open output file for moments%s\n", filename);502 psLogMsg ("pmModelWriteFLTs", 3, "can't open output file for moments%s\n", filename); 503 503 return false; 504 504 } … … 506 506 // write sources with models first 507 507 for (i = 0; i < sources->n; i++) { 508 p sSource *source = (psSource *) sources->data[i];509 model = (p sModel *) source->modelFLT;508 pmSource *source = (pmSource *) sources->data[i]; 509 model = (pmModel *) source->modelFLT; 510 510 if (model == NULL) continue; 511 511 if (source->type == PS_SOURCE_GALAXY) goto valid; … … 551 551 552 552 // dump the sources to an output file 553 bool p sModelWriteNULLs (psArray *sources, char *filename)553 bool pmModelWriteNULLs (psArray *sources, char *filename) 554 554 { 555 555 … … 563 563 } 564 564 565 p sMoments *empty = pmMomentsAlloc ();565 pmMoments *empty = pmMomentsAlloc (); 566 566 567 567 // write sources with models first 568 568 for (i = 0; i < sources->n; i++) { 569 p sSource *source = (psSource *) sources->data[i];569 pmSource *source = (pmSource *) sources->data[i]; 570 570 571 571 // skip these sources (in PSF or FLT) … … 598 598 599 599 // translations between psphot object types and dophot object types 600 int pmSourceDophotType (p sSource *source) {600 int pmSourceDophotType (pmSource *source) { 601 601 602 602 switch (source->type) { -
trunk/psphot/src/psphotSetup.c
r4946 r4949 73 73 float YMIN = psMetadataLookupF32 (&status, config, "YMIN"); 74 74 float YMAX = psMetadataLookupF32 (&status, config, "YMAX"); 75 psRegion *keep = psRegionAlloc(XMIN, XMAX, YMIN, YMAX);76 keep = psRegionForImage ( keep, image,keep);77 psImageKeepRegion (mask, keep, OR, PSPHOT_MASK_INVALID);78 psFree (keep);75 psRegion keep = psRegionSet (XMIN, XMAX, YMIN, YMAX); 76 keep = psRegionForImage (image, &keep); 77 psImageKeepRegion (mask, &keep, OR, PSPHOT_MASK_INVALID); 78 // XXX EAM : psRegionForImage should not take psRegion *keep 79 79 80 80 // mask the saturated pixels -
trunk/psphot/src/psphotSortBySN.c
r4946 r4949 4 4 int psphotSortBySN (const void **a, const void **b) 5 5 { 6 p sSource *A = *(psSource **)a;7 p sSource *B = *(psSource **)b;6 pmSource *A = *(pmSource **)a; 7 pmSource *B = *(pmSource **)b; 8 8 9 9 psF32 fA = (A->moments == NULL) ? 0 : A->moments->SN; -
trunk/psphot/src/psphotSourceStats.c
r4946 r4949 19 19 20 20 // create a new source, add peak 21 p sSource *source = pmSourceAlloc();22 source->peak = (p sPeak *)psMemCopy(peaks->data[i]);21 pmSource *source = pmSourceAlloc(); 22 source->peak = (pmPeak *)psMemCopy(peaks->data[i]); 23 23 24 24 // allocate image, noise, mask arrays for each peak (square of radius OUTER) -
trunk/psphot/src/psphotSubtractPSF.c
r4946 r4949 4 4 // need to control application of this with some thresholding 5 5 6 bool psphotSubtractPSF (p sSource *source)6 bool psphotSubtractPSF (pmSource *source) 7 7 { 8 8 float sky; 9 p sModel *model;9 pmModel *model; 10 10 psImage *pixels; 11 11 -
trunk/psphot/src/pspsf.c
r4901 r4949 10 10 11 11 // a PSF always has 4 parameters fewer than the equivalent model 12 pmPSF *pmPSFAlloc (p sModelType type) {12 pmPSF *pmPSFAlloc (pmModelType type) { 13 13 14 14 int Nparams; … … 19 19 psf->chisq = 0.0; 20 20 21 Nparams = p sModelParameterCount (type);21 Nparams = pmModelParameterCount (type); 22 22 if (!Nparams) { 23 psError(PS_ERR_UNKNOWN, true, "Undefined p sModelType");23 psError(PS_ERR_UNKNOWN, true, "Undefined pmModelType"); 24 24 return(NULL); 25 25 } … … 54 54 55 55 // XXX probably need to increment ref counter 56 test->modelType = p sModelSetType (modelName);56 test->modelType = pmModelSetType (modelName); 57 57 test->psf = pmPSFAlloc (test->modelType); 58 58 test->sources = psMemCopy(sources); … … 99 99 for (int i = 0; i < test->sources->n; i++) { 100 100 101 p sSource *source = test->sources->data[i];102 p sModel *model = pmSourceModelGuess (source, test->modelType);101 pmSource *source = test->sources->data[i]; 102 pmModel *model = pmSourceModelGuess (source, test->modelType); 103 103 x = source->peak->x; 104 104 y = source->peak->y; … … 134 134 if (test->mask->data.U8[i]) continue; 135 135 136 p sSource *source = test->sources->data[i];137 p sModel *modelFLT = test->modelFLT->data[i];136 pmSource *source = test->sources->data[i]; 137 pmModel *modelFLT = test->modelFLT->data[i]; 138 138 139 139 // set shape for this model based on PSF 140 p sModel *modelPSF = psModelFromPSF (modelFLT, test->psf);140 pmModel *modelPSF = pmModelFromPSF (modelFLT, test->psf); 141 141 x = source->peak->x; 142 142 y = source->peak->y; … … 185 185 } 186 186 187 // input: an array of p sModels, pre-allocated psf187 // input: an array of pmModels, pre-allocated psf 188 188 // some of the array entries may be NULL, ignore them 189 189 bool pmPSFFromModels (pmPSF *psf, psArray *models, psVector *mask) { … … 197 197 198 198 for (int i = 0; i < models->n; i++) { 199 p sModel *model = models->data[i];199 pmModel *model = models->data[i]; 200 200 if (model == NULL) continue; 201 201 … … 211 211 for (int i = 0; i < psf->params->n; i++) { 212 212 for (int j = 0; j < models->n; j++) { 213 p sModel *model = models->data[j];213 pmModel *model = models->data[j]; 214 214 if (model == NULL) continue; 215 215 z->data.F64[j] = model->params->data.F32[i + 4]; … … 231 231 } 232 232 233 p sModel *psModelFromPSF (psModel *modelFLT, pmPSF *psf) {233 pmModel *pmModelFromPSF (pmModel *modelFLT, pmPSF *psf) { 234 234 235 235 // need to define the relationship between the modelFLT and modelPSF ? 236 236 237 237 // find function used to set the model parameters 238 p sModelFromPSFFunc modelFromPSFFunc = psModelFromPSFFunc_GetFunction (psf->type);238 pmModelFromPSFFunc modelFromPSFFunc = pmModelFromPSFFunc_GetFunction (psf->type); 239 239 240 240 // do we need a different model for the PSF vs FLT version? 241 p sModel *modelPSF = psModelAlloc (psf->type);241 pmModel *modelPSF = pmModelAlloc (psf->type); 242 242 243 243 // set model parameters for this source based on PSF information
Note:
See TracChangeset
for help on using the changeset viewer.
