IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 35665


Ignore:
Timestamp:
Jun 15, 2013, 9:06:07 PM (13 years ago)
Author:
eugene
Message:

move boundary test before offset error checks; update tiny measure as well as big measure

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20130509/Ohana/src/relastro/src/ImageOps.c

    r35105 r35665  
    454454    }
    455455    n = measure[0].averef;
     456    Average *average = &catalog[c].average[n];
    456457
    457458    if (moscoords == NULL) {
     
    467468
    468469    // new dR, dD : test
    469     dR = 3600.0*(catalog[c].average[n].R - R);
    470     dD = 3600.0*(catalog[c].average[n].D - D);
     470    dR = 3600.0*(average[0].R - R);
     471    dD = 3600.0*(average[0].D - D);
     472
     473    // make sure detection is on the same side of the 0,360 boundary as the average
     474    // this will give some funny results withing ~1 arcsec of the pol
     475    if (dR > +180.0*3600.0) {
     476      // average on high end of boundary, move star up
     477      R += 360.0;
     478      dR = 3600.0*(average[0].R - R);
     479    }
     480    if (dR < -180.0*3600.0) {
     481      // average on low end of boundary, move star down
     482      R -= 360.0;
     483      dR = 3600.0*(average[0].R - R);
     484    }
     485
     486    float csdec = cos(average[0].D * RAD_DEG);
    471487
    472488    // complain if the new location is far from the average location
    473489    // NOTE: This should never happen, or our StarMap tests are not working
    474     if (fabs(dR) > 3.0*ADDSTAR_RADIUS) {
     490    if (fabs(dR*csdec) > 3.0*ADDSTAR_RADIUS) {
    475491      NoffRAave ++;
    476492      if (VERBOSE2) {
    477         fprintf (stderr, "measurement is far from average location (R): %f %f (%f %f)\n", catalog[c].average[n].R, catalog[c].average[n].D, dR, dD);
    478         dump_measures (&catalog[c].average[n], catalog[c].measure);
     493        fprintf (stderr, "measurement is far from average location (R): %f %f (%f %f %f)\n", average[0].R, average[0].D, dR, dR*csdec, dD);
     494        dump_measures (&average[0], catalog[c].measure);
    479495      }
    480496      // abort ();
     
    483499      NoffDECave ++;
    484500      if (VERBOSE2) {
    485         fprintf (stderr, "measurement is far from average location (D): %f %f (%f %f)\n", catalog[c].average[n].R, catalog[c].average[n].D, dR, dD);
    486         dump_measures (&catalog[c].average[n], catalog[c].measure);
     501        fprintf (stderr, "measurement is far from average location (D): %f %f (%f %f)\n", average[0].R, average[0].D, dR, dD);
     502        dump_measures (&average[0], catalog[c].measure);
    487503      }
    488504      // abort ();
     
    490506
    491507    // complain if the new location is far from the old location
    492     if (fabs(catalog[c].measureT[m].dR - dR) > DPOS_MAX_ASEC) {
     508    if (fabs(csdec*(measure[0].dR - dR)) > DPOS_MAX_ASEC) {
    493509      NoffRAori ++;
    494510      if (VERBOSE2) {
    495         fprintf (stderr, "measurement is far from original location (R): %f %f (%f %f)\n", catalog[c].average[n].R, catalog[c].average[n].D, dR, dD);
    496         dump_measures (&catalog[c].average[n], catalog[c].measure);
     511        fprintf (stderr, "measurement moves far from original location (R): %f %f (%f %f %f %f)\n", average[0].R, average[0].D, measure[0].dR, dR, csdec*(measure[0].dR - dR), dD);
     512        dump_measures (&average[0], catalog[c].measure);
    497513      }
    498514      // abort();
     
    501517      NoffDECori ++;
    502518      if (VERBOSE2) {
    503         fprintf (stderr, "measurement is far from original location (D): %f %f (%f %f)\n", catalog[c].average[n].R, catalog[c].average[n].D, dR, dD);
    504         dump_measures (&catalog[c].average[n], catalog[c].measure);
     519        fprintf (stderr, "measurement moves far from original location (D): %f %f (%f %f)\n", average[0].R, average[0].D, dR, measure[0].dD, dD);
     520        dump_measures (&average[0], catalog[c].measure);
    505521      }      // abort();
    506522    }
     
    511527    measure[0].dR = dR;
    512528    measure[0].dD = dD;
     529    measureT[0].dR = dR;
     530    measureT[0].dD = dD;
    513531   
    514     if (measure[0].dR > +180.0*3600.0) {
    515       // average on high end of boundary, move star up
    516       R += 360.0;
    517       measure[0].dR = 3600.0*(catalog[c].average[n].R - R);
    518     }
    519     if (measure[0].dR < -180.0*3600.0) {
    520       // average on low end of boundary, move star down
    521       R -= 360.0;
    522       measure[0].dR = 3600.0*(catalog[c].average[n].R - R);
    523     }
    524 
    525532    // set the systematic error for this image:
    526533    measure[0].dRsys = ToShortPixels(dPosSys);
     534    measureT[0].dRsys = ToShortPixels(dPosSys);
    527535  }
    528536
     
    530538  if (VERBOSE && (Noff > 0)) fprintf (stderr, "Noff ave RA %d, Noff ave DEC %d, Noff ori RA %d, Noff ori DEC %d\n", NoffRAave, NoffDECave, NoffRAori, NoffDECori);
    531539  saveOffsets (dPos, nPos, im);
    532 
    533   // XXX this function should probably update the average positions as well.
    534540
    535541  return;
Note: See TracChangeset for help on using the changeset viewer.