IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 22, 2009, 4:54:27 PM (17 years ago)
Author:
watersc1
Message:

Updated fringe fitting code.

Corrected Bool->S32 bug for BTOOLAPP header concept.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppImage/src/ppImageDetrendFringe.c

    r24911 r25930  
    8484    psArray *cells = chip->cells;       // Component cells
    8585    psArray *fringes = psArrayAlloc(cells->n); // Fringes, to return
     86    int video_cell_zero = 0;
     87   
    8688    for (int i = 0; i < cells->n; i++) {
    8789        fringes->data[i] = NULL;
     
    8991        pmCell *cell = cells->data[i];  // Cell of interest
    9092
     93        psTrace("psModules.detrend",7,"Readouts: Cell %d chip: %ld\n",i,cell->readouts->n);
    9194        // XXX for now, skip the video cells (cell->readouts->n > 1)
    92         if (cell->readouts->n > 1) {
    93             psWarning ("Skipping Video Cell (%d) for ppImageDetrendFringe.c:getFringes", i);
    94             continue;
    95         }
    96 
     95        // CZW: This mess creates a fake set of fringe stats by stealing the previous one.
     96        // We let the fitting code know that this is all lies by scaling the weights by a crazy amount.
     97
     98        if ( (cell->readouts->n > 1) ) {
     99          psTrace("psModules.detrend",7,"Should be skipping scichip: %d\n",i);
     100          psWarning ("Skipping Video Cell (%d) for ppImageDetrendFringe.c:getFringes", i);
     101
     102          if (i == 0) {
     103            video_cell_zero = 1;
     104          }
     105          else {
     106            pmFringeStats *prevFringe = fringes->data[i-1];
     107            pmFringeStats *fringe     = pmFringeStatsAlloc(prevFringe->regions);
     108            for (int j = 0; j < fringe->regions->nRequested; j++) {
     109              fringe->f->data.F32[j] = prevFringe->f->data.F32[j];
     110              fringe->df->data.F32[j] = prevFringe->df->data.F32[j] / 1e6;
     111            }
     112            fringes->data[i] = fringe;
     113          }
     114           
     115          continue;
     116        }
     117       
    97118        fringes->data[i] = psMemIncrRefCounter(psMetadataLookupPtr(NULL, cell->analysis, source));
    98119    }
    99120
     121    if (video_cell_zero == 1) {
     122      pmFringeStats *prevFringe = fringes->data[1];
     123      pmFringeStats *fringe     = pmFringeStatsAlloc(prevFringe->regions);
     124      for (int j = 0; j < fringe->regions->nRequested; j++) {
     125        fringe->f->data.F32[j] = NAN;
     126        fringe->df->data.F32[j] = 1.0;
     127      }
     128      fringes->data[0] = fringe;
     129    }
     130   
    100131    return fringes;
    101132}
     
    112143    psArray *science = NULL;
    113144    if (isResidual) {
    114         science = getFringes(scienceChip, "FRINGE.RESIDUALS"); // Fringe residuals on science chip
     145        science = getFringes(scienceChip,  "FRINGE.RESIDUALS"); // Fringe residuals on science chip
    115146    } else {
    116147        science = getFringes(scienceChip, "FRINGE.MEASUREMENTS"); // Fringe measurements on science chip
     
    124155    psArray *references = getFringes(refChip, "FRINGE.MEASUREMENTS"); // Fringe measurements on reference chip
    125156    int numRefs = ((psArray*)references->data[0])->n; // Number of reference fringes
    126     psArray *referencesCat = psArrayAlloc(numRefs); // Reference fringes
    127     for (int i = 0; i < numRefs; i++) { // Iterate over fringes
    128         psArray *refs = psArrayAlloc(references->n); // Array of fringes for each cell
    129         for (int j = 0; j < references->n; j++) { // Iterate over cells
    130             psArray *ref = references->data[j]; // Array of references for this cell
     157    psArray *referencesCat = psArrayAlloc(numRefs);   // Reference fringes
     158    for (int i = 0; i < numRefs; i++) {               // Iterate over fringes
     159        psArray *refs = psArrayAlloc(references->n);  // Array of fringes for each cell
     160        for (int j = 0; j < references->n; j++) {     // Iterate over cells
     161            psArray *ref = references->data[j];       // Array of references for this cell
     162           
    131163            refs->data[j] = psMemIncrRefCounter(ref->data[i]);
    132164        }
    133         referencesCat->data[i] = pmFringeStatsConcatenate(refs, NULL, NULL);
     165        referencesCat->data[i] = pmFringeStatsConcatenate(refs, NULL, NULL);
    134166        psFree(refs);
    135167    }
Note: See TracChangeset for help on using the changeset viewer.