IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 35972


Ignore:
Timestamp:
Aug 19, 2013, 6:45:18 AM (13 years ago)
Author:
eugene
Message:

add an interactive mode to extended source fits; allow sky to be fitted for ext models

Location:
branches/eam_branches/ipp-20130711/psphot/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20130711/psphot/src/psphotExtendedSourceFits.c

    r35844 r35972  
    6565    psphotVisualShowImage(readout);
    6666
     67    // psphotSaveImage (NULL, readout->image, "test.01.fits");
     68
    6769    pmDetections *detections = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.DETECTIONS");
    6870    psAssert (detections, "missing detections?");
     
    123125    }
    124126
     127    // perform full extended source non-linear fits?
     128    bool isInteractive = psMetadataLookupBool (&status, recipe, "EXTENDED_SOURCE_FITS_INTERACTIVE");
     129    if (!status) isInteractive = false;
     130
    125131    // Define source fitting parameters for extended source fits
    126132    pmSourceFitOptions *fitOptions = pmSourceFitOptionsAlloc();
    127     fitOptions->mode           = PM_SOURCE_FIT_EXT;
     133    fitOptions->mode           = PM_SOURCE_FIT_EXT_AND_SKY;
    128134    fitOptions->saveCovariance = true;  // XXX make this a user option?
    129135    fitOptions->covarFactor    = psImageCovarianceFactorForAperture(readout->covariance, 10.0); // Covariance matrix
     
    134140    fitOptions->gainFactorMode   = gainFactorMode;
    135141    fitOptions->chisqConvergence = chisqConvergence;
     142    fitOptions->isInteractive    = isInteractive;
    136143
    137144    // maskVal is used to test for rejected pixels, and must include markVal
     
    296303            PS_ARRAY_ADD_SCALAR(job->args, 0, PS_TYPE_S32); // this is used as a return value for Nfail
    297304
    298 // set this to 0 to run without threading
    299 # if (1)           
    300             if (!psThreadJobAddPending(job)) {
    301                 psError(PS_ERR_UNKNOWN, false, "Unable to guess model.");
    302                 psFree(AnalysisRegion);
    303                 psFree (fitOptions);
    304                 psFree (models);
    305                 psphotSersicModelClassCleanup();
    306                 return false;
    307             }
    308 # else
    309             if (!psphotExtendedSourceFits_Threaded(job)) {
    310                 psError(PS_ERR_UNKNOWN, false, "Unable to guess model.");
    311                 psFree(AnalysisRegion);
    312                 psFree (fitOptions);
    313                 psFree (models);
    314                 psphotSersicModelClassCleanup();
    315                 return false;
     305            if (!isInteractive) {
     306                if (!psThreadJobAddPending(job)) {
     307                    psError(PS_ERR_UNKNOWN, false, "Unable to guess model.");
     308                    psFree(AnalysisRegion);
     309                    psFree (fitOptions);
     310                    psFree (models);
     311                    psphotSersicModelClassCleanup();
     312                    return false;
     313                }
     314            } else {
     315                // run without threading
     316                if (!psphotExtendedSourceFits_Threaded(job)) {
     317                    psError(PS_ERR_UNKNOWN, false, "Unable to guess model.");
     318                    psFree(AnalysisRegion);
     319                    psFree (fitOptions);
     320                    psFree (models);
     321                    psphotSersicModelClassCleanup();
     322                    return false;
     323                }
     324                psScalar *scalar = NULL;
     325                scalar = job->args->data[9];
     326                Next += scalar->data.S32;
     327                scalar = job->args->data[10];
     328                Nconvolve += scalar->data.S32;
     329                scalar = job->args->data[11];
     330                NconvolvePass += scalar->data.S32;
     331                scalar = job->args->data[12];
     332                Nplain += scalar->data.S32;
     333                scalar = job->args->data[13];
     334                NplainPass += scalar->data.S32;
     335                scalar = job->args->data[14];
     336                Nfaint += scalar->data.S32;
     337                scalar = job->args->data[15];
     338                Nfail += scalar->data.S32;
     339                psFree(job->args->data[3]); // iterator allocated above
     340                psFree(job);
    316341            }
    317             psScalar *scalar = NULL;
    318             scalar = job->args->data[9];
    319             Next += scalar->data.S32;
    320             scalar = job->args->data[10];
    321             Nconvolve += scalar->data.S32;
    322             scalar = job->args->data[11];
    323             NconvolvePass += scalar->data.S32;
    324             scalar = job->args->data[12];
    325             Nplain += scalar->data.S32;
    326             scalar = job->args->data[13];
    327             NplainPass += scalar->data.S32;
    328             scalar = job->args->data[14];
    329             Nfaint += scalar->data.S32;
    330             scalar = job->args->data[15];
    331             Nfail += scalar->data.S32;
    332             psFree(job->args->data[3]); // iterator allocated above
    333             psFree(job);
    334 # endif
    335342        }
    336343
     
    377384
    378385    psphotSersicModelClassCleanup();
     386
     387    // psphotSaveImage (NULL, readout->image, "test.02.fits");
    379388
    380389    psphotVisualShowResidualImage (readout, false);
  • branches/eam_branches/ipp-20130711/psphot/src/psphotRadiusChecks.c

    r32348 r35972  
    171171# undef MIN_WINDOW
    172172
    173 # define MIN_WINDOW 5.0
    174 # define SCALE1 5.0
     173// XXX EAM : 20130724 : for a test, double the window size parameters
     174# define MIN_WINDOW 10.0
     175# define SCALE1 7.0
    175176# define PAD_WINDOW 3.0
    176177
  • branches/eam_branches/ipp-20130711/psphot/src/psphotSourceFits.c

    r35769 r35972  
    606606            return model;
    607607        }
     608        // XXX TEST:
     609        // pcm->modelConv->params->data.F32[4] = 30.0;
     610        // pcm->modelConv->params->data.F32[5] = 30.0;
    608611    }
    609612
     
    613616        options.mode = PM_SOURCE_FIT_NO_INDEX;
    614617    } else {
    615         options.mode = PM_SOURCE_FIT_EXT;
     618      options.mode = PM_SOURCE_FIT_EXT_AND_SKY; // XXX note that there may be a conflict with psphotExtendedSourceFits.c:133
    616619    }
    617620    // update the pcm elements if we have changed the circumstance (options.mode or source->pixels)
Note: See TracChangeset for help on using the changeset viewer.