IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 25930 for trunk/ppImage/src


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.

Location:
trunk/ppImage/src
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppImage/src/Makefile.am

    r25299 r25930  
    4141        ppImageDetrendFringe.c \
    4242        ppImageDetrendFree.c \
     43        ppImageDetrendPattern.c \
    4344        ppImageRebinReadout.c \
    4445        ppImageMosaic.c \
  • trunk/ppImage/src/ppImage.h

    r25875 r25930  
    159159bool ppImageBurntoolMask(pmConfig *config, ppImageOptions *options, pmFPAview *view, pmReadout *mask);
    160160
     161bool ppImageDetrendPatternApply(pmConfig *config, pmChip *chip, const pmFPAview *inputView, const ppImageOptions *options);
     162
    161163// Record which detrend file was used for the detrending
    162164bool ppImageDetrendRecord(
  • 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    }
  • trunk/ppImage/src/ppImageDetrendReadout.c

    r25299 r25930  
    128128    }
    129129
    130     // Pattern noise correction
    131     if (options->doPattern) {
    132         if (!pmPatternRow(input, options->patternOrder, options->patternIter, options->patternRej,
    133                           options->patternThresh, options->patternMean, options->patternStdev,
    134                           options->maskValue, options->darkMask)) {
    135             psFree(detview);
    136             return false;
    137         }
    138     }
     130/*     // Pattern noise correction */
     131/*     if (options->doPattern) { */
     132/*         if (!pmPatternRow(input, options->patternOrder, options->patternIter, options->patternRej, */
     133/*                           options->patternThresh, options->patternMean, options->patternStdev, */
     134/*                           options->maskValue, options->darkMask)) { */
     135/*             psFree(detview); */
     136/*             return false; */
     137/*         } */
     138/*     } */
    139139
    140140    // Normalization by a single (known) constant
  • trunk/ppImage/src/ppImageLoop.c

    r25875 r25930  
    163163        }
    164164
     165        // Apply the pattern noise correction
     166        if (options->doPattern) {
     167          if (!ppImageDetrendPatternApply(config,chip,view,options)) {
     168            ESCAPE("Unable to apply pattern corrections");
     169          }
     170        }
     171       
    165172        // measure various pixel-based statistics for this image
    166173        if (!ppImagePixelStats(config, stats, options, view)) {
  • trunk/ppImage/src/ppImageOptions.c

    r25324 r25930  
    249249
    250250    options->burntoolTrails = psMetadataLookupS32(&status, recipe, "BURNTOOL.TRAILS");
    251     fprintf(stderr,"TRAILS: %d %d %d\n",options->burntoolTrails,psMetadataLookupS32(&status,recipe,"BURNTOOL.TRAILS"),status);
     251    psTrace("psModules.detrend", 7, "burntoolTrails: %d BURNTOOL.TRAILS: %d Status: %d\n",
     252            options->burntoolTrails,psMetadataLookupS32(&status,recipe,"BURNTOOL.TRAILS"),status);
    252253    if (!status) {
    253254      psWarning("BURNTOOL.TRAILS not found in recipe: setting to default value.\n");
Note: See TracChangeset for help on using the changeset viewer.