- Timestamp:
- Feb 24, 2016, 10:22:33 AM (10 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/relastro/src/UpdateMeasures.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/relastro/src/UpdateMeasures.c
r37807 r39385 9 9 double DPOS_MAX_ASEC; 10 10 11 int badImage =12 ID_IMAGE_ASTROM_NOCAL |13 ID_IMAGE_ASTROM_POOR |14 ID_IMAGE_ASTROM_FAIL |15 ID_IMAGE_ASTROM_SKIP |16 ID_IMAGE_ASTROM_FEW;17 18 if (RESET_BAD_IMAGES) badImage = 0;19 20 11 image = getimages (&Nimage, NULL); 21 12 22 13 // track measurements which are far from their original position (poor at pole) 23 int NoffRA ave = 0; int NoffRAori = 0;24 int NoffDEC ave = 0; int NoffDECori = 0;14 int NoffRAori = 0; 15 int NoffDECori = 0; 25 16 26 17 for (i = 0; i < Ncatalog; i++) { 27 18 myAssert (!catalog[i].Nmeasure || catalog[i].measureT, "programming error"); 19 for (j = 0; j < catalog[i].Naverage; j++) { 20 // normalize R,D to 0,360 & -90,90 21 Average *average = &catalog[i].average[j]; 22 average[0].R = ohana_normalize_angle_to_midpoint(average[0].R, 180.0); 23 average[0].D = ohana_normalize_angle_to_midpoint(average[0].D, 0.0); 24 } 25 28 26 for (j = 0; j < catalog[i].Nmeasure; j++) { 29 27 MeasureTiny *measureT = &catalog[i].measureT[j]; … … 38 36 myAssert (measureT->t <= image[im].tzero + image[im].NX*image[im].trate/5000.0, "image time mismatch (2)"); 39 37 // I'm allowing the trate*NX to be a factor of 2x too small 40 41 // skip measurements on images that have failed solutions (divergent or otherwise)42 // XXX apply this or not??43 if (FALSE && (image[im].flags & badImage)) continue;44 38 45 39 Coords *moscoords = image[im].coords.mosaic; … … 68 62 XY_to_RD (&R, &D, X, Y, imcoords); 69 63 70 int n = measureT[0].averef;71 Average *average = &catalog[i].average[n];64 R = ohana_normalize_angle_to_midpoint(R, 180.0); 65 D = ohana_normalize_angle_to_midpoint(D, 0.0); 72 66 73 double dR = 3600.0*(average[0].R - R);74 double dD = 3600.0*(average[0].D - D);67 double oldR = ohana_normalize_angle_to_midpoint(measureT[0].R, 180.0); 68 double oldD = ohana_normalize_angle_to_midpoint(measureT[0].D, 0.0); 75 69 76 // make sure detection is on the same side of the 0,360 boundary as the average 77 // this will give some funny results withing ~1 arcsec of the pol 78 if (dR > +180.0*3600.0) { 79 // average on high end of boundary, move star up 80 R += 360.0; 81 dR = 3600.0*(average[0].R - R); 82 } 83 if (dR < -180.0*3600.0) { 84 // average on low end of boundary, move star down 85 R -= 360.0; 86 dR = 3600.0*(average[0].R - R); 87 } 70 float csdec = cos(oldD * RAD_DEG); 88 71 89 float csdec = cos(average[0].D * RAD_DEG); 72 double dR = 3600.0*fabs(csdec*(oldR - R)); 73 double dD = 3600.0*fabs(oldD - R); 90 74 91 // complain if the new location is far from the average location 92 // NOTE: This should never happen, or our StarMap tests are not working 93 if (fabs(dR*csdec) > 3.0*ADDSTAR_RADIUS) { 94 NoffRAave ++; 75 // complain if the new location is far from the old location 76 if (dR > DPOS_MAX_ASEC) { 77 NoffRAori ++; 95 78 if (VERBOSE2 && catalog[i].measure) { 96 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); 97 dump_measures (&average[0], catalog[i].measure); 79 fprintf (stderr, "measurement moves far from original location (R): %f %f : %f %f (%f)\n", oldR, oldD, R, D, dR); 98 80 } 99 81 } 100 if (fabs(dD) > 3.0*ADDSTAR_RADIUS) { 101 NoffDECave ++; 102 if (VERBOSE2 && catalog[i].measure) { 103 fprintf (stderr, "measurement is far from average location (D): %f %f (%f %f)\n", average[0].R, average[0].D, dR, dD); 104 dump_measures (&average[0], catalog[i].measure); 105 } 106 } 107 108 // complain if the new location is far from the old location 109 if (fabs(csdec*(measureT[0].R - R)) > DPOS_MAX_ASEC) { 110 NoffRAori ++; 111 if (VERBOSE2 && catalog[i].measure) { 112 fprintf (stderr, "measurement moves far from original location (R): %f %f (%f %f %f %f)\n", average[0].R, average[0].D, measureT[0].R, dR, csdec*(measureT[0].R - R), dD); 113 dump_measures (&average[0], catalog[i].measure); 114 } 115 } 116 if (fabs(measureT[0].D - D) > DPOS_MAX_ASEC) { 82 if (dD > DPOS_MAX_ASEC) { 117 83 NoffDECori ++; 118 84 if (VERBOSE2 && catalog[i].measure) { 119 fprintf (stderr, "measurement moves far from original location (D): %f %f (%f %f %f)\n", average[0].R, average[0].D, dR, measureT[0].D, dD); 120 dump_measures (&average[0], catalog[i].measure); 85 fprintf (stderr, "measurement moves far from original location (D): %f %f : %f %f (%f)\n", oldR, oldD, R, D, dD); 121 86 } 122 87 } … … 131 96 // printNcatTotal (); 132 97 133 int Noff = NoffRA ave + NoffDECave + NoffRAori + NoffDECori;134 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);98 int Noff = NoffRAori + NoffDECori; 99 if (VERBOSE && (Noff > 0)) fprintf (stderr, "Noff ori RA %d, Noff ori DEC %d\n", NoffRAori, NoffDECori); 135 100 136 101 return (TRUE);
Note:
See TracChangeset
for help on using the changeset viewer.
