IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 7, 2007, 2:49:27 PM (19 years ago)
Author:
Paul Price
Message:

Updating to use the automatically generated skycell version of the camera. This means that the output file shares the same file rule as the original camera, not the same file rule as the skycell. This in turn means that we don't have to deal with multiple groups of file rules.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/pswarp/src/pswarpDefine.c

    r13109 r13705  
    1414    pmFPAfile *skycell = psMetadataLookupPtr (NULL, config->files, "PSWARP.SKYCELL");
    1515    if (!skycell) {
    16         psError(PSWARP_ERR_CONFIG, true, "Can't find skycell data!\n");
     16        psError(PSWARP_ERR_CONFIG, false, "Can't find skycell data!\n");
     17        return false;
     18    }
     19    pmFPAfile *output = psMetadataLookupPtr(NULL, config->files, "PSWARP.OUTPUT");
     20    if (!output) {
     21        psError(PSWARP_ERR_CONFIG, false, "Can't find output data!\n");
     22        return false;
     23    }
     24    pmFPAfile *input = psMetadataLookupPtr(NULL, config->files, "PSWARP.INPUT");
     25    if (!input) {
     26        psError(PSWARP_ERR_CONFIG, false, "Can't find input data!\n");
    1727        return false;
    1828    }
     
    2434    // Read header and create target
    2535    {
    26         pmFPAReadHeaderSet(skycell->fpa, skycell->fits, config->database);
     36        if (!pmFPAReadHeaderSet(skycell->fpa, skycell->fits, config->database)) {
     37            psError(PS_ERR_UNKNOWN, false, "Unable to read headers for skycell.");
     38            psFree(view);
     39            return false;
     40        }
    2741        view->chip = 0;
    2842        view->cell = 0;
     
    3246        if (!hdu || !hdu->header) {
    3347            psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to find header for sky cell.");
     48            psFree(view);
    3449            return false;
    3550        }
     
    3752        int numRows = psMetadataLookupS32(NULL, hdu->header, "NAXIS2"); // Number of rows
    3853
    39         pmCell *target = pmFPAfileThisCell(config->files, view, "PSWARP.OUTPUT"); // Target cell
     54        pmCell *target = pmFPAviewThisCell(view, output->fpa); // Target cell
    4055        pmReadout *readout = pmReadoutAlloc(target); // Target readout
    4156        readout->image = psImageAlloc(numCols, numRows, PS_TYPE_F32);
     
    5469    // XXX this is not a sufficient test
    5570    view->chip = 0;
    56     pmChip *chip = pmFPAviewThisChip (view, skycell->fpa);
    57     pmHDU *phu = pmFPAviewThisPHU (view, skycell->fpa);
    58     pmHDU *hdu = pmFPAviewThisHDU (view, skycell->fpa);
     71    view->cell = 0;
     72    view->readout = -1;
     73    pmHDU *phu = pmFPAviewThisPHU(view, skycell->fpa); // Skycell PHU
     74    pmHDU *hdu = pmFPAviewThisHDU(view, skycell->fpa); // Skycell header
    5975    bool bilevelAstrometry = false;
    6076    if (phu) {
    61         char *ctype = psMetadataLookupStr (NULL, phu->header, "CTYPE1");
     77        char *ctype = psMetadataLookupStr(NULL, phu->header, "CTYPE1");
    6278        if (ctype) {
    63             bilevelAstrometry = !strcmp (&ctype[4], "-DIS");
     79            bilevelAstrometry = !strcmp(&ctype[4], "-DIS");
    6480        }
    6581    }
     82
     83    // We read from the skycell into the output.  i.e., the output receives the desired astrometry.
     84    pmChip *outputChip = pmFPAviewThisChip(view, output->fpa); // Chip in the output
    6685    if (bilevelAstrometry) {
    67         if (!pmAstromReadBilevelMosaic (skycell->fpa, phu->header)) {
     86        if (!pmAstromReadBilevelMosaic(output->fpa, phu->header)) {
    6887            psError(PS_ERR_UNKNOWN, false, "Unable to read bilevel mosaic astrometry for skycell.");
    6988            psFree(view);
    7089            return false;
    7190        }
    72         if (!pmAstromReadBilevelChip (chip, hdu->header)) {
     91        if (!pmAstromReadBilevelChip(outputChip, hdu->header)) {
    7392            psError(PS_ERR_UNKNOWN, false, "Unable to read bilevel chip astrometry for skycell.");
    7493            psFree(view);
     
    7796    } else {
    7897        // we use a default FPA pixel scale of 1.0
    79         if (!pmAstromReadWCS (skycell->fpa, chip, hdu->header, 1.0)) {
     98        if (!pmAstromReadWCS(output->fpa, outputChip, hdu->header, 1.0)) {
    8099            psError(PS_ERR_UNKNOWN, false, "Unable to read WCS astrometry for skycell.");
    81100            psFree(view);
     
    84103    }
    85104
    86     // construct the output fpa here
    87     pmFPAfile *output = psMetadataLookupPtr (NULL, config->files, "PSWARP.OUTPUT");
    88     if (!output) {
    89         psError(PSWARP_ERR_CONFIG, true, "Can't find output data!\n");
    90         return false;
    91     }
     105    const char *name = psMetadataLookupStr(NULL, input->fpa->concepts, "FPA.NAME"); // Name of FPA
     106    view->chip = view->cell = view->readout = -1;
     107    pmFPAAddSourceFromView(output->fpa, name, view, output->format);
    92108
    93109    psFree (view);
Note: See TracChangeset for help on using the changeset viewer.