IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 13705


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.

Location:
trunk/pswarp/src
Files:
3 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);
  • trunk/pswarp/src/pswarpLoop.c

    r13686 r13705  
    135135    }
    136136
     137    output->data_exists = true;
     138    outCell->data_exists = true;
     139    outChip->data_exists = true;
     140
    137141
    138142    // XXX Hack so that INSTRUME header keyword and the like are not updated properly
     
    163167
    164168    pmHDU *hdu = output->parent->parent->parent->hdu; // HDU for the output warped image
     169    if (!hdu->header) {
     170        hdu->header = psMetadataAlloc();
     171    }
    165172
    166173    // Add MD5 information for readout
  • trunk/pswarp/src/pswarpParseCamera.c

    r13685 r13705  
    99    // the input image(s) are required arguments; they define the camera
    1010    status = false;
    11     pmFPAfile *input = pmFPAfileDefineFromArgs (&status, config, "PSWARP.INPUT", "INPUT");
     11    pmFPAfile *input = pmFPAfileDefineFromArgs(&status, config, "PSWARP.INPUT", "INPUT");
    1212    if (!input || !status) {
    1313        psError(PSWARP_ERR_CONFIG, false, "Failed to build FPA from PSWARP.INPUT");
     
    1717    // the input image(s) are required arguments; they define the camera
    1818    status = false;
    19     pmFPAfile *astrom = pmFPAfileDefineFromArgs (&status, config, "PSWARP.ASTROM", "ASTROM");
     19    pmFPAfile *astrom = pmFPAfileBindFromArgs(&status, input, config, "PSWARP.ASTROM", "ASTROM");
    2020    if (!status) {
    2121        psError (PS_ERR_UNKNOWN, false, "failed to load find definition");
     
    4949    // the input skycell is a required argument: it defines the output image
    5050    // XXX we may need a different skycell structure here
    51     status = pswarpDefineSkycell (&skycell, &skyConfig, config, "PSWARP.SKYCELL", "SKYCELL");
     51    status = pswarpDefineSkycell(&skycell, &skyConfig, config, "PSWARP.SKYCELL", "SKYCELL");
    5252    if (!status) {
    5353        psError(PSWARP_ERR_CONFIG, false, "Failed to build FPA from PSWARP.SKYCELL");
    5454        return false;
    5555    }
     56    psFree(skyConfig);
    5657
    57     // these calls bind the I/O handle to the specified fpa
    58     // NOTE: output file could be binned relative to sky cell...
    59     // if (!pmFPAfileDefineFromFPA (skyConfig, skycell->fpa, 1, 1, "PSWARP.OUTPUT")) {
    60     if (!pmFPAfileDefineOutput (skyConfig, skycell->fpa, "PSWARP.OUTPUT")) {
     58    // The output skycell
     59    pmFPAfile *output = pmFPAfileDefineSkycell(config, NULL, "PSWARP.OUTPUT");
     60    if (!output) {
    6161        psError(PSWARP_ERR_CONFIG, false, "Failed to build FPA from PSWARP.OUTPUT");
    6262        return false;
    6363    }
    64     if (!pmFPAfileDefineOutput (skyConfig, skycell->fpa, "PSWARP.OUTPUT.MASK")) {
     64    if (!pmFPAfileDefineSkycell(config, output->fpa, "PSWARP.OUTPUT.MASK")) {
    6565        psError(PSWARP_ERR_CONFIG, false, "Failed to build FPA from PSWARP.OUTPUT.MASK");
    6666        return false;
    6767    }
    6868    if (inWeight) {
    69         if (!pmFPAfileDefineOutput (skyConfig, skycell->fpa, "PSWARP.OUTPUT.WEIGHT")) {
     69        if (!pmFPAfileDefineSkycell(config, output->fpa, "PSWARP.OUTPUT.WEIGHT")) {
    7070            psError(PSWARP_ERR_CONFIG, false, "Failed to build FPA from PSWARP.OUTPUT.WEIGHT");
    7171            return false;
    7272        }
    7373    }
    74     psFree (skyConfig);
    7574
    7675    // Chip selection: turn on only the chips specified
Note: See TracChangeset for help on using the changeset viewer.