IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 26, 2013, 9:07:23 AM (13 years ago)
Author:
eugene
Message:

major mods to allow multichip output

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20130419/pswarp/src/pswarpLoadAstrometry.c

    r35424 r35434  
    1414// WCS and read the headers.  We place the resulting info on the target astrometry
    1515// containers
    16 bool pswarpLoadAstrometry (pmConfig *config, pmFPAfile *astrom, pmFPAfile *target) {
     16bool pswarpLoadAstrometry (pmFPAfile *target, pmFPAfile *astrom, pmConfig *config) {
    1717
    1818    pmChip *chip = NULL;
    1919    pmCell *cell = NULL;
     20
     21    // XXX assert that astrom be WCS or CMF?
    2022
    2123    // XXX set the type to be WCS
     
    4244        while ((cell = pmFPAviewNextCell (view, astrom->fpa, 1)) != NULL) {
    4345            psTrace ("pswarp", 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process);
    44             if (!cell->process || !cell->file_exists) { continue; }
     46            if (!cell->process) { continue; }
    4547            if (!pmFPAfileRead (astrom, view, config)) {
    4648                psError(psErrorCodeLast(), false, "failed READ at CELL %s", astrom->name);
     
    8991    // apply the bilevel astrometry elements to the target
    9092    if (bilevelAstrometry) {
    91         if (!pmAstromReadBilevelMosaic(target->fpa, phu->header)) {
     93        if (!pmAstromReadBilevelMosaic(astrom->fpa, phu->header)) {
    9294            psError(psErrorCodeLast(), false, "Unable to read bilevel mosaic astrometry for skycell.");
    9395            psFree(view);
     
    9597        }
    9698    }
     99    // for pswarpLocalFrame, I need transformations and HDUs on a single fpa (so set on astrom as well as target)
     100    target->fpa->toTPA = psMemIncrRefCounter (astrom->fpa->toTPA);
     101    target->fpa->fromTPA = psMemIncrRefCounter (astrom->fpa->fromTPA);
     102    target->fpa->toSky = psMemIncrRefCounter (astrom->fpa->toSky);
    97103
    98104    while ((chip = pmFPAviewNextChip (view, astrom->fpa, 1)) != NULL) {
     
    110116        // We read from the astrometry source into the target.
    111117        pmChip *targetChip = pmFPAviewThisChip(view, target->fpa); ///< Chip in the output
     118        if (!targetChip) continue; // only load astrometry into output chips which exist!
     119
    112120        if (bilevelAstrometry) {
    113             if (!pmAstromReadBilevelChip(targetChip, hdu->header)) {
     121            if (!pmAstromReadBilevelChip(chip, hdu->header)) {
    114122                psError(psErrorCodeLast(), false, "Unable to read bilevel chip astrometry for skycell.");
    115123                psFree(view);
     
    118126        } else {
    119127            // we use a default FPA pixel scale of 1.0
    120             if (!pmAstromReadWCS(target->fpa, targetChip, hdu->header, 1.0)) {
     128            if (!pmAstromReadWCS(target->fpa, chip, hdu->header, 1.0)) {
    121129                psError(psErrorCodeLast(), false, "Unable to read WCS astrometry for skycell.");
    122130                psFree(view);
     
    124132            }
    125133        }
     134        targetChip->toFPA = psMemIncrRefCounter (chip->toFPA);
     135        targetChip->fromFPA = psMemIncrRefCounter (chip->fromFPA);
    126136    }
    127137
Note: See TracChangeset for help on using the changeset viewer.