- Timestamp:
- Jul 29, 2010, 2:36:33 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20100621/psphot/src/psphotAddNoise.c
r28013 r28782 34 34 35 35 bool status = false; 36 psEllipseShape oldshape;37 psEllipseShape newshape;38 psEllipseAxes axes;39 36 40 37 // find the currently selected readout … … 78 75 } 79 76 77 psphotSaveImage (NULL, readout->variance, "test.var0.fits"); 78 80 79 // loop over all source 81 80 for (int i = 0; i < sources->n; i++) { … … 86 85 if (!(source->tmpFlags & PM_SOURCE_TMPF_SUBTRACTED)) continue; 87 86 88 // select appropriate model 89 pmModel *model = pmSourceGetModel (NULL, source); 90 if (model == NULL) continue; // model must be defined 91 92 if (add) { 93 psTrace ("psphot", 4, "adding noise for object at %f,%f\n", model->params->data.F32[PM_PAR_XPOS], model->params->data.F32[PM_PAR_YPOS]); 94 } else { 95 psTrace ("psphot", 4, "remove noise for object at %f,%f\n", model->params->data.F32[PM_PAR_XPOS], model->params->data.F32[PM_PAR_YPOS]); 96 } 97 98 psF32 *PAR = model->params->data.F32; 99 100 // save original values 101 float oldI0 = PAR[PM_PAR_I0]; 102 oldshape.sx = PAR[PM_PAR_SXX]; 103 oldshape.sy = PAR[PM_PAR_SYY]; 104 oldshape.sxy = PAR[PM_PAR_SXY]; 105 106 // XXX can this be done more intelligently? 107 if (oldI0 == 0.0) continue; 108 if (!isfinite(oldI0)) continue; 109 110 // increase size and height of source 111 axes = psEllipseShapeToAxes (oldshape, 20.0); 112 axes.major *= SIZE; 113 axes.minor *= SIZE; 114 newshape = psEllipseAxesToShape (axes); 115 PAR[PM_PAR_I0] = FACTOR*oldI0; 116 PAR[PM_PAR_SXX] = newshape.sx; 117 PAR[PM_PAR_SYY] = newshape.sy; 118 PAR[PM_PAR_SXY] = newshape.sxy; 119 120 // XXX if we use pmSourceOp, the size (and possibly Io) will not be respected 121 pmSourceOp (source, PM_MODEL_OP_FULL | PM_MODEL_OP_NOISE, add, maskVal, 0, 0); 122 123 // restore original values 124 PAR[PM_PAR_I0] = oldI0; 125 PAR[PM_PAR_SXX] = oldshape.sx; 126 PAR[PM_PAR_SYY] = oldshape.sy; 127 PAR[PM_PAR_SXY] = oldshape.sxy; 87 pmSourceNoiseOp (source, PM_MODEL_OP_FULL | PM_MODEL_OP_NOISE, FACTOR, SIZE, add, maskVal, 0, 0); 128 88 } 129 89 if (add) { … … 132 92 psLogMsg ("psphot.noise", PS_LOG_INFO, "sub noise for %ld objects: %f sec\n", sources->n, psTimerMark ("psphot.noise")); 133 93 } 94 95 psphotSaveImage (NULL, readout->variance, "test.var1.fits"); 134 96 return true; 135 97 }
Note:
See TracChangeset
for help on using the changeset viewer.
