IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 38433


Ignore:
Timestamp:
Jun 11, 2015, 4:42:16 AM (11 years ago)
Author:
eugene
Message:

change from -synthphot_zpts to -synthphot-zpts for consistency; do not exit on failure to read a catalog: report and move on; do not include measurements with nan error in the mean mag,flux; pad errors with the systematic error to avoid crazy weighing; deactivate the warp & stack flags if not explictly set; choose the primary stack measurement as best as long as psfqfperf > 0.98 (otherwise, use max psfqfperf)

Location:
branches/eam_branches/ipp-20150419/Ohana/src/relphot/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20150419/Ohana/src/relphot/src/args.c

    r38317 r38433  
    375375  }
    376376
    377   // if -synthphot_zpts is supplied, the map of corrections needed for the synthetic photometry is supplied
     377  // if -synthphot-zpts is supplied, the map of corrections needed for the synthetic photometry is supplied
    378378  // and used to tie down the synthetic magnitudes
    379   // NOTE: SYNTH_ZERO_POINTS is used for the same file in both -synthphot_zpts and -synthphot_means
     379  // NOTE: SYNTH_ZERO_POINTS is used for the same file in both -synthphot-zpts and -synthphot_means
    380380  SYNTH_ZERO_POINTS = NULL;
    381   if ((N = get_argument (argc, argv, "-synthphot_zpts"))) {
    382     remove_argument (N, &argc, argv);
    383     myAssert (N < argc, "missing argument to -synthphot_zpts");
     381  if ((N = get_argument (argc, argv, "-synthphot-zpts"))) {
     382    remove_argument (N, &argc, argv);
     383    myAssert (N < argc, "missing argument to -synthphot-zpts");
    384384    SYNTH_ZERO_POINTS = strcreate (argv[N]);
    385385    remove_argument (N, &argc, argv);
     
    495495  }
    496496  SYNTH_ZERO_POINTS = NULL;
    497   if ((N = get_argument (argc, argv, "-synthphot_zpts"))) {
    498     remove_argument (N, &argc, argv);
    499     myAssert (N < argc, "missing argument to -synthphot_zpts");
     497  if ((N = get_argument (argc, argv, "-synthphot-zpts"))) {
     498    remove_argument (N, &argc, argv);
     499    myAssert (N < argc, "missing argument to -synthphot-zpts");
    500500    SYNTH_ZERO_POINTS = strcreate (argv[N]);
    501501    remove_argument (N, &argc, argv);
  • branches/eam_branches/ipp-20150419/Ohana/src/relphot/src/reload_catalogs.c

    r38317 r38433  
    6565
    6666    if (!dvo_catalog_open (&catalog, skylist[0].regions[i], VERBOSE, "w")) {
    67       fprintf (stderr, "ERROR: failure reading catalog %s\n", catalog.filename);
    68       exit (1);
     67      fprintf (stderr, "ERROR: failure reading catalog %s, skipping\n", catalog.filename);
     68      continue;
     69      // exit (1);
    6970    }
    7071    if (VERBOSE && (catalog.Naves_disk == 0)) {
  • branches/eam_branches/ipp-20150419/Ohana/src/relphot/src/setMrelCatalog.c

    r38432 r38433  
    1212    continue; }
    1313
    14 # define CHECK_VALID_MAG(MAG) (!isnan(MAG) && (MAG > -5.0) && (MAG < 30.0))
    15 # define CHECK_VALID_FLUX(FLUX) (!isnan(FLUX))
     14# define CHECK_VALID_MAG(MAG,D_MAG) (isfinite(MAG) && isfinite(D_MAG) && (MAG > -5.0) && (MAG < 30.0))
     15# define CHECK_VALID_FLUX(FLUX,D_FLUX) (isfinite(FLUX) && isfinite(D_FLUX))
    1616
    1717static float MagToFlux (float Mag) {
     
    126126  // assign measurements to the photcode lists
    127127  for (k = 0; k < averageT[0].Nmeasure; k++) {
     128
     129    // these bits should not be set unless we use them in this pass
     130    measure[k].dbFlags &= ~(ID_MEAS_PHOTOM_PSF | ID_MEAS_PHOTOM_APER | ID_MEAS_PHOTOM_KRON);
    128131
    129132    // skip measurements that do not have a valid photcode (raise exception?)
     
    214217      Map = PhotCat (&measure[k], MAG_CLASS_APER);
    215218      dMap = MAX (hypot(measure[k].dMap,   code->photomErrSys), MIN_ERROR);
    216       if (CHECK_VALID_MAG(Map)) {
     219      if (CHECK_VALID_MAG(Map, dMap)) {
    217220        int Nap = results->aperData[Nsec].Nlist;
    218221        results->aperData[Nsec].flxlist[Nap] = Map - Mcal - Mmos - Mgrid;
     
    229232      Mkron = PhotCat (&measure[k], MAG_CLASS_KRON);
    230233      dMkron = MAX (hypot(measure[k].dMkron, code->photomErrSys), MIN_ERROR);
    231       if (CHECK_VALID_MAG(Mkron)) {
     234      if (CHECK_VALID_MAG(Mkron, dMkron)) {
    232235        int Nkron = results->kronData[Nsec].Nlist;
    233236        results->kronData[Nsec].flxlist[Nkron] = Mkron - Mcal - Mmos - Mgrid;
     
    242245    float Mpsf = PhotSysTiny (&measureT[k], &averageT[0], &secfilt[0], MAG_CLASS_PSF);
    243246    float dMpsf  = MAX (hypot(measureT[k].dM, code->photomErrSys), MIN_ERROR);
    244     if (CHECK_VALID_MAG(Mpsf)) {
     247    if (CHECK_VALID_MAG(Mpsf, dMpsf)) {
    245248      int Npsf = results->psfData[Nsec].Nlist;
    246249      results->psfData[Nsec].flxlist[Npsf] = Mpsf - Mcal - Mmos - Mgrid;
     
    338341
    339342    if (isSetMrelFinal) {
    340       if ((average->objID == 0x1) && (average->catID)) {
     343      if (FALSE && (average->objID == 0x1) && (average->catID)) {
    341344        fprintf (stderr, "test obj\n");
    342345      }
     
    555558      if (isnan(Finst)) SKIP_THIS_MEAS_STACK(Ninst);
    556559
     560      // choose the best psfQFperf value for the BEST measurement
    557561      if (measure[k].psfQFperf > psfQFbest) {
    558562        psfQFbest = measure[k].psfQFperf;
     563        stackBestMeasure = k;
     564      }
     565      // ... UNLESS psfQFperf > 0.98 for the primary, in which case just use the primary.
     566      if ((measure[k].dbFlags & ID_MEAS_STACK_PRIMARY) && (measure[k].psfQFperf > 0.98)) {
    559567        stackBestMeasure = k;
    560568      }
     
    678686  float Mcal = 0;
    679687
     688  SetMrelInfoResetObject (results); // reset the per-object arrays
     689
    680690  // option for a test print
    681   if ((average[0].objID == 0xd6e) && (average[0].catID == 0x4984)) {
     691  if (FALSE && (average[0].objID == 0x0000020d) && (average[0].catID == 0x000049e1)) {
    682692    fprintf (stderr, "test obj\n");
    683693    print_measure_set_alt (average, secfilt, measure);
     
    704714    off_t meas = measureOffset + k;
    705715
     716    measure[k].dbFlags &= ~ID_MEAS_WARP_USED; // this should not be set unless we use it in this pass
     717
    706718    // skip measurements that do not have a valid photcode (raise exception?)
    707719    PhotCode *code = GetPhotcodebyCode (measure[k].photcode);
     
    717729    results->Nmeas[Nsec] ++;
    718730    if (measure[k].psfQFperf > 0.85) results->NmeasGood[Nsec] ++;
    719 
    720     measure[k].dbFlags &= ~ID_MEAS_WARP_USED;
    721731
    722732    // use primary skycell for DIFF, stack skycell for WARP
     
    749759    float Fpsf = PhotFluxCat (&measure[k], MAG_CLASS_PSF);
    750760    float dFpsf = PhotFluxCatErr (&measure[k], MAG_CLASS_PSF);
    751     if (CHECK_VALID_FLUX(Fpsf)) {
     761    if (CHECK_VALID_FLUX(Fpsf, dFpsf)) {
     762      dFpsf = MAX (hypot(dFpsf, code->photomErrSys*Fpsf), MIN_ERROR*Fpsf); // bump up the error by a systematic floor
    752763      int Npsf = results->psfData[Nsec].Nlist;
    753764      results->psfData[Nsec].flxlist[Npsf] = Fpsf * Fcal;
     
    761772    float Fap = PhotFluxCat (&measure[k], MAG_CLASS_APER);
    762773    float dFap = PhotFluxCatErr (&measure[k], MAG_CLASS_APER);
    763     if (CHECK_VALID_FLUX(Fap)) {
     774    if (CHECK_VALID_FLUX(Fap, dFap)) {
     775      dFap = MAX (hypot(dFap, code->photomErrSys*Fap), MIN_ERROR*Fap); // bump up the error by a systematic floor
    764776      int Naper = results->aperData[Nsec].Nlist;
    765777      results->aperData[Nsec].flxlist[Naper] = Fap * Fcal;
     
    773785    float Fkron = PhotFluxCat (&measure[k], MAG_CLASS_KRON);
    774786    float dFkron = PhotFluxCatErr (&measure[k], MAG_CLASS_KRON);
    775     if (CHECK_VALID_FLUX(Fkron)) {
     787    if (CHECK_VALID_FLUX(Fkron, dFkron)) {
     788      dFkron = MAX (hypot(dFkron, code->photomErrSys*Fkron), MIN_ERROR*Fkron); // bump up the error by a systematic floor
    776789      int Nkron = results->kronData[Nsec].Nlist;
    777790      results->kronData[Nsec].flxlist[Nkron] = Fkron * Fcal;
  • branches/eam_branches/ipp-20150419/Ohana/src/relphot/src/setMrelFinal.c

    r38317 r38433  
    329329
    330330    // RANK 2 : psfQF value
    331     if (measure[i].psfQF < 0.85)                    { measureRank[i] = 4; continue; }
     331    if (!isfinite(measure[i].psfQF) || measure[i].psfQF < 0.85) { measureRank[i] = 4; continue; }
    332332       
    333333    // RANK 1 : POOR photFlags
     
    338338   
    339339    // RANK 1 : psfQFperfect value
    340     if (measure[i].psfQFperf < 0.85)                { measureRank[i] = 1; continue; }
     340    if (!isfinite(measure[i].psfQFperf) || measure[i].psfQFperf < 0.85) { measureRank[i] = 1; continue; }
    341341       
    342342    // RANK 0 : perfect measurement:
Note: See TracChangeset for help on using the changeset viewer.