IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 27, 2015, 4:49:06 PM (11 years ago)
Author:
eugene
Message:

extensive work on relphot, relastro, uniphot, dvomerge aiming to the construction and calibration of PV3

Location:
trunk/Ohana
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana

  • trunk/Ohana/src/addstar/src/grefstars.c

    r38467 r38986  
    22
    33/* read ASCII file with ref star data */
    4 Stars *grefstars (char *file, int photcode, unsigned int *Nstars) {
     4Catalog *grefstars (char *file, int photcode) {
    55
    66  FILE *f;
    7   int N, NSTARS;
    8   Stars *stars;
     7  int NSTARS;
    98  char line[256];
    109
     
    1312  if (f == NULL) Shutdown ("can't read data from %s", file);
    1413
    15   NSTARS = 100;
    16   ALLOCATE (stars, Stars, NSTARS);
     14  NSTARS = 1000;
     15
     16  Catalog *catalog = NULL;
     17  ALLOCATE (catalog, Catalog, 1);
     18  dvo_catalog_init (catalog, TRUE);
     19  ALLOCATE (catalog->average, Average, NSTARS);
     20  ALLOCATE (catalog->measure, Measure, NSTARS);
    1721
    1822  /* read in stars line-by-line */
    19   for (N = 0; scan_line (f, line) != EOF; N++) {
     23  int N = 0;
     24  while (scan_line (f, line) != EOF) {
    2025    stripwhite (line);
    2126    if (line[0] == 0) continue;
    2227    if (line[0] == '#') continue;
    2328
    24     InitStar (&stars[N]);
     29    dvo_average_init (&catalog->average[N]);
     30    dvo_measure_init (&catalog->measure[N]);
    2531
    2632    int status = sscanf (line, "%lf %lf %f %f %x",
    27                      &stars[N].average.R,  &stars[N].average.D, 
    28                      &stars[N].measure.M, &stars[N].measure.dM,
    29                      &stars[N].measure.photFlags);
     33                         &catalog->average[N].R, &catalog->average[N].D, 
     34                         &catalog->measure[N].M, &catalog->measure[N].dM,
     35                         &catalog->measure[N].photFlags);
     36
    3037    if ((status != 4) && (status != 5)) {
    3138      fprintf (stderr, "error reading line: %s\n", line);
    32       N --;
    3339      continue;
    3440    }
    35     stars[N].average.R = ohana_normalize_angle (stars[N].average.R);
     41    catalog->average[N].R = ohana_normalize_angle (catalog->average[N].R);
    3642
    37     stars[N].measure.R = stars[N].average.R;
    38     stars[N].measure.D = stars[N].average.D;
     43    catalog->measure[N].R = catalog->average[N].R;
     44    catalog->measure[N].D = catalog->average[N].D;
    3945
    40     stars[N].measure.photcode = photcode;
     46    catalog->measure[N].photcode = photcode;
    4147
    42     CHECK_REALLOCATE (stars, Stars, NSTARS, N+1, 100);
     48    catalog->average[N].Nmeasure = 1;
     49    catalog->average[N].measureOffset = N;
     50
     51    N++;
     52    CHECK_REALLOCATE (catalog->average, Average, NSTARS, N, 1000);
     53    CHECK_REALLOCATE (catalog->measure, Measure, NSTARS, N, 1000);
    4354  }
    44   *Nstars = N;
    45   return (stars);
     55  catalog->Naverage = N;
     56  catalog->Nmeasure = N;
     57  return (catalog);
    4658}
Note: See TracChangeset for help on using the changeset viewer.