IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 29, 2007, 4:48:20 PM (19 years ago)
Author:
eugene
Message:

added deblend for saturated stars, fixed AddNoise

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psphot/src/psphotAddNoise.c

    r12635 r12689  
    44
    55    bool status = false;
    6     psTimerStart ("psphot");
     6    psEllipseShape oldshape;
     7    psEllipseShape newshape;
     8    psEllipseAxes axes;
    79
    810    PS_ASSERT (readout, false);
    911    PS_ASSERT (readout->parent, false);
    1012    PS_ASSERT (readout->parent->concepts, false);
     13
     14    psTimerStart ("psphot");
    1115
    1216    // increase variance by factor*(object noise):
     
    1519
    1620    float FACTOR = psMetadataLookupF32 (&status, recipe, "NOISE.FACTOR");
     21    PS_ASSERT (status, false);
     22    float SIZE = psMetadataLookupF32 (&status, recipe, "NOISE.SIZE");
    1723    PS_ASSERT (status, false);
    1824
     
    3945        }
    4046
    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
    4265        if (add) {
    4366            pmModelAdd (source->weight, source->mask, model, false, false);
     
    4568            pmModelSub (source->weight, source->mask, model, false, false);
    4669        }
     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;
    4776    }
    4877    if (add) {
Note: See TracChangeset for help on using the changeset viewer.