IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 27046


Ignore:
Timestamp:
Feb 23, 2010, 5:25:24 PM (16 years ago)
Author:
Paul Price
Message:

Close PSASTRO.MODEL (now require closing all pmFPAfiles).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psastro/src/psastroUseModel.c

    r21409 r27046  
    11/** @file psastroMosiacAstrom.c
    22 *
    3  *  @brief 
     3 *  @brief
    44 *
    55 *  @ingroup libpsastro
     
    1717/**
    1818 * Apply the generic astrometry model to this image.  This assumes the WCS i
    19  * terms either do not exist or are invalid 
     19 * terms either do not exist or are invalid
    2020 */
    2121bool psastroUseModel (pmConfig *config, psMetadata *recipe) {
     
    2929  if (!useModel) return true;
    3030
    31   // identify reference astrometry table. 
     31  // identify reference astrometry table.
    3232  // if not defined, correction was not requested; skip step
    3333  pmFPAfile *astrom = psMetadataLookupPtr (NULL, config->files, "PSASTRO.MODEL");
     
    6969      pmFPAview *myView = pmFPAviewAlloc (0);
    7070
    71       // loop over all chips, replace input astrometry elements with those from astrom 
     71      // loop over all chips, replace input astrometry elements with those from astrom
    7272      pmChip *obsChip = NULL;
    7373      while ((obsChip = pmFPAviewNextChip (myView, input->fpa, 1)) != NULL) {
    74           psTrace ("psastro", 4, "Chip %d: %x %x\n", myView->chip, obsChip->file_exists, obsChip->process);
    75           if (!obsChip->process || !obsChip->file_exists || !obsChip->data_exists) { continue; }
     74          psTrace ("psastro", 4, "Chip %d: %x %x\n", myView->chip, obsChip->file_exists, obsChip->process);
     75          if (!obsChip->process || !obsChip->file_exists || !obsChip->data_exists) { continue; }
    7676
    77           // set the chip astrometry using the astrom file
    78           pmChip *refChip = pmFPAviewThisChip (myView, astrom->fpa);
     77          // set the chip astrometry using the astrom file
     78          pmChip *refChip = pmFPAviewThisChip (myView, astrom->fpa);
    7979
    80           psFree (obsChip->toFPA);
    81           psFree (obsChip->fromFPA);
     80          psFree (obsChip->toFPA);
     81          psFree (obsChip->fromFPA);
    8282
    83           // supply astrometry from model
    84           obsChip->toFPA   = psMemIncrRefCounter (refChip->toFPA);
    85           obsChip->fromFPA = psMemIncrRefCounter (refChip->fromFPA);
     83          // supply astrometry from model
     84          obsChip->toFPA   = psMemIncrRefCounter (refChip->toFPA);
     85          obsChip->fromFPA = psMemIncrRefCounter (refChip->fromFPA);
    8686
    87           // XXX if we want to write out the result, update the header here.  this needs to be
    88           // updated with the correct HDU selection.  obsChip->hdu may not exist.
    89           // pmAstromWriteBilevelChip (obsChip->hdu->header, obsChip, NONLIN_TOL);
     87          // XXX if we want to write out the result, update the header here.  this needs to be
     88          // updated with the correct HDU selection.  obsChip->hdu may not exist.
     89          // pmAstromWriteBilevelChip (obsChip->hdu->header, obsChip, NONLIN_TOL);
    9090      }
    9191
     
    108108  if (DEBUG) psastroDumpCorners ("corners.up.ast2.dat", "corners.dn.ast2.dat", astrom->fpa);
    109109
    110   // loop over all chips, replace input astrometry elements with those from astrom 
     110  // loop over all chips, replace input astrometry elements with those from astrom
    111111  pmChip *obsChip = NULL;
    112112  while ((obsChip = pmFPAviewNextChip (view, input->fpa, 1)) != NULL) {
     
    120120    psFree (obsChip->fromFPA);
    121121
    122     // supply astrometry from model 
     122    // supply astrometry from model
    123123    obsChip->toFPA   = psMemIncrRefCounter (refChip->toFPA);
    124124    obsChip->fromFPA = psMemIncrRefCounter (refChip->fromFPA);
     
    147147  // psFree (updates);
    148148
     149  // files associated with the science image
     150  if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) {
     151      psError (PS_ERR_IO, false, "Can't close the astrometry model file");
     152      return false;
     153  }
     154
    149155  psFree (view);
    150156  return true;
Note: See TracChangeset for help on using the changeset viewer.