Changeset 30649
- Timestamp:
- Feb 16, 2011, 11:47:40 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20110213/Ohana/src/relphot/src/select_images.c
r30616 r30649 33 33 struct timeval start, stop; 34 34 35 double RmaxSkyRegion, RminSkyRegion, DminSkyRegion, DmaxSkyRegion, RmidSkyRegion;35 double RmaxSkyRegion, RminSkyRegion, RmidSkyRegion, DminSkyRegion, DmaxSkyRegion; 36 36 37 37 double *RmaxSky; … … 131 131 } 132 132 133 /* define image corners */ 134 Xi[0] = 0; Yi[0] = 0; 135 Xi[1] = timage[i].NX; Yi[1] = 0; 136 Xi[2] = timage[i].NX; Yi[2] = timage[i].NY; 137 Xi[3] = 0; Yi[3] = timage[i].NY; 138 Xi[4] = 0; Yi[4] = 0; 133 /* define image corners - note the DIS images (mosaic phu) are special */ 134 if (!strcmp(&timage[i].coords.ctype[4], "-DIS")) { 135 Xi[0] = -0.5*timage[i].NX; Yi[0] = -0.5*timage[i].NY; 136 Xi[1] = +0.5*timage[i].NX; Yi[1] = -0.5*timage[i].NY; 137 Xi[2] = +0.5*timage[i].NX; Yi[2] = +0.5*timage[i].NY; 138 Xi[3] = -0.5*timage[i].NX; Yi[3] = +0.5*timage[i].NY; 139 Xi[4] = -0.5*timage[i].NX; Yi[4] = -0.5*timage[i].NY; 140 } else { 141 Xi[0] = 0; Yi[0] = 0; 142 Xi[1] = timage[i].NX; Yi[1] = 0; 143 Xi[2] = timage[i].NX; Yi[2] = timage[i].NY; 144 Xi[3] = 0; Yi[3] = timage[i].NY; 145 Xi[4] = 0; Yi[4] = 0; 146 } 139 147 found = FALSE; 140 148 141 /* transform corners to ra,dec -- costs ~3sec for 3M images */149 /* transform corners to ra,dec -- costs ~3sec for 3M images (pikake) */ 142 150 double RminImage = 360.0; 143 151 double RmaxImage = 0.0; … … 147 155 XY_to_RD (&Ri[j], &Di[j], Xi[j], Yi[j], &timage[i].coords); 148 156 Ri[j] = ohana_normalize_angle_to_midpoint (Ri[j], RmidSkyRegion); 149 157 150 158 RminImage = MIN(RminImage, Ri[j]); 151 159 RmaxImage = MAX(RmaxImage, Ri[j]); … … 158 166 RminImage = tmp - 360.0; 159 167 } 160 168 161 169 // check that this image is even in range of the searched region 162 170 if (DminImage > DmaxSkyRegion) continue; … … 182 190 tcoords.crval2 = skycoords[m].Dc; 183 191 184 /* transform to ra,dec*/192 /* transform corner coords to X,Y in this catalog system */ 185 193 InRange = TRUE; 186 194 for (j = 0; (j < 5) && InRange; j++) { … … 352 360 return (Nlo); 353 361 } 354 355 off_t getRegionStopByRA (double R, double *Rref, off_t Nregions) {356 357 // use bisection to find the overlapping mosaic358 359 off_t Nlo, Nhi, N;360 361 // find the last mosaic before start362 Nlo = 0; Nhi = Nregions;363 while (Nhi - Nlo > 10) {364 N = 0.5*(Nlo + Nhi);365 if (Rref[N] < R) {366 Nlo = MAX(N, 0);367 } else {368 Nhi = MIN(N, Nregions);369 }370 }371 return (Nlo);372 }
Note:
See TracChangeset
for help on using the changeset viewer.
