Changeset 37807 for trunk/Ohana/src/libdvo/src/mosaic_astrom.c
- Timestamp:
- Jan 11, 2015, 2:14:39 PM (12 years ago)
- Location:
- trunk/Ohana
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
src/libdvo/src/mosaic_astrom.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana
- Property svn:mergeinfo changed
-
trunk/Ohana/src/libdvo/src/mosaic_astrom.c
r29938 r37807 1 1 # include <dvo.h> 2 3 // the block of code below was used to define the chip->mosaic relationship before this 4 // was assigned to the coords value 2 5 3 6 off_t getDISentry (e_time start, e_time stop, e_time *startMos, off_t *indexMos, off_t Nmosaic); 4 7 void SortDISindex (e_time *S, off_t *I, off_t N); 8 9 # if (0) 5 10 6 11 /* chip-match table: j = ChipMatch[i], images[j] is DIS for images[i] WRP */ … … 93 98 } 94 99 95 int BuildChipMatch_old (Image *images, off_t Nimages) { 100 // this is a very old version of BuildChipMatch which does not use bisection 101 int BuildChipMatch_nosort (Image *images, off_t Nimages) { 96 102 97 103 off_t i, j, NDIS; … … 140 146 } 141 147 142 int BuildChipMatch (Image *images, off_t Nimages) { 148 // this is an old version of BuildChipMatch which stores the results here in a local static variable 149 int BuildChipMatch_static (Image *images, off_t Nimages) { 143 150 144 151 off_t i, j, NDIS; … … 198 205 return (TRUE); 199 206 } 200 207 # endif 208 209 // XXX Note that this links (images[i].coords.mosaic, images[i].parent) will break 210 // if we reallocate the Image array in the middle of program 211 int BuildChipMatch (Image *images, off_t Nimages) { 212 213 off_t i, j, NDIS; 214 215 off_t Ndis = 0; 216 off_t *DISentry = NULL; 217 e_time *DIStzero = NULL; 218 219 if (DISentry != NULL) free (DISentry); 220 if (DIStzero != NULL) free (DIStzero); 221 222 // allocate containers for DIS indexing 223 Ndis = 0; 224 NDIS = 100; 225 ALLOCATE (DISentry, off_t, NDIS); 226 ALLOCATE (DIStzero, e_time, NDIS); 227 228 // find all DIS images, save tzero (& photcode?) 229 for (i = 0; i < Nimages; i++) { 230 if (strcmp(&images[i].coords.ctype[4], "-DIS")) continue; 231 DISentry[Ndis] = i; 232 DIStzero[Ndis] = images[i].tzero; 233 Ndis ++; 234 if (Ndis >= NDIS) { 235 NDIS += 100; 236 REALLOCATE (DISentry, off_t, NDIS); 237 REALLOCATE (DIStzero, e_time, NDIS); 238 } 239 } 240 241 // sort the index, start, and stop by the start times: 242 SortDISindex (DIStzero, DISentry, Ndis); 243 244 /* find all matched WRP images */ 245 for (i = 0; i < Nimages; i++) { 246 images[i].parent = NULL; // reset to NULL 247 images[i].coords.mosaic = NULL; // reset to NULL 248 if (strcmp(&images[i].coords.ctype[4], "-WRP")) continue; // only define link for WRP coords 249 250 j = getDISentry (images[i].tzero, images[i].tzero + (int) images[i].exptime, DIStzero, DISentry, Ndis); 251 if (j == -1) { 252 fprintf (stderr, "WARNING: can't find matching mosaic \n"); 253 continue; 254 } 255 if (j >= Nimages) myAbort("invalid DIS entry"); 256 images[i].parent = &images[j]; 257 images[i].coords.mosaic = &images[j].coords; 258 } 259 return (TRUE); 260 } 261 262 // use bisection to find the overlapping mosaic 201 263 off_t getDISentry (e_time start, e_time stop, e_time *startMos, off_t *indexMos, off_t Nmosaic) { 202 203 // use bisection to find the overlapping mosaic204 264 205 265 off_t Nlo, Nhi, N;
Note:
See TracChangeset
for help on using the changeset viewer.
