IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 28695


Ignore:
Timestamp:
Jul 22, 2010, 7:50:52 AM (16 years ago)
Author:
eugene
Message:

finish code for starmap in relastro

Location:
branches/eam_branches/ipp-20100621/Ohana/src/relastro/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20100621/Ohana/src/relastro/src/ImageOps.c

    r28241 r28695  
    372372
    373373    // complain if the new location is far from the average location
     374    // XXX warning or error here??
    374375    if (fabs(dR) > 2.0) {
    375376      fprintf (stderr, "!");
     
    414415
    415416  saveOffsets (dPos, nPos, im);
     417
     418  // XXX this function should probably update the average positions as well.
    416419
    417420  return;
  • branches/eam_branches/ipp-20100621/Ohana/src/relastro/src/StarMaps.c

    r28685 r28695  
    11# include "relastro.h"
     2
     3// XXX mark the image grid based on the loaded detections
     4// XXX modify tcatalog to exclude any photcode or other choices that
     5// only affect image selection?
     6
     7// XXX this stuff is only going to work for SIMPLE and CHIP; need to
     8// use parentID to get from imageID to the mosaic pseudo-image
     9
     10typedef struct {
     11  double L;
     12  double M;
     13  double X;
     14  double Y;
     15  double dL;
     16  double dM;
     17} StarMapPoint;
    218
    319typedef struct {
     
    521  int  Ny;
    622  int *stars;
     23  StarMapPoint *points;
     24  int Npoints;
    725} StarMap;
    826
     
    5876  return (TRUE);
    5977}
     78
     79int createStarMapPoints() {
     80
     81  Image *images;
     82  off_t i, Nimages;
     83
     84  images = getimages(&Nimages);
     85
     86  for (i = 0; i < Nimages; i++) {
     87   
     88    ALLOCATE (starmap[i].points, StarMapPoint, NX_MAP*NY_MAP);
     89    starmap[i].Npoints = 0;
     90
     91    for (ix = 0; ix < NX_MAP; ix++) {
     92      for (iy = 0; iy < NY_MAP; iy++) {
     93        if (starmap[i].stars[iybin*NX_BAP + ixbin] < 1) continue;
     94        StarMapPoint *point = &starmap[i].points[starmap[i].Npoints];
     95        starmap[i].Npoints++;
     96
     97        // set the pixel coordinates
     98        point[0].X = ixbin * NX_MAP; // XXX fix 0.5 pixel offset
     99        point[0].Y = iybin * NY_MAP; // XXX fix 0.5 pixel offset
     100
     101        // set the transformed coordinates
     102        XY_to_LM (&point[0].L, &point[0].M, point[0].X, point[0].Y, &image[i].coords);
     103
     104        point[0].dL = 0.0;
     105        point[0].dM = 0.0;
     106      }
     107    }
     108  }
     109
     110  return (TRUE);
     111}
     112
     113int checkStarMap(int N) {
     114
     115  Image *images;
     116  off_t i, Nimages;
     117  double L, M, dLmax, dMmax;
     118
     119  images = getimages(&Nimages);
     120
     121  dLmax = dMmax = 0.0;
     122
     123  for (i = 0; i < starmap[N].Npoints; i++) {
     124
     125    // set the transformed coordinates
     126    XY_to_LM (&L, &M, starmap[N].point[i].X, starmap[N].point[i].Y, &image[N].coords);
     127
     128    starmap[N].point[i].dL = starmap[N].point[i].L - L;
     129    starmap[N].point[i].dM = starmap[N].point[i].M - M;
     130
     131    dLmax = MAX(starmap[N].point[i].dL, dLmax);
     132    dMmax = MAX(starmap[N].point[i].dM, dMmax);
     133  }
     134
     135  if (dLmax > XXX) return (FALSE);
     136  if (dMmax > XXX) return (FALSE);
     137  return (TRUE);
     138}
     139
  • branches/eam_branches/ipp-20100621/Ohana/src/relastro/src/UpdateChips.c

    r28241 r28695  
    3535      oldCoords = getCoords (i);
    3636      memcpy (&image[i].coords, oldCoords, sizeof(Coords));
     37      // XXX need to set some flag to note failure here
     38      free (raw);
     39      free (ref);
     40      continue;
     41    }
     42
     43    if (!checkStarMap (i)) {
     44      fprintf (stderr, "fit diverges too much for image %s ("OFF_T_FMT") : Nstars: "OFF_T_FMT"\n", image[i].name,  i,  Nraw);
     45      oldCoords = getCoords (i);
     46      memcpy (&image[i].coords, oldCoords, sizeof(Coords));
     47      // XXX need to set some flag to note failure here
    3748    }
    3849
  • branches/eam_branches/ipp-20100621/Ohana/src/relastro/src/UpdateMeasures.c

    r27435 r28695  
    1313    if (!strcmp(&image[i].coords.ctype[4], "-DIS")) continue;
    1414
     15    // skip images that have failed solutions (divergent or otherwise)
     16
    1517    /* convert measure coordinates to raw entries */
    1618    fixImageRaw (catalog, Ncatalog, i);
  • branches/eam_branches/ipp-20100621/Ohana/src/relastro/src/load_catalogs.c

    r28685 r28695  
    3737    }
    3838
    39     // XXX mark the image grid based on the loaded detections
    40     // XXX modify tcatalog to exclude any photcode or other choices that only affect image selection?
    4139    updateStarMaps (&tcatalog);
    4240
  • branches/eam_branches/ipp-20100621/Ohana/src/relastro/src/relastro.c

    r28683 r28695  
    6666  }
    6767
     68  // set test points based on the starmap
     69  createStarMapPoints();
     70
    6871  /* major modes */
    6972  switch (FIT_TARGET) {
     
    104107
    105108  // iterate over catalogs to make detection coordinates consistant
    106   FixProblemImages (skylist);
     109  // FixProblemImages (skylist);
    107110
    108111  // save the updated image parameters
Note: See TracChangeset for help on using the changeset viewer.