IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 3, 2013, 2:43:13 PM (13 years ago)
Author:
eugene
Message:

thread psphotModelBackground, psphotAddOrSubNoise, psphotGuessModel; add recipe options to control selection of extended models fitted; iterate on the trail window a bit

Location:
trunk/psphot
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/psphot

  • trunk/psphot/src

  • trunk/psphot/src/psphotModelTestReadout.c

    r35559 r35769  
    161161    // get the initial model parameter guess
    162162    pmModel *model = pmSourceModelGuess (source, modelType, maskVal, markVal);
     163    if (!model) {
     164      fprintf (stderr, "failed to generate model guess\n");
     165      exit (2);
     166    }
     167
    163168    source->modelEXT = model;
    164169
     
    186191        fprintf (stderr, "guess: %f @ (%f, %f)\n", params[6]*180/M_PI, params[4], params[5]);
    187192    } else {
    188         // list model input shape
    189         psEllipseShape shape;
    190         shape.sx  = 1.4 / model->params->data.F32[4];
    191         shape.sy  = 1.4 / model->params->data.F32[5];
    192         shape.sxy = model->params->data.F32[6];
    193         axes = psEllipseShapeToAxes (shape, 20.0);
    194         fprintf (stderr, "guess: %f @ (%f, %f)\n", axes.theta*180/M_PI, axes.major, axes.minor);
     193        bool useReff = pmModelUseReff (modelType);
     194        pmModelParamsToAxes (&axes, params[PM_PAR_SXX], params[PM_PAR_SXY], params[PM_PAR_SYY], useReff);
     195        fprintf (stderr, "guess: %f @ (%f, %f) : %f\n", axes.theta*180/M_PI, axes.major, axes.minor, params[PM_PAR_SXY]);
    195196    }
    196197
     
    217218    fitOptions->covarFactor   = psImageCovarianceFactorForAperture(readout->covariance, 10.0); // Covariance matrix
    218219
     220    bool chisqConvergence = psMetadataLookupBool (&status, recipe, "LMM_FIT_CHISQ_CONVERGENCE"); // Fit tolerance
     221    if (!status) chisqConvergence = true;
     222    fitOptions->chisqConvergence = chisqConvergence;
     223
     224    int gainFactorMode = psMetadataLookupS32 (&status, recipe, "LMM_FIT_GAIN_FACTOR_MODE"); // Fit tolerance
     225    if (!status) gainFactorMode = 0;
     226    fitOptions->gainFactorMode = gainFactorMode;
     227
    219228    if (modelType == pmModelClassGetType("PS_MODEL_SERSIC")) {
    220229        fitOptions->mode = PM_SOURCE_FIT_NO_INDEX;
     
    231240        pmSourceModelGuessPCM (pcm, source, maskVal, markVal);
    232241      }
     242
     243      // if we provide a test guess value we want to use that value!
     244      for (int i = 0; i < nParams; i++) {
     245          if (i == PM_PAR_XPOS) continue;
     246          if (i == PM_PAR_YPOS) continue;
     247
     248          char name[32];
     249          sprintf (name, "TEST_FIT_PAR%d", i);
     250          float value = psMetadataLookupF32 (&status, recipe, name);
     251          if (status && isfinite (value)) {
     252              params[i] = value;
     253          }
     254      }
     255
    233256      pmPCMupdate(pcm, source, fitOptions, model);
    234257      pmSourceFitPCM (pcm, source, fitOptions, maskVal, markVal, psfSize);
     
    258281    }
    259282
     283    if (modelType == pmModelClassGetType("PS_MODEL_TRAIL")) {
     284        fprintf (stderr, "result: %f @ (%f, %f)\n", params[6]*180/M_PI, params[4], params[5]);
     285    } else {
     286        bool useReff = pmModelUseReff (modelType);
     287        pmModelParamsToAxes (&axes, params[PM_PAR_SXX], params[PM_PAR_SXY], params[PM_PAR_SYY], useReff);
     288        fprintf (stderr, "result: %f @ (%f, %f) : %f\n", axes.theta*180/M_PI, axes.major, axes.minor, params[PM_PAR_SXY]);
     289    }
     290
    260291    // write out
    261292    psphotSaveImage (NULL, source->pixels, "resid.fits");
Note: See TracChangeset for help on using the changeset viewer.