IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 26, 2009, 8:40:07 PM (17 years ago)
Author:
eugene
Message:

incorporating changes from 16bit mask upgrades (eam_branch_20081230)

File:
1 edited

Legend:

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

    r9730 r21183  
    99
    1010#include "pmFlatNormalize.h"
     11
     12// XXX this function should take the abstract mask names and set bad values in a more precise way
    1113
    1214// I'm not sure that many many iterations are required, but rather suspect that the system converges within a
     
    5557    // Take the logarithms
    5658    psImage *flux = psImageCopy(NULL, bgMatrix, PS_TYPE_F32); // Copy of the input flux levels matrix
    57     psImage *fluxMask = psImageAlloc(numChips, numExps, PS_TYPE_U8); // Mask for bad measurements
     59    psImage *fluxMask = psImageAlloc(numChips, numExps, PS_TYPE_IMAGE_MASK); // Mask for bad measurements
    5860    psImageInit(fluxMask, 0);
    59     psVector *gainMask = psVectorAlloc(numChips, PS_TYPE_U8); // Mask for bad gains
     61    psVector *gainMask = psVectorAlloc(numChips, PS_TYPE_VECTOR_MASK); // Mask for bad gains
    6062    psVectorInit(gainMask, 0);
    61     psVector *expMask = psVectorAlloc(numExps, PS_TYPE_U8); // Mask for bad exposures
     63    psVector *expMask = psVectorAlloc(numExps, PS_TYPE_VECTOR_MASK); // Mask for bad exposures
    6264    psVectorInit(expMask, 0);
    6365    for (int i = 0; i < numChips; i++) {
     
    7577            } else {
    7678                // Blank out this measurement
    77                 fluxMask->data.U8[j][i] = 1;
     79                fluxMask->data.PS_TYPE_IMAGE_MASK_DATA[j][i] = 1;
    7880                flux->data.F32[j][i] = NAN;
    7981            }
     
    9092        int numFluxes = 0;              // Number of fluxes
    9193        for (int i = 0; i < numExps; i++) {
    92             if (expMask->data.U8[i]) {
     94            if (expMask->data.PS_TYPE_VECTOR_MASK_DATA[i]) {
    9395                psTrace("psModules.detrend", 7, "Flux for exposure %d is masked.\n", i);
    9496                continue;
     
    98100            int number = 0;             // Number of chips contributing
    99101            for (int j = 0; j < numChips; j++) {
    100                 if (!gainMask->data.U8[j] && !fluxMask->data.U8[i][j]) {
     102                if (!gainMask->data.PS_TYPE_VECTOR_MASK_DATA[j] && !fluxMask->data.PS_TYPE_IMAGE_MASK_DATA[i][j]) {
    101103                    sum += flux->data.F32[i][j] - chipGains->data.F32[j];
    102104                    number++;
     
    106108                expFluxes->data.F32[i] = sum / (float)number;
    107109            } else {
    108                 expMask->data.U8[i] = 1;
     110                expMask->data.PS_TYPE_VECTOR_MASK_DATA[i] = 1;
    109111                expFluxes->data.F32[i] = NAN;
    110112            }
     
    116118        int numGains = 0;               // Number of gains
    117119        for (int i = 0; i < numChips; i++) {
    118             if (gainMask->data.U8[i]) {
     120            if (gainMask->data.PS_TYPE_VECTOR_MASK_DATA[i]) {
    119121                continue;
    120122            }
     
    122124            int number = 0;             // Numer of sources contributing
    123125            for (int j = 0; j < numExps; j++) {
    124                 if (!fluxMask->data.U8[j][i]) {
     126                if (!fluxMask->data.PS_TYPE_IMAGE_MASK_DATA[j][i]) {
    125127                    sum += flux->data.F32[j][i] - expFluxes->data.F32[j];
    126128                    number++;
     
    130132                chipGains->data.F32[i] = sum / (float)number;
    131133            } else {
    132                 gainMask->data.U8[i] = 1;
     134                gainMask->data.PS_TYPE_VECTOR_MASK_DATA[i] = 1;
    133135                chipGains->data.F32[i] = NAN;
    134136            }
     
    144146            diff = 0.0;
    145147            for (int i = 0; i < numChips; i++) {
    146                 if (gainMask->data.U8[i]) {
     148                if (gainMask->data.PS_TYPE_VECTOR_MASK_DATA[i]) {
    147149                    continue;
    148150                }
     
    151153            }
    152154            for (int i = 0; i < numExps; i++) {
    153                 if (expMask->data.U8[i]) {
     155                if (expMask->data.PS_TYPE_VECTOR_MASK_DATA[i]) {
    154156                    continue;
    155157                }
     
    171173    // Un-log the vectors
    172174    for (int i = 0; i < numChips; i++) {
    173         if (!gainMask->data.U8[i]) {
     175        if (!gainMask->data.PS_TYPE_VECTOR_MASK_DATA[i]) {
    174176            chipGains->data.F32[i] = expf(chipGains->data.F32[i]);
    175177        }
    176178    }
    177179    for (int i = 0; i < numExps; i++) {
    178         if (!expMask->data.U8[i]) {
     180        if (!expMask->data.PS_TYPE_VECTOR_MASK_DATA[i]) {
    179181            expFluxes->data.F32[i] = expf(expFluxes->data.F32[i]);
    180182        }
Note: See TracChangeset for help on using the changeset viewer.