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/getusno.c

    r38467 r38986  
    44# define NELEM  3
    55
    6 Stars *getusno (SkyRegion *catstats, int photcode, unsigned int *nstars) {
     6Catalog *getusno (SkyRegion *catstats) {
    77
    88  off_t offset;
     
    1515  double dec;
    1616  int spd, spd_start, spd_end;
    17   int NUSNO, Nusno;
    18   Stars *stars;
    1917  short int USNO_RED, USNO_BLUE;
    2018
     
    2220  NAMED_PHOTCODE (USNO_RED, "USNO_RED");
    2321  NAMED_PHOTCODE (USNO_BLUE, "USNO_BLUE");
    24   if (photcode == USNO_RED) goto good_code;
    25   if (photcode == USNO_BLUE) goto good_code;
    26   Shutdown ("USNO photcode not specified");
    27 good_code:
    2822
    2923  /* identify ra & dec range of interest */
     
    4337  }
    4438
    45   Nusno = 0;
    46   NUSNO = 5000;
    47   ALLOCATE (stars, Stars, NUSNO);
     39  int Nave = 0;
     40  int Nmeas = 0;
     41  int NAVE = 1000;
     42  int NMEAS = 1000;
     43
     44  Catalog *catalog = NULL;
     45  ALLOCATE (catalog, Catalog, 1);
     46  dvo_catalog_init (catalog, TRUE);
     47  ALLOCATE (catalog->average, Average, NAVE);
     48  ALLOCATE (catalog->measure, Measure, NMEAS);
    4849
    4950  for (spd = spd_start; spd < spd_end; spd += 75) {
     
    110111      if (buf[1] > iDEC1) continue;
    111112
    112       InitStar (&stars[Nusno]);
     113      dvo_average_init (&catalog->average[Nave]);
     114      dvo_measure_init (&catalog->measure[Nmeas+0]);
     115      dvo_measure_init (&catalog->measure[Nmeas+1]);
    113116
    114       stars[Nusno].average.R     = buf[0]/360000.0;
    115       stars[Nusno].average.D     = buf[1]/360000.0 - 90.0;
    116       stars[Nusno].measure.R     = stars[Nusno].average.R;
    117       stars[Nusno].measure.D     = stars[Nusno].average.D;
    118       stars[Nusno].measure.dM    = NAN;
     117      catalog->average[Nave].R     = buf[0]/360000.0;
     118      catalog->average[Nave].D     = buf[1]/360000.0 - 90.0;
    119119
    120       /* one pass of addstar does either r or b */
    121       if (photcode == USNO_RED) {
    122         stars[Nusno].measure.photcode = USNO_RED;
    123         stars[Nusno].measure.M        = fabs (0.1*(buf[2] - 1000*((int)(buf[2]/1000))));
    124       }
    125       if (photcode == USNO_BLUE) {     
    126         stars[Nusno].measure.photcode = USNO_BLUE;
    127         stars[Nusno].measure.M        = fabs (0.1*((int)(buf[2] - 1000000*((int)(buf[2]/1000000))) / 1000));
    128       }
    129       Nusno ++;
    130       CHECK_REALLOCATE (stars, Stars, NUSNO, Nusno, 5000);
     120      catalog->measure[Nmeas+0].R  = catalog->average[Nave].R;
     121      catalog->measure[Nmeas+0].D  = catalog->average[Nave].D;
     122      catalog->measure[Nmeas+0].dM = NAN;
     123      catalog->measure[Nmeas+1].R  = catalog->average[Nave].R;
     124      catalog->measure[Nmeas+1].D  = catalog->average[Nave].D;
     125      catalog->measure[Nmeas+1].dM = NAN;
     126
     127      catalog->measure[Nmeas+0].photcode = USNO_RED;
     128      catalog->measure[Nmeas+0].M        = fabs (0.1*(buf[2] - 1000*((int)(buf[2]/1000))));
     129      catalog->measure[Nmeas+1].photcode = USNO_BLUE;
     130      catalog->measure[Nmeas+1].M        = fabs (0.1*((int)(buf[2] - 1000000*((int)(buf[2]/1000000))) / 1000));
     131
     132      catalog->average[Nave].Nmeasure = 2;
     133      catalog->average[Nave].measureOffset = Nmeas;
     134
     135      Nave ++;
     136      Nmeas += 2;
     137
     138      CHECK_REALLOCATE (catalog->average, Average, NAVE,  Nave,  1000);
     139      CHECK_REALLOCATE (catalog->measure, Measure, NMEAS, Nmeas, 1000);
    131140    }
    132141    free (buffer);
    133142    fclose (f);
    134143  }
    135   REALLOCATE (stars, Stars, Nusno);
     144  catalog->Naverage = Nave;
     145  catalog->Nmeasure = Nmeas;
    136146
    137   *nstars = Nusno;
    138   if (VERBOSE) fprintf (stderr, "%d stars from USNO 1.0\n", Nusno);
    139   return (stars);
     147  if (VERBOSE) fprintf (stderr, "%d stars from USNO 1.0\n", Nave);
     148  return (catalog);
    140149}
    141150
Note: See TracChangeset for help on using the changeset viewer.