Changeset 38284
- Timestamp:
- May 16, 2015, 6:34:16 AM (11 years ago)
- Location:
- branches/eam_branches/ipp-20150419/Ohana/src/uniphot
- Files:
-
- 4 edited
-
Makefile (modified) (2 diffs)
-
include/setastrom.h (modified) (1 diff)
-
src/repair_tycho_setastrom.c (modified) (2 diffs)
-
src/tyc_correction.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20150419/Ohana/src/uniphot/Makefile
r38062 r38284 112 112 $(SRC)/setastrom.$(ARCH).o \ 113 113 $(SRC)/initialize_setastrom.$(ARCH).o \ 114 $(SRC)/tyc_correction.$(ARCH).o \ 114 115 $(SRC)/cam_correction.$(ARCH).o \ 115 116 $(SRC)/dcr_correction.$(ARCH).o \ 116 117 $(SRC)/kh_correction.$(ARCH).o \ 117 118 $(SRC)/astrom_correction.$(ARCH).o \ 119 $(SRC)/repair_tycho_setastrom.$(ARCH).o \ 118 120 $(SRC)/update_dvo_setastrom.$(ARCH).o \ 119 121 $(SRC)/update_catalog_setastrom.$(ARCH).o \ … … 128 130 $(SRC)/update_dvo_setastrom.$(ARCH).o \ 129 131 $(SRC)/update_catalog_setastrom.$(ARCH).o \ 132 $(SRC)/tyc_correction.$(ARCH).o \ 130 133 $(SRC)/cam_correction.$(ARCH).o \ 131 134 $(SRC)/dcr_correction.$(ARCH).o \ 132 135 $(SRC)/kh_correction.$(ARCH).o \ 136 $(SRC)/repair_tycho_setastrom.$(ARCH).o \ 133 137 $(SRC)/astrom_correction.$(ARCH).o \ 134 138 $(SRC)/initialize_setastrom.$(ARCH).o -
branches/eam_branches/ipp-20150419/Ohana/src/uniphot/include/setastrom.h
r38282 r38284 93 93 int load_cam_correction (char *filename); 94 94 int get_cam_correction (int chipID, int filter, float Xccd, float Yccd, double *dX, double *dY); 95 96 int load_tyc_correction (char *filename); 97 int get_tyc_correction (double **R, double **D, int *N); 98 int repair_tycho_setastrom (Catalog *catalog, SkyRegion *region); -
branches/eam_branches/ipp-20150419/Ohana/src/uniphot/src/repair_tycho_setastrom.c
r38283 r38284 6 6 int Ntycho; 7 7 8 short TYCHO_B = GetPhotcodeCodebyName ("TYCHO_B"); myAssert (TYCHO_B, "TYCHO_B photcode not found\n"); 9 short TYCHO_V = GetPhotcodeCodebyName ("TYCHO_V"); myAssert (TYCHO_V, "TYCHO_V photcode not found\n"); 10 11 // the tycho R,D entries are sorted by tychoR 8 12 if (!get_tyc_correction (&tychoR, &tychoD, &Ntycho)) { 9 13 fprintf (stderr, "TYCHO correction not loaded\n"); … … 13 17 // first select the subset of objects which lie in this catalog: 14 18 int Ns = ohana_bisection_double (tychoR, Ntycho, region->Rmin); 19 Ns = MAX(Ns, 0); // if Rmin = 0.0, Ns could be -1 (since there are no entries with R < 0.0 15 20 16 NSUBSET = 100; 17 Nsubset = 0; 21 int NSUBSET = 100; 22 int Nsubset = 0; 23 int *index = NULL; 18 24 ALLOCATE (index, int, NSUBSET); 19 25 20 // scan through ttycho stars to select those in this catalog26 // scan through tycho stars to select those in this catalog 21 27 while ((Ns < Ntycho) && (tychoR[Ns] < region->Rmax)) { 22 28 if (tychoD[Ns] < region->Dmin) continue; 23 29 if (tychoD[Ns] > region->Dmax) continue; 24 25 Ns 30 // we have an object in range (Rmin <= R < Rmax; Dmin <= D <= Dmax) 31 32 index[Nsubset] = Ns; 33 Nsubset ++; 34 CHECK_REALLOCATE (index, int, NSUBSET, Nsubset, 100); 35 } 36 if (Nsubset == 0) { 37 free (index); 38 return TRUE; 39 } 26 40 41 // now find matches within this catalog 27 42 43 /** allocate local arrays (stars) **/ 44 off_t *N1, *N2; 45 double *X1, *Y1, *X2, *Y2; 46 ALLOCATE (X1, double, Nsubset); 47 ALLOCATE (Y1, double, Nsubset); 48 ALLOCATE (N1, off_t, Nsubset); 49 50 /** allocate local arrays (catalog) **/ 51 ALLOCATE (X2, double, catalog[0].Naverage); 52 ALLOCATE (Y2, double, catalog[0].Naverage); 53 ALLOCATE (N2, off_t, catalog[0].Naverage); 54 55 Coords tcoords; 56 InitCoords (&tcoords, "DEC--ARC"); 57 tcoords.crval1 = 0.5*(region[0].Rmin + region[0].Rmax); 58 if (region[0].Dmax < 90) { 59 tcoords.crval2 = 0.5*(region[0].Dmin + region[0].Dmax); 60 } else { 61 tcoords.crval2 = 90.0; 62 } 63 tcoords.cdelt1 = tcoords.cdelt2 = 1.0 / 3600.0; 64 65 /* build spatial index (RA sort) referencing input array sequence */ 66 int i, j, J, k; 67 for (i = 0; i < Nsubset; i++) { 68 RD_to_XY (&X1[i], &Y1[i], tychoR[index[i]], tychoD[index[i]], &tcoords); 69 N1[i] = i; 70 } 71 sort_coords_index (X1, Y1, N1, Nsubset); 28 72 73 /* build spatial index (RA sort) */ 74 for (i = 0; i < catalog[0].Naverage; i++) { 75 RD_to_XY (&X2[i], &Y2[i], catalog[0].average[i].R, catalog[0].average[i].D, &tcoords); 76 N2[i] = i; 77 } 78 sort_coords_index (X2, Y2, N2, catalog[0].Naverage); 29 79 80 /* choose a radius for matches (defined in args.c or ImageOptions.c) */ 81 float RADIUS = 1.0; 82 float RADIUS2 = RADIUS*RADIUS; 83 84 float dX, dY, dR; 85 86 /** find matched stars **/ 87 for (i = j = 0; (i < Nsubset) && (j < catalog[0].Naverage); ) { 88 if (!finite(X1[i]) || !finite(Y1[i])) { i++; continue; } 89 if (!finite(X2[j]) || !finite(Y2[j])) { j++; continue; } 90 91 /* negative dX: j is too large; positive dX, i is too large */ 92 dX = X1[i] - X2[j]; 93 if (dX <= -1.02*RADIUS) { i++; continue; } 94 if (dX >= +1.02*RADIUS) { j++; continue; } 95 96 /* within match range; look for matches */ 97 for (J = j; (dX > -1.02*RADIUS) && (J < catalog[0].Naverage); J++) { 98 dX = X1[i] - X2[J]; 99 dY = Y1[i] - Y2[J]; 100 dR = dX*dX + dY*dY; 101 if (dR > RADIUS2) continue; 102 103 /*** a match is found ***/ 104 105 off_t Ns = N1[i]; 106 off_t Nc = N2[j]; 107 108 off_t m = catalog[0].average[Nc].measureOffset; 109 110 // for these stars, the average.R,D values are correct; replace the measure.R,D 111 for (k = 0; k < catalog[0].average[Nc].Nmeasure; k++) { 112 // find the tycho photcodes: 113 int valid = FALSE; 114 valid = valid || (catalog[0].measure[m+k].photcode == TYCHO_B); 115 valid = valid || (catalog[0].measure[m+k].photcode == TYCHO_V); 116 if (!valid) continue; 117 catalog[0].measure[m+k].R = tychoR[Ns]; 118 catalog[0].measure[m+k].D = tychoD[Ns]; 119 } 120 } 121 } 122 123 free (X1); 124 free (X2); 125 free (Y1); 126 free (Y2); 127 free (N1); 128 free (N2); 129 free (index); 130 131 return TRUE; 30 132 } 133 -
branches/eam_branches/ipp-20150419/Ohana/src/uniphot/src/tyc_correction.c
r38282 r38284 5 5 static double *tychoD = NULL; 6 6 7 // the tycho correction table just lists the tycho stars (R,D) for which the astrometry was messed up 7 8 int load_tyc_correction (char *filename) { 8 9
Note:
See TracChangeset
for help on using the changeset viewer.
