Changeset 15017
- Timestamp:
- Sep 25, 2007, 12:05:51 PM (19 years ago)
- Location:
- trunk/psphot
- Files:
-
- 1 added
- 3 edited
-
doc/psfmodel.txt (modified) (1 diff)
-
src/psphotCheckStarDistribution.c (added)
-
src/psphotChoosePSF.c (modified) (4 diffs)
-
src/psphotRadialPlot.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/doc/psfmodel.txt
r15000 r15017 1 2 2007.09.25 3 4 The PSF model has parameters which vary across the image. This 2D 5 is can be represented as either a polynomial (ordinary or chebychev) 6 or as an image map. The user requests the maximum X & Y scale 7 (PSF.TREND.NX & PSF.TREND.NY) for the variations, and 8 psphotChoosePSF / pmPSFtry attempt to find the best choice for the 9 scale. For the polynomial representations, NX and NY are the order 10 of the variation. For the image map, NX and NY are the size of the 11 image map. 1 12 2 13 2007.09.21 -
trunk/psphot/src/psphotChoosePSF.c
r15000 r15017 62 62 63 63 pmSourceFitModelInit (15, 0.01, PS_SQR(SKY_SIG), options->poissonErrorsPhotLMM); 64 65 // check that the identified psf stars sufficiently cover the region; if not, extend the 66 // limits somewhat 67 // psphotCheckStarDistribution (sources, options); 64 68 65 69 psArray *stars = psArrayAllocEmpty (sources->n); … … 86 90 87 91 // get the list pointers for the PSF_MODEL entries 88 ps List *list= NULL;89 psMetadataItem * mdi= psMetadataLookup (recipe, "PSF_MODEL");90 if ( mdi== NULL) psAbort("missing PSF_MODEL selection");91 92 if ( mdi->type == PS_DATA_STRING) {93 list = psListAlloc(NULL);94 psListAdd (list, PS_LIST_HEAD, mdi);92 psArray *modelNames = NULL; 93 psMetadataItem *item = psMetadataLookup (recipe, "PSF_MODEL"); 94 if (item == NULL) psAbort("missing PSF_MODEL selection"); 95 96 if (item->type == PS_DATA_STRING) { 97 modelNames = psArrayAlloc(1); 98 modelNames->data[0] = psStringCopy (item->data.V); 95 99 } else { 96 if ( mdi->type != PS_DATA_METADATA_MULTI) psAbort("missing PSF_MODEL selection");97 list = psMemIncrRefCounter(mdi->data.list);100 if (item->type != PS_DATA_METADATA_MULTI) psAbort("missing PSF_MODEL selection"); 101 modelNames = psListToArray (item->data.list); 98 102 } 99 103 100 104 // set up an array to store the results 101 psArray *models = psArrayAlloc ( list->n);105 psArray *models = psArrayAlloc (modelNames->n); 102 106 103 107 // try each model option listed in config 104 psListIterator *iter = psListIteratorAlloc (list, PS_LIST_HEAD, FALSE); 105 for (int i = 0; i < models->n; i++) { 106 psMetadataItem *item = psListGetAndIncrement (iter); 107 char *modelName = item->data.V; 108 for (int i = 0; i < modelNames->n; i++) { 109 char *modelName = modelNames->data[i]; 108 110 models->data[i] = pmPSFtryModel (stars, modelName, options, maskVal, mark); 109 111 } 110 111 psFree (iter);112 psFree (list);113 psFree (stars);114 112 115 113 // select the best of the models … … 120 118 pmPSFtry *try = models->data[i]; 121 119 if (try == NULL) { 122 ps Error(PSPHOT_ERR_PSF, false, "PSF model %d is NULL", i);120 psTrace ("psphot", 3, "PSF model %d is NULL", i); 123 121 continue; 124 122 } … … 132 130 // use the best model: 133 131 if (bestN < 0) { 134 psError (PSPHOT_ERR_DATA, false, "Failed to fit any models when choosing PSF");135 132 psFree (models); 136 return NULL; 137 } 133 psFree (stars); 134 135 // XXX optionally give up here 136 // generate a psf model using the first selection 137 psError(PSPHOT_ERR_PSF, false, "Failed to fit any models when choosing PSF"); 138 psErrorStackPrint (stderr, "Using guess PSF model"); 139 psErrorClear (); 140 141 // unset the PSFSTAR flags (none are used): 142 for (int i = 0; i < sources->n; i++) { 143 pmSource *source = sources->data[i]; 144 source->mode &= ~PM_SOURCE_MODE_PSFSTAR; 145 } 146 147 // XXX set sxx, etc from FWHM in recipe 148 pmPSF *psf = pmPSFBuildSimple (modelNames->data[0], 1.0, 1.0, 0.0, 1.0); 149 psf->fieldNx = readout->image->numCols; 150 psf->fieldNy = readout->image->numRows; 151 psFree (modelNames); 152 153 bool status = true; 154 status &= psphotMakeFluxScale (readout->image, recipe, psf); 155 status &= psphotPSFstats (readout, recipe, psf); 156 if (!status) { 157 psError(PSPHOT_ERR_PSF, false, "Failed to fit any models when choosing PSF"); 158 psFree (psf); 159 return NULL; 160 } 161 162 // XXX set DSX_MEAN, etc? 163 return psf; 164 } 165 166 psFree (modelNames); 167 psFree (stars); 138 168 139 169 pmPSFtry *try = models->data[bestN]; 140 141 // print/dump psf parameters142 if (psTraceGetLevel("psphot") >= 5) {143 for (int i = PM_PAR_SXX; i < try->psf->params->n; i++) {144 // XXX re-write the output or some other status info145 }146 }147 170 148 171 // measure and save the median value of dparams[PM_PAR_SXX],dparams[PM_PAR_SYY] -
trunk/psphot/src/psphotRadialPlot.c
r13477 r15017 24 24 // XXX 'showWindow = false' is broken 25 25 if (*kapa == 0) { 26 *kapa = pmKapaOpen ( true);26 *kapa = pmKapaOpen (false); 27 27 KapaResize (*kapa, 500, 500); 28 28 unlink (filename);
Note:
See TracChangeset
for help on using the changeset viewer.
