IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 28421


Ignore:
Timestamp:
Jun 22, 2010, 1:11:00 PM (16 years ago)
Author:
Paul Price
Message:

Read WCS if trivially applicable (certainly true for skycells).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psphot/src/psphotImageLoop.c

    r27657 r28421  
    4646        if (!psphotMosaicChip(config, view, "PSPHOT.INPUT", "PSPHOT.LOAD")) ESCAPE ("Unable to mosaic chip.");
    4747
     48        // Read WCS if easy.
     49        // XXX Since we're mosaicking cells, we ignore the case where the WCS is defined for a cell.
     50        {
     51            pmChip *inChip = pmFPAviewThisChip(view, input->fpa); // Mosaicked chip
     52            pmHDU *hduLow = pmHDUGetLowest(input->fpa, inChip, NULL);
     53            if (hduLow && !pmAstromReadWCS(input->fpa, inChip, hduLow->header, 1.0)) {
     54                psWarning("Unable to read WCS astrometry from header.");
     55                psErrorClear();
     56                pmHDU *hduHigh = pmHDUGetHighest(input->fpa, inChip, NULL);
     57                if (hduHigh && hduHigh != hduLow &&
     58                    !pmAstromReadWCS(input->fpa, chip, hduHigh->header, 1.0)) {
     59                    psWarning("Unable to read WCS astrometry from primary header.");
     60                    psErrorClear();
     61                }
     62            }
     63        }
     64
    4865        // try to load other supporting data (PSF, SRC, etc).
    4966        // do not re-load the following three files
     
    6784
    6885                // Update the header
    69                 pmHDU *hdu = pmHDUGetHighest(input->fpa, chip, cell);
    70                 if (hdu && hdu != lastHDU) {
    71                     psphotVersionHeaderFull(hdu->header);
    72                     lastHDU = hdu;
     86                {
     87                    pmHDU *hdu = pmHDUGetHighest(input->fpa, chip, cell);
     88                    if (hdu && hdu != lastHDU) {
     89                        psphotVersionHeaderFull(hdu->header);
     90                        lastHDU = hdu;
     91                    }
    7392                }
    7493
    75                 // if an external mask is supplied, ensure that NAN pixels are also masked
    76                 if (readout->mask) {
    77                     psImageMaskType maskSat = pmConfigMaskGet("SAT", config); // Mask value for saturated pixels
    78                     if (!pmReadoutMaskNonfinite(readout, maskSat)) {
    79                         psError(psErrorCodeLast(), false, "Unable to mask non-finite pixels.");
    80                         psFree(view);
    81                         return false;
    82                     }
    83                 }
     94                // if an external mask is supplied, ensure that NAN pixels are also masked
     95                if (readout->mask) {
     96                    psImageMaskType maskSat = pmConfigMaskGet("SAT", config); // Mask value for saturated pixels
     97                    if (!pmReadoutMaskNonfinite(readout, maskSat)) {
     98                        psError(psErrorCodeLast(), false, "Unable to mask non-finite pixels.");
     99                        psFree(view);
     100                        return false;
     101                    }
     102                }
    84103
    85104                // run the actual photometry analysis on this chip/cell/readout
     
    91110            }
    92111
    93             // drop all versions of the internal files
    94             status = true;
    95             status &= pmFPAfileDropInternal (config->files, "PSPHOT.BACKMDL");
    96             status &= pmFPAfileDropInternal (config->files, "PSPHOT.BACKMDL.STDEV");
    97             status &= pmFPAfileDropInternal (config->files, "PSPHOT.BACKGND");
    98             if (!status) {
    99                 psError(PSPHOT_ERR_PROG, false, "trouble dropping internal files");
    100                 psFree (view);
    101                 return false;
    102             }
     112            // drop all versions of the internal files
     113            status = true;
     114            status &= pmFPAfileDropInternal (config->files, "PSPHOT.BACKMDL");
     115            status &= pmFPAfileDropInternal (config->files, "PSPHOT.BACKMDL.STDEV");
     116            status &= pmFPAfileDropInternal (config->files, "PSPHOT.BACKGND");
     117            if (!status) {
     118                psError(PSPHOT_ERR_PROG, false, "trouble dropping internal files");
     119                psFree (view);
     120                return false;
     121            }
    103122        }
    104123        // save output which is saved at the chip level
Note: See TracChangeset for help on using the changeset viewer.