IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 13499


Ignore:
Timestamp:
May 23, 2007, 6:01:33 PM (19 years ago)
Author:
Paul Price
Message:

Need to add NAXIS1,NAXIS2 to the header after chip mosaic, so that CMF files know the proper extent of the chip.

Location:
trunk/psModules/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/camera/pmFPAExtent.c

    r12710 r13499  
    1010    PS_ASSERT_PTR_NON_NULL(readout, NULL);
    1111
    12     if (readout->image) {
    13         return psRegionAlloc(readout->col0, readout->image->numCols,
    14                              readout->row0, readout->image->numRows);
     12    psImage *image = readout->image;    // Image from which to get dimensions
     13    if (!image) {
     14        image = readout->mask;
    1515    }
    16     pmCell *cell = readout->parent;     // The parent cell
    17     if (!cell) {
    18         psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to determine size of readout.\n");
    19         return NULL;
    20     }
    21     bool mdok;                          // Status of MD lookup
    22     psRegion *trimsec = psMetadataLookupPtr(&mdok, cell->concepts, "CELL.TRIMSEC"); // Trim section
    23     if (!mdok || !trimsec) {
    24         psError(PS_ERR_UNKNOWN, true, "Unable to find CELL.TRIMSEC.\n");
    25         return NULL;
     16    if (!image) {
     17        image = readout->weight;
    2618    }
    2719
    28     // XXX: Binning?
    29     // XXX this is not setting the right value for megacam spliced chip
    30     trimsec->x0 = 0;
    31     trimsec->y0 = 0;
    32     trimsec->x1 = 2112;
    33     trimsec->y1 = 4644;
     20    if (!image) {
     21        // Don't have anything to base the true extent on, so have to give the largest possible extent
     22        int xSize = psMetadataLookupS32(NULL, readout->parent->concepts, "CELL.XSIZE");
     23        int ySize = psMetadataLookupS32(NULL, readout->parent->concepts, "CELL.YSIZE");
     24        return psRegionAlloc(0, xSize, 0, ySize);
     25    }
    3426
    35     return psRegionAlloc(readout->col0, trimsec->x1 - trimsec->x0,
    36                          readout->row0, trimsec->y1 - trimsec->y0);
     27    // Get the offset to the CCD window
     28    int xWindow = psMetadataLookupS32(NULL, readout->parent->concepts, "CELL.XWINDOW");
     29    int yWindow = psMetadataLookupS32(NULL, readout->parent->concepts, "CELL.YWINDOW");
     30    return psRegionAlloc(xWindow, xWindow + image->numCols,
     31                         yWindow, yWindow + image->numRows);
    3732}
    3833
  • trunk/psModules/src/camera/pmFPAMosaic.c

    r13339 r13499  
    1616#include "pmConfig.h"
    1717#include "pmAstrometryWCS.h"
     18#include "pmFPAExtent.h"
    1819
    1920#include "pmFPAMosaic.h"
     
    10861087    pmHDU *sourcePHU = pmHDUGetHighest(source->parent, source, NULL);
    10871088
     1089    // Need to update NAXIS1, NAXIS2 in the target header, so that when we write a CMF, it has the correct
     1090    // extent.  I'm not convinced that this is the best way to do this, but it should be, at worst, harmless,
     1091    // since NAXIS[12] will get overwritten for an image with the proper dimensions.
     1092    psRegion *naxis = pmChipExtent(target);
     1093    psMetadataAddS32(targetHDU->header, PS_LIST_TAIL, "NAXIS1", PS_META_REPLACE, "Size in x",
     1094                     naxis->x1 - naxis->x0);
     1095    psMetadataAddS32(targetHDU->header, PS_LIST_TAIL, "NAXIS2", PS_META_REPLACE, "Size in y",
     1096                     naxis->y1 - naxis->y0);
     1097    psFree(naxis);
     1098
     1099
    10881100    if (!targetPHU) {
    10891101        psError(PS_ERR_UNKNOWN, true, "Unable to find HDU after mosaicking.\n");
  • trunk/psModules/src/concepts/pmConcepts.c

    r13034 r13499  
    868868            psFree(cellYsize);
    869869        }
     870
     871        // CELL.XWINDOW
     872        {
     873            psMetadataItem *cellXwindow = psMetadataItemAllocS32("CELL.XWINDOW",
     874                                                                 "Start of cell window (pixels)", 0);
     875            pmConceptRegister(cellXwindow, NULL, NULL, true, PM_FPA_LEVEL_CELL);
     876            psFree(cellXwindow);
     877        }
     878
     879        // CELL.YSIZE
     880        {
     881            psMetadataItem *cellYwindow = psMetadataItemAllocS32("CELL.YWINDOW",
     882                                                                 "Start of cell window (pixels)", 0);
     883            pmConceptRegister(cellYwindow, NULL, NULL, true, PM_FPA_LEVEL_CELL);
     884            psFree(cellYwindow);
     885        }
    870886    }
    871887
     
    888904
    889905
    890 // XXX EAM : Paul, please handle the biassec independently so the 
     906// XXX EAM : Paul, please handle the biassec independently so the
    891907// psList is copied without a verbose warning.  when this is fixed, you can
    892908// convert the trace back to a log (psMetadata.c:429)
Note: See TracChangeset for help on using the changeset viewer.