IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 7860


Ignore:
Timestamp:
Jul 10, 2006, 3:48:50 PM (20 years ago)
Author:
Paul Price
Message:

Removing normalisation to unity.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/detrend/pmFlatNormalize.c

    r7278 r7860  
    3838    psVectorInit(sourceMask, 0);
    3939    for (int i = 0; i < numChips; i++) {
     40        // Note: the input gains are in e/ADU; we want to work with ADU/e (bg [ADU] = g [ADU/e] * f [e])
    4041        if (isfinite(chipGains->data.F32[i]) && chipGains->data.F32[i] > 0) {
    41             chipGains->data.F32[i] = log(chipGains->data.F32[i]);
     42            chipGains->data.F32[i] = -log(chipGains->data.F32[i]);
    4243        } else {
    4344            chipGains->data.F32[i] = 0.0; // Take a wild guess
    44             #if 0
    45             // Blank out this chip
    46             gainMask->data.U8[i] = 1;
    47             chipGains->data.F32[i] = NAN;
    48             #endif
    49 
    5045        }
    5146
     
    6156    }
    6257
     58    // Not really sure that we need to iterate, but here we go anyway...
     59
    6360    float diff = INFINITY;             // Difference from previous iteration
    6461    psVector *sourceFlux = psVectorAlloc(numSources, PS_TYPE_F32); // The flux in each integration
     
    7067        diff = 0.0;
    7168
    72 
    7369        // Improve on the fluxes
    74         float sumFlux = 0.0;           // Total fluxes
    7570        long numFluxes = 0;             // Number of fluxes
    7671        for (int i = 0; i < numSources; i++) {
     
    9489                sourceFlux->data.F32[i] = NAN;
    9590            }
    96             sumFlux += exp(sourceFlux->data.F32[i]);
    97             psTrace(__func__, 7, "Flux for exposure %d is %f\n", i, exp(sourceFlux->data.F32[i]));
     91            psTrace(__func__, 7, "Flux for exposure %d is %lf\n", i, exp(sourceFlux->data.F32[i]));
    9892        }
    99         // Normalise the mean to unity
    100         sumFlux /= (float)numFluxes;
    101         sumFlux = log(sumFlux);
     93
    10294        for (int i = 0; i < numSources; i++) {
    103             if (sourceMask->data.U8[i]) {
    104                 continue;
     95            if (!sourceMask->data.U8[i]) {
     96                diff += abs((sourceFlux->data.F32[i] - oldSourceFlux->data.F32[i]) / sourceFlux->data.F32[i]);
    10597            }
    106             sourceFlux->data.F32[i] -= sumFlux;
    107             diff += abs((sourceFlux->data.F32[i] - oldSourceFlux->data.F32[i]) / sourceFlux->data.F32[i]);
    10898        }
    10999
     
    127117                chipGains->data.F32[i] = NAN;
    128118            }
    129             psTrace(__func__, 7, "Gain for chip %d is %f\n", i, exp(chipGains->data.F32[i]));
     119            psTrace(__func__, 7, "Gain for chip %d is %lf\n", i, exp(-chipGains->data.F32[i]));
    130120        }
    131121
    132         psTrace(__func__, 2, "Iteration %d: difference is %f\n", iter, diff);
     122        psTrace(__func__, 2, "Iteration %d: difference is %e\n", iter, diff);
    133123
    134124        // Switch the old and new
Note: See TracChangeset for help on using the changeset viewer.