IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 11, 2007, 4:12:43 PM (19 years ago)
Author:
eugene
Message:

progress on running relastro:images

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/relastro/src/ImageOps.c

    r15579 r15590  
    176176// return StarData values for detections in the specified image, converting coordinates from the
    177177// chip positions: X,Y -> L,M -> P,Q -> R,D
    178 StarData *getImageRaw (Catalog *catalog, int Ncatalog, int im, int *Nstars, int isMosaic) {
     178StarData *getImageRaw (Catalog *catalog, int Ncatalog, int im, int *Nstars, CoordMode mode) {
    179179
    180180  int i, m, c;
    181 
    182   Image *mosaic;
     181 
     182  Mosaic *mosaic;
    183183  Coords *moscoords;
    184184  StarData *raw;
     
    188188  mosaic = NULL;
    189189  moscoords = NULL;
    190   if (isMosaic) {
    191     mosaic = getMosaicForImage (im);
    192     if (mosaic == NULL) {
    193       fprintf (stderr, "mosaic not found for image %s\n", image[i].name);
    194       exit (1);
    195     }
    196     moscoords = &mosaic[0].coords;
     190  switch (mode) {
     191    case MODE_SIMPLE:
     192      break;
     193    case MODE_CHIP:
     194      mosaic = getMosaicForImage (im);
     195      if (mosaic == NULL) {
     196        fprintf (stderr, "mosaic not found for image %s\n", image[i].name);
     197        exit (1);
     198      }
     199      moscoords = &mosaic[0].coords;
     200      break;
     201    case MODE_MOSAIC:
     202      // XXX find all images which are chips for this mosaic image
     203      // XXX count the stars in the superset of lists?
     204      fprintf (stderr, "problem with the mosaic mode (need to grab the correct set of stars)");
     205      abort ();
     206      break;
    197207  }
    198208
     
    208218    raw[i].dMag = catalog[c].measure[m].dM;
    209219
    210     /* note that for a Simple image, L,M = P,Q */
    211     XY_to_LM (&raw[i].L, &raw[i].M, raw[i].X, raw[i].Y, &image[im].coords);
    212     if (isMosaic) {
    213       XY_to_LM (&raw[i].P, &raw[i].Q, raw[i].L, raw[i].M, moscoords);
    214       LM_to_RD (&raw[i].R, &raw[i].D, raw[i].P, raw[i].Q, moscoords);
    215     } else {
    216       raw[i].P = raw[i].L;
    217       raw[i].Q = raw[i].M;
    218       LM_to_RD (&raw[i].R, &raw[i].D, raw[i].P, raw[i].Q, &image[im].coords);
     220    raw[i].mask = FALSE;
     221
     222    switch (mode) {
     223      case MODE_SIMPLE:
     224        /* note that for a Simple image, L,M = P,Q */
     225        XY_to_LM (&raw[i].L, &raw[i].M, raw[i].X, raw[i].Y, &image[im].coords);
     226        raw[i].P = raw[i].L;
     227        raw[i].Q = raw[i].M;
     228        LM_to_RD (&raw[i].R, &raw[i].D, raw[i].P, raw[i].Q, &image[im].coords);
     229        break;
     230      case MODE_CHIP:
     231        XY_to_LM (&raw[i].L, &raw[i].M, raw[i].X, raw[i].Y, &image[im].coords);
     232        XY_to_LM (&raw[i].P, &raw[i].Q, raw[i].L, raw[i].M, moscoords);
     233        LM_to_RD (&raw[i].R, &raw[i].D, raw[i].P, raw[i].Q, moscoords);
     234        break;
     235      case MODE_MOSAIC:
     236        XY_to_LM (&raw[i].L, &raw[i].M, raw[i].X, raw[i].Y, &image[im].coords);
     237        raw[i].P = raw[i].L;
     238        raw[i].Q = raw[i].M;
     239        LM_to_RD (&raw[i].R, &raw[i].D, raw[i].P, raw[i].Q, &image[im].coords);
     240        break;
    219241    }
    220   }
    221  
     242  } 
     243
    222244  *Nstars = Nlist[im];
    223245  return (raw);
     
    230252  int i, m, c, n;
    231253
    232   Image *mosaic;
     254  Mosaic *mosaic;
    233255  Coords *moscoords;
    234256  StarData *ref;
     
    251273    ref[i].R = catalog[c].average[n].R;
    252274    ref[i].D = catalog[c].average[n].D;
     275    ref[i].mask = FALSE;
    253276
    254277    /* note that for a Simple image, L,M = P,Q */
    255     RD_to_LM (&ref[i].P, &ref[i].Q, ref[i].R, ref[i].D, &image[im].coords);
    256278    if (isMosaic) {
     279      RD_to_LM (&ref[i].P, &ref[i].Q, ref[i].R, ref[i].D, moscoords);
    257280      LM_to_XY (&ref[i].M, &ref[i].L, ref[i].P, ref[i].Q, moscoords);
    258       LM_to_XY (&ref[i].X, &ref[i].Y, ref[i].L, ref[i].M, moscoords);
     281      LM_to_XY (&ref[i].X, &ref[i].Y, ref[i].L, ref[i].M, &image[im].coords);
    259282    } else {
     283      RD_to_LM (&ref[i].P, &ref[i].Q, ref[i].R, ref[i].D, &image[im].coords);
    260284      ref[i].L = ref[i].P;
    261285      ref[i].M = ref[i].Q;
Note: See TracChangeset for help on using the changeset viewer.