IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 5, 2014, 2:33:52 PM (12 years ago)
Author:
bills
Message:

more progress on fullforce summary stage

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psphot/src/psphotFullForceSummaryReadout.c

    r36718 r36731  
    1212    psVector    *fRMajor;
    1313    psVector    *fRMinor;
    14     psArray *zeroPt;
    15     psArray *exptime;
    16     psArray *cffTables;
     14    psArray *zeroPt;    // zero points for each input used with exptime to scale flux
     15    psArray *exptime;   // exposure times for each input
     16    psArray *cffTables; // one for each model type index is (model_type + 1) entry 0 is no extended model (star)
    1717} galaxyShapeOptions;
    1818
     
    384384                // save the flux and dFlux values from entry with lowest chisq
    385385                psF64 fluxBest = fluxVec->data.F32[min_k];
    386                 psF64 dFlux0   = dFluxVec->data.F32[min_k];
     386                psF64 dFluxBest = dFluxVec->data.F32[min_k];
     387                psF64 dFlux0   = NAN;
    387388                psF64 flux0    = NAN;
    388389
    389390                if (useFit) {
    390                     #define NUM_TRIALS_INIT 9     // this isn't used for anything execpt for the initial vector lengths
     391                    #define NUM_TRIALS_INIT 9
    391392                    psVector *major = psVectorAllocEmpty(NUM_TRIALS_INIT, PS_TYPE_F64);
    392393                    psVector *minor = psVectorAllocEmpty(NUM_TRIALS_INIT, PS_TYPE_F64);
     
    477478                    psPolynomial2D *chisqFit = psPolynomial2DAlloc(PS_POLYNOMIAL_ORD, 2, 2);
    478479                    psPolynomial2D *fluxFit = psPolynomial2DAlloc(PS_POLYNOMIAL_ORD, 2, 2);
     480                    psPolynomial2D *fluxErrorFit = psPolynomial2DAlloc(PS_POLYNOMIAL_ORD, 2, 2);
    479481                    chisqFit->coeffMask[2][2] = PS_POLY_MASK_SET;
    480482                    chisqFit->coeffMask[2][1] = PS_POLY_MASK_SET;
     
    483485                    fluxFit->coeffMask[2][1] = PS_POLY_MASK_SET;
    484486                    fluxFit->coeffMask[1][2] = PS_POLY_MASK_SET;
     487                    fluxErrorFit->coeffMask[2][2] = PS_POLY_MASK_SET;
     488                    fluxErrorFit->coeffMask[2][1] = PS_POLY_MASK_SET;
     489                    fluxErrorFit->coeffMask[1][2] = PS_POLY_MASK_SET;
    485490
    486491                    bool goodFit = psVectorFitPolynomial2D (chisqFit, NULL, 0xff, chisq, NULL, major, minor);
     
    504509                        } else {
    505510                            flux0 = fluxBest;
     511                        }
     512
     513                        // .. and compute dFlux at the minimum chisq position
     514                        bool goodFluxErrorFit = psVectorFitPolynomial2D(fluxErrorFit, NULL, 0xFF, dFlux, NULL, major, minor);
     515                        if (goodFluxErrorFit) {
     516                            dFlux0  = psPolynomial2DEval(fluxErrorFit, major0, minor0);
     517                        } else {
     518                            dFlux0 = dFluxBest;
    506519                        }
    507520
     
    540553                    }
    541554                    psFree(chisqFit);
     555                    psFree(fluxFit);
     556                    psFree(fluxErrorFit);
    542557                    psFree(major);
    543558                    psFree(minor);
     
    552567                    model->chisq = minChisq;
    553568                    flux0 = fluxBest;
     569                    dFlux0 = dFluxBest;
    554570#ifdef PRINTVALS
    555571                    fprintf(stderr, "%4d %3d %3ld | %6.3f %6.3f %6.3f %6.3f skip fit\n",
     
    581597static bool setOptions(galaxyShapeOptions *opt, pmReadout *readout, psMetadata *recipe, bool makeVectors) {
    582598    bool status;
    583     bool useAnalysis;
     599    bool useAnalysis;   // fall back to recipe if we dont' find values in analysis. Probably should no longer do this
    584600
    585601    psMetadataLookupF32(&useAnalysis, readout->analysis, "GALAXY_SHAPES_FR_MAJOR_MIN");
Note: See TracChangeset for help on using the changeset viewer.