Changeset 36612
- Timestamp:
- Mar 21, 2014, 11:42:48 AM (12 years ago)
- Location:
- branches/eam_branches/ipp-20140206/Ohana/src/relphot
- Files:
-
- 4 edited
-
include/relphot.h (modified) (1 diff)
-
src/MosaicOps.c (modified) (1 diff)
-
src/assign_images.c (modified) (11 diffs)
-
src/relphot_parallel_images.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20140206/Ohana/src/relphot/include/relphot.h
r36558 r36612 473 473 int select_images_hostregion (RegionHostTable *hosts, Image *image, off_t Nimage); 474 474 int find_host_for_coords (RegionHostTable *regionHosts, double R, double d); 475 int calculate_image_bounds (Image *image, double *rmin, double *rmax, double *dmin, double *dmax );475 int calculate_image_bounds (Image *image, double *rmin, double *rmax, double *dmin, double *dmax, double Rmid); 476 476 477 477 int launch_region_hosts (RegionHostTable *regionHosts); -
branches/eam_branches/ipp-20140206/Ohana/src/relphot/src/MosaicOps.c
r36611 r36612 575 575 image[m].Xm = NAN_S_SHORT; 576 576 } 577 577 578 if (Nc > 0) { 578 579 dsort (Rc, Nc); 580 if (Rc[Nc-1] - Rc[0] > 180.0) { 581 // in our list, Rc is in the range 0.0 to 360.0. 582 // any mosaic which is close to the 0.0, 360.0 boundary may have some on 583 // one side or the other. count how many have values more than Rc[0] + 180. 584 // if more than half are at the large end, re-normalize to that range 585 int Nbig = 0; 586 for (j = 1; j < Nc; j++) { 587 if (Rc[j] - Rc[0] > 180.0) Nbig ++; 588 } 589 if (Nbig > 0.5*Nc) { 590 for (j = 0; j < Nc; j++) { 591 Rc[j] = ohana_normalize_angle_to_midpoint (Rc[j], 360.0); 592 } 593 dsort (Rc, Nc); 594 } else if (Nbig > 0) { 595 for (j = 0; j < Nc; j++) { 596 Rc[j] = ohana_normalize_angle_to_midpoint (Rc[j], 0.0); 597 } 598 dsort (Rc, Nc); 599 } 600 } 579 601 dsort (Dc, Nc); 602 580 603 Rmid = Rc[(int)(0.5*Nc)]; 581 604 Dmid = Dc[(int)(0.5*Nc)]; -
branches/eam_branches/ipp-20140206/Ohana/src/relphot/src/assign_images.c
r36611 r36612 40 40 // even faster would be to use a tree to get to the real regions... 41 41 select_images_hostregion (regionHosts, image, Nimage); 42 43 // calculate_host_image_bounds (regionHosts);44 42 45 43 return TRUE; … … 120 118 image[j].DECo = Dc; 121 119 120 // NOTE: if we are NOT using mosaic centers, we don't need to keep chips with centers 121 // on opposite sides of 0,360 together. in which case, it is OK for the range of Rc 122 // to be 0.0 to 360.0. also NOTE: RAo,DECo are only used for debugging reference. 123 122 124 if (MOSAIC_ZEROPT) { 123 125 // use the coords of the associated mosaic to select … … 125 127 Rc = mosaic->coords.crval1; 126 128 Dc = mosaic->coords.crval2; 129 // NOTE : have defined mosaic Rc,Dc to choose the side of 0,360 on which most of the 130 // chips are located. but, for host assignment, we rationalize to 0.0 - 360.0 127 131 Rc = ohana_normalize_angle_to_midpoint (Rc, 180.0); 128 132 } … … 134 138 RegionHostInfo *host = ®ionHosts->hosts[i]; 135 139 140 // image bounds are defined for a range centered on the mosaic center thus, a mosaic 141 // with center 0.5 will have chips bounds ranging from ~ -1.5 to +2.5 or so, while a mosaic 142 // with center 359.5 will have chips bounds ranging from ~ 357.5 to 361.5 or so 136 143 double Rmin, Rmax, Dmin, Dmax; 137 calculate_image_bounds (&image[j], &Rmin, &Rmax, &Dmin, &Dmax );144 calculate_image_bounds (&image[j], &Rmin, &Rmax, &Dmin, &Dmax, Rc); 138 145 139 146 host->RminCat = MIN(Rmin, host->RminCat); … … 168 175 double Yf[] = {0.0, 0.0, 1.0, 1.0}; 169 176 170 int calculate_image_bounds (Image *image, double *rmin, double *rmax, double *dmin, double *dmax ) {177 int calculate_image_bounds (Image *image, double *rmin, double *rmax, double *dmin, double *dmax, double Rmid) { 171 178 172 179 int n; … … 183 190 Yc = Yf[n]*image->NY; 184 191 XY_to_RD (&Rc, &Dc, Xc, Yc, &image->coords); 185 Rc = ohana_normalize_angle_to_midpoint (Rc, 180.0);192 Rc = ohana_normalize_angle_to_midpoint (Rc, Rmid); 186 193 187 194 Rmin = MIN (Rmin, Rc); … … 199 206 } 200 207 201 int calculate_host_image_bounds (RegionHostTable *regionHosts ) {208 int calculate_host_image_bounds (RegionHostTable *regionHosts, double Rmid) { 202 209 203 210 int i, n; … … 212 219 BuildChipMatch (host->image, host->Nimage); 213 220 214 double Rmin = 360.0;215 double Rmax = 0.0;216 double Dmin = +90.0;221 double Rmin = 720.0; 222 double Rmax = -360.0; 223 double Dmin = +90.0; 217 224 double Dmax = -90.0; 218 225 … … 232 239 Yc = Yf[n]*image->NY; 233 240 XY_to_RD (&Rc, &Dc, Xc, Yc, &image->coords); 234 Rc = ohana_normalize_angle_to_midpoint (Rc, 180.0);241 Rc = ohana_normalize_angle_to_midpoint (Rc, Rmid); 235 242 236 243 Rmin = MIN (Rmin, Rc); … … 243 250 } 244 251 252 // RminCat, RmaxCat may extended beyond 0.0 - 360.0 245 253 host->RminCat = Rmin; 246 254 host->DminCat = Dmin; … … 259 267 260 268 261 // XXX add a search tree to speed this up?269 // Rc is in range 0.0 - 360.0, hosts Rmin,Rmax in range 0.0 - 360.0 262 270 int find_host_for_coords (RegionHostTable *regionHosts, double Rc, double Dc) { 263 271 -
branches/eam_branches/ipp-20140206/Ohana/src/relphot/src/relphot_parallel_images.c
r36611 r36612 50 50 SkyTable *sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, TRUE, SKY_DEPTH, VERBOSE); 51 51 SkyTableSetFilenames (sky, CATDIR, "cpt"); 52 53 // UserPatch.Rmin,Rmax may have range from a few degrees < 0.0 to few degrees > 360.0. 54 // the following function correctly chooses the sky regions on the 0,360 boundary 52 55 SkyList *skylist = SkyListByBounds (sky, -1, UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax); 53 56
Note:
See TracChangeset
for help on using the changeset viewer.
