Changeset 4251 for trunk/psphot/src/setup.c
- Timestamp:
- Jun 14, 2005, 3:23:24 AM (21 years ago)
- File:
-
- 1 edited
-
trunk/psphot/src/setup.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/src/setup.c
r4216 r4251 13 13 psImage *noise = NULL; 14 14 psImage *mask = NULL; 15 16 psRegion region = {0,0,0,0}; // a region representing the entire array15 psRegion region = {0,0,0,0}; // a region representing the entire array 16 bool status; 17 17 18 18 psTimerStart ("psphot"); … … 24 24 25 25 // read header and image data from INPUT 26 char *input = psMetadataLookup STR(&status, config, "INPUT");26 char *input = psMetadataLookupPtr (&status, config, "INPUT"); 27 27 psFits *file = psFitsAlloc (input); 28 28 header = psFitsReadHeader (header, file); … … 31 31 32 32 // grab these values from the approrpiate location (image header if necessary) 33 bool status = false;34 33 float RDNOISE = pmConfigLookupF32 (&status, config, header, "RDNOISE"); 35 34 float GAIN = pmConfigLookupF32 (&status, config, header, "GAIN"); … … 38 37 39 38 // load the noise image if it is supplied, otherwise build from input 40 char *noiseName = psMetadataLookup STR(&status, config, "NOISE");39 char *noiseName = psMetadataLookupPtr (&status, config, "NOISE"); 41 40 if (status == true) { 42 41 file = psFitsAlloc (noiseName); … … 44 43 psFree (file); 45 44 } else { 46 psScalar *value = psScalarAlloc (1.0 / GAIN, PS_TYPE_F64); 47 noise = BinaryOp (NULL, image, '/', value); 45 psScalar *value; 46 47 noise = psImageAlloc (image->numCols, image->numRows, PS_TYPE_F32); 48 for (int iy = 0; iy < image->numRows; iy++) { 49 for (int ix = 0; ix < image->numCols; ix++) { 50 noise->data.F32[iy][ix] = image->data.F32[iy][ix] / GAIN + PS_SQR(RDNOISE/GAIN); 51 } 52 } 53 54 // XXX EAM it looks like psBinaryOp is broken for (image op scalar) 55 # if (0) 56 value = psScalarAlloc (1.0 / GAIN, PS_TYPE_F64); 57 noise = (psImage *) psBinaryOp (NULL, image, "/", value); 48 58 psFree (value); 49 59 50 psScalar *value = psScalarAlloc (PS_SQR(RDNOISE/GAIN), PS_TYPE_F64);51 noise = BinaryOp (noise, noise, '+', value);60 value = psScalarAlloc (PS_SQR(RDNOISE/GAIN), PS_TYPE_F64); 61 noise = (psImage *) psBinaryOp (noise, noise, "+", value); 52 62 psFree (value); 63 # endif 53 64 } 54 65 55 char *maskName = psMetadataLookup STR(&status, config, "MASK");66 char *maskName = psMetadataLookupPtr (&status, config, "MASK"); 56 67 if (status == true) { 57 68 file = psFitsAlloc (maskName); … … 67 78 psRegion *keep = psRegionAlloc (XBORDER, -XBORDER, YBORDER, -YBORDER); 68 79 keep = psRegionForImage (keep, image, keep); 69 psImageKeepRegion (mask, keep, 0x01);80 psImageKeepRegion (mask, keep, OR, 0x01); 70 81 71 82 // mask the saturated pixels … … 87 98 imdata->mask = mask; 88 99 89 return ( true);100 return (imdata); 90 101 }
Note:
See TracChangeset
for help on using the changeset viewer.
