IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 39747


Ignore:
Timestamp:
Oct 11, 2016, 8:40:34 AM (10 years ago)
Author:
eugene
Message:

add USE_IRLS

Location:
branches/czw_branch/20160809/Ohana/src/relastro
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/czw_branch/20160809/Ohana/src/relastro/include/relastro.h

    r39746 r39747  
    453453
    454454FitMode FIT_MODE;
     455int USE_IRLS;
     456int ALLOW_IRLS;
    455457
    456458RelastroOp RELASTRO_OP;
  • branches/czw_branch/20160809/Ohana/src/relastro/src/BootstrapOps.c

    r39457 r39747  
    7777    case FIT_RESULT_RA:
    7878      // result->Ro = median;
    79       result->dRo = sigma;
     79      result->dRo = MAX(sigma, result->dRo);
    8080      break;
    8181    case FIT_RESULT_DEC:
    8282      // result->Do = median;
    83       result->dDo = sigma;
     83      result->dDo = MAX(sigma, result->dDo);
    8484      break;
    8585    case FIT_RESULT_uR:
    8686      // result->uR = median;
    87       result->duR = sigma;
     87      result->duR = MAX(sigma, result->duR);
    8888      break;
    8989    case FIT_RESULT_uD:
    9090      // result->uD = median;
    91       result->duD = sigma;
     91      result->duD = MAX(sigma, result->duD);
    9292      break;
    9393    case FIT_RESULT_PLX:
    9494      // result->p = median;
    95       result->dp = sigma;
     95      result->dp = MAX(sigma, result->dp);
    9696      break;
    9797    default:
  • branches/czw_branch/20160809/Ohana/src/relastro/src/UpdateObjects.c

    r39735 r39747  
    200200    // then run N_BOOTSTRAP_SAMPLES to measure the errors
    201201    fitStats->fitdataPar->getError = !N_BOOTSTRAP_SAMPLES;
    202     if (!FitPMandPar_IRLS (&fitPar, fitStats->fitdataPar, fitStats->points, fitStats->Npoints)) {
    203       mode = FIT_PM_ONLY;
    204       goto skipParallax;
    205     }
    206 
    207     if (N_BOOTSTRAP_SAMPLES) {
     202    if (USE_IRLS) {
     203      if (!FitPMandPar_IRLS (&fitPar, fitStats->fitdataPar, fitStats->points, fitStats->Npoints)) {
     204        mode = FIT_PM_ONLY;
     205        goto skipParallax;
     206      }
     207    } else {
     208      if (!FitPMandPar_Basic (&fitPar, fitStats->fitdataPar, fitStats->points, fitStats->Npoints)) {
     209        mode = FIT_PM_ONLY;
     210        goto skipParallax;
     211      }
     212    }
     213
     214    // in the fits above, we have saved the formal error for the unmasked points. 
     215    // if we do not have enough points for bootstrap, we will keep those errors
     216    if (N_BOOTSTRAP_SAMPLES && (fitPar.Nfit >= PAR_MIN_NPTS_BOOT)) {
    208217      fitStats->Nfit = 0;
    209218      int Nnomask = BootstrapSaveUnmasked (fitStats->nomask, fitStats->points, fitStats->Npoints);
     
    218227        fitStats->Nfit ++;
    219228      }
    220       // these calls set the ERRORS on the fit parameters, not the fit values (set in IRLS above)
     229      // These calls set the ERRORS on the fit parameters, not the fit values (set in IRLS above)
     230      // this call expects the fitted parameters to have the formal error set: it will apply the
     231      // max of the formal and bootstrap errors
    221232      BootstrapRobustStats (&fitPar, fitStats->fit, fitStats->Nfit, FIT_RESULT_RA);
    222233      BootstrapRobustStats (&fitPar, fitStats->fit, fitStats->Nfit, FIT_RESULT_DEC);
     
    273284    } else {
    274285      fitStats->fitdataPM->getError = !N_BOOTSTRAP_SAMPLES;
    275       if (!FitPM_IRLS (&fitPM, fitStats->fitdataPM, fitStats->points, fitStats->Npoints)) {
    276         mode = FIT_AVERAGE;
    277         goto justPosition;
    278       }
    279       if (N_BOOTSTRAP_SAMPLES) {
     286      if (USE_IRLS) {
     287        if (!FitPM_IRLS (&fitPM, fitStats->fitdataPM, fitStats->points, fitStats->Npoints)) {
     288          mode = FIT_AVERAGE;
     289          goto justPosition;
     290        }
     291      } else {
     292        if (!FitPM_Basic (&fitPM, fitStats->fitdataPM, fitStats->points, fitStats->Npoints)) {
     293          mode = FIT_AVERAGE;
     294          goto justPosition;
     295        }
     296      }
     297
     298    // in the fits above, we have saved the formal error for the unmasked points. 
     299    // if we do not have enough points for bootstrap, we will keep those errors
     300      if (N_BOOTSTRAP_SAMPLES && (fitPM.Nfit >= PM_MIN_NPTS_BOOT)) {
    280301        fitStats->Nfit = 0;
    281302        int Nnomask = BootstrapSaveUnmasked (fitStats->nomask, fitStats->points, fitStats->Npoints);
     
    289310          fitStats->Nfit ++;
    290311        }
     312      // These calls set the ERRORS on the fit parameters, not the fit values (set in IRLS above)
     313      // this call expects the fitted parameters to have the formal error set: it will apply the
     314      // max of the formal and bootstrap errors
    291315        BootstrapRobustStats (&fitPM, fitStats->fit, fitStats->Nfit, FIT_RESULT_RA);
    292316        BootstrapRobustStats (&fitPM, fitStats->fit, fitStats->Nfit, FIT_RESULT_DEC);
     
    343367        goto useBasic;
    344368      }
    345       if (!FitPosPMfixed_IRLS (&fitPos, fitStats->fitdataPos, fitStats->points, fitStats->Npoints)) {
    346         // if the above fails, we need to clear the masks and try again below
    347         FitPointsClearMasks (fitStats->points, fitStats->Npoints);
    348         // just calculate the weighted average
     369      if (USE_IRLS) {
     370        if (!FitPosPMfixed_IRLS (&fitPos, fitStats->fitdataPos, fitStats->points, fitStats->Npoints)) {
     371          // if the above fails, we need to clear the masks and try again below
     372          FitPointsClearMasks (fitStats->points, fitStats->Npoints);
     373          // just calculate the weighted average
     374          if (!FitPosPMfixed_Basic (&fitPos, fitStats->fitdataPos, fitStats->points, fitStats->Npoints)) {
     375            // if this fails, find a single unmasked point below
     376            goto doneWithFit;
     377          }
     378          average[0].flags |= ID_OBJ_USE_AVE;
     379          average[0].flags |= ID_OBJ_RAW_AVE;
     380          goto useBasic;
     381        }
     382      } else {
    349383        if (!FitPosPMfixed_Basic (&fitPos, fitStats->fitdataPos, fitStats->points, fitStats->Npoints)) {
    350384          // if this fails, find a single unmasked point below
     
    360394        int Nnomask = BootstrapSaveUnmasked (fitStats->nomask, fitStats->points, fitStats->Npoints);
    361395        if (Nnomask < POS_MIN_NPTS_BOOT) {
    362           // if the above fails, we need to clear the masks and try again below
     396          // XXX if the above fails, accept the formal error from unmasked points?
    363397          FitPointsClearMasks (fitStats->points, fitStats->Npoints);
    364398          if (!FitPosPMfixed_Basic (&fitPos, fitStats->fitdataPos, fitStats->points, fitStats->Npoints)) {
  • branches/czw_branch/20160809/Ohana/src/relastro/src/args.c

    r39746 r39747  
    176176      exit (2);
    177177    }
     178  }
     179
     180  // for fitting objects, this is always the same as 'ALLOW_IRLS' below, but for fitting
     181  // images, this is set to FALSE while doing the fit for the image parameters
     182  USE_IRLS = TRUE; 
     183  ALLOW_IRLS = TRUE;
     184  if ((N = get_argument (argc, argv, "-no-irls"))) {
     185    remove_argument (N, &argc, argv);
     186    USE_IRLS = FALSE;
     187    ALLOW_IRLS = FALSE;
    178188  }
    179189
  • branches/czw_branch/20160809/Ohana/src/relastro/src/relastro_images.c

    r39738 r39747  
    6464
    6565  // XXX NOTE : for 2mass reset, photcodesKeep should now limit to 2MASS measurements
     66
     67  USE_IRLS = FALSE;  // do not use IRLS yet -- leads to excessive outlier rejections in the loops
    6668
    6769  /* major modes */
     
    161163  // iterate over catalogs to make detection coordinates consistant
    162164  if (APPLY_OFFSETS) {
     165    USE_IRLS = ALLOW_IRLS;  // now that we have fitted the images, choose the user's option
    163166    UpdateObjectOffsets (skylist, 0, NULL);
    164167  }
Note: See TracChangeset for help on using the changeset viewer.