IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 36904


Ignore:
Timestamp:
Jun 18, 2014, 8:06:06 AM (12 years ago)
Author:
eugene
Message:

fix builds for measure.dR,dD -> measure.R,D

Location:
branches/eam_branches/ipp-20140610/Ohana/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20140610/Ohana/src/addstar/src/find_matches.c

    r36903 r36904  
    1414
    1515  if (NSTAR_GROUP <= 0) {
    16       fprintf (stderr, "ERROR: NSTAR_GROUP NOT SET!\n");
    17       exit (1);
     16    fprintf (stderr, "ERROR: NSTAR_GROUP NOT SET!\n");
     17    exit (1);
    1818  }
    1919
     
    169169      float dRoff = dvoOffsetR(&catalog[0].measure[Nmeas], &catalog[0].average[n]);
    170170
    171       // rationalize dR:
     171      // rationalize R:
    172172      if (dRoff > +180.0*3600.0) {
    173           // average on high end of boundary, move star up
    174           catalog[0].measure[Nmeas].R += 360.0;
    175           dRoff -= 360.0*3600.0;
     173        // average on high end of boundary, move star up
     174        catalog[0].measure[Nmeas].R += 360.0;
     175        dRoff -= 360.0*3600.0;
    176176      }
    177177      if (dRoff < -180.0*3600.0) {
    178           // average on low end of boundary, move star down
    179           catalog[0].measure[Nmeas].R -= 360.0;
    180           dRoff += 360.0*3600.0;
    181       }
    182       if (dRoff > 10*RADIUS) {
     178        // average on low end of boundary, move star down
     179        catalog[0].measure[Nmeas].R -= 360.0;
     180        dRoff += 360.0*3600.0;
     181      }
     182      if (fabs(dRoff) > 10*RADIUS) {
     183        // take declination into account and check again.
     184        double cosD = cos(RAD_DEG*catalog[0].average[n].D);
     185        if (fabs(dRoff*cosD) > 10*RADIUS) {
    183186          fprintf (stderr, "error: %10.6f,%10.6f vs %10.6f,%10.6f (%f,%f vs %f,%f)\n",
    184187                   catalog[0].average[n].R, catalog[0].average[n].D,
     
    186189                   X1[i], X2[J],
    187190                   Y1[i], Y2[J]);
     191        }
    188192      }
    189193
     
    234238  }
    235239
    236   /* incorporate unmatched image stars, if this star is in field of this catalog */
    237   /* these new entries are all written out in UPDATE mode */
     240/* incorporate unmatched image stars, if this star is in field of this catalog */
     241/* these new entries are all written out in UPDATE mode */
    238242  for (i = 0; (i < Nstars) && !options.only_match; i += NSTAR_GROUP) {
    239243    /* make sure there is space for next entry */
     
    262266
    263267    if (PSPS_ID) {
    264         catalog[0].average[Nave].extID = CreatePSPSObjectID(catalog[0].average[Nave].R, catalog[0].average[Nave].D);
     268      catalog[0].average[Nave].extID = CreatePSPSObjectID(catalog[0].average[Nave].R, catalog[0].average[Nave].D);
    265269    }
    266270
     
    286290      /* in UPDATE mode, this value is not saved; use relphot to recalculate */
    287291      if (Nsec > -1) {
    288           catalog[0].secfilt[Nave*Nsecfilt+Nsec].M = PhotCat (&catalog[0].measure[Nmeas]);
     292        catalog[0].secfilt[Nave*Nsecfilt+Nsec].M = PhotCat (&catalog[0].measure[Nmeas]);
    289293      }
    290294
    291295      /* next[Nmeas] should always be -1 in this context (it is always the only
    292         measurement for the star) */
     296        measurement for the star) */
    293297      stars[i].found = Nmeas;
    294298      next_meas[Nmeas] = -1;  // initial value here update below
     
    311315  }
    312316
    313   /* note stars which have been found in this catalog */
     317/* note stars which have been found in this catalog */
    314318  for (i = 0; i < NstarsIn; i++) {
    315319    if (stars[i].found > -1) {
     
    318322  }
    319323
    320   /* check if the catalog has changed?  if no change, no need to write */
     324/* check if the catalog has changed?  if no change, no need to write */
    321325  catalog[0].objID    = objID; // new max value, save on catalog close
    322326  catalog[0].Naverage = Nave;
  • branches/eam_branches/ipp-20140610/Ohana/src/addstar/src/find_matches_closest.c

    r36903 r36904  
    207207      dRoff += 360.0*3600.0;
    208208    }
    209     if (dRoff > 10*RADIUS) {
    210       fprintf (stderr, "error: %10.6f,%10.6f vs %10.6f,%10.6f (%f,%f vs %f,%f)\n",
    211                catalog[0].average[n].R, catalog[0].average[n].D,
    212                stars[N].average.R, stars[N].average.D,
    213                X1[i], X2[Jmin],
    214                Y1[i], Y2[Jmin]);
    215         // XXX abort on this? -- this is a bad failure...
     209    if (fabs(dRoff) > 10*RADIUS) {
     210        // take declination into account and check again.
     211        double cosD = cos(RAD_DEG*catalog[0].average[n].D);
     212        if (fabs(dRoff*cosD) > 10*RADIUS) {
     213            fprintf (stderr, "error: %10.6f,%10.6f vs %10.6f,%10.6f (%f,%f vs %f,%f)\n",
     214                     catalog[0].average[n].R, catalog[0].average[n].D,
     215                     stars[N].average.R, stars[N].average.D,
     216                     X1[i], X2[Jmin],
     217                     Y1[i], Y2[Jmin]);
     218            // XXX abort on this? -- this is a bad failure...
     219        }
    216220    }
    217221
  • branches/eam_branches/ipp-20140610/Ohana/src/dvomerge/src/merge_catalogs_old.c

    r36486 r36904  
    1919
    2020  off_t i, j, k, Nin, offset, J, Jmin, status, Nstars;
    21   double RADIUS2, Rmin, Rin, Din;
     21  double RADIUS2, Rmin;
    2222  double *X1, *Y1, *X2, *Y2;
    2323  double dX, dY, dR;
     
    206206      output[0].measure[Nmeas] = input[0].measure[offset];
    207207
    208       Rin = input[0].average[N].R - input[0].measure[offset].dR / 3600.0;
    209       Din = input[0].average[N].D - input[0].measure[offset].dD / 3600.0;
    210 
    211       /** dR,dD now represent arcsec **/
    212       output[0].measure[Nmeas].dR       = 3600.0*(output[0].average[n].R - Rin);  // XXX update these based on choice of astromety
    213       output[0].measure[Nmeas].dD       = 3600.0*(output[0].average[n].D - Din);  // XXX update these based on choice of astromety
     208      // old code: find R,D using average_in[0], the get offset relative to average_out[0].  no longer
     209      // needed since we carry around R,D
     210      // Rin = input[0].average[N].R - input[0].measure[offset].dR / 3600.0;
     211      // Din = input[0].average[N].D - input[0].measure[offset].dD / 3600.0;
     212      // output[0].measure[Nmeas].dR = 3600.0*(output[0].average[n].R - Rin);
     213      // output[0].measure[Nmeas].dD = 3600.0*(output[0].average[n].D - Din);
     214
    214215      output[0].measure[Nmeas].dbFlags  = 0;  // XXX why reset these?
    215216      output[0].measure[Nmeas].averef   = n;
     
    221222      // fprintf (stderr, "Nave : "OFF_T_FMT", Nmeas : "OFF_T_FMT", dR: %f, dD: %f, catID: %d\n",  n,  Nmeas, output[0].measure[Nmeas].dR, output[0].measure[Nmeas].dD, output[0].measure[i].catID);
    222223
    223       // rationalize dR
    224       if (output[0].measure[Nmeas].dR > +180.0*3600.0) {
     224      float dRoff = dvoOffsetR(&output[0].measure[Nmeas], &output[0].average[n]);
     225
     226      // rationalize R
     227      if (dRoff > +180.0*3600.0) {
    225228        // average on high end of boundary, move star up
    226         Rin += 360.0;
    227         output[0].measure[Nmeas].dR = 3600.0*(output[0].average[n].R - Rin);
    228       }
    229       if (output[0].measure[Nmeas].dR < -180.0*3600.0) {
     229        output[0].measure[Nmeas].R += 360.0;
     230        dRoff -= 360.0*3600.0;
     231      }
     232      if (dRoff < -180.0*3600.0) {
    230233        // average on low end of boundary, move star down
    231         Rin -= 360.0;
    232         output[0].measure[Nmeas].dR = 3600.0*(output[0].average[n].R - Rin);
    233       }
    234       if (fabs(output[0].measure[Nmeas].dR) > 10*RADIUS) {
    235         // ok take declination into account and check again.
    236         double cosD = cos(RAD_DEG*Din);
    237         if (fabs(output[0].measure[Nmeas].dR*cosD) > 10*RADIUS) {
    238 
    239             fprintf (stderr, "error: %10.6f,%10.6f vs %10.6f,%10.6f (%f,%f vs %f,%f)\n",
    240              output[0].average[n].R, output[0].average[n].D, Rin, Din,
    241              X1[i], X2[Jmin], Y1[i], Y2[Jmin]);
    242 
    243             // XXX abort on this? -- this is a bad failure...
     234        output[0].measure[Nmeas].R -= 360.0;
     235        dRoff += 360.0*3600.0;
     236      }
     237      if (fabs(dRoff) > 10*RADIUS) {
     238        // take declination into account and check again.
     239        double cosD = cos(RAD_DEG*output[0].average[n].D);
     240        if (fabs(dRoff*cosD) > 10*RADIUS) {
     241          fprintf (stderr, "error: %10.6f,%10.6f vs %10.6f,%10.6f (%f,%f vs %f,%f)\n",
     242                   output[0].average[n].R, output[0].average[n].D,
     243                   output[0].measure[Nmeas].R, output[0].measure[Nmeas].D,
     244                   X1[i], X2[Jmin], Y1[i], Y2[Jmin]);
     245          // XXX abort on this? -- this is a bad failure...
    244246        }
    245247      }
  • branches/eam_branches/ipp-20140610/Ohana/src/dvomerge/src/replace_match.c

    r33963 r36904  
    77  unsigned int averef;
    88  unsigned int catID;
    9   double Rin, Din;
    109
    1110  // find the matching photcode in the object's list of measurements
     
    1817    measure_out[Nout] = measure_in[0];
    1918
    20     Rin = average_in[0].R - measure_in[0].dR / 3600.0;
    21     Din = average_in[0].D - measure_in[0].dD / 3600.0;
     19    // old code: find R,D using average_in[0], the get offset relative to average_out[0].  no longer
     20    // needed since we carry around R,D
     21    // double Rin = average_in[0].R - measure_in[0].dR / 3600.0;
     22    // double Din = average_in[0].D - measure_in[0].dD / 3600.0;
     23    // measure_out[Nout].dR = 3600.0*(average_out[0].R - Rin);
     24    // measure_out[Nout].dD = 3600.0*(average_out[0].D - Din);
    2225
    23     /** dR,dD now represent arcsec **/
    24     measure_out[Nout].dR       = 3600.0*(average_out[0].R - Rin);
    25     measure_out[Nout].dD       = 3600.0*(average_out[0].D - Din);
    2626    measure_out[Nout].dbFlags  = 0;  // XXX why reset these?
    2727    measure_out[Nout].averef   = averef;
     
    2929    measure_out[Nout].catID    = catID;
    3030
     31    float dRoff = dvoOffsetR(&measure_out[Nout], average_out);
     32
    3133    // rationalize dR
    32     if (measure_out[Nout].dR > +180.0*3600.0) {
     34    if (dRoff > +180.0*3600.0) {
    3335      // average on high end of boundary, move star up
    34       Rin += 360.0;
    35       measure_out[Nout].dR = 3600.0*(average_out[0].R - Rin);
     36      measure_out[Nout].R += 360.0;
     37      dRoff -= 360.0*3600.0;
    3638    }
    37     if (measure_out[Nout].dR < -180.0*3600.0) {
     39    if (dRoff < -180.0*3600.0) {
    3840      // average on low end of boundary, move star down
    39       Rin -= 360.0;
    40       measure_out[Nout].dR = 3600.0*(average_out[0].R - Rin);
     41      measure_out[Nout].R -= 360.0;
     42      dRoff += 360.0*3600.0;
    4143    }
    4244
    4345    // warn on surprisingly distant detections
    44     if (fabs(measure_out[Nout].dR) > 10*RADIUS) {
     46    if (fabs(dRoff) > 10*RADIUS) {
    4547      // ok take declination into account and check again.
    46       double cosD = cos(RAD_DEG*Din);
    47       if (fabs(measure_out[Nout].dR*cosD) > 10*RADIUS) {
    48 
     48      double cosD = cos(RAD_DEG*average_out[0].D);
     49      if (fabs(dRoff*cosD) > 10*RADIUS) {
    4950        fprintf (stderr, "surprisingly distant detection: %10.6f,%10.6f vs %10.6f,%10.6f\n",
    50                  average_out[0].R, average_out[0].D, Rin, Din);
     51                 average_out[0].R, average_out[0].D, measure_out[Nout].R, measure_out[Nout].D);
    5152      }
    5253    }
Note: See TracChangeset for help on using the changeset viewer.