IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 33101


Ignore:
Timestamp:
Jan 13, 2012, 1:34:15 PM (15 years ago)
Author:
eugene
Message:

rename relationship variables to make the code clearer

Location:
branches/eam_branches/ipp-20111122/Ohana/src/relphot/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/ImageOps.c

    r31668 r33101  
    11# include "relphot.h"
    22
    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)
    104static off_t        Nimage;   // number of available images
     5static 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
    119static off_t       *LineNumber; // match of subset to full image table
    1210
     
    1412static off_t        *imageIDs; // list of all image IDs
    1513static 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
     17static off_t        *N_onImage;   // actual number of measurements on image         
     18static off_t        *N_ONIMAGE;   // allocated number of measurements on image   
     19
     20// relationships between the measure,catalog set and the images:
     21static off_t       **MeasureToImage; // image index from measure,catalog   : MeasureToImage[cat][meas] = ImageIndex
     22static off_t       **ImageToCatalog; // catalog for given measure on image : ImageCatalog[ImageIndex][i] = cat (i : 0 < NonImage[ImageIndex])
     23static 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'
    1631
    1732Image *getimages (off_t *N, off_t **line_number) {
     
    7388  off_t i, j;
    7489
    75   ALLOCATE (bin, off_t *, Ncatalog);
     90  ALLOCATE (MeasureToImage, off_t *, Ncatalog);
    7691  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;
    7994  }
    8095
    8196  if (doImageList) {
    82     ALLOCATE (Nlist, off_t, Nimage);
    83     ALLOCATE (NLIST, 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);
    86101
    87102    for (i = 0; i < Nimage; i++) {
    88       Nlist[i] = 0;
    89       NLIST[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]);
    92107    }
    93108  }
     
    99114
    100115  for (i = 0; i < Ncatalog; i++) {
    101     free (bin[i]);
    102   }
    103   free (bin);
     116    free (MeasureToImage[i]);
     117  }
     118  free (MeasureToImage);
    104119
    105120  if (doImageList) {
    106121    for (i = 0; i < Nimage; i++) {
    107       free (clist[i]);
    108       free (mlist[i]);
    109     }
    110     free (clist);
    111     free (mlist);
    112     free (Nlist);
    113     free (NLIST);
     122      free (ImageToCatalog[i]);
     123      free (ImageToMeasure[i]);
     124    }
     125    free (ImageToCatalog);
     126    free (ImageToMeasure);
     127    free (N_onImage);
     128    free (N_ONIMAGE);
    114129  }
    115130}
     
    210225
    211226  // index for (catalog, measure) -> image
    212   bin[cat][meas] = idx;
     227  MeasureToImage[cat][meas] = idx;
    213228
    214229  if (doImageList) {
    215230    // index for image, Nentry -> catalog
    216     clist[idx][Nlist[idx]] = cat;
     231    ImageToCatalog[idx][N_onImage[idx]] = cat;
    217232
    218233    // index for image, Nentry -> measure
    219     mlist[idx][Nlist[idx]] = meas;
    220     Nlist[idx] ++;
    221 
    222     if (Nlist[idx] == NLIST[idx]) {
    223       NLIST[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]);
    226241    }   
    227242  }
     
    234249  off_t i;
    235250
    236   i = bin[cat][meas];
     251  i = MeasureToImage[cat][meas];
    237252  return (i);
    238253}
     
    243258  float value;
    244259
    245   i = bin[cat][meas];
     260  i = MeasureToImage[cat][meas];
    246261  if (i == -1) return (NAN);
    247262
     
    255270  off_t i;
    256271
    257   i = bin[cat][meas];
     272  i = MeasureToImage[cat][meas];
    258273  if (i == -1) return (NULL);
    259274  return (&image[i].coords);
     
    279294  Nmax = 0;
    280295  for (i = 0; i < Nimage; i++) {
    281     Nmax = MAX (Nmax, Nlist[i]);
     296    Nmax = MAX (Nmax, N_onImage[i]);
    282297  }
    283298  ALLOCATE (list, double, Nmax);
     
    299314
    300315    N = 0;
    301     for (j = 0; j < Nlist[i]; j++) {
     316    for (j = 0; j < N_onImage[i]; j++) {
    302317     
    303       m = mlist[i][j];
    304       c = clist[i][j];
     318      m = ImageToMeasure[i][j];
     319      c = ImageToCatalog[i][j];
    305320     
    306321      if (catalog[c].measureT[m].dbFlags & MEAS_BAD) {
     
    339354      N++;
    340355    }
    341     /* Nlist[i] is all measurements, N is good measurements */
     356    /* N_onImage[i] is all measurements, N is good measurements */
    342357
    343358    /* too few good measurements or too many bad measurements */
    344359    if (!PoorImages) {
    345       mark = (N < IMAGE_TOOFEW) || (N < IMAGE_GOOD_FRACTION*Nlist[i]);
     360      mark = (N < IMAGE_TOOFEW) || (N < IMAGE_GOOD_FRACTION*N_onImage[i]);
    346361      if (mark) {
    347362        image[i].flags |= ID_IMAGE_PHOTOM_FEW;
     
    383398  int mark, Nmark;
    384399  off_t i, N;
    385   double *mlist, *slist, *dlist;
     400  double *ImageToMeasure, *slist, *dlist;
    386401  double MaxOffset, MaxScatter, MedOffset;
    387402  StatType stats;
     
    391406  if (VERBOSE) fprintf (stderr, "marking poor images\n");
    392407
    393   ALLOCATE (mlist, double, Nimage);
     408  ALLOCATE (ImageToMeasure, double, Nimage);
    394409  ALLOCATE (slist, double, Nimage);
    395410  ALLOCATE (dlist, double, Nimage);
     
    397412  for (i = N = 0; i < Nimage; i++) {
    398413    if (image[i].flags & IMAGE_BAD) continue;
    399     mlist[N] = fabs (image[i].Mcal);
     414    ImageToMeasure[N] = fabs (image[i].Mcal);
    400415    slist[N] = image[i].dMcal;
    401416    dlist[N] = 1;
     
    403418  }
    404419  initstats ("MEAN");
    405   liststats (mlist, dlist, N, &stats);
     420  liststats (ImageToMeasure, dlist, N, &stats);
    406421  MaxOffset = MAX (IMAGE_OFFSET, 3*stats.sigma);
    407422  MedOffset = stats.median;
     
    425440  fprintf (stderr, "%d images marked poor\n", Nmark);
    426441  initstats (STATMODE);
    427   free (mlist);
     442  free (ImageToMeasure);
    428443  free (slist);
    429444  free (dlist);
     
    496511
    497512    N = 0;
    498     for (j = 0; j < Nlist[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];
    502517
    503518      Mcal  = getMcal  (m, c);
  • branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/MosaicOps.c

    r31668 r33101  
    55static Mosaic *mosaic;
    66
    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
     8static off_t   *MosaicN_Image; // number of images associated with the given mosaic
     9static off_t  **MosaicToImage; // list of imagesa associated with the given mosaic
     10
     11// mosaic index for given image : ImageToMosaic[ImageIndex] = MosaicIndex (ImageIndex : 0 < Nimage)
     12static 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
     16static off_t    *N_onMosaic;   // actual number of measurements on mosaic       
     17static off_t    *N_ONMOSAIC;   // allocated number of measurements on mosaic   
     18
     19// relationships between the measure,catalog set and the mosaics:
     20static off_t   **MeasureToMosaic; // Mosaic index from measure,catalog  : MeasureToMosaic[cat][meas] = MosaicIndex
     21static off_t   **MosaicToCatalog; // catalog for given measure on mosaic : MosaicCatalog[MosaicIndex][i] = cat (i : 0 < NonMosaic[MosaicIndex])
     22static 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'
    2035
    2136/* find mosaic frames (unique time periods & photcode name matches mosaic) */
    2237void initMosaics (Image *image, off_t Nimage) {
    2338
    24   off_t i, j, status, found, NMOSAIC, *NIMLIST;
     39  off_t i, j, status, found, NMOSAIC, *MosaicN_IMAGE;
    2540  unsigned int start, stop;
    2641  char *pname;
     
    3247  ALLOCATE (mosaic, Mosaic, NMOSAIC);
    3348
    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 belongs
     49  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
    3954
    4055  /* a 'mosaic' in relphot is (unlike relastro) a virtual concept: there is no
     
    4560  /* generate list of unique mosaics */
    4661  for (i = 0; i < Nimage; i++) {
    47     mosimage[i] = -1;
     62    ImageToMosaic[i] = -1;
    4863
    4964    /* select valid mosaic images by photcode */
     
    6479
    6580      // add reference from image to mosaic
    66       mosimage[i] = j;
     81      ImageToMosaic[i] = j;
    6782
    6883      /* 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]);
    7489      }
    7590
     
    89104
    90105    /* 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;
    95110
    96111    // add reference from image to mosaic
    97     mosimage[i] = Nmosaic;
     112    ImageToMosaic[i] = Nmosaic;
    98113   
    99114    Nmosaic ++;
     
    101116      NMOSAIC += 10;
    102117      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);
    108126
    109127  initMosaicGrid (image, Nimage);
     
    129147    dS = 0.0;
    130148    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];
    133151      NX = image[m].NX;
    134152      NY = image[m].NY;
     
    162180      image[m].Xm    = NAN_S_SHORT;
    163181    }
    164     dS /= Nimlist[i];
     182    dS /= MosaicN_Image[i];
    165183    strcpy (mosaic[i].coords.ctype, "RA---TAN");
    166184    mosaic[i].coords.crval1 = Rmin;
     
    176194    RD_to_XY (&dX, &dY, Rmax, Dmax, &mosaic[i].coords);
    177195
    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];
    181199  }
    182200  if (!USE_GRID) return;
     
    200218  // impact to the images
    201219  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];
    204222      image[im].Mcal += mosaic[i].Mcal;
    205223      image[im].dMcal = mosaic[i].dMcal;
     
    221239  if (!MOSAIC_ZEROPT) return;
    222240
    223   ALLOCATE (bin, off_t *, Ncatalog);
     241  ALLOCATE (MeasureToMosaic, off_t *, Ncatalog);
    224242  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;
    227245  }
    228246
    229247  if (doMosaicList) {
    230248    /* mosaic -> measure */
    231     ALLOCATE (Nlist, off_t,   Nmosaic);
    232     ALLOCATE (NLIST, 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);
    235253
    236254    for (i = 0; i < Nmosaic; i++) {
    237       Nlist[i] = 0;
    238       NLIST[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]);
    241259    }
    242260  }
     
    251269
    252270  for (i = 0; i < Ncatalog; i++) {
    253     free (bin[i]);
    254   }
    255   free (bin);
     271    free (MeasureToMosaic[i]);
     272  }
     273  free (MeasureToMosaic);
    256274
    257275  if (doMosaicList) {
    258276    /* mosaic -> measure */
    259277    for (i = 0; i < Nmosaic; i++) {
    260       free (clist[i]);
    261       free (mlist[i]);
    262     }
    263     free (Nlist);
    264     free (NLIST);
    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);
    267285  }
    268286}
     
    310328  }
    311329
    312   mosID = mosimage[idx];
     330  mosID = ImageToMosaic[idx];
    313331  if (mosID < 0) {
    314332    Image *image = getimage(idx);
     
    327345  }
    328346
    329   bin[cat][meas] = mosID;
     347  MeasureToMosaic[cat][meas] = mosID;
    330348
    331349  if (doMosaicList) {
    332     clist[mosID][Nlist[mosID]] = cat;
    333     mlist[mosID][Nlist[mosID]] = meas;
    334     Nlist[mosID] ++;
     350    MosaicToCatalog[mosID][N_onMosaic[mosID]] = cat;
     351    MosaicToMeasure[mosID][N_onMosaic[mosID]] = meas;
     352    N_onMosaic[mosID] ++;
    335353   
    336     if (Nlist[mosID] == NLIST[mosID]) {
    337       NLIST[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]);
    340358    }   
    341359  }
     
    350368  if (!MOSAIC_ZEROPT) return (0);
    351369
    352   i = bin[cat][meas];
     370  i = MeasureToMosaic[cat][meas];
    353371  if (i == -1) return (NAN);
    354372
     
    380398  Nmax = 0;
    381399  for (i = 0; i < Nmosaic; i++) {
    382     Nmax = MAX (Nmax, Nlist[i]);
     400    Nmax = MAX (Nmax, N_onMosaic[i]);
    383401  }
    384402  ALLOCATE (list, double, Nmax);
     
    398416
    399417    N = 0;
    400     for (j = 0; j < Nlist[i]; j++) {
     418    for (j = 0; j < N_onMosaic[i]; j++) {
    401419     
    402       m = mlist[i][j];
    403       c = clist[i][j];
     420      m = MosaicToMeasure[i][j];
     421      c = MosaicToCatalog[i][j];
    404422     
    405423      if (catalog[c].measureT[m].dbFlags & MEAS_BAD) {
     
    435453      N++;
    436454    }
    437     /* Nlist[i] is all measurements, N is good measurements */
     455    /* N_onMosaic[i] is all measurements, N is good measurements */
    438456
    439457    /* too few good measurements or too many bad measurements (skip in PoorImages run) */
    440458
    441459    if (!PoorImages) {
    442       mark = (N < IMAGE_TOOFEW) || (N < IMAGE_GOOD_FRACTION*Nlist[i]);
     460      mark = (N < IMAGE_TOOFEW) || (N < IMAGE_GOOD_FRACTION*N_onMosaic[i]);
    443461      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]); }
    445463        mosaic[i].flags |= ID_IMAGE_PHOTOM_FEW;
    446464        Nfew ++;
     
    515533
    516534    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);
    518536    }
    519537    if (VERBOSE2 && (mosaic[i].Mcal < -CLOUD_TOLERANCE)) {
     
    521539      // NOTE the negative sign: down below, we are going to add in the negative of Mcal
    522540      // 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);
    524542    }
    525543    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);
    527545    }
    528546  }
     
    579597
    580598        // find the source of this measurement (skip unassigned measurements)
    581         nMos = bin[i][m];
     599        nMos = MeasureToMosaic[i][m];
    582600        if (nMos == -1) continue;
    583601
     
    641659    }
    642660    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]);
    644662  }
    645663
    646664  // 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]);
    648666  // }
    649667
     
    746764
    747765    N = 0;
    748     for (j = 0; j < Nlist[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];
    752770
    753771      Mcal = getMcal  (m, c);
     
    872890  N = 0;
    873891  for (i = 0; i < Nmosaic; i++)
    874     N = MAX (N, Nlist[i]);
     892    N = MAX (N, N_onMosaic[i]);
    875893
    876894  ALLOCATE (xlist, double, N);
     
    881899    Xmin = Ymin = +360.0;
    882900    Xmax = Ymax = -360.0;
    883     for (j = 0; j < Nlist[i]; j++) {
     901    for (j = 0; j < N_onMosaic[i]; j++) {
    884902     
    885       m = mlist[i][j];
    886       c = clist[i][j];
     903      m = MosaicToMeasure[i][j];
     904      c = MosaicToCatalog[i][j];
    887905     
    888906      if (catalog[c].measureT[m].dbFlags & (ID_MEAS_AREA | ID_MEAS_NOCAL)) continue;
     
    959977
    960978  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) {
    964982      Imax = i;
    965       Nmax = Nimlist[i];
     983      Nmax = MosaicN_Image[i];
    966984    }
    967985  }
     
    969987  *refmosaic = &mosaic[Imax];
    970988  *Nimage = Nmax;
    971   return (imlist[Imax]);
    972 }
     989  return (MosaicToImage[Imax]);
     990}
Note: See TracChangeset for help on using the changeset viewer.