Changeset 13035 for trunk/psphot/src/psphotOutput.c
- Timestamp:
- Apr 25, 2007, 3:35:50 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/psphot/src/psphotOutput.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/src/psphotOutput.c
r13008 r13035 59 59 for (int j = 0; j < source->pixels->numCols; j++) { 60 60 // skip masked points 61 if (source->mask ->data.U8[i][j]) {61 if (source->maskObj->data.U8[i][j]) { 62 62 continue; 63 63 } … … 72 72 source->pixels->data.F32[i][j], 73 73 1.0 / source->weight->data.F32[i][j], 74 source->mask ->data.U8[i][j]);74 source->maskObj->data.U8[i][j]); 75 75 } 76 76 } … … 104 104 for (int i = 0; (sources != NULL) && (i < sources->n); i++) { 105 105 pmSource *source = (pmSource *) sources->data[i]; 106 pmModel *model = pmSource SelectModel (source);106 pmModel *model = pmSourceGetModel (NULL, source); 107 107 if (model == NULL) 108 108 continue; … … 154 154 return header; 155 155 } 156 157 # if (0)158 // output functions: we have several fixed modes (sx, obj, cmp)159 void psphotOutput (pmReadout *readout, psMetadata *arguments) {160 161 bool status;162 char *outputFile = NULL;163 164 psMetadata *header = pmReadoutGetHeader (readout);165 166 pmPSF *psf = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.PSF");167 // sample PSF images??168 if (psfSample != NULL) psphotSamplePSFs (psf, readout->image, psfSample);169 if (psfSample != NULL) psphotSamplePSFs (psf, readout->image, psfSample);170 171 if (psfFile != NULL) {172 psMetadata *psfData = pmPSFtoMD (NULL, psf);173 psMetadataConfigWrite (psfData, psfFile);174 psFree (psfData);175 }176 }177 178 psImage *pmModelPSFatXY (psImage *image, pmModel *modelEXT, pmPSF *psf, int x, int y, int dx, int dy) {179 180 psRegion region = {x - dx, x + dx, y - dy, y + dy};181 psImage *view = psImageSubset (image, region);182 psImage *sample = psImageCopy (NULL, view, PS_TYPE_F32);183 psImageInit (sample, 0);184 modelEXT->params->data.F32[2] = x;185 modelEXT->params->data.F32[3] = y;186 pmModel *modelPSF = pmModelFromPSF (modelEXT, psf);187 pmModelAdd (sample, NULL, modelPSF, false, false);188 psFree (modelPSF);189 return (sample);190 }191 192 bool psphotSamplePSFs (pmPSF *psf, psImage *image, char *output) {193 194 // make sample PSFs for 4 corners and the center195 psImage *sample;196 197 // optional dump of all rough source data198 if (output[0] == 0) return false;199 200 pmModel *modelEXT = pmModelAlloc (psf->type);201 modelEXT->params->data.F32[0] = 0;202 modelEXT->params->data.F32[1] = 1;203 204 psFits *fits = psFitsOpen (output, "w");205 206 // the centers are in parent coordinates; they do not need to correspond to valid pixels...207 sample = pmModelPSFatXY (image, modelEXT, psf, 25, 25, 25, 25);208 psFitsWriteImage (fits, NULL, sample, 0);209 sample = pmModelPSFatXY (image, modelEXT, psf, image->numCols - 25, image->numRows - 25, 25, 25);210 psFitsWriteImage (fits, NULL, sample, 0);211 sample = pmModelPSFatXY (image, modelEXT, psf, image->numCols - 25, 25, 25, 25);212 psFitsWriteImage (fits, NULL, sample, 0);213 sample = pmModelPSFatXY (image, modelEXT, psf, 25, image->numRows - 25, 25, 25);214 psFitsWriteImage (fits, NULL, sample, 0);215 sample = pmModelPSFatXY (image, modelEXT, psf, image->numCols / 2, image->numRows / 2, 25, 25);216 psFitsWriteImage (fits, NULL, sample, 0);217 218 psFitsClose (fits);219 return (TRUE);220 }221 # endif
Note:
See TracChangeset
for help on using the changeset viewer.
