IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 27369


Ignore:
Timestamp:
Mar 19, 2010, 5:52:50 PM (16 years ago)
Author:
Paul Price
Message:

Fix CCDNUM-KEYWORD

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/addstar/src/ReadImageHeader.c

    r26370 r27369  
    8585  }
    8686
    87   { 
     87  {
    8888    double R, D;
    8989    /* sanity check on the image coordinates */
     
    9494    }
    9595  }
    96    
     96
    9797  /* CERROR in data file is in arcsec */
    9898  if (!gfits_scan (header, "CERROR",   "%lf", 1, &tmp)) tmp = 1.0;
    9999  image[0].cerror = tmp * 50.0;
    100  
     100
    101101  /* get photcode from header */
    102102  if (photcode == 0) {
     
    112112    photcode = photcodeData[0].code;
    113113  }
    114   if (photcode == 0) { 
     114  if (photcode == 0) {
    115115    fprintf (stderr, "no valid photcode is supplied\n");
    116116    return (FALSE);
     
    122122  gfits_scan (header, ExptimeKeyword,  "%lf", 1, &tmp);
    123123  image[0].exptime = tmp;
    124  
     124
    125125  /*** why are we no longer using APMIFIT?? ***/
    126126  tmp = 0;
     
    172172  if (gfits_scan (header, AirmassKeyword, "%lf", 1, &tmp)) {
    173173    image[0].secz = tmp;
    174   } 
     174  }
    175175
    176176  if (!gfits_scan (header, CCDNumKeyword, "%s", 1, ccdnum)) {
     
    184184    // get rid of any leading non-digit characters
    185185    while (*p && !isdigit(*p)) p++;
    186     if (*p == 0) {
    187       fprintf (stderr, "invalid ccdnum %s\n", ccdnum);
    188       return FALSE;
    189     }
    190     image[0].ccdnum = atoi(p);
     186    if (*p) {
     187        image[0].ccdnum = atoi(p);
     188    } else {
     189        image[0].ccdnum = 0;
     190    }
    191191  }
    192192
     
    198198  } else {
    199199    if (sourceID > 0xffff) {
    200       fprintf (stderr, "image source ID is surprisingly large: %d, skipping\n", sourceID); 
     200      fprintf (stderr, "image source ID is surprisingly large: %d, skipping\n", sourceID);
    201201      return (FALSE);
    202202    }
     
    207207  // 0 - 32 so it would fit in an unsigned int.  This is also needed because some programs like
    208208  // sextractor will put in an arbitrary zero point that we need to understand to get back to
    209   // instrumental mags. 
     209  // instrumental mags.
    210210  gfits_scan (header, "ZERO_PT", "%lf", 1, &ZeroPt);
    211211  if (ZeroPt != GetZeroPoint()) {
    212       fprintf (stderr, "WARNING: inconsistent zero point values: image: %f, config: %f\n", ZeroPt, GetZeroPoint()); 
     212      fprintf (stderr, "WARNING: inconsistent zero point values: image: %f, config: %f\n", ZeroPt, GetZeroPoint());
    213213  }
    214214
     
    217217      float ZPT_OBS;
    218218      if (!photcodeData || !gfits_scan (header, "ZPT_OBS", "%f", 1, &ZPT_OBS)) {
    219           fprintf (stderr, "zero point not supplied in header\n");
    220           ZERO_POINT_OFFSET = 0.0;
     219          fprintf (stderr, "zero point not supplied in header\n");
     220          ZERO_POINT_OFFSET = 0.0;
    221221      } else {
    222           ZERO_POINT_OFFSET = 0.001*photcodeData[0].C - ZPT_OBS;
    223       }   
     222          ZERO_POINT_OFFSET = 0.001*photcodeData[0].C - ZPT_OBS;
     223      }
    224224  }
    225225
     
    227227  if (!strcasecmp(ZERO_POINT_OPTION, "PHU_HEADER")) {
    228228      if (!photcodeData) {
    229           fprintf (stderr, "photcode data not supplied for this chip\n");
    230           ZERO_POINT_OFFSET = 0.0;
     229          fprintf (stderr, "photcode data not supplied for this chip\n");
     230          ZERO_POINT_OFFSET = 0.0;
    231231      } else {
    232           ZERO_POINT_OFFSET = 0.001*photcodeData[0].C - ZERO_POINT_OFFSET;
    233       }   
     232          ZERO_POINT_OFFSET = 0.001*photcodeData[0].C - ZERO_POINT_OFFSET;
     233      }
    234234  }
    235235
Note: See TracChangeset for help on using the changeset viewer.