IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 16648


Ignore:
Timestamp:
Feb 24, 2008, 3:28:36 PM (18 years ago)
Author:
eugene
Message:

setting the values for imageID, detID, objID

Location:
branches/eam_branch_20080223/Ohana/src/addstar/src
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branch_20080223/Ohana/src/addstar/src/FilterStars.c

    r15514 r16648  
    11# include "addstar.h"
    22
    3 Stars *FilterStars (Stars *instars, Image *image) {
     3Stars *FilterStars (Stars *instars, Image *image, unsigned int imageID) {
    44
    55  int j, N;
     
    7272    }
    7373   
     74    // XXX currently, this ID is internal only;
     75    // should we use the psphot / other external ID, if available?
     76    stars[N].detID = N; // sequence number within image
     77    stars[N].imageID = imageID; // does this need to be updated?
     78
    7479    N ++;
    7580  }
  • branches/eam_branch_20080223/Ohana/src/addstar/src/LoadStars.c

    r15487 r16648  
    11# include "addstar.h"
    22
    3 Stars *LoadStars (char *filename, int *Nstars, Image **images, int *Nimages, int photcode) {
    4 
    5   int i, Nfile, Nheaders, NheaderSets, mode, *extsize;
    6   char **file;
     3Stars *LoadStars (char *filename, int *Nstars, Image **images, int *Nimages, AddstarClientOptions *options) {
     4
     5  int i, Nfile, NFILE, Nheaders, NheaderSets, mode, *extsize;
     6  char **file, line[1024];
    77  FILE *f;
    88  glob_t globList;
     
    1111  HeaderSet *headerSets;
    1212
    13   // parse the filename as a glob
    14   globList.gl_offs = 0;
    15   glob (filename, 0, NULL, &globList);
    16 
    17   // if the glob does not match, save the literal word:
    18   // otherwise save all glob matches
    19   if (globList.gl_pathc == 0) {
    20     Nfile = 1;
    21     ALLOCATE (file, char *, Nfile);
    22     file[0] = strcreate (filename);
     13  if (options[0].filelist) {
     14    // read the list of input files from the supplied file
     15    f = fopen (filename, "r");
     16    if (f == NULL) {
     17      fprintf (stderr, "can't read input list %s, giving up\n", filename);
     18      exit (1);
     19    }
     20
     21    NFILE = 10;
     22    ALLOCATE (file, char *, NFILE);
     23    for (i = 0; (fscanf (f, "%s", line) != EOF); i++) {
     24      // filename limited to 1024 chars
     25      file[i] = strcreate (line);
     26    }
     27    Nfile = i;
    2328  } else {
    24     Nfile = globList.gl_pathc;
    25     ALLOCATE (file, char *, Nfile);
    26     for (i = 0; i < Nfile; i++) {
    27       file[i] = strcreate (globList.gl_pathv[i]);
     29    // parse the filename as a glob
     30    globList.gl_offs = 0;
     31    glob (filename, 0, NULL, &globList);
     32
     33    // if the glob does not match, save the literal word:
     34    // otherwise save all glob matches
     35    if (globList.gl_pathc == 0) {
     36      Nfile = 1;
     37      ALLOCATE (file, char *, Nfile);
     38      file[0] = strcreate (filename);
     39    } else {
     40      Nfile = globList.gl_pathc;
     41      ALLOCATE (file, char *, Nfile);
     42      for (i = 0; i < Nfile; i++) {
     43        file[i] = strcreate (globList.gl_pathv[i]);
     44      }
    2845    }
    2946  }
     
    5471
    5572    /* supplied photcode is incompatible with multi-chip images */
    56     if ((NheaderSets > 1) && photcode) {
     73    if ((NheaderSets > 1) && options[0].photcode) {
    5774      fprintf (stderr, "ERROR: photcode cannot be supplied to multi-chip images -- manually adjust the headers\n");
    5875      exit (1);
     
    227244      continue;
    228245    }
     246    images[0][Nvalid].imageID = Nvalid;
     247    images[0][Nvalid].externID = 0;
     248    images[0][Nvalid].sourceID = 0;
    229249
    230250    // XXX use something to set the chip name? EXTNAME?
     
    254274         
    255275    inStars = ReadStarsFITS (f, headers[Nhead], headers[Ndata], &images[0][Nvalid].nstar);
    256     inStars = FilterStars (inStars, &images[0][Nvalid]);
     276    inStars = FilterStars (inStars, &images[0][Nvalid], Nvalid);
    257277    *stars = MergeStars (*stars, Nstars, inStars, images[0][Nvalid].nstar);
    258278    Nvalid++;
  • branches/eam_branch_20080223/Ohana/src/addstar/src/addstar.c

    r15743 r16648  
    3737  switch (options.mode) {
    3838    case M_IMAGE:
    39       stars = LoadStars (argv[1], &Nstars, &images, &Nimages, options.photcode);
     39      stars = LoadStars (argv[1], &Nstars, &images, &Nimages, &options);
     40
     41      // set and update the imageID sequence
     42      UpdateImageIDs (stars, Nstars, images, Nimages);
     43
    4044      if ((DUMP != NULL) && !strcmp (DUMP, "rawstars")) dump_rawstars (stars, Nstars);
    4145      for (i = 0; i < Nimages; i++) {
  • branches/eam_branch_20080223/Ohana/src/addstar/src/args.c

    r14590 r16648  
    3737  if ((N = get_argument (argc, argv, "-resort"))) {
    3838    options.mode = M_RESORT;
     39    remove_argument (N, &argc, argv);
     40  }
     41
     42  options.filelist = FALSE;
     43  if ((N = get_argument (argc, argv, "-list"))) {
     44    options.filelist = TRUE;
    3945    remove_argument (N, &argc, argv);
    4046  }
  • branches/eam_branch_20080223/Ohana/src/addstar/src/fakeimage.c

    r15509 r16648  
    193193  image[0].Myyyy = 0;
    194194
     195  // XXX need to set the imageID here
     196
    195197  *Nimage = Nchips + 1;
    196198  return (image);
  • branches/eam_branch_20080223/Ohana/src/addstar/src/find_matches.c

    r16633 r16648  
    3737  NMEAS = Nmeas = catalog[0].Nmeasure;
    3838 
     39  // current max obj ID for this catalog
     40  objID = catalog[0].objID;
     41  catID = catalog[0].catID;
     42
    3943  /* project onto rectilinear grid with 1 arcsec pixels. the choice of ZEA projection has the
    4044   * advantage that every point in R,D has a mapping to a unique X,Y.  However, note that not all
     
    280284    catalog[0].average[Nave].P         = 0;
    281285    catalog[0].average[Nave].dP        = 0;
     286
     287    catalog[0].average[Nave].objID     = objID;
     288    catalog[0].average[Nave].catID     = catID;
     289    objID ++;
    282290
    283291    for (j = 0; j < Nsecfilt; j++) {
     
    314322
    315323    catalog[0].measure[Nmeas].detID     = stars[N].detID;
    316     catalog[0].measure[Nmeas].imageID   = options.imageID;
     324    catalog[0].measure[Nmeas].imageID   = stars[N].imageID;
    317325
    318326    catalog[0].measure[Nmeas].dXccd     = stars[N].dX;
     
    359367
    360368  /* check if the catalog has changed?  if no change, no need to write */
     369  catalog[0].objID    = objID; // new max value, save on catalog close
    361370  catalog[0].Naverage = Nave;
    362371  catalog[0].Nmeasure = Nmeas;
  • branches/eam_branch_20080223/Ohana/src/addstar/src/find_matches_closest.c

    r16633 r16648  
    3737  NMEAS = Nmeas = catalog[0].Nmeasure;
    3838  NMISS = Nmiss = catalog[0].Nmissing;
     39
     40  // current max obj ID for this catalog
     41  objID = catalog[0].objID;
     42  catID = catalog[0].catID;
    3943
    4044  /* project onto rectilinear grid with 1 arcsec pixels. the choice of ZEA projection has the
     
    283287    catalog[0].average[Nave].dP        = 0;
    284288
     289    catalog[0].average[Nave].objID     = objID;
     290    catalog[0].average[Nave].catID     = catID;
     291    objID ++;
     292
    285293    for (j = 0; j < Nsecfilt; j++) {
    286294      catalog[0].secfilt[Nave*Nsecfilt+j].M  = NAN;
     
    360368
    361369  /* check if the catalog has changed?  if no change, no need to write */
     370  catalog[0].objID    = objID; // new max value, save on catalog close
    362371  catalog[0].Naverage = Nave;
    363372  catalog[0].Nmeasure = Nmeas;
  • branches/eam_branch_20080223/Ohana/src/addstar/src/find_matches_refstars.c

    r16633 r16648  
    4747  REALLOCATE (catalog[0].missing, Missing, NMISS);
    4848 
     49  // current max obj ID for this catalog
     50  objID = catalog[0].objID;
     51  catID = catalog[0].catID;
     52
    4953  /* project onto rectilinear grid with 1 arcsec pixels, sort by X */
    5054  /* reference for coords is catalog center */
     
    253257    }
    254258
     259    catalog[0].average[Nave].objID     = objID;
     260    catalog[0].average[Nave].catID     = catID;
     261    objID ++;
     262
    255263    for (j = 0; j < Nsecfilt; j++) {
    256264      catalog[0].secfilt[Nave*Nsecfilt+j].M  = NAN;
     
    369377  free (next_miss);
    370378
     379  catalog[0].objID    = objID; // new max value, save on catalog close
    371380  catalog[0].Naverage = Nave;
    372381  catalog[0].Nmeasure = Nmeas;
  • branches/eam_branch_20080223/Ohana/src/addstar/src/get2mass_dr2.c

    r7394 r16648  
    6262      stars[Nstars].t     = short_date_to_sec (&buffer[NBYTE*i + 164]);
    6363      stars[Nstars].found = -1;
     64      stars[Nstars].detID   = 0;
     65      stars[Nstars].imageID = 0;
    6466
    6567      if (photcode == TM_J) {
  • branches/eam_branch_20080223/Ohana/src/addstar/src/get2mass_ops.c

    r14590 r16648  
    5757  }
    5858
    59   star[0].M     = M;
    60   star[0].dM    = dM;
    61   star[0].code  = Photcode;
    62   star[0].t     = time;
    63   star[0].found = -1;
     59  star[0].M       = M;
     60  star[0].dM      = dM;
     61  star[0].code    = Photcode;
     62  star[0].t       = time;
     63  star[0].found   = -1;
     64  star[0].detID   = 0;
     65  star[0].imageID = 0;
    6466
    6567  return TRUE;
     
    108110  star[0].t     = time;
    109111  star[0].found = -1;
     112  star[0].detID   = 0;
     113  star[0].imageID = 0;
    110114
    111115  star[1].M     = H;
     
    114118  star[1].t     = time;
    115119  star[1].found = -1;
     120  star[1].detID   = 0;
     121  star[1].imageID = 0;
    116122
    117123  star[2].M     = K;
     
    120126  star[2].t     = time;
    121127  star[2].found = -1;
     128  star[2].detID   = 0;
     129  star[2].imageID = 0;
    122130
    123131  return TRUE;
  • branches/eam_branch_20080223/Ohana/src/addstar/src/getgsc.c

    r15514 r16648  
    7575      stars[Nstars].code  = GSC_M;
    7676      stars[Nstars].found = -1;
     77
     78      stars[Nstars].detID   = 0;
     79      stars[Nstars].imageID = 0;
     80
    7781      Nstars ++;
    7882      CHECK_REALLOCATE (stars, Stars, NSTARS, Nstars, 1000);
  • branches/eam_branch_20080223/Ohana/src/addstar/src/gettycho.c

    r14590 r16648  
    9696        stars[Ntycho].dP  = 0;
    9797
     98        stars[Ntycho].detID   = 0;
     99        stars[Ntycho].imageID = 0;
     100
    98101        /* Tycho uses J2000 equinox and 1991.25 epoch for coordinates */
    99102        /* the magnitudes have no temporal information */
  • branches/eam_branch_20080223/Ohana/src/addstar/src/getusno.c

    r15514 r16648  
    117117      stars[Nusno].found = -1;
    118118
     119      stars[Nusno].detID   = 0;
     120      stars[Nusno].imageID = 0;
     121
    119122      /* one pass of addstar does either r or b */
    120123      if (photcode == USNO_RED) {
  • branches/eam_branch_20080223/Ohana/src/addstar/src/getusnob.c

    r15036 r16648  
    141141      stars[Nusno].found = -1;
    142142     
     143      stars[Nusno].detID   = 0;
     144      stars[Nusno].imageID = 0;
     145
    143146      /* USNO-B uses J2000 equinox and 2000.0 epoch for coordinates */
    144147      /* the magnitudes have no temporal information */
  • branches/eam_branch_20080223/Ohana/src/addstar/src/grefstars.c

    r8361 r16648  
    3030    stars[N].code = photcode;
    3131    stars[N].found = FALSE;
     32    stars[N].detID   = 0;
     33    stars[N].imageID = 0;
    3234    CHECK_REALLOCATE (stars, Stars, NSTARS, N+1, 100);
    3335  }
Note: See TracChangeset for help on using the changeset viewer.