Changeset 33101
- Timestamp:
- Jan 13, 2012, 1:34:15 PM (15 years ago)
- Location:
- branches/eam_branches/ipp-20111122/Ohana/src/relphot/src
- Files:
-
- 2 edited
-
ImageOps.c (modified) (17 diffs)
-
MosaicOps.c (modified) (27 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/ImageOps.c
r31668 r33101 1 1 # include "relphot.h" 2 2 3 static off_t **bin; // link from catalog,measure to image 4 static off_t **clist; // catalog which supplied measurement on image 5 static off_t **mlist; // measure reference for measurement on image 6 static off_t *Nlist; // number of measurements on image 7 static off_t *NLIST; // allocated number of measurements on image 8 9 static Image *image; // list of available images 3 // we have an array of images: image[ImageIndex] (ImageIndex : 0 < Nimage) 10 4 static off_t Nimage; // number of available images 5 static Image *image; // array of available images 6 7 // if we read only a subset of the rows from the Image FITS, LineNumber tells us to which row 8 // each image belongs 11 9 static off_t *LineNumber; // match of subset to full image table 12 10 … … 14 12 static off_t *imageIDs; // list of all image IDs 15 13 static off_t *imageIdx; // list of index for image IDs 14 15 // elsewhere, we have loaded a set of catalogs with measures (catalog[cat].measure[meas]) 16 // each image has N_onImage[ImageIndex] measurements 17 static off_t *N_onImage; // actual number of measurements on image 18 static off_t *N_ONIMAGE; // allocated number of measurements on image 19 20 // relationships between the measure,catalog set and the images: 21 static off_t **MeasureToImage; // image index from measure,catalog : MeasureToImage[cat][meas] = ImageIndex 22 static off_t **ImageToCatalog; // catalog for given measure on image : ImageCatalog[ImageIndex][i] = cat (i : 0 < NonImage[ImageIndex]) 23 static off_t **ImageToMeasure; // measure for given measure on image : ImageMeasure[ImageIndex][i] = cat (i : 0 < NonImage[ImageIndex]) 24 25 // MeasureToImage was 'bin' 26 // ImageToCatalog was 'clist' 27 // ImageToMeasure was 'mlist' 28 29 // N_onImage was 'Nlist' 30 // N_ONIMAGE was 'NLIST' 16 31 17 32 Image *getimages (off_t *N, off_t **line_number) { … … 73 88 off_t i, j; 74 89 75 ALLOCATE ( bin, off_t *, Ncatalog);90 ALLOCATE (MeasureToImage, off_t *, Ncatalog); 76 91 for (i = 0; i < Ncatalog; i++) { 77 ALLOCATE ( bin[i], off_t, MAX (catalog[i].Nmeasure, 1));78 for (j = 0; j < catalog[i].Nmeasure; j++) bin[i][j] = -1;92 ALLOCATE (MeasureToImage[i], off_t, MAX (catalog[i].Nmeasure, 1)); 93 for (j = 0; j < catalog[i].Nmeasure; j++) MeasureToImage[i][j] = -1; 79 94 } 80 95 81 96 if (doImageList) { 82 ALLOCATE (N list, off_t, Nimage);83 ALLOCATE (N LIST, off_t, Nimage);84 ALLOCATE ( clist, off_t *, Nimage);85 ALLOCATE ( mlist, off_t *, Nimage);97 ALLOCATE (N_onImage, off_t, Nimage); 98 ALLOCATE (N_ONIMAGE, off_t, Nimage); 99 ALLOCATE (ImageToCatalog, off_t *, Nimage); 100 ALLOCATE (ImageToMeasure, off_t *, Nimage); 86 101 87 102 for (i = 0; i < Nimage; i++) { 88 N list[i] = 0;89 N LIST[i] = 100;90 ALLOCATE ( clist[i], off_t, NLIST[i]);91 ALLOCATE ( mlist[i], off_t, NLIST[i]);103 N_onImage[i] = 0; 104 N_ONIMAGE[i] = 100; 105 ALLOCATE (ImageToCatalog[i], off_t, N_ONIMAGE[i]); 106 ALLOCATE (ImageToMeasure[i], off_t, N_ONIMAGE[i]); 92 107 } 93 108 } … … 99 114 100 115 for (i = 0; i < Ncatalog; i++) { 101 free ( bin[i]);102 } 103 free ( bin);116 free (MeasureToImage[i]); 117 } 118 free (MeasureToImage); 104 119 105 120 if (doImageList) { 106 121 for (i = 0; i < Nimage; i++) { 107 free ( clist[i]);108 free ( mlist[i]);109 } 110 free ( clist);111 free ( mlist);112 free (N list);113 free (N LIST);122 free (ImageToCatalog[i]); 123 free (ImageToMeasure[i]); 124 } 125 free (ImageToCatalog); 126 free (ImageToMeasure); 127 free (N_onImage); 128 free (N_ONIMAGE); 114 129 } 115 130 } … … 210 225 211 226 // index for (catalog, measure) -> image 212 bin[cat][meas] = idx;227 MeasureToImage[cat][meas] = idx; 213 228 214 229 if (doImageList) { 215 230 // index for image, Nentry -> catalog 216 clist[idx][Nlist[idx]] = cat;231 ImageToCatalog[idx][N_onImage[idx]] = cat; 217 232 218 233 // index for image, Nentry -> measure 219 mlist[idx][Nlist[idx]] = meas;220 N list[idx] ++;221 222 if (N list[idx] == NLIST[idx]) {223 N LIST[idx] += 100;224 REALLOCATE ( clist[idx], off_t, NLIST[idx]);225 REALLOCATE ( mlist[idx], off_t, NLIST[idx]);234 ImageToMeasure[idx][N_onImage[idx]] = meas; 235 N_onImage[idx] ++; 236 237 if (N_onImage[idx] == N_ONIMAGE[idx]) { 238 N_ONIMAGE[idx] += 100; 239 REALLOCATE (ImageToCatalog[idx], off_t, N_ONIMAGE[idx]); 240 REALLOCATE (ImageToMeasure[idx], off_t, N_ONIMAGE[idx]); 226 241 } 227 242 } … … 234 249 off_t i; 235 250 236 i = bin[cat][meas];251 i = MeasureToImage[cat][meas]; 237 252 return (i); 238 253 } … … 243 258 float value; 244 259 245 i = bin[cat][meas];260 i = MeasureToImage[cat][meas]; 246 261 if (i == -1) return (NAN); 247 262 … … 255 270 off_t i; 256 271 257 i = bin[cat][meas];272 i = MeasureToImage[cat][meas]; 258 273 if (i == -1) return (NULL); 259 274 return (&image[i].coords); … … 279 294 Nmax = 0; 280 295 for (i = 0; i < Nimage; i++) { 281 Nmax = MAX (Nmax, N list[i]);296 Nmax = MAX (Nmax, N_onImage[i]); 282 297 } 283 298 ALLOCATE (list, double, Nmax); … … 299 314 300 315 N = 0; 301 for (j = 0; j < N list[i]; j++) {316 for (j = 0; j < N_onImage[i]; j++) { 302 317 303 m = mlist[i][j];304 c = clist[i][j];318 m = ImageToMeasure[i][j]; 319 c = ImageToCatalog[i][j]; 305 320 306 321 if (catalog[c].measureT[m].dbFlags & MEAS_BAD) { … … 339 354 N++; 340 355 } 341 /* N list[i] is all measurements, N is good measurements */356 /* N_onImage[i] is all measurements, N is good measurements */ 342 357 343 358 /* too few good measurements or too many bad measurements */ 344 359 if (!PoorImages) { 345 mark = (N < IMAGE_TOOFEW) || (N < IMAGE_GOOD_FRACTION*N list[i]);360 mark = (N < IMAGE_TOOFEW) || (N < IMAGE_GOOD_FRACTION*N_onImage[i]); 346 361 if (mark) { 347 362 image[i].flags |= ID_IMAGE_PHOTOM_FEW; … … 383 398 int mark, Nmark; 384 399 off_t i, N; 385 double * mlist, *slist, *dlist;400 double *ImageToMeasure, *slist, *dlist; 386 401 double MaxOffset, MaxScatter, MedOffset; 387 402 StatType stats; … … 391 406 if (VERBOSE) fprintf (stderr, "marking poor images\n"); 392 407 393 ALLOCATE ( mlist, double, Nimage);408 ALLOCATE (ImageToMeasure, double, Nimage); 394 409 ALLOCATE (slist, double, Nimage); 395 410 ALLOCATE (dlist, double, Nimage); … … 397 412 for (i = N = 0; i < Nimage; i++) { 398 413 if (image[i].flags & IMAGE_BAD) continue; 399 mlist[N] = fabs (image[i].Mcal);414 ImageToMeasure[N] = fabs (image[i].Mcal); 400 415 slist[N] = image[i].dMcal; 401 416 dlist[N] = 1; … … 403 418 } 404 419 initstats ("MEAN"); 405 liststats ( mlist, dlist, N, &stats);420 liststats (ImageToMeasure, dlist, N, &stats); 406 421 MaxOffset = MAX (IMAGE_OFFSET, 3*stats.sigma); 407 422 MedOffset = stats.median; … … 425 440 fprintf (stderr, "%d images marked poor\n", Nmark); 426 441 initstats (STATMODE); 427 free ( mlist);442 free (ImageToMeasure); 428 443 free (slist); 429 444 free (dlist); … … 496 511 497 512 N = 0; 498 for (j = 0; j < N list[i]; j++) {499 500 m = mlist[i][j];501 c = clist[i][j];513 for (j = 0; j < N_onImage[i]; j++) { 514 515 m = ImageToMeasure[i][j]; 516 c = ImageToCatalog[i][j]; 502 517 503 518 Mcal = getMcal (m, c); -
branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/MosaicOps.c
r31668 r33101 5 5 static Mosaic *mosaic; 6 6 7 // list of all images associated with a mosaic 8 static off_t *Nimlist; 9 static off_t **imlist; /* mosaic -> image[] */ 10 static off_t **bin; /* catalog, measure -> mosaic */ 11 12 // list of mosaics associated with an image 13 static off_t *mosimage; 14 15 // list of mosaic associated with each image 16 static int **clist; /* mosaic -> catalog[] */ 17 static off_t **mlist; /* mosiac -> measure[] */ 18 static off_t *Nlist; 19 static off_t *NLIST; 7 // relationships between the mosaics and their associated images 8 static off_t *MosaicN_Image; // number of images associated with the given mosaic 9 static off_t **MosaicToImage; // list of imagesa associated with the given mosaic 10 11 // mosaic index for given image : ImageToMosaic[ImageIndex] = MosaicIndex (ImageIndex : 0 < Nimage) 12 static off_t *ImageToMosaic; 13 14 // elsewhere, we have loaded a set of catalogs with measures (catalog[cat].measure[meas]) 15 // each mosaic has N_onMosaic[MosaicIndex] measurements 16 static off_t *N_onMosaic; // actual number of measurements on mosaic 17 static off_t *N_ONMOSAIC; // allocated number of measurements on mosaic 18 19 // relationships between the measure,catalog set and the mosaics: 20 static off_t **MeasureToMosaic; // Mosaic index from measure,catalog : MeasureToMosaic[cat][meas] = MosaicIndex 21 static off_t **MosaicToCatalog; // catalog for given measure on mosaic : MosaicCatalog[MosaicIndex][i] = cat (i : 0 < NonMosaic[MosaicIndex]) 22 static off_t **MosaicToMeasure; // measure for given measure on mosaic : MosaicMeasure[MosaicIndex][i] = cat (i : 0 < NonMosaic[MosaicIndex]) 23 24 // MeasureToMosaic was 'bin' 25 // MosaicToCatalog was 'clist' 26 // MosaicToMeasure was 'mlist' 27 28 // N_onMosaic was 'Nlist' 29 // N_ONMOSAIC was 'NLIST' 30 31 // ImageToMosaic was 'mosimage' 32 33 // MosaicN_image was 'Nimlist' 34 // MosaicToImage was 'imlist' 20 35 21 36 /* find mosaic frames (unique time periods & photcode name matches mosaic) */ 22 37 void initMosaics (Image *image, off_t Nimage) { 23 38 24 off_t i, j, status, found, NMOSAIC, * NIMLIST;39 off_t i, j, status, found, NMOSAIC, *MosaicN_IMAGE; 25 40 unsigned int start, stop; 26 41 char *pname; … … 32 47 ALLOCATE (mosaic, Mosaic, NMOSAIC); 33 48 34 ALLOCATE ( imlist, off_t *, NMOSAIC);35 ALLOCATE ( Nimlist, off_t, NMOSAIC);36 ALLOCATE ( NIMLIST, off_t, NMOSAIC);37 38 ALLOCATE ( mosimage, off_t, Nimage); // mosaic to which image belongs49 ALLOCATE (MosaicToImage, off_t *, NMOSAIC); 50 ALLOCATE (MosaicN_Image, off_t, NMOSAIC); 51 ALLOCATE (MosaicN_IMAGE, off_t, NMOSAIC); 52 53 ALLOCATE (ImageToMosaic, off_t, Nimage); // mosaic to which image belongs 39 54 40 55 /* a 'mosaic' in relphot is (unlike relastro) a virtual concept: there is no … … 45 60 /* generate list of unique mosaics */ 46 61 for (i = 0; i < Nimage; i++) { 47 mosimage[i] = -1;62 ImageToMosaic[i] = -1; 48 63 49 64 /* select valid mosaic images by photcode */ … … 64 79 65 80 // add reference from image to mosaic 66 mosimage[i] = j;81 ImageToMosaic[i] = j; 67 82 68 83 /* add image to mosaic image list */ 69 imlist[j][Nimlist[j]] = i;70 Nimlist[j] ++;71 if ( Nimlist[j] == NIMLIST[j]) {72 NIMLIST[j] += 10;73 REALLOCATE ( imlist[j], off_t, NIMLIST[j]);84 MosaicToImage[j][MosaicN_Image[j]] = i; 85 MosaicN_Image[j] ++; 86 if (MosaicN_Image[j] == MosaicN_IMAGE[j]) { 87 MosaicN_IMAGE[j] += 10; 88 REALLOCATE (MosaicToImage[j], off_t, MosaicN_IMAGE[j]); 74 89 } 75 90 … … 89 104 90 105 /* add image to mosaic image list */ 91 NIMLIST[Nmosaic] = 10;92 Nimlist[Nmosaic] = 1;93 ALLOCATE ( imlist[Nmosaic], off_t, NIMLIST[Nmosaic]);94 imlist[Nmosaic][0] = i;106 MosaicN_IMAGE[Nmosaic] = 10; 107 MosaicN_Image[Nmosaic] = 1; 108 ALLOCATE (MosaicToImage[Nmosaic], off_t, MosaicN_IMAGE[Nmosaic]); 109 MosaicToImage[Nmosaic][0] = i; 95 110 96 111 // add reference from image to mosaic 97 mosimage[i] = Nmosaic;112 ImageToMosaic[i] = Nmosaic; 98 113 99 114 Nmosaic ++; … … 101 116 NMOSAIC += 10; 102 117 REALLOCATE (mosaic, Mosaic, NMOSAIC); 103 REALLOCATE (imlist, off_t *, NMOSAIC); 104 REALLOCATE (Nimlist, off_t, NMOSAIC); 105 REALLOCATE (NIMLIST, off_t, NMOSAIC); 106 } 107 } 118 REALLOCATE (MosaicToImage, off_t *, NMOSAIC); 119 REALLOCATE (MosaicN_Image, off_t, NMOSAIC); 120 REALLOCATE (MosaicN_IMAGE, off_t, NMOSAIC); 121 } 122 } 123 124 // free this or not? 125 free (MosaicN_IMAGE); 108 126 109 127 initMosaicGrid (image, Nimage); … … 129 147 dS = 0.0; 130 148 Mcal = dMcal = Xm = 0; 131 for (j = 0; j < Nimlist[i]; j++) {132 m = imlist[i][j];149 for (j = 0; j < MosaicN_Image[i]; j++) { 150 m = MosaicToImage[i][j]; 133 151 NX = image[m].NX; 134 152 NY = image[m].NY; … … 162 180 image[m].Xm = NAN_S_SHORT; 163 181 } 164 dS /= Nimlist[i];182 dS /= MosaicN_Image[i]; 165 183 strcpy (mosaic[i].coords.ctype, "RA---TAN"); 166 184 mosaic[i].coords.crval1 = Rmin; … … 176 194 RD_to_XY (&dX, &dY, Rmax, Dmax, &mosaic[i].coords); 177 195 178 mosaic[i].Mcal = Mcal / Nimlist[i];179 mosaic[i].dMcal = dMcal / Nimlist[i];180 mosaic[i].Xm = Xm / Nimlist[i];196 mosaic[i].Mcal = Mcal / MosaicN_Image[i]; 197 mosaic[i].dMcal = dMcal / MosaicN_Image[i]; 198 mosaic[i].Xm = Xm / MosaicN_Image[i]; 181 199 } 182 200 if (!USE_GRID) return; … … 200 218 // impact to the images 201 219 for (i = 0; i < Nmosaic; i++) { 202 for (j = 0; j < Nimlist[i]; j++) {203 im = imlist[i][j];220 for (j = 0; j < MosaicN_Image[i]; j++) { 221 im = MosaicToImage[i][j]; 204 222 image[im].Mcal += mosaic[i].Mcal; 205 223 image[im].dMcal = mosaic[i].dMcal; … … 221 239 if (!MOSAIC_ZEROPT) return; 222 240 223 ALLOCATE ( bin, off_t *, Ncatalog);241 ALLOCATE (MeasureToMosaic, off_t *, Ncatalog); 224 242 for (i = 0; i < Ncatalog; i++) { 225 ALLOCATE ( bin[i], off_t, MAX (catalog[i].Nmeasure, 1));226 for (j = 0; j < catalog[i].Nmeasure; j++) bin[i][j] = -1;243 ALLOCATE (MeasureToMosaic[i], off_t, MAX (catalog[i].Nmeasure, 1)); 244 for (j = 0; j < catalog[i].Nmeasure; j++) MeasureToMosaic[i][j] = -1; 227 245 } 228 246 229 247 if (doMosaicList) { 230 248 /* mosaic -> measure */ 231 ALLOCATE (N list, off_t, Nmosaic);232 ALLOCATE (N LIST, off_t, Nmosaic);233 ALLOCATE ( clist, int *,Nmosaic);234 ALLOCATE ( mlist, off_t *, Nmosaic);249 ALLOCATE (N_onMosaic, off_t, Nmosaic); 250 ALLOCATE (N_ONMOSAIC, off_t, Nmosaic); 251 ALLOCATE (MosaicToCatalog, off_t *, Nmosaic); 252 ALLOCATE (MosaicToMeasure, off_t *, Nmosaic); 235 253 236 254 for (i = 0; i < Nmosaic; i++) { 237 N list[i] = 0;238 N LIST[i] = 100;239 ALLOCATE ( clist[i], int, NLIST[i]);240 ALLOCATE ( mlist[i], off_t, NLIST[i]);255 N_onMosaic[i] = 0; 256 N_ONMOSAIC[i] = 100; 257 ALLOCATE (MosaicToCatalog[i], off_t, N_ONMOSAIC[i]); 258 ALLOCATE (MosaicToMeasure[i], off_t, N_ONMOSAIC[i]); 241 259 } 242 260 } … … 251 269 252 270 for (i = 0; i < Ncatalog; i++) { 253 free ( bin[i]);254 } 255 free ( bin);271 free (MeasureToMosaic[i]); 272 } 273 free (MeasureToMosaic); 256 274 257 275 if (doMosaicList) { 258 276 /* mosaic -> measure */ 259 277 for (i = 0; i < Nmosaic; i++) { 260 free ( clist[i]);261 free ( mlist[i]);262 } 263 free (N list);264 free (N LIST);265 free ( clist);266 free ( mlist);278 free (MosaicToCatalog[i]); 279 free (MosaicToMeasure[i]); 280 } 281 free (N_onMosaic); 282 free (N_ONMOSAIC); 283 free (MosaicToCatalog); 284 free (MosaicToMeasure); 267 285 } 268 286 } … … 310 328 } 311 329 312 mosID = mosimage[idx];330 mosID = ImageToMosaic[idx]; 313 331 if (mosID < 0) { 314 332 Image *image = getimage(idx); … … 327 345 } 328 346 329 bin[cat][meas] = mosID;347 MeasureToMosaic[cat][meas] = mosID; 330 348 331 349 if (doMosaicList) { 332 clist[mosID][Nlist[mosID]] = cat;333 mlist[mosID][Nlist[mosID]] = meas;334 N list[mosID] ++;350 MosaicToCatalog[mosID][N_onMosaic[mosID]] = cat; 351 MosaicToMeasure[mosID][N_onMosaic[mosID]] = meas; 352 N_onMosaic[mosID] ++; 335 353 336 if (N list[mosID] == NLIST[mosID]) {337 N LIST[mosID] += 100;338 REALLOCATE ( clist[mosID], int, NLIST[mosID]);339 REALLOCATE ( mlist[mosID], off_t, NLIST[mosID]);354 if (N_onMosaic[mosID] == N_ONMOSAIC[mosID]) { 355 N_ONMOSAIC[mosID] += 100; 356 REALLOCATE (MosaicToCatalog[mosID], off_t, N_ONMOSAIC[mosID]); 357 REALLOCATE (MosaicToMeasure[mosID], off_t, N_ONMOSAIC[mosID]); 340 358 } 341 359 } … … 350 368 if (!MOSAIC_ZEROPT) return (0); 351 369 352 i = bin[cat][meas];370 i = MeasureToMosaic[cat][meas]; 353 371 if (i == -1) return (NAN); 354 372 … … 380 398 Nmax = 0; 381 399 for (i = 0; i < Nmosaic; i++) { 382 Nmax = MAX (Nmax, N list[i]);400 Nmax = MAX (Nmax, N_onMosaic[i]); 383 401 } 384 402 ALLOCATE (list, double, Nmax); … … 398 416 399 417 N = 0; 400 for (j = 0; j < N list[i]; j++) {418 for (j = 0; j < N_onMosaic[i]; j++) { 401 419 402 m = mlist[i][j];403 c = clist[i][j];420 m = MosaicToMeasure[i][j]; 421 c = MosaicToCatalog[i][j]; 404 422 405 423 if (catalog[c].measureT[m].dbFlags & MEAS_BAD) { … … 435 453 N++; 436 454 } 437 /* N list[i] is all measurements, N is good measurements */455 /* N_onMosaic[i] is all measurements, N is good measurements */ 438 456 439 457 /* too few good measurements or too many bad measurements (skip in PoorImages run) */ 440 458 441 459 if (!PoorImages) { 442 mark = (N < IMAGE_TOOFEW) || (N < IMAGE_GOOD_FRACTION*N list[i]);460 mark = (N < IMAGE_TOOFEW) || (N < IMAGE_GOOD_FRACTION*N_onMosaic[i]); 443 461 if (mark) { 444 if (VERBOSE2) { fprintf (stderr, "marked mosaic %s ("OFF_T_FMT"), ("OFF_T_FMT" < %d) || ("OFF_T_FMT" < %f*"OFF_T_FMT")\n", image[ imlist[i][0]].name, i, N, IMAGE_TOOFEW, N, IMAGE_GOOD_FRACTION, Nlist[i]); }462 if (VERBOSE2) { fprintf (stderr, "marked mosaic %s ("OFF_T_FMT"), ("OFF_T_FMT" < %d) || ("OFF_T_FMT" < %f*"OFF_T_FMT")\n", image[MosaicToImage[i][0]].name, i, N, IMAGE_TOOFEW, N, IMAGE_GOOD_FRACTION, N_onMosaic[i]); } 445 463 mosaic[i].flags |= ID_IMAGE_PHOTOM_FEW; 446 464 Nfew ++; … … 515 533 516 534 if (VERBOSE2 && (fabs(mosaic[i].Mcal) < CLOUD_TOLERANCE)) { 517 fprintf (stderr, "cloud-free: %s : %f\n", image[ imlist[i][0]].name, mosaic[i].Mcal);535 fprintf (stderr, "cloud-free: %s : %f\n", image[MosaicToImage[i][0]].name, mosaic[i].Mcal); 518 536 } 519 537 if (VERBOSE2 && (mosaic[i].Mcal < -CLOUD_TOLERANCE)) { … … 521 539 // NOTE the negative sign: down below, we are going to add in the negative of Mcal 522 540 // to this image, and the propagated mean values for other images 523 fprintf (stderr, "anti-clouds: %s : %f\n", image[ imlist[i][0]].name, mosaic[i].Mcal);541 fprintf (stderr, "anti-clouds: %s : %f\n", image[MosaicToImage[i][0]].name, mosaic[i].Mcal); 524 542 } 525 543 if (VERBOSE2 && (mosaic[i].Mcal > CLOUD_TOLERANCE)) { 526 fprintf (stderr, "cloudy : %s : %f\n", image[ imlist[i][0]].name, mosaic[i].Mcal);544 fprintf (stderr, "cloudy : %s : %f\n", image[MosaicToImage[i][0]].name, mosaic[i].Mcal); 527 545 } 528 546 } … … 579 597 580 598 // find the source of this measurement (skip unassigned measurements) 581 nMos = bin[i][m];599 nMos = MeasureToMosaic[i][m]; 582 600 if (nMos == -1) continue; 583 601 … … 641 659 } 642 660 imageOffset[i] = dM / NSlist[i]; 643 // fprintf (stderr, "adjust image: %s : (%f %d) : %f\n", image[ imlist[i][0]].name, dM, NSlist[i], imageOffset[i]);661 // fprintf (stderr, "adjust image: %s : (%f %d) : %f\n", image[MosaicToImage[i][0]].name, dM, NSlist[i], imageOffset[i]); 644 662 } 645 663 646 664 // for (i = 0; i < Nmosaic; i++) { 647 // fprintf (stderr, "correction: %s : %f\n", image[ imlist[i][0]].name, imageOffset[i]);665 // fprintf (stderr, "correction: %s : %f\n", image[MosaicToImage[i][0]].name, imageOffset[i]); 648 666 // } 649 667 … … 746 764 747 765 N = 0; 748 for (j = 0; j < N list[i]; j++) {749 750 m = mlist[i][j];751 c = clist[i][j];766 for (j = 0; j < N_onMosaic[i]; j++) { 767 768 m = MosaicToMeasure[i][j]; 769 c = MosaicToCatalog[i][j]; 752 770 753 771 Mcal = getMcal (m, c); … … 872 890 N = 0; 873 891 for (i = 0; i < Nmosaic; i++) 874 N = MAX (N, N list[i]);892 N = MAX (N, N_onMosaic[i]); 875 893 876 894 ALLOCATE (xlist, double, N); … … 881 899 Xmin = Ymin = +360.0; 882 900 Xmax = Ymax = -360.0; 883 for (j = 0; j < N list[i]; j++) {901 for (j = 0; j < N_onMosaic[i]; j++) { 884 902 885 m = mlist[i][j];886 c = clist[i][j];903 m = MosaicToMeasure[i][j]; 904 c = MosaicToCatalog[i][j]; 887 905 888 906 if (catalog[c].measureT[m].dbFlags & (ID_MEAS_AREA | ID_MEAS_NOCAL)) continue; … … 959 977 960 978 Imax = 0; 961 Nmax = Nimlist[0];962 for (i = 0; i < Nmosaic; i++) { 963 if ( Nimlist[i] > Nmax) {979 Nmax = MosaicN_Image[0]; 980 for (i = 0; i < Nmosaic; i++) { 981 if (MosaicN_Image[i] > Nmax) { 964 982 Imax = i; 965 Nmax = Nimlist[i];983 Nmax = MosaicN_Image[i]; 966 984 } 967 985 } … … 969 987 *refmosaic = &mosaic[Imax]; 970 988 *Nimage = Nmax; 971 return ( imlist[Imax]);972 } 989 return (MosaicToImage[Imax]); 990 }
Note:
See TracChangeset
for help on using the changeset viewer.
