IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 10, 2010, 3:02:06 PM (16 years ago)
Author:
Paul Price
Message:

Implement chip mosaic for ppVizPattern. Pattern I/O is now correct: subtraction of the pattern from the pattern-subtracted image restores the original image.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/20091201/psModules/src/detrend/pmPatternIO.c

    r26843 r26847  
    99#include "pmFPAfile.h"
    1010#include "pmFPAfileFitsIO.h"
     11#include "pmFPAHeader.h"
    1112#include "pmConceptsRead.h"
     13#include "pmConceptsWrite.h"
    1214
    1315#include "pmPattern.h"
     
    2426    psImage *rowCorr = psMetadataLookupPtr(&gotRow, ro->analysis, PM_PATTERN_ROW_CORRECTION); // Row correction
    2527    float cellCorr = psMetadataLookupF32(&gotCell, ro->analysis, PM_PATTERN_CELL_CORRECTION); // Cell corr.
    26     if (!gotRow && !gotCell) {
    27         // Nothing to write
    28         return true;
    29     }
    3028
    3129    pmCell *cell = ro->parent;          // Cell of interest
     
    7371    PS_ASSERT_PTR_NON_NULL(cell->readouts, false);
    7472    PS_ASSERT_PTR_NON_NULL(view, false);
     73
     74    if (!pmConceptsWriteCell(cell, true, config)) {
     75        psError(PS_ERR_IO, false, "Unable to write concepts for cell.");
     76        return false;
     77    }
    7578
    7679    pmFPAview *thisView = pmFPAviewAlloc(view->nRows); // Copy of input view
     
    97100    PS_ASSERT_PTR_NON_NULL(view, false);
    98101
     102    if (!pmConceptsWriteChip(chip, true, true, config)) {
     103        psError(PS_ERR_IO, false, "Unable to write concepts for chip.\n");
     104        return false;
     105    }
     106
    99107    pmFPAview *thisView = pmFPAviewAlloc(view->nRows); // Copy of input view
    100108    *thisView = *view;
     
    120128    PS_ASSERT_PTR_NON_NULL(fpa->chips, false);
    121129
     130    if (!pmConceptsWriteFPA(fpa, true, config)) {
     131        psError(PS_ERR_IO, false, "Unable to write concepts for FPA.\n");
     132        return false;
     133    }
     134
    122135    pmFPAview *thisView = pmFPAviewAlloc(view->nRows); // Copy of input view
    123136    *thisView = *view;
     
    168181    }
    169182
    170     bool data = false;                  // Did we find any data?
     183    bool data = true;                  // Did we find any data?
    171184
    172185    psMetadataItem *cellCorr = psMetadataLookup(header, PM_PATTERN_CELL_CORRECTION); // Cell pattern correction
     
    216229        pmReadout *readout = cell->readouts->data[i];
    217230        thisView->readout = i;
    218         pmReadoutReadPattern(readout, file->fits);
    219         if (!readout->data_exists) {
    220             continue;
    221         }
    222 #if 0
    223         // load in the concept information for this cell
    224         if (!pmConceptsReadCell(cell, PM_CONCEPT_SOURCE_HEADER, true, NULL)) {
    225             psErrorClear();
    226             psWarning("Difficulty reading concepts for cell; attempting to proceed.");
    227         }
    228 #endif
    229         cell->data_exists = true;
    230     }
    231     psFree(thisView);
     231        if (!pmReadoutReadPattern(readout, file->fits)) {
     232            psError(PS_ERR_IO, false, "Unable to read pattern correction.");
     233            return false;
     234        }
     235    }
     236    psFree(thisView);
     237
     238    if (!pmCellReadHeader(cell, file->fits, config)) {
     239        psError(PS_ERR_IO, false, "Unable to read header for cell.");
     240        return false;
     241    }
     242    // load in the concept information for this cell
     243    if (!pmConceptsReadCell(cell, PM_CONCEPT_SOURCE_HEADER, true, NULL)) {
     244        psErrorClear();
     245        psWarning("Difficulty reading concepts for cell; attempting to proceed.");
     246    }
    232247
    233248    return true;
     
    256271    psFree(thisView);
    257272
    258 #if 0
     273    if (!pmChipReadHeader(chip, file->fits, config)) {
     274        psError(PS_ERR_IO, false, "Unable to read header for cell.");
     275        return false;
     276    }
    259277    if (!pmConceptsReadChip(chip, PM_CONCEPT_SOURCE_HEADER, true, true, NULL)) {
    260278        psError(PS_ERR_IO, false, "Failed to read concepts for chip.\n");
    261279        return false;
    262280    }
    263 #endif
    264281
    265282    return true;
     
    284301    psFree(thisView);
    285302
    286 #if 0
     303    if (!pmFPAReadHeader(fpa, file->fits, config)) {
     304        psError(PS_ERR_IO, false, "Unable to read header for cell.");
     305        return false;
     306    }
    287307    if (!pmConceptsReadFPA(fpa, PM_CONCEPT_SOURCE_HEADER, true, NULL)) {
    288308        psError(PS_ERR_IO, false, "Failed to read concepts for fpa.\n");
    289309        return false;
    290310    }
    291 #endif
    292311
    293312    return true;
Note: See TracChangeset for help on using the changeset viewer.