Changeset 12689 for trunk/psphot/src/psphotAddNoise.c
- Timestamp:
- Mar 29, 2007, 4:48:20 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/psphot/src/psphotAddNoise.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/src/psphotAddNoise.c
r12635 r12689 4 4 5 5 bool status = false; 6 psTimerStart ("psphot"); 6 psEllipseShape oldshape; 7 psEllipseShape newshape; 8 psEllipseAxes axes; 7 9 8 10 PS_ASSERT (readout, false); 9 11 PS_ASSERT (readout->parent, false); 10 12 PS_ASSERT (readout->parent->concepts, false); 13 14 psTimerStart ("psphot"); 11 15 12 16 // increase variance by factor*(object noise): … … 15 19 16 20 float FACTOR = psMetadataLookupF32 (&status, recipe, "NOISE.FACTOR"); 21 PS_ASSERT (status, false); 22 float SIZE = psMetadataLookupF32 (&status, recipe, "NOISE.SIZE"); 17 23 PS_ASSERT (status, false); 18 24 … … 39 45 } 40 46 41 model->params->data.F32[PM_PAR_I0] *= FACTOR; 47 psF32 *PAR = model->params->data.F32; 48 49 // save original values 50 float oldI0 = PAR[PM_PAR_I0]; 51 oldshape.sx = PAR[PM_PAR_SXX]; 52 oldshape.sy = PAR[PM_PAR_SYY]; 53 oldshape.sxy = PAR[PM_PAR_SXY]; 54 55 // increase size and height of source 56 axes = psEllipseShapeToAxes (oldshape, 20.0); 57 axes.major *= SIZE; 58 axes.minor *= SIZE; 59 newshape = psEllipseAxesToShape (axes); 60 PAR[PM_PAR_I0] = FACTOR*PS_SQR(oldI0); 61 PAR[PM_PAR_SXX] = newshape.sx; 62 PAR[PM_PAR_SYY] = newshape.sy; 63 PAR[PM_PAR_SXY] = newshape.sxy; 64 42 65 if (add) { 43 66 pmModelAdd (source->weight, source->mask, model, false, false); … … 45 68 pmModelSub (source->weight, source->mask, model, false, false); 46 69 } 70 71 // restore original values 72 PAR[PM_PAR_I0] = oldI0; 73 PAR[PM_PAR_SXX] = oldshape.sx; 74 PAR[PM_PAR_SYY] = oldshape.sy; 75 PAR[PM_PAR_SXY] = oldshape.sxy; 47 76 } 48 77 if (add) {
Note:
See TracChangeset
for help on using the changeset viewer.
