IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 27430


Ignore:
Timestamp:
Mar 24, 2010, 8:56:59 AM (16 years ago)
Author:
eugene
Message:

merge changes from trunk (mostly related to recent SDSS fix)

Location:
branches/eam_branches/largefiles.20100314/Ohana
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/largefiles.20100314/Ohana

  • branches/eam_branches/largefiles.20100314/Ohana/src/addstar/include/addstar.h

    r27368 r27430  
    145145char     *SELECT_2MASS_QUALITY;  // used only by get2mass_as
    146146int NREFSTAR_GROUP;
     147int NSTAR_GROUP;
    147148
    148149/*** addstar prototypes ***/
  • branches/eam_branches/largefiles.20100314/Ohana/src/addstar/src/ReadImageHeader.c

    r27338 r27430  
    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)) {
     
    199199  } else {
    200200    if (sourceID > 0xffff) {
    201       fprintf (stderr, "image source ID is surprisingly large: %d, skipping\n", sourceID); 
     201      fprintf (stderr, "image source ID is surprisingly large: %d, skipping\n", sourceID);
    202202      return (FALSE);
    203203    }
     
    208208  // 0 - 32 so it would fit in an unsigned int.  This is also needed because some programs like
    209209  // sextractor will put in an arbitrary zero point that we need to understand to get back to
    210   // instrumental mags. 
     210  // instrumental mags.
    211211  gfits_scan (header, "ZERO_PT", "%lf", 1, &ZeroPt);
    212212  if (ZeroPt != GetZeroPoint()) {
    213       fprintf (stderr, "WARNING: inconsistent zero point values: image: %f, config: %f\n", ZeroPt, GetZeroPoint()); 
     213      fprintf (stderr, "WARNING: inconsistent zero point values: image: %f, config: %f\n", ZeroPt, GetZeroPoint());
    214214  }
    215215
     
    218218      float ZPT_OBS;
    219219      if (!photcodeData || !gfits_scan (header, "ZPT_OBS", "%f", 1, &ZPT_OBS)) {
    220           fprintf (stderr, "zero point not supplied in header\n");
    221           ZERO_POINT_OFFSET = 0.0;
     220          fprintf (stderr, "zero point not supplied in header\n");
     221          ZERO_POINT_OFFSET = 0.0;
    222222      } else {
    223           ZERO_POINT_OFFSET = 0.001*photcodeData[0].C - ZPT_OBS;
    224       }   
     223          ZERO_POINT_OFFSET = 0.001*photcodeData[0].C - ZPT_OBS;
     224      }
    225225  }
    226226
     
    228228  if (!strcasecmp(ZERO_POINT_OPTION, "PHU_HEADER")) {
    229229      if (!photcodeData) {
    230           fprintf (stderr, "photcode data not supplied for this chip\n");
    231           ZERO_POINT_OFFSET = 0.0;
     230          fprintf (stderr, "photcode data not supplied for this chip\n");
     231          ZERO_POINT_OFFSET = 0.0;
    232232      } else {
    233           ZERO_POINT_OFFSET = 0.001*photcodeData[0].C - ZERO_POINT_OFFSET;
    234       }   
     233          ZERO_POINT_OFFSET = 0.001*photcodeData[0].C - ZERO_POINT_OFFSET;
     234      }
    235235  }
    236236
  • branches/eam_branches/largefiles.20100314/Ohana/src/addstar/src/ReadStarsSDSS.c

    r27296 r27430  
    259259  }
    260260
     261  NSTAR_GROUP = NFILTER;
    261262  *nimages += NFILTER;
    262263  *nstars = Nstars*NFILTER;
  • branches/eam_branches/largefiles.20100314/Ohana/src/addstar/src/args.c

    r24975 r27430  
    99  // a global used by find_matches_refstars.c (value is 1 except for load2mass)
    1010  NREFSTAR_GROUP = 1;
     11  // a global used by find_matches_closest.c (value is 1 except for loadsdss)
     12  NSTAR_GROUP = 1;
    1113
    1214  /* check for help request */
  • branches/eam_branches/largefiles.20100314/Ohana/src/addstar/src/find_matches.c

    r27295 r27430  
    1212  unsigned int objID, catID;
    1313  Coords tcoords;
     14
     15  if (NSTAR_GROUP <= 0) {
     16      fprintf (stderr, "ERROR: NSTAR_GROUP NOT SET!\n");
     17      exit (1);
     18  }
    1419
    1520  /* photcode data - must by of type DEP; options.photcode is equiv photcode for all input
     
    103108
    104109  /** find matched stars **/
     110  // XXX could use NSTAR_GROUP to do this match more quicky if NSTAR_GROUP > 1
    105111  for (i = j = 0; (i < Nstars) && (j < Nave); ) {
    106112    if (!finite(X1[i]) || !finite(Y1[i])) {
     
    141147        NMEAS = Nmeas + 1000;
    142148        REALLOCATE (next_meas, off_t, NMEAS);
     149
    143150        REALLOCATE (catalog[0].measure, Measure, NMEAS);
    144151      }
     
    227234  /* incorporate unmatched image stars, if this star is in field of this catalog */
    228235  /* these new entries are all written out in UPDATE mode */
    229   for (i = 0; (i < Nstars) && !options.only_match; i++) {
     236  for (i = 0; (i < Nstars) && !options.only_match; i += NSTAR_GROUP) {
    230237    /* make sure there is space for next entry */
    231     if (Nmeas >= NMEAS) {
     238    if (Nmeas >= NMEAS - NSTAR_GROUP) {
    232239      NMEAS = Nmeas + 1000;
    233240      REALLOCATE (next_meas, off_t, NMEAS);
     
    249256    catalog[0].average[Nave].dD            = 0;
    250257
    251     catalog[0].average[Nave].Nmeasure      = 1;
     258    catalog[0].average[Nave].Nmeasure      = NSTAR_GROUP;
    252259    catalog[0].average[Nave].Nmissing      = 0;
    253260    catalog[0].average[Nave].Nextend       = 0;
     
    290297    }
    291298
    292     // supply the measurments from this detection
    293     catalog[0].measure[Nmeas]           = stars[N].measure;
    294 
    295     // the following measure elements cannot be set until here:
    296     catalog[0].measure[Nmeas].dR        = 0.0;
    297     catalog[0].measure[Nmeas].dD        = 0.0;
    298     catalog[0].measure[Nmeas].dbFlags   = 0;
    299     catalog[0].measure[Nmeas].averef    = Nave; // XXX EAM : must be absolute Nave if partial read
    300     catalog[0].measure[Nmeas].objID     = catalog[0].average[Nave].objID;
    301     catalog[0].measure[Nmeas].catID     = catalog[0].catID;
    302 
    303     /* set the average magnitude if not already set and the photcode.equiv is not 0 */
    304     /* in UPDATE mode, this value is not saved; use relphot to recalculate */
    305     if (Nsec > -1) {
    306         catalog[0].secfilt[Nave*Nsecfilt+Nsec].M = PhotCat (&catalog[0].measure[Nmeas]);
    307     }
    308 
    309     /* next[Nmeas] should always be -1 in this context (it is always the only
    310        measurement for the star) */
    311     stars[N].found = Nmeas;
    312     next_meas[Nmeas] = -1;
    313     Nmeas ++;
     299    for (j = 0; j < NSTAR_GROUP; j++) {
     300      // supply the measurments from this detection
     301      catalog[0].measure[Nmeas]           = stars[N].measure;
     302      N = N1[i + j];
     303
     304      // the following measure elements cannot be set until here:
     305      catalog[0].measure[Nmeas].dR              = 0.0;
     306      catalog[0].measure[Nmeas].dD              = 0.0;
     307      catalog[0].measure[Nmeas].dbFlags         = 0;
     308      catalog[0].measure[Nmeas].averef          = Nave; // XXX EAM : must be absolute Nave if partial read
     309      catalog[0].measure[Nmeas].objID     = catalog[0].average[Nave].objID;
     310      catalog[0].measure[Nmeas].catID     = catalog[0].catID;
     311
     312      /* set the average magnitude if not already set and the photcode.equiv is not 0 */
     313      /* in UPDATE mode, this value is not saved; use relphot to recalculate */
     314      if (Nsec > -1) {
     315          catalog[0].secfilt[Nave*Nsecfilt+Nsec].M = PhotCat (&catalog[0].measure[Nmeas]);
     316      }
     317
     318      /* next[Nmeas] should always be -1 in this context (it is always the only
     319         measurement for the star) */
     320      stars[N].found = Nmeas;
     321      next_meas[Nmeas] = -1;  // initial value here update below
     322      Nmeas ++;
     323    }
     324    for (j = 0; j < NSTAR_GROUP - 1; j++) {
     325      next_meas[Nmeas - NSTAR_GROUP + j] = Nmeas - NSTAR_GROUP + j + 1;
     326    }
    314327    Nave ++;
    315328  }
  • branches/eam_branches/largefiles.20100314/Ohana/src/addstar/src/find_matches_closest.c

    r27382 r27430  
    1313  Coords tcoords;
    1414
     15  if (NSTAR_GROUP <= 0) {
     16      fprintf (stderr, "ERROR: NSTAR_GROUP NOT SET!\n");
     17      exit (1);
     18  }
     19
    1520  /* photcode data - must by of type DEP; options.photcode is equiv photcode for all input
    1621     images this function requires incoming stars to have the same photcode.equiv value.  if
     
    104109
    105110  /** find matched stars **/
     111  // XXX could use NSTAR_GROUP to do this match more quicky if NSTAR_GROUP > 1
    106112  for (i = j = 0; (i < Nstars) && (j < Nave); ) {
    107113    if (!finite(X1[i]) || !finite(Y1[i])) {
     
    223229  /** incorporate unmatched image stars, if this star is in field of this catalog **/
    224230  /* these new entries are all written out in UPDATE mode */
    225   for (i = 0; (i < Nstars) && !options.only_match; i++) {
     231  for (i = 0; (i < Nstars) && !options.only_match; i += NSTAR_GROUP) {
    226232    /* make sure there is space for next entry */
    227     if (Nmeas >= NMEAS) {
     233    if (Nmeas >= NMEAS - NSTAR_GROUP) {
    228234      NMEAS = Nmeas + 1000;
    229235      REALLOCATE (next_meas, off_t, NMEAS);
     
    245251    catalog[0].average[Nave].dD            = 0;
    246252
    247     catalog[0].average[Nave].Nmeasure      = 1;
     253    catalog[0].average[Nave].Nmeasure      = NSTAR_GROUP;
    248254    catalog[0].average[Nave].Nmissing      = 0;
    249255    catalog[0].average[Nave].Nextend       = 0;
     
    285291    }
    286292
    287     // supply the measurments from this detection
    288     catalog[0].measure[Nmeas]           = stars[N].measure;
    289 
    290     // the following measure elements cannot be set until here:
    291     catalog[0].measure[Nmeas].dR       = 0.0; // astrometric offset, not error
    292     catalog[0].measure[Nmeas].dD       = 0.0; // astrometric offset, not error
    293     catalog[0].measure[Nmeas].dbFlags  = 0;
    294     catalog[0].measure[Nmeas].averef   = Nave;
    295     catalog[0].measure[Nmeas].objID    = catalog[0].average[Nave].objID;
    296     catalog[0].measure[Nmeas].catID    = catalog[0].catID;
    297 
    298     /* set the average magnitude if not already set and the photcode.equiv is not 0 */
    299     /* in UPDATE mode, this value is not saved; use relphot to recalculate */
    300     if (Nsec > -1) {
    301         catalog[0].secfilt[Nave*Nsecfilt+Nsec].M = PhotCat (&catalog[0].measure[Nmeas]);
    302     }
    303 
    304     /* next[Nmeas] should always be -1 in this context (it is always the only
    305        measurement for the star) */
    306     stars[N].found = Nmeas;
    307     next_meas[Nmeas] = -1;
    308     Nmeas ++;
     293    for (j = 0; j < NSTAR_GROUP; j++) {
     294        // supply the measurments from this detection
     295        catalog[0].measure[Nmeas]           = stars[N].measure;
     296        N = N1[i + j];
     297
     298        // the following measure elements cannot be set until here:
     299        catalog[0].measure[Nmeas].dR       = 0.0; // astrometric offset, not error
     300        catalog[0].measure[Nmeas].dD       = 0.0; // astrometric offset, not error
     301        catalog[0].measure[Nmeas].dbFlags  = 0;
     302        catalog[0].measure[Nmeas].averef   = Nave;
     303        catalog[0].measure[Nmeas].objID    = catalog[0].average[Nave].objID;
     304        catalog[0].measure[Nmeas].catID    = catalog[0].catID;
     305
     306        /* set the average magnitude if not already set and the photcode.equiv is not 0 */
     307        /* in UPDATE mode, this value is not saved; use relphot to recalculate */
     308        if (Nsec > -1) {
     309            catalog[0].secfilt[Nave*Nsecfilt+Nsec].M = PhotCat (&catalog[0].measure[Nmeas]);
     310        }
     311
     312        /* next[Nmeas] should always be -1 in this context (it is always the only
     313           measurement for the star) */
     314        stars[N].found = Nmeas;
     315        next_meas[Nmeas] = -1;  // inital value here update below
     316        Nmeas ++;
     317    }
     318    for (j = 0; j < NSTAR_GROUP - 1; j++) {
     319        next_meas[Nmeas - NSTAR_GROUP + j] = Nmeas - NSTAR_GROUP + j + 1;
     320    }
    309321    Nave ++;
    310322  }
Note: See TracChangeset for help on using the changeset viewer.