IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 14, 2009, 3:17:41 PM (17 years ago)
Author:
heather
Message:

added WCS header info to smf files with help from PAP. HAF.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/magic/censorObjects/src/censorLoop.c

    r24714 r25080  
    2222 */
    2323bool censorLoop (pmConfig *config) {
    24 
     24  //bool status;
    2525    pmChip *chip;
    2626    pmCell *cell;
     
    2828
    2929    psTimerStart ("censor");
     30
     31
     32
    3033
    3134    // select the current recipe
     
    3538        return false;
    3639    }
     40
     41    // physical pixel scale in microns per pixel
     42    //double pixelScale = psMetadataLookupF32 (&status, recipe, "PSASTRO.PIXEL.SCALE");
     43    //if (!status) {
     44    //    psError(PS_ERR_IO, true, "Failed to lookup pixel scale");
     45    //    return false;
     46    //}
     47
    3748
    3849    // select the input data sources
     
    5061    }
    5162
     63   
     64#if 0   
     65    pmFPAfileActivate(config->files, false, NULL);
     66    pmFPAfileActivate(config->files, true, "CENSOR.INPUT");
     67#endif
     68
    5269    pmFPAview *view = pmFPAviewAlloc (0);
     70
     71
     72
     73
     74
    5375    bool badMaskFile = false;
    5476
     
    5981    if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE;
    6082
     83
     84// check PHU header to see if we are using mosaic-level or per-chip astrometry
     85    bool bilevelAstrometry = false;
     86    pmHDU *phu = pmFPAviewThisPHU (view, input->fpa);
     87    if (phu) {
     88      char *ctype = psMetadataLookupStr (NULL, phu->header, "CTYPE1");
     89      if (ctype) bilevelAstrometry = !strcmp (&ctype[4], "-DIS");
     90    }
     91    if (bilevelAstrometry) {
     92      pmAstromReadBilevelMosaic (input->fpa, phu->header);
     93    }
     94
     95
     96
    6197    while ((chip = pmFPAviewNextChip (view, input->fpa, 1)) != NULL) {
    6298        psTrace ("censor", 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process);
    6399        if (!chip->process || !chip->file_exists) { continue; }
    64 
     100       
    65101        // check on the mask file at this level if possible
    66102        badMaskFile = censorBadFileByView(badMaskFile, inMask, config, view);
    67103
    68104        if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE;
     105
     106        // read WCS data from the corresponding header
     107
     108        pmHDU *hdu = pmFPAviewThisHDU (view, input->fpa);
     109       
     110        //      int nAstro = psMetadataLookupS32 (&status, hdu->header, "NASTRO");
     111        //      if (!nAstro) {psLogMsg ("censor", 3, "nothing %f sec\n", psTimerMark ("censor"));}
     112       
     113        //continue;
     114        if (bilevelAstrometry) {
     115          if (!pmAstromReadBilevelChip (chip, hdu->header)) {
     116            psWarning("Could not get WCS information from header for chip %d, skipping", view->chip);
     117            continue;
     118          }
     119        } else {
     120          if (!pmAstromReadWCS(input->fpa, chip, hdu->header, 1.0)) {
     121            psWarning( "Unable to read WCS astrometry from chip %d, skipping", view->chip);
     122            continue;
     123          }
     124        }
     125
     126
     127       
     128
    69129
    70130        while ((cell = pmFPAviewNextCell (view, input->fpa, 1)) != NULL) {
Note: See TracChangeset for help on using the changeset viewer.