- Timestamp:
- Mar 28, 2016, 10:07:15 AM (10 years ago)
- Location:
- trunk/Ohana/src/dvolens/src
- Files:
-
- 4 edited
-
WarpImageMaps.c (modified) (4 diffs)
-
myIndex.c (modified) (1 diff)
-
select_images.c (modified) (1 diff)
-
update_objects_catalog.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/dvolens/src/WarpImageMaps.c
r39487 r39488 11 11 off_t *warps; 12 12 unsigned short photcode; 13 double *Rmin; 14 double *Rmax; 15 double *Dmin; 16 double *Dmax; 17 int *onBoundary; 13 18 } WarpGroup; 14 19 … … 112 117 } 113 118 119 // we now have the warps assigned to groups. now we need to generate the grid data to find the warp assignments 120 for (int i = 0; i < Nwarpgroup; i++) { 121 122 myAssert (warpgroup[i].Nwarps == uniqcount[i], "failure"); 123 ALLOCATE (warpgroup[i].Rmin, double, warpgroup[i].Nwarps); 124 ALLOCATE (warpgroup[i].Rmax, double, warpgroup[i].Nwarps); 125 ALLOCATE (warpgroup[i].Dmin, double, warpgroup[i].Nwarps); 126 ALLOCATE (warpgroup[i].Dmax, double, warpgroup[i].Nwarps); 127 ALLOCATE (warpgroup[i].onBoundary, int, warpgroup[i].Nwarps); 128 129 for (int j = 0; j < warpgroup[i].Nwarps; j++) { 130 131 off_t N = warpgroup[i].warps[j]; 132 133 int Nx = image[N].NX; 134 int Ny = image[N].NY; 135 136 warpgroup[i].onBoundary[j] = FALSE; 137 138 double R, D; 139 XY_to_RD (&R, &D, 0.0, 0.0, &image[N].coords); 140 R = ohana_normalize_angle_to_midpoint(R, 180.0); 141 warpgroup[i].Rmin[j] = R; 142 warpgroup[i].Rmax[j] = R; 143 warpgroup[i].Dmin[j] = D; 144 warpgroup[i].Dmax[j] = D; 145 146 // XXX need to worry about 0,360 boundary 147 XY_to_RD (&R, &D, Nx, 0.0, &image[N].coords); 148 R = ohana_normalize_angle_to_midpoint(R, 180.0); 149 warpgroup[i].Rmin[j] = MIN (warpgroup[i].Rmin[j], R); 150 warpgroup[i].Rmax[j] = MAX (warpgroup[i].Rmax[j], R); 151 warpgroup[i].Dmin[j] = MIN (warpgroup[i].Dmin[j], D); 152 warpgroup[i].Dmax[j] = MAX (warpgroup[i].Dmax[j], D); 153 154 // XXX need to worry about 0,360 boundary 155 XY_to_RD (&R, &D, 0.0, Ny, &image[N].coords); 156 R = ohana_normalize_angle_to_midpoint(R, 180.0); 157 warpgroup[i].Rmin[j] = MIN (warpgroup[i].Rmin[j], R); 158 warpgroup[i].Rmax[j] = MAX (warpgroup[i].Rmax[j], R); 159 warpgroup[i].Dmin[j] = MIN (warpgroup[i].Dmin[j], D); 160 warpgroup[i].Dmax[j] = MAX (warpgroup[i].Dmax[j], D); 161 162 // XXX need to worry about 0,360 boundary 163 XY_to_RD (&R, &D, Nx, Ny, &image[N].coords); 164 R = ohana_normalize_angle_to_midpoint(R, 180.0); 165 warpgroup[i].Rmin[j] = MIN (warpgroup[i].Rmin[j], R); 166 warpgroup[i].Rmax[j] = MAX (warpgroup[i].Rmax[j], R); 167 warpgroup[i].Dmin[j] = MIN (warpgroup[i].Dmin[j], D); 168 warpgroup[i].Dmax[j] = MAX (warpgroup[i].Dmax[j], D); 169 170 // bump Rmin,Rmax,Dmin,Dmax 10 arcsec worth of padding 171 double dR = 10.0/3600.0 / cos (RAD_DEG*warpgroup[i].Dmin[j]); 172 double dD = 10.0/3600.0; 173 174 // at north pole, force test of all nearby skycells 175 if (warpgroup[i].Dmax[j] > 89.8) { 176 warpgroup[i].Rmin[j] = 0.0; 177 warpgroup[i].Rmax[j] = 360.0; 178 warpgroup[i].Dmax[j] = 90.0; 179 warpgroup[i].Dmin[j] -= dD; 180 continue; 181 } 182 183 if (warpgroup[i].Rmax[j] - warpgroup[i].Rmin[j] > 270.0) { 184 // Rmin and Rmax are in the range 0 - 360. For images at the 0,360 boundary, 185 // "Rmax" is the lower edge, and "Rmin" is the upper edge. we need to flip them 186 // and then break the 0-360 range: 187 double tmp = warpgroup[i].Rmin[j]; 188 warpgroup[i].Rmin[j] = warpgroup[i].Rmax[j] - 360.0; 189 warpgroup[i].Rmax[j] = tmp; 190 warpgroup[i].onBoundary[j] = TRUE; 191 } 192 193 warpgroup[i].Rmin[j] -= dR; 194 warpgroup[i].Rmax[j] += dR; 195 warpgroup[i].Dmin[j] -= dD; 196 warpgroup[i].Dmax[j] += dD; 197 } 198 } 199 114 200 free (uniqtimes); 115 201 free (uniqcount); … … 131 217 132 218 // can we find an image in this set which matches one of our measures? 219 double Rave = average->R; 220 double Dave = average->D; 133 221 134 222 // we now have the warp group, but which is the correct warp? … … 138 226 // average->R,D could pin-point more quickly 139 227 140 // this is a possible image: check the coordinates: 228 if (warpgroup[seq].onBoundary[i]) { 229 int inRange1 = (Rave >= warpgroup[seq].Rmin[i]) && (Rave <= warpgroup[seq].Rmax[i]); 230 int inRange2 = (Rave >= warpgroup[seq].Rmin[i] + 360.0) && (Rave <= warpgroup[seq].Rmax[i] + 360.0); 231 if (!inRange1 && !inRange2) continue; 232 } else { 233 if (Rave < warpgroup[seq].Rmin[i]) continue; 234 if (Rave > warpgroup[seq].Rmax[i]) continue; 235 } 236 if (Dave < warpgroup[seq].Dmin[i]) continue; 237 if (Dave > warpgroup[seq].Dmax[i]) continue; 238 239 // this is a possible image based on coordinates: does it match a warp? 141 240 int N = warpgroup[seq].warps[i]; 142 241 -
trunk/Ohana/src/dvolens/src/myIndex.c
r38153 r39488 47 47 48 48 myIndex->Nindex = myIndex->maxID - myIndex->minID + 1; 49 myIndex->NINDEX = myIndex->Nindex; 50 51 REALLOCATE (myIndex->index, int, myIndex->NINDEX); 49 if (myIndex->Nindex > myIndex->NINDEX) { 50 myIndex->NINDEX = myIndex->Nindex; 51 REALLOCATE (myIndex->index, int, myIndex->NINDEX); 52 } 52 53 53 54 int i; -
trunk/Ohana/src/dvolens/src/select_images.c
r39487 r39488 43 43 ALLOCATE (image, Image, NIMAGE); 44 44 45 // I need to ensure we get the images from any skycells in a warp 46 double dD = 2.0; 47 double dR = dD / cos(RAD_DEG*DminSkyRegion); 48 RminSkyRegion -= dR; 49 RmaxSkyRegion += dR; 50 DminSkyRegion -= dD; 51 DmaxSkyRegion += dD; 52 45 53 // go through the complete list of images, selecting ones which overlap any region 46 54 for (i = 0; i < Ntimage; i++) { -
trunk/Ohana/src/dvolens/src/update_objects_catalog.c
r39487 r39488 2 2 # define SCALE 0.001 3 3 float MagToFlux (float Mag); // in libdvo, but not exposed? 4 5 # define TIMESTAMP(TIME){ \ 6 gettimeofday (&stopTimer, (void *) NULL); \ 7 double dtime = DTIME (stopTimer, startTimer); \ 8 TIME += dtime; \ 9 gettimeofday (&startTimer, (void *) NULL); } 4 10 5 11 int update_objects_catalog (Catalog *catalog) { … … 31 37 myIndexType *measureIndex = myIndexAlloc(); 32 38 39 int Nfixed = 0; 40 int Nfailed = 0; 41 42 INITTIME; 43 44 double time1 = 0.0; 45 double time2 = 0.0; 46 double time3 = 0.0; 47 double time4 = 0.0; 48 33 49 for (i = 0; i < catalog->Naverage; i++) { 50 51 if (i % 1000 == 0) { 52 MARKTIME ("done with %d aves: %f sec (%f %f %f %f)\n", (int) i, dtime, time1, time2, time3, time4); 53 time1 = 0.0; 54 time2 = 0.0; 55 time3 = 0.0; 56 time4 = 0.0; 57 gettimeofday (&startTimer, NULL); 58 } 59 34 60 Average *average = &catalog->average[i]; 35 61 if (average->Nlensing == 0) continue; … … 62 88 myIndexUpdateLimits (measureIndex, catalog->measure[Moff + Mj].imageID); 63 89 } 90 91 TIMESTAMP (time1); 64 92 myIndexSetRange (measureIndex); 93 TIMESTAMP (time2); 94 65 95 for (Mj = 0; Mj < average->Nmeasure; Mj++) { 66 96 // if there are duplicates (multiple measures from the same image), … … 89 119 // the set of warps which match our obstime, then choosing the one from that set 90 120 // which matches one of our warps. 91 if ((Mj < 0) && REPAIR_LENSING_IDS) { 92 Mj = RecoverLensingIndex (average, measureIndex, lensing); 93 } 94 myAssert (Mj > -1, "missing index"); 121 if (Mj < 0) { 122 if (REPAIR_LENSING_IDS) { 123 Mj = RecoverLensingIndex (average, measureIndex, lensing); 124 if (Mj == -1) { 125 Nfailed ++; 126 continue; 127 } 128 Nfixed ++; 129 } else { 130 Nfailed ++; 131 continue; 132 } 133 } 95 134 96 135 Measure *measure = &catalog->measure[Moff + Mj]; … … 196 235 } 197 236 237 TIMESTAMP (time3); 238 198 239 for (j = 0; j < Nsecfilt; j++) { 199 240 if (!lensobj[j].Nmeas) { … … 273 314 } 274 315 316 TIMESTAMP (time4); 317 275 318 average->Nlensobj = Nsecfilt; 276 319 average->lensobjOffset = Nlensobj; … … 290 333 myIndexFree (measureIndex); 291 334 335 fprintf (stderr, "corrected %d lensing IDs, failed on %d lensing IDs\n", Nfixed, Nfailed); 336 292 337 catalog->Nlensobj = Nlensobj; 293 338 catalog->Nlensobj_disk = 0;
Note:
See TracChangeset
for help on using the changeset viewer.
