IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 30554


Ignore:
Timestamp:
Feb 10, 2011, 10:39:48 AM (15 years ago)
Author:
eugene
Message:

speed up image selection; add dMsys, nFitPhotom info; plug a leak

Location:
branches/eam_branches/ipp-20101205/Ohana/src/relphot
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20101205/Ohana/src/relphot/include/relphot.h

    r30443 r30554  
    1313  float Mcal;
    1414  float dMcal;
     15  float dMsys;
     16  short nFitPhotom;
    1517  short Xm;
    1618  float secz;
     
    5052double STAR_CHISQ;
    5153double MIN_ERROR;
     54double IMFIT_SYS_SIGMA_LIM;
    5255
    5356int    VERBOSE;
     
    103106SkyRegion UserPatch;
    104107int UserPatchSelect;
     108
     109int USE_BASIC_CHECK;
    105110
    106111# ifdef GRID_V1
  • branches/eam_branches/ipp-20101205/Ohana/src/relphot/src/ConfigInit.c

    r25757 r30554  
    2020  GetConfig (config, "MAG_LIM",                "%lf", 0, &MAG_LIM);
    2121  GetConfig (config, "SIGMA_LIM",              "%lf", 0, &SIGMA_LIM);
     22
     23  if (!ScanConfig (config, "RELPHOT_IMFIT_SYS_SIGMA_LIM", "%lf", 0, &IMFIT_SYS_SIGMA_LIM)) IMFIT_SYS_SIGMA_LIM = 0.01;
     24
    2225  GetConfig (config, "STAR_SCATTER",           "%lf", 0, &STAR_SCATTER);
    2326  GetConfig (config, "IMAGE_SCATTER",          "%lf", 0, &IMAGE_SCATTER);
  • branches/eam_branches/ipp-20101205/Ohana/src/relphot/src/ImageOps.c

    r29001 r30554  
    124124  free (clist);
    125125  free (mlist);
     126  free (Nlist);
     127  free (NLIST);
    126128}
    127129
     
    299301
    300302  off_t i, j, m, c, n, N, Nmax, mark, bad;
    301   int Nfew, Nbad, Nmos, Ngrid, Nrel, Nsys;
    302   float Msys, Mrel, Mmos, Mgrid;
     303  int Nfew, Nbad, Nmos, Ngrid, Nrel, Nsys, Nbright;
     304  float Msys, Mrel, Mmos, Mgrid, McalBright, McalBright2;
    303305  double *list, *dlist;
    304306  StatType stats;
     
    318320
    319321  Nfew = Nbad = Nmos = Ngrid = Nrel = Nsys = 0;
     322
     323  // counters to measure the bright-end scatter
     324  McalBright = McalBright2 = 0.0;
     325  Nbright = 0;
    320326
    321327  for (i = 0; i < Nimage; i++) {
     
    361367      list[N] = Msys - Mrel - Mmos - Mgrid;
    362368      dlist[N] = MAX (catalog[c].measure[m].dM, MIN_ERROR);
     369      if (catalog[c].measure[m].dM < IMFIT_SYS_SIGMA_LIM) {
     370        McalBright += list[N];
     371        McalBright2 += SQ(list[N]);
     372        Nbright ++;
     373      }
    363374      N++;
    364375    }
     
    378389    liststats (list, dlist, N, &stats);
    379390    image[i].Mcal  = stats.mean;
    380     image[i].dMcal = stats.sigma;
     391    image[i].dMcal = stats.error;
     392    image[i].dMagSys = stats.sigma;
     393    image[i].nFitPhotom = N;
    381394    image[i].Xm    = 100.0*log10(stats.chisq);
    382395  }
  • branches/eam_branches/ipp-20101205/Ohana/src/relphot/src/MosaicOps.c

    r30443 r30554  
    7373    mosaic[Nmosaic].Mcal  = 0.0;
    7474    mosaic[Nmosaic].dMcal = 0.0;
     75    mosaic[Nmosaic].dMsys = 0.0;
    7576    mosaic[Nmosaic].Xm    = 0.0;
    7677    mosaic[Nmosaic].flags  = image[i].flags;
     
    189190      image[im].dMcal = mosaic[i].dMcal;
    190191      image[im].Xm = mosaic[i].Xm;
     192      image[im].dMagSys = mosaic[i].dMsys;
     193      image[im].nFitPhotom = mosaic[i].nFitPhotom;
    191194      image[im].flags |= (mosaic[i].flags & ID_IMAGE_PHOTOM_FEW);
    192195      image[im].flags |= (mosaic[i].flags & ID_IMAGE_PHOTOM_POOR);
     
    410413    if (PoorImages) fprintf (stderr, "Mmos: %f %f %d "OFF_T_FMT"\n", stats.mean, stats.sigma, stats.Nmeas,  N);
    411414    mosaic[i].Mcal  = stats.mean;
    412     mosaic[i].dMcal = stats.sigma;
     415    mosaic[i].dMcal = stats.error;
     416    mosaic[i].dMsys = stats.sigma;
     417    mosaic[i].nFitPhotom = N;
    413418    mosaic[i].Xm    = 100.0*log10(stats.chisq);
    414419  }
  • branches/eam_branches/ipp-20101205/Ohana/src/relphot/src/args.c

    r30443 r30554  
    5252  }
    5353
     54  USE_BASIC_CHECK = FALSE;
     55  if ((N = get_argument (argc, argv, "-basic-image-search"))) {
     56    remove_argument (N, &argc, argv);
     57    USE_BASIC_CHECK = TRUE;
     58  }
     59
    5460  VERBOSE = VERBOSE2 = FALSE;
    5561  if ((N = get_argument (argc, argv, "-v"))) {
  • branches/eam_branches/ipp-20101205/Ohana/src/relphot/src/select_images.c

    r30503 r30554  
    3333  struct timeval start, stop;
    3434 
    35   double RmaxSkyRegion, RminSkyRegion, DminSkyRegion, DmaxSkyRegion;
     35  double RmaxSkyRegion, RminSkyRegion, DminSkyRegion, DmaxSkyRegion, RmidSkyRegion;
    3636
    3737  double *RmaxSky;
     
    9797    DmaxSkyRegion = MAX(DmaxSkyRegion, skylist[0].regions[i][0].Dmax);
    9898  }
     99  RmidSkyRegion = 0.5*(RminSkyRegion + RmaxSkyRegion);
    99100  MARKTIME("create sky region coords: %f sec\n", dtime);
    100101
     
    145146    for (j = 0; j < 5; j++) {
    146147      XY_to_RD (&Ri[j], &Di[j], Xi[j], Yi[j], &timage[i].coords);
     148      Ri[j] = ohana_normalize_angle_to_midpoint (Ri[j], RmidSkyRegion);
     149     
    147150      RminImage = MIN(RminImage, Ri[j]);
    148151      RmaxImage = MAX(RmaxImage, Ri[j]);
     
    164167    if (RmaxImage < RminSkyRegion) continue;
    165168
     169    // image overlaps region, keep it
     170    if (USE_BASIC_CHECK) goto found_it;
     171
    166172    // RA(nStart) is guaranteed to be < RminImage: -- costs 0.5sec for 3M images
    167173    nStart = getRegionStartByRA (RminImage, RmaxSky, skylist[0].Nregions);
     
    186192      for (j = 0; (j < 4) && !found; j++) {
    187193        found = corner_check (&Xi[j], &Yi[j], &skycoords[m].Xc[0], &skycoords[m].Yc[0]);
     194        if (found) goto found_it;
    188195      }
    189196      /* check if catalog corner inside image */
    190197      for (j = 0; (j < 4) && !found; j++) {
    191198        found = corner_check (&skycoords[m].Xc[j], &skycoords[m].Yc[j], &Xi[0], &Yi[0]);
     199        if (found) goto found_it;
    192200      }
    193201      /* check if edges cross */
     
    195203        for (k = 0; (k < 4) && !found; k++) {
    196204          found = edge_check (&Xi[j], &Yi[j], &skycoords[m].Xc[k], &skycoords[m].Yc[k]);
     205          if (found) goto found_it;
    197206        }
    198207      }
    199       if (!found) continue;
    200 
    201       image[nimage] = timage[i];
    202       /* always allow 'few' images to succeed, if possible */
    203       if (image[nimage].flags & ID_IMAGE_PHOTOM_FEW) {
    204         image[nimage].flags &= ~(ID_IMAGE_PHOTOM_FEW | ID_IMAGE_PHOTOM_POOR);
    205       }
    206       if (RESET) {
    207         // XXX assignMcal (&image[nimage], (double *) NULL, -1);
    208         // XXX this needs to be thought through a bit more
    209         image[nimage].Mcal = 0.0;
    210         image[nimage].dMcal = NAN;
    211         image[nimage].flags &= ~ID_IMAGE_PHOTOM_POOR;
    212       }
    213       line_number[nimage] = i;
    214       nimage ++;
    215       if (nimage == NIMAGE) {
    216         NIMAGE += 100;
    217         REALLOCATE (image, Image, NIMAGE);
    218         REALLOCATE (line_number, off_t, NIMAGE);
    219       }
     208    }
     209    if (!found) continue;
     210
     211  found_it:
     212    image[nimage] = timage[i];
     213    /* always allow 'few' images to succeed, if possible */
     214    if (image[nimage].flags & ID_IMAGE_PHOTOM_FEW) {
     215      image[nimage].flags &= ~(ID_IMAGE_PHOTOM_FEW | ID_IMAGE_PHOTOM_POOR);
     216    }
     217    if (RESET) {
     218      // XXX assignMcal (&image[nimage], (double *) NULL, -1);
     219      // XXX this needs to be thought through a bit more
     220      image[nimage].Mcal = 0.0;
     221      image[nimage].dMcal = NAN;
     222      image[nimage].flags &= ~ID_IMAGE_PHOTOM_POOR;
     223    }
     224    line_number[nimage] = i;
     225    nimage ++;
     226    if (nimage == NIMAGE) {
     227      NIMAGE += 100;
     228      REALLOCATE (image, Image, NIMAGE);
     229      REALLOCATE (line_number, off_t, NIMAGE);
    220230    }
    221231  }
Note: See TracChangeset for help on using the changeset viewer.