Changeset 5049 for trunk/psphot/src/psphotSetup.c
- Timestamp:
- Sep 13, 2005, 4:06:55 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/psphot/src/psphotSetup.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/src/psphotSetup.c
r4954 r5049 5 5 // apply X/Y border info 6 6 // apply the SATURATE mask? 7 // load or construct the noise7 // load or construct the weight 8 8 9 psImageData*psphotSetup (psMetadata *config)9 eamReadout *psphotSetup (psMetadata *config) 10 10 { 11 11 psMetadata *header = NULL; 12 12 psImage *image = NULL; 13 psImage * noise= NULL;13 psImage *weight = NULL; 14 14 psImage *mask = NULL; 15 15 psRegion region = {0,0,0,0}; // a region representing the entire array … … 39 39 psMetadataAdd (config, PS_LIST_TAIL, "GAIN", PS_META_F32 | PS_META_REPLACE, "gain value used", GAIN); 40 40 41 // load the noise image if it is supplied, otherwise build from input 42 char *noiseName = psMetadataLookupPtr (&status, config, "NOISE"); 41 // load the weight image if it is supplied, otherwise build from input 42 // by 'weight' we really mean variance image 43 char *weightName = psMetadataLookupPtr (&status, config, "WEIGHT"); 43 44 if (status == true) { 44 file = psFitsAlloc ( noiseName);45 noise= psFitsReadImage (NULL, file, region, 0);45 file = psFitsAlloc (weightName); 46 weight = psFitsReadImage (NULL, file, region, 0); 46 47 psFree (file); 47 // psFree ( noiseName); XXX - see psFree (input)48 // psFree (weightName); XXX - see psFree (input) 48 49 } else { 49 // build the noiseimage from the input image, RDNOISE, and GAIN50 noise= psImageAlloc (image->numCols, image->numRows, PS_TYPE_F32);50 // build the weight image from the input image, RDNOISE, and GAIN 51 weight = psImageAlloc (image->numCols, image->numRows, PS_TYPE_F32); 51 52 for (int iy = 0; iy < image->numRows; iy++) { 52 53 for (int ix = 0; ix < image->numCols; ix++) { 53 noise->data.F32[iy][ix] = image->data.F32[iy][ix] / GAIN + PS_SQR(RDNOISE/GAIN);54 weight->data.F32[iy][ix] = image->data.F32[iy][ix] / GAIN + PS_SQR(RDNOISE/GAIN); 54 55 } 55 56 } … … 92 93 93 94 // save the image data & return it 94 psImageData *imdata = psImageDataAlloc(image, noise, mask, header);95 eamReadout *imdata = eamReadoutAlloc(image, weight, mask, header); 95 96 return (imdata); 96 97 }
Note:
See TracChangeset
for help on using the changeset viewer.
