IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 27392


Ignore:
Timestamp:
Mar 22, 2010, 1:59:00 PM (16 years ago)
Author:
bills
Message:

changes to support SDSS import

Location:
trunk/Ohana/src/addstar
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/addstar/include/addstar.h

    r26384 r27392  
    145145char     *SELECT_2MASS_QUALITY;  // used only by get2mass_as
    146146int NREFSTAR_GROUP;
     147int NSTAR_GROUP;
    147148
    148149/*** addstar prototypes ***/
  • trunk/Ohana/src/addstar/src/ReadStarsSDSS.c

    r21508 r27392  
    258258  }
    259259
     260  NSTAR_GROUP = NFILTER;
    260261  *nimages += NFILTER;
    261262  *nstars = Nstars*NFILTER;
  • trunk/Ohana/src/addstar/src/args.c

    r24975 r27392  
    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 */
  • trunk/Ohana/src/addstar/src/find_matches.c

    r26384 r27392  
    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, int, 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, int, 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  }
  • trunk/Ohana/src/addstar/src/find_matches_closest.c

    r26384 r27392  
    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
     
    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])) {
     
    222228  /** incorporate unmatched image stars, if this star is in field of this catalog **/
    223229  /* these new entries are all written out in UPDATE mode */
    224   for (i = 0; (i < Nstars) && !options.only_match; i++) {
     230  for (i = 0; (i < Nstars) && !options.only_match; i += NSTAR_GROUP) {
    225231    /* make sure there is space for next entry */
    226     if (Nmeas >= NMEAS) {
     232    if (Nmeas >= NMEAS - NSTAR_GROUP) {
    227233      NMEAS = Nmeas + 1000;
    228234      REALLOCATE (next_meas, int, NMEAS);
     
    244250    catalog[0].average[Nave].dD            = 0;
    245251
    246     catalog[0].average[Nave].Nmeasure      = 1;
     252    catalog[0].average[Nave].Nmeasure      = NSTAR_GROUP;
    247253    catalog[0].average[Nave].Nmissing      = 0;
    248254    catalog[0].average[Nave].Nextend       = 0;
     
    286292    }
    287293
    288     // supply the measurments from this detection
    289     catalog[0].measure[Nmeas]           = stars[N].measure;
    290 
    291     // the following measure elements cannot be set until here:
    292     catalog[0].measure[Nmeas].dR       = 0.0; // astrometric offset, not error
    293     catalog[0].measure[Nmeas].dD       = 0.0; // astrometric offset, not error
    294     catalog[0].measure[Nmeas].dbFlags  = 0;
    295     catalog[0].measure[Nmeas].averef   = Nave;
    296     catalog[0].measure[Nmeas].objID    = catalog[0].average[Nave].objID;
    297     catalog[0].measure[Nmeas].catID    = catalog[0].catID;
    298 
    299     /* set the average magnitude if not already set and the photcode.equiv is not 0 */
    300     /* in UPDATE mode, this value is not saved; use relphot to recalculate */
    301     if (Nsec > -1) {
    302         catalog[0].secfilt[Nave*Nsecfilt+Nsec].M = PhotCat (&catalog[0].measure[Nmeas]);
    303     }
    304 
    305     /* next[Nmeas] should always be -1 in this context (it is always the only
    306        measurement for the star) */
    307     stars[N].found = Nmeas;
    308     next_meas[Nmeas] = -1;
    309     Nmeas ++;
     294    for (j = 0; j < NSTAR_GROUP; j++) {
     295        // supply the measurments from this detection
     296        catalog[0].measure[Nmeas]           = stars[N].measure;
     297        N = N1[i + j];
     298
     299        // the following measure elements cannot be set until here:
     300        catalog[0].measure[Nmeas].dR       = 0.0; // astrometric offset, not error
     301        catalog[0].measure[Nmeas].dD       = 0.0; // astrometric offset, not error
     302        catalog[0].measure[Nmeas].dbFlags  = 0;
     303        catalog[0].measure[Nmeas].averef   = Nave;
     304        catalog[0].measure[Nmeas].objID    = catalog[0].average[Nave].objID;
     305        catalog[0].measure[Nmeas].catID    = catalog[0].catID;
     306
     307        /* set the average magnitude if not already set and the photcode.equiv is not 0 */
     308        /* in UPDATE mode, this value is not saved; use relphot to recalculate */
     309        if (Nsec > -1) {
     310            catalog[0].secfilt[Nave*Nsecfilt+Nsec].M = PhotCat (&catalog[0].measure[Nmeas]);
     311        }
     312
     313        /* next[Nmeas] should always be -1 in this context (it is always the only
     314           measurement for the star) */
     315        stars[N].found = Nmeas;
     316        next_meas[Nmeas] = -1;  // inital value here update below
     317        Nmeas ++;
     318    }
     319    for (j = 0; j < NSTAR_GROUP - 1; j++) {
     320        next_meas[Nmeas - NSTAR_GROUP + j] = Nmeas - NSTAR_GROUP + j + 1;
     321    }
    310322    Nave ++;
    311323  }
Note: See TracChangeset for help on using the changeset viewer.