IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 33568


Ignore:
Timestamp:
Mar 19, 2012, 6:09:12 PM (14 years ago)
Author:
eugene
Message:

count images with too few, nearly too few objects; require images to be completely within the selected region (or we have gradients across the images); use psastro style order selection based on number of objects; free some possible leaks; clean up bcatalog messages (and list counts for selected objects at each stage); pass SIGMA_LIM to relastro_client -load-objects

Location:
branches/eam_branches/ipp-20111122/Ohana/src/relastro/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20111122/Ohana/src/relastro/src/FitChip.c

    r33566 r33568  
    44int FitChip (StarData *raw, StarData *ref, int Nmatch, Image *image) {
    55
    6   int i, NstatFull, Nstat, Niter, skip;
     6  int i, NstatFull, Nstat, Niter;
    77  float dLsig, dMsig, dRsig;
    88  float dLsigFull, dMsigFull, dRsigFull;
     
    5252    // fit the requested order polynomial
    5353    if (CHIPORDER > 0) {
    54       image[0].coords.Npolyterms = CHIPORDER;
    55     }
     54      int Ndof_min = 3;
     55      int order_max = 0.5*(sqrt(4*Nmatch - 4*Ndof_min + 1) - 3);
     56      int order_use = MIN (CHIPORDER, order_max);
     57      if (order_use < 1) {
     58        if (VERBOSE2) fprintf (stderr, "insufficient measurements (%d) for linear fit\n", Nmatch);
     59        image[0].flags |= ID_IMAGE_ASTROM_FEW;
     60        return FALSE;
     61      }
     62      image[0].coords.Npolyterms = order_use;
     63    }
     64
    5665    if (fit) fit_free (fit);
    5766    fit = fit_init (image[0].coords.Npolyterms);
     
    6372    }
    6473
     74# if (0)
    6575    // check if the fit has enough data points for the polynomial order
    6676    skip = FALSE;
     
    8696      return FALSE;
    8797    }
     98# endif
    8899
    89100    // measure the fit, update the coords & object coordinates
     
    91102      fprintf (stderr, "failed to fit new model\n");
    92103      image[0].flags |= ID_IMAGE_ASTROM_FAIL;
     104      if (fit) fit_free (fit);
    93105      return FALSE;
    94106    }
     
    97109      fprintf (stderr, "failed to fit new model\n");
    98110      image[0].flags |= ID_IMAGE_ASTROM_FAIL;
     111      if (fit) fit_free (fit);
    99112      return FALSE;
    100113    }
     
    133146  image[0].nLinkAstrom = (Nm / Ns);
    134147
    135   if (VERBOSE) fprintf (stderr, "fit sigma: %f (%f, %f) : full: %f (%f, %f), scatter limit: %f (%d full, %d bright, %d fit, %d all) (%d %d %d %d %d)\n", dRsig, dLsig, dMsig, dRsigFull, dLsigFull, dMsigFull, dRmax, NstatFull, Nstat, fit[0].Npts, Nmatch, nMask1, nMask2, nMask3, nMask4, nMask5);
     148  if (VERBOSE2) fprintf (stderr, "fit sigma: %f (%f, %f) : full: %f (%f, %f), scatter limit: %f (%d full, %d bright, %d fit, %d all) (%d %d %d %d %d)\n", dRsig, dLsig, dMsig, dRsigFull, dLsigFull, dMsigFull, dRmax, NstatFull, Nstat, fit[0].Npts, Nmatch, nMask1, nMask2, nMask3, nMask4, nMask5);
    136149
    137150  image[0].dXpixSys = dLsig;
  • branches/eam_branches/ipp-20111122/Ohana/src/relastro/src/ImageOps.c

    r33566 r33568  
    181181  }
    182182
    183   for (i = 0; VERBOSE && (i < Nimage); i++) {
    184     name = GetPhotcodeNamebyCode (image[i].photcode);
    185     fprintf (stderr, "image "OFF_T_FMT" (%d, %s) has "OFF_T_FMT" of %d measures (%s, %s)\n",  i,  image[i].imageID, image[i].name, N_onImage[i], image[i].nstar,
    186              ohana_sec_to_date(image[i].tzero), name);
    187   }
     183  // watch for chips with few stars
     184  int Nfew = 0;
     185  int Nbad = 0;
     186  for (i = 0; i < Nimage; i++) {
     187    // ignore the PHU entries
     188    if (!strcmp(&image[i].coords.ctype[4], "-DIS")) continue;
     189    if (VERBOSE2 || (MATCHCAT && (N_onImage[i] < 20))) {
     190      name = GetPhotcodeNamebyCode (image[i].photcode);
     191      fprintf (stderr, "image "OFF_T_FMT" (%d, %s) has "OFF_T_FMT" of %d measures (%s, %s)",  i,  image[i].imageID, image[i].name, N_onImage[i], image[i].nstar,
     192               ohana_sec_to_date(image[i].tzero), name);
     193      if (N_onImage[i] < 20) {
     194        fprintf (stderr, "*");
     195        Nfew ++;
     196      }
     197      if (N_onImage[i] < 15) {
     198        fprintf (stderr, "*** warning ***");
     199        Nbad ++;
     200      }
     201      fprintf (stderr, "\n");
     202    }
     203  }
     204  fprintf (stderr, OFF_T_FMT" total images, %d with < 20 measurements, %d with < 15\n", Nimage, Nfew, Nbad);
    188205}
    189206
  • branches/eam_branches/ipp-20111122/Ohana/src/relastro/src/UpdateChips.c

    r33566 r33568  
    2525  ALLOCATE (mode, char, Nimage);
    2626
     27  // XXX for faster processing in the future, this can be easily run in parallel
     28  // each chip is fitted independently, so we could do N at once in parallel
    2729  for (i = 0; i < Nimage; i++) {
    2830
     
    4749      Nskip ++;
    4850      mode[i] = 0;
     51      free (raw);
    4952      continue;
    5053    }
  • branches/eam_branches/ipp-20111122/Ohana/src/relastro/src/bcatalog.c

    r33567 r33568  
    11# include "relastro.h"
     2
     3static int Nskip1 = 0;
     4static int Nskip2 = 0;
     5static unsigned int Tref = 1323353985;
     6static short Cref = 10355;
    27
    38int bcatalog (Catalog *subcatalog, Catalog *catalog) {
     
    3439    if (catalog[0].average[i].Nmeasure <= SRC_MEAS_TOOFEW) {
    3540      continue;
     41      // XXX can't (easily) count this for a given chip
    3642    }
    3743   
     
    5561      if (!MeasFilterTest(&catalog[0].measure[offset], TRUE)) {
    5662        catalog[0].measure[offset].dbFlags &= ~ID_MEAS_USED_CHIP;
     63        if (FALSE && (abs(catalog[0].measure[offset].t - Tref) < 10) && (catalog[0].measure[offset].photcode == Cref)) {
     64          Nskip1 ++;
     65        }
    5766        continue;
    5867      }
     
    6170      if (FlagOutlier && (catalog[0].measure[offset].dbFlags & ID_MEAS_POOR_ASTROM)) {
    6271        catalog[0].measure[offset].dbFlags &= ~ID_MEAS_USED_CHIP;
     72        if (FALSE && (abs(catalog[0].measure[offset].t - Tref) < 10) && (catalog[0].measure[offset].photcode == Cref)) {
     73          Nskip2 ++;
     74        }
    6375        continue;
    6476      }
     
    115127  if (MaxDensityUse) {
    116128    LimitDensityCatalog_ByNmeasure (subcatalog, catalog);
    117   }
    118 
    119   if (VERBOSE) {
    120     fprintf (stderr, OFF_T_FMT": using "OFF_T_FMT" stars ("OFF_T_FMT" measures) for catalog\n",  i,  subcatalog[0].Naverage,  subcatalog[0].Nmeasure);
    121    }
     129  } else {
     130    if (VERBOSE) {
     131      char *basename = filebasename (catalog[0].filename);
     132      fprintf (stderr, "subset of "OFF_T_FMT" ("OFF_T_FMT" total) stars, "OFF_T_FMT" ("OFF_T_FMT" total) measures for catalog %s\n",
     133               subcatalog[0].Naverage, catalog[0].Naverage, subcatalog[0].Nmeasure, catalog[0].Nmeasure, basename);
     134      free (basename);
     135    }
     136  }
    122137  return (TRUE);
     138}
     139
     140void bcatalog_show_skips () {
     141  fprintf (stderr, "Nskip: %d, %d\n", Nskip1, Nskip2);
    123142}
    124143
     
    140159
    141160/* this version does NOT use AverageTiny, MeasureTiny */
    142 int LimitDensityCatalog_ByNmeasure (Catalog *subcatalog, Catalog *catalog) {
     161int LimitDensityCatalog_ByNmeasure (Catalog *subcatalog, Catalog *oldcatalog) {
    143162
    144163  Catalog tmpcatalog;
     
    148167  int Nsecfilt = GetPhotcodeNsecfilt ();
    149168
    150   gfits_scan (&catalog[0].header, "RA0",  "%lf", 1, &Rmin);
    151   gfits_scan (&catalog[0].header, "DEC0", "%lf", 1, &Dmin);
    152   gfits_scan (&catalog[0].header, "RA1",  "%lf", 1, &Rmax);
    153   gfits_scan (&catalog[0].header, "DEC1", "%lf", 1, &Dmax);
     169  gfits_scan (&oldcatalog[0].header, "RA0",  "%lf", 1, &Rmin);
     170  gfits_scan (&oldcatalog[0].header, "DEC0", "%lf", 1, &Dmin);
     171  gfits_scan (&oldcatalog[0].header, "RA1",  "%lf", 1, &Rmax);
     172  gfits_scan (&oldcatalog[0].header, "DEC1", "%lf", 1, &Dmax);
    154173
    155174  if (VERBOSE2) fprintf (stderr, "extracting from catalog covering region %f,%f to %f,%f\n", Rmin, Dmin, Rmax, Dmax);
     
    177196  for (i = 0; i < Naverage; i++) {
    178197    index[i] = i;
    179     value[i] = catalog[0].average[i].Nmeasure;
     198    value[i] = subcatalog[0].average[i].Nmeasure;
    180199  }
    181200  sort_by_Nmeasure (value, index, Naverage);
     
    212231
    213232  if (VERBOSE) {
    214     fprintf (stderr, "limited to "OFF_T_FMT" of "OFF_T_FMT" stars ("OFF_T_FMT" of "OFF_T_FMT" measures) for catalog %s\n",
    215              Nmax, subcatalog[0].Naverage, Nmeasure, subcatalog[0].Nmeasure,  catalog[0].filename);
     233    char *basename = filebasename (oldcatalog[0].filename);
     234    fprintf (stderr, "limited to "OFF_T_FMT" ("OFF_T_FMT" subset, "OFF_T_FMT" total) stars, "OFF_T_FMT" ("OFF_T_FMT" subset, "OFF_T_FMT" total) measures for catalog %s\n",
     235             Nmax, subcatalog[0].Naverage, oldcatalog[0].Naverage, Nmeasure, subcatalog[0].Nmeasure,  oldcatalog[0].Nmeasure, basename);
     236    free (basename);
    216237  }
    217238
     
    227248  subcatalog[0].Naverage = Nmax;
    228249  subcatalog[0].Nmeasure = Nmeasure;
    229   subcatalog[0].Nsecfilt = catalog[0].Nsecfilt;
    230   subcatalog[0].Nsecf_mem = Naverage * catalog[0].Nsecfilt;
     250  subcatalog[0].Nsecfilt = oldcatalog[0].Nsecfilt;
     251  subcatalog[0].Nsecf_mem = Naverage * oldcatalog[0].Nsecfilt;
    231252
    232253  return (TRUE);
  • branches/eam_branches/ipp-20111122/Ohana/src/relastro/src/fitpoly.c

    r29001 r33568  
    149149 
    150150  if (!dgaussjordan (matrix, vector, fit[0].Nelems, 2)) {
     151    array_free (matrix, fit[0].Nelems);
     152    array_free (vector, fit[0].Nelems);
    151153    return (FALSE);
    152154  }
  • branches/eam_branches/ipp-20111122/Ohana/src/relastro/src/load_catalogs.c

    r33565 r33568  
    22
    33Catalog *load_catalogs_parallel (SkyList *sky, int *Ncatalog);
     4void bcatalog_show_skips ();
    45
    56Catalog *load_catalogs (SkyList *skylist, int *Ncatalog, int subselect, int hostID, char *hostpath) {
     
    8384  }
    8485
     86  // XXX TEST : bcatalog_show_skips();
     87
    8588  Nstar = 0;
    8689  for (i = 0; i < Ncat; i++) {
     
    139142
    140143    char command[1024];
    141     snprintf (command, 1024, "relastro_client -load-objects %s -hostID %d -D CATDIR %s -hostdir %s -region %f %f %f %f -statmode %s -minerror %f",
    142               table->hosts[i].results, table->hosts[i].hostID, CATDIR, table->hosts[i].pathname, UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax, STATMODE, MIN_ERROR);
     144    snprintf (command, 1024, "relastro_client -load-objects %s -hostID %d -D CATDIR %s -hostdir %s -region %f %f %f %f -statmode %s -minerror %f -D RELASTRO_SIGMA_LIM %f",
     145              table->hosts[i].results, table->hosts[i].hostID, CATDIR, table->hosts[i].pathname, UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax, STATMODE, MIN_ERROR, SIGMA_LIM);
    143146
    144147    char tmpline[1024];
  • branches/eam_branches/ipp-20111122/Ohana/src/relastro/src/select_images.c

    r33485 r33568  
    196196    if (RmaxImage < RminSkyRegion) continue;
    197197
     198    if (!strncmp(timage[i].name, "o5903g0638o", 10) && (timage[i].photcode == 10355)) {
     199      fprintf (stderr, "test image\n");
     200    }
     201
     202    // require that the full image be inside the region of interest (only for non PHU
     203    // images) XXX : if we calibrate the mosaic, require that the full mosaic be inside
     204    // the region and all of its chips..
     205# define FULL_OVERLAP 1
     206    if (FULL_OVERLAP && strcmp(&timage[i].coords.ctype[4], "-DIS")) {
     207      if (RmaxImage > UserPatch.Rmax) continue;
     208      if (RminImage < UserPatch.Rmin) continue;
     209      if (DmaxImage > UserPatch.Dmax) continue;
     210      if (DminImage < UserPatch.Dmin) continue;
     211    }
     212
    198213    // image overlaps region, keep it
    199214    if (USE_BASIC_CHECK) goto found_it;
Note: See TracChangeset for help on using the changeset viewer.