IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 26847


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.

Location:
branches/eam_branches/20091201
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/20091201/ippconfig/recipes/filerules-split.mdc

    r26841 r26847  
    285285PPVIZPSF.OUTPUT         OUTPUT {OUTPUT}.{CHIP.NAME}.fits         IMAGE     NONE       CHIP       TRUE      NONE
    286286PPVIZPATTERN.OUTPUT     OUTPUT {OUTPUT}.{CHIP.NAME}.fits         IMAGE     NONE       CHIP       TRUE      NONE
     287PPVIZPATTERN.CHIP       OUTPUT {OUTPUT}.{CHIP.NAME}.ch.fits      IMAGE     NONE       CHIP       TRUE      NONE
    287288
    288289# {FPA.OBS}
  • branches/eam_branches/20091201/ppViz/src/ppVizPattern

    • Property svn:ignore
      •  

        old new  
        1 ppVizPSF
        21Makefile.in
        3 ppVizPSFVersionDefinitions.h
        42.deps
        53Makefile
         4ppVizPattern
         5ppVizPatternVersionDefinitions.h
  • branches/eam_branches/20091201/ppViz/src/ppVizPattern/ppVizPatternCamera.c

    r26837 r26847  
    4242    pmFPAfile *output = pmFPAfileDefineOutput(data->config, input->fpa, "PPVIZPATTERN.OUTPUT");
    4343    if (!output) {
    44         psError(psErrorCodeLast(), false, "Unable to define output.");
     44        psError(psErrorCodeLast(), false, "Unable to define file PPVIZPATTERN.OUTPUT");
    4545        return false;
    4646    }
    4747    output->save = true;
     48
     49    pmFPAfile *outChip = pmFPAfileDefineChipMosaic(data->config, input->fpa, "PPVIZPATTERN.CHIP");
     50    if (!outChip) {
     51        psError(psErrorCodeLast(), false, "Unable to define file PPVIZPATTERN.CHIP");
     52        return false;
     53    }
     54    outChip->save = true;
     55
    4856
    4957#if 0
  • branches/eam_branches/20091201/ppViz/src/ppVizPattern/ppVizPatternLoop.c

    r26842 r26847  
    1515{
    1616    pmConfig *config = data->config;                                        // Configuration data
    17     pmFPAfile *input = pmFPAfileSelectSingle(config->files, "PPVIZPATTERN.INPUT", 0); // File with PSF
     17    pmFPAfile *input = pmFPAfileSelectSingle(config->files, "PPVIZPATTERN.INPUT", 0); // Input file
     18    pmFPAfile *output = pmFPAfileSelectSingle(config->files, "PPVIZPATTERN.CHIP", 0); // Output file
    1819
    1920    pmFPAview *view = pmFPAviewAlloc(0); // Pointer into FPA hierarchy
     
    4849                    return false;
    4950                }
    50                 if (!readout->data_exists) {
     51                // Need to generate an image even if there's nothing in this readout, so chip-mosaicked image
     52                // is filled in.
     53                if (!readout->data_exists && !cell->data_exists && !chip->data_exists) {
    5154                    continue;
    5255                }
     
    100103                    return false;
    101104                }
     105
     106                // Blow away bias sections to prevent warnings
     107                psMetadataItem *biassec = psMetadataLookup(cell->concepts, "CELL.BIASSEC"); // Bias section
     108                psFree(biassec->data.list);
     109                biassec->data.list = psListAlloc(NULL);
    102110            }
    103111            // Cell
     
    107115            }
    108116        }
     117
     118        pmChip *outChip = pmFPAfileThisChip(config->files, view, "PPVIZPATTERN.CHIP");
     119        if (!outChip->hdu && !outChip->parent->hdu) {
     120            const char *name = psMetadataLookupStr(NULL, chip->parent->concepts, "FPA.OBS"); // Name of FPA
     121            pmFPAAddSourceFromView(outChip->parent, name, view, output->format);
     122        }
     123        if (!pmChipMosaic(outChip, chip, true, MASK_BAD)) {
     124            psError(PS_ERR_UNKNOWN, false, "Unable to mosaic chip.");
     125            return false;
     126        }
     127
    109128        // Chip
    110129        if (!pmFPAfileIOChecks(config, view, PM_FPA_AFTER)) {
  • branches/eam_branches/20091201/psModules/src/detrend/pmPattern.c

    r26845 r26847  
    8787
    8888    psImage *corr = psImageAlloc(order + 1, numRows, PS_TYPE_F64); // Corrections applied
     89    psImageInit(corr, NAN);
    8990
    9091    for (int y = 0; y < numRows; y++) {
     
    113114        }
    114115
     116        poly->coeff[0] -= background;
    115117        memcpy(corr->data.F64[y], poly->coeff, (order + 1) * PSELEMTYPE_SIZEOF(PS_TYPE_F64));
    116         corr->data.F64[y][0] -= background;
    117 
    118118        psVector *solution = psPolynomial1DEvalVector(poly, indices); // Solution vector
    119119        if (!solution) {
     
    125125
    126126        for (int x = 0; x < numCols; x++) {
    127             image->data.F32[y][x] += (background - solution->data.F32[x]);
     127            image->data.F32[y][x] -= solution->data.F32[x];
    128128        }
    129129        psFree(solution);
     
    174174
    175175    for (int y = 0; y < numRows; y++) {
    176         memcpy(poly->coeff, corr->data.F64[y], order * PSELEMTYPE_SIZEOF(PS_TYPE_F64));
     176        memcpy(poly->coeff, corr->data.F64[y], (order + 1) * PSELEMTYPE_SIZEOF(PS_TYPE_F64));
    177177        psVector *solution = psPolynomial1DEvalVector(poly, indices); // Solution vector
    178178        if (!solution) {
  • 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.