IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 12, 2015, 12:34:04 PM (12 years ago)
Author:
eugene
Message:

merge changes from trunk (adds galaxy bumpiness/asym parameters; fixes full-force bugs)

Location:
branches/eam_branches/ipp-pv3-20140717-merge/psphot/src
Files:
20 edited
2 copied

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-pv3-20140717-merge/psphot/src/Makefile.am

    r36623 r37825  
    9797# generalized forced photometry (including Kron, Petro, and Models) of specified positions given a specified psf
    9898psphotFullForce_SOURCES = \
    99         psphotFullForce.c             \
    100         psphotFullForceArguments.c    \
     99        psphotFullForce.c          \
     100        psphotFullForceArguments.c \
    101101        psphotParseCamera.c        \
    102102        psphotImageLoop.c          \
     
    259259        psphotEfficiency.c             \
    260260        psphotSetNFrames.c             \
    261         psphotSourceMemory.c
     261        psphotSourceMemory.c           \
     262        psphotChipParams.c              \
     263        psphotGalaxyParams.c
    262264
    263265# not currently used
  • branches/eam_branches/ipp-pv3-20140717-merge/psphot/src/psphot.h

    r36757 r37825  
    138138bool            psphotExtendedSourceFits_Threaded (psThreadJob *job);
    139139
     140bool            psphotGalaxyParams (pmConfig *config, const pmFPAview *view, const char *filerule);
     141bool            psphotGalaxyParamsReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe);
     142bool            psphotGalaxyParams_Threaded (psThreadJob *job);
     143
    140144bool            psphotApResid (pmConfig *config, const pmFPAview *view, const char *filerule);
    141145bool            psphotApResidReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe);
    142146
    143147bool            psphotMagnitudes (pmConfig *config, const pmFPAview *view, const char *filerule);
    144 bool            psphotMagnitudesReadout(pmConfig *config, psMetadata *recipe, const pmFPAview *view, pmReadout *readout, psArray *sources, pmPSF *psf);
     148bool            psphotMagnitudesReadout(pmConfig *config, psMetadata *recipe, const pmFPAview *view, pmReadout *readout, psArray *sources, pmPSF *psf, int index);
    145149bool            psphotMagnitudes_Threaded (psThreadJob *job);
    146150
     
    168172// in psphotChoosePSF.c:
    169173bool            psphotPSFstats (pmReadout *readout, pmPSF *psf);
     174bool            psphotPSFstatsSources (pmReadout *readout, psArray *sources, pmPSF *psf);
    170175bool            psphotMomentsStats (pmReadout *readout, psArray *sources);
    171176
     
    232237int             psphotSaveImage (psMetadata *header, psImage *image, char *filename);
    233238bool            psphotDumpConfig (pmConfig *config);
    234 pmReadout      *psphotSelectBackground (pmConfig *config, const pmFPAview *view);
    235 pmReadout      *psphotSelectBackgroundStdev (pmConfig *config, const pmFPAview *view);
     239pmReadout      *psphotSelectBackground (pmConfig *config, const pmFPAview *view, int index);
     240pmReadout      *psphotSelectBackgroundStdev (pmConfig *config, const pmFPAview *view, int index);
    236241
    237242// PSF / DBL / EXT evaluation functions
     
    571576bool psphotSourceMemoryReadout(pmConfig *config, const pmFPAview *view, const char *filerule, int index);
    572577
     578bool psphotChipParams(pmConfig *config, const pmFPAview *view, const char *filerule);
     579bool psphotChipParams_Threaded(psThreadJob *job);
     580
    573581const char * psphotGetFilerule(const char *baseRule);
    574582extern bool psphotINpsphotStack;
    575583
     584
    576585#endif
  • branches/eam_branches/ipp-pv3-20140717-merge/psphot/src/psphotChooseAnalysisOptions.c

    r36453 r37825  
    606606    psLogMsg ("psphot.options", PS_LOG_WARN, "choose analysis options for %ld objects: %f sec\n", objects->n, psTimerMark ("psphot.options"));
    607607
     608    psFree(exptime);
     609    psFree(zeropt);
     610    psFree(chips);
     611    psFree(inputFilters);
     612    psFree(petroFluxLim);
     613    psFree(extFitFluxLim);
    608614    psFree(toGal);
    609615
  • branches/eam_branches/ipp-pv3-20140717-merge/psphot/src/psphotChoosePSF.c

    r36863 r37825  
    11# include "psphotInternal.h"
     2bool psphotPSFstatsSources (pmReadout *readout, psArray *sources, pmPSF *psf);
    23
    34// generate a PSF model for inputs without PSF models already loaded
     
    388389    psFree (models);
    389390
    390     if (!psphotPSFstats (readout, psf)) {
     391    // if (!psphotPSFstats (readout, psf)) {
     392
     393    if (!psphotPSFstatsSources (readout, sources, psf)) {
    391394        psError(PSPHOT_ERR_PSF, false, "cannot measure PSF shape terms");
    392395        psFree(options);
     
    466469
    467470            if (modelPSF->params->n > 7) {
    468               psVectorAppend (psfExtra1, modelPSF->params->data.F32[7]);
     471                psVectorAppend (psfExtra1, modelPSF->params->data.F32[7]);
    469472            }
    470473            if (modelPSF->params->n > 8) {
    471               psVectorAppend (psfExtra2, modelPSF->params->data.F32[8]);
     474                psVectorAppend (psfExtra2, modelPSF->params->data.F32[8]);
    472475            }
    473476            psFree (modelPSF);
     
    522525
    523526    if (psfExtra1->n) {
    524       if (!psVectorStats (stats, psfExtra1, NULL, NULL, 0)) {
    525         psError(PS_ERR_UNKNOWN, false, "failure to measure stats for PSF EXTRA 1");
     527        if (!psVectorStats (stats, psfExtra1, NULL, NULL, 0)) {
     528            psError(PS_ERR_UNKNOWN, false, "failure to measure stats for PSF EXTRA 1");
     529            goto escape;
     530        }
     531        psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "PSF_EXT1", PS_META_REPLACE, "PSF extra param 1", stats->sampleMean);
     532        psLogMsg ("psphot", PS_LOG_DETAIL, "PSF extra parameter 1: %f +/- %f", stats->sampleMean, stats->sampleStdev);
     533    }
     534
     535    if (psfExtra2->n) {
     536        if (!psVectorStats (stats, psfExtra2, NULL, NULL, 0)) {
     537            psError(PS_ERR_UNKNOWN, false, "failure to measure stats for PSF EXTRA 2");
     538            goto escape;
     539        }
     540        psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "PSF_EXT2", PS_META_REPLACE, "PSF extra param 2", stats->sampleMean);
     541        psLogMsg ("psphot", PS_LOG_DETAIL, "PSF extra parameter 2: %f +/- %f", stats->sampleMean, stats->sampleStdev);
     542    }
     543
     544    psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "ANGLE",    PS_META_REPLACE, "PSF angle",           axes.theta);
     545    psMetadataAddS32 (readout->analysis, PS_LIST_TAIL, "NPSFSTAR", PS_META_REPLACE, "Number of stars used to make PSF", psf->nPSFstars);
     546
     547    // psLogMsg ("psphot", PS_LOG_DETAIL, "PSF angle: %f, nstars: %d", axes.theta, psf->nPSFstars);
     548
     549    char *psfModelName = pmModelClassGetName(psf->type);
     550    psMetadataAddStr(readout->analysis,  PS_LIST_TAIL, "PSFMODEL", PS_META_REPLACE, "PSF Model Name", psfModelName);
     551    psMetadataAddBool(readout->analysis, PS_LIST_TAIL, "PSF_OK",   PS_META_REPLACE, "Valid PSF Model?", true);
     552
     553    int nParams = pmModelClassParameterCount(psf->type);
     554    psMetadataAddS32(readout->analysis, PS_LIST_TAIL, "PSF_NPAR",   PS_META_REPLACE, "Number of PSF parameters", nParams);
     555
     556    psFree (fwhmMajor);
     557    psFree (fwhmMinor);
     558    psFree (psfExtra1);
     559    psFree (psfExtra2);
     560    psFree (stats);
     561    return true;
     562
     563escape:
     564    psFree (fwhmMajor);
     565    psFree (fwhmMinor);
     566    psFree (psfExtra1);
     567    psFree (psfExtra2);
     568    psFree (stats);
     569    return false;
     570}
     571
     572// measure average parameters of the PSF model
     573bool psphotPSFstatsSources (pmReadout *readout, psArray *sources, pmPSF *psf) {
     574
     575    psEllipseShape shape;
     576    psEllipseAxes axes;
     577
     578    PS_ASSERT_PTR_NON_NULL(readout, false);
     579    PS_ASSERT_PTR_NON_NULL(psf, false);
     580
     581    psImage *image = readout->image;
     582    PS_ASSERT_PTR_NON_NULL(image, false);
     583
     584    // XXX a minor hack: measure the values for a grid of points across the image, determine mean, UQ, LQ, etc:
     585    psVector *fwhmMajor = psVectorAllocEmpty (100, PS_DATA_F32);
     586    psVector *fwhmMinor = psVectorAllocEmpty (100, PS_DATA_F32);
     587    psVector *psfExtra1 = psVectorAllocEmpty (100, PS_DATA_F32);
     588    psVector *psfExtra2 = psVectorAllocEmpty (100, PS_DATA_F32);
     589
     590    for (int i = 0; i < sources->n; i++) {
     591
     592        pmSource *source = sources->data[i];
     593
     594        if (!(source->mode & PM_SOURCE_MODE_PSFSTAR)) continue;
     595
     596        float xc = source->peak->xf;
     597        float yc = source->peak->yf;
     598
     599        // create modelPSF from this model
     600        pmModel *modelPSF = pmModelFromPSFforXY (psf, xc, yc, 1.0);
     601        if (!modelPSF) {
     602            fprintf (stderr, "?");
     603            continue;
     604        }
     605
     606        // get the model full-width at half-max
     607        float FWHM_MAJOR = 2*modelPSF->class->modelRadius (modelPSF->params, 0.5);
     608
     609        // XXX make sure this is consistent with the re-definition of PM_PAR_SXX
     610        shape.sx  = modelPSF->params->data.F32[PM_PAR_SXX];
     611        shape.sy  = modelPSF->params->data.F32[PM_PAR_SYY];
     612        shape.sxy = modelPSF->params->data.F32[PM_PAR_SXY];
     613        axes = psEllipseShapeToAxes (shape, 20.0);
     614
     615        float FWHM_MINOR = FWHM_MAJOR * (axes.minor / axes.major);
     616        if (!isfinite(FWHM_MAJOR) || !isfinite(FWHM_MINOR)) {
     617            fprintf (stderr, "!");
     618            psFree (modelPSF);
     619            continue;
     620        }
     621        psVectorAppend (fwhmMajor, FWHM_MAJOR);
     622        psVectorAppend (fwhmMinor, FWHM_MINOR);
     623
     624        if (modelPSF->params->n > 7) {
     625            psVectorAppend (psfExtra1, modelPSF->params->data.F32[7]);
     626        }
     627        if (modelPSF->params->n > 8) {
     628            psVectorAppend (psfExtra2, modelPSF->params->data.F32[8]);
     629        }
     630        psFree (modelPSF);
     631
     632        // float fwhmtest = pmPSFtoFWHM(psf, xc, yc);
     633        // fprintf (stderr, "fwhm: %f, %f : %f\n", FWHM_MAJOR, FWHM_MINOR, fwhmtest);
     634    }
     635
     636    psStats *stats = psStatsAlloc (PS_STAT_SAMPLE_MEAN | PS_STAT_SAMPLE_STDEV | PS_STAT_SAMPLE_QUARTILE);
     637    if (!psVectorStats (stats, fwhmMajor, NULL, NULL, 0)) {
     638        psError(PS_ERR_UNKNOWN, false, "failure to measure stats for FWHM MAJOR");
    526639        goto escape;
    527       }
    528       psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "PSF_EXT1", PS_META_REPLACE, "PSF extra param 1", stats->sampleMean);
    529       psLogMsg ("psphot", PS_LOG_DETAIL, "PSF extra parameter 1: %f +/- %f", stats->sampleMean, stats->sampleStdev);
     640    }
     641
     642    psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "FWHM_MAJ",   PS_META_REPLACE, "PSF FWHM Major axis (mean)", stats->sampleMean);
     643    psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "FW_MJ_SG",   PS_META_REPLACE, "PSF FWHM Major axis (sigma)", stats->sampleStdev);
     644    psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "FW_MJ_LQ",   PS_META_REPLACE, "PSF FWHM Major axis (lower quartile)", stats->sampleLQ);
     645    psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "FW_MJ_UQ",   PS_META_REPLACE, "PSF FWHM Major axis (upper quartile)", stats->sampleUQ);
     646
     647    float fwhmMaj = stats->sampleMean;  // FWHM on major axis
     648
     649    if (!psVectorStats (stats, fwhmMinor, NULL, NULL, 0)) {
     650        psError(PS_ERR_UNKNOWN, false, "failure to measure stats for FWHM MINOR");
     651        goto escape;
     652    }
     653    psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "FWHM_MIN",   PS_META_REPLACE, "PSF FWHM Minor axis (mean)", stats->sampleMean);
     654    psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "FW_MN_SG",   PS_META_REPLACE, "PSF FWHM Minor axis (sigma)", stats->sampleStdev);
     655    psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "FW_MN_LQ",   PS_META_REPLACE, "PSF FWHM Minor axis (lower quartile)", stats->sampleLQ);
     656    psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "FW_MN_UQ",   PS_META_REPLACE, "PSF FWHM Minor axis (upper quartile)", stats->sampleUQ);
     657
     658    float fwhmMin = stats->sampleMean;  // FWHM on minor axis
     659
     660    if (readout->parent) {
     661
     662        // we now have 2 possible measurements of the seeing : the PSF model based version and
     663        // the Moments based value we need to define a definitive "CHIP.SEEING" value.  This
     664        // value is used by the PSF-matching programs (ppSub and ppStack).  The moments-based
     665        // value is probably more representative of the value needed by those tools (it is also
     666        // more stable?)
     667        bool status = false;
     668        float fwhmMajorMoments = psMetadataLookupF32(&status, readout->analysis, "IQ_FW1");
     669        float fwhmMinorMoments = psMetadataLookupF32(&status, readout->analysis, "IQ_FW1");
     670
     671        pmChip *chip = readout->parent->parent; // Parent chip
     672        psAssert(chip, "Cell should be attached to a chip.");
     673        psMetadataItem *item = psMetadataLookup(chip->concepts, "CHIP.SEEING"); // Item with chip
     674        item->data.F32 = 0.5 * (fwhmMajorMoments + fwhmMinorMoments);
     675
     676        psLogMsg ("psphot", PS_LOG_DETAIL, "fwhm (psf): %f,%f (moments): %f,%f", fwhmMaj, fwhmMin, fwhmMajorMoments, fwhmMinorMoments);
     677    }
     678
     679    if (psfExtra1->n) {
     680        if (!psVectorStats (stats, psfExtra1, NULL, NULL, 0)) {
     681            psError(PS_ERR_UNKNOWN, false, "failure to measure stats for PSF EXTRA 1");
     682            goto escape;
     683        }
     684        psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "PSF_EXT1", PS_META_REPLACE, "PSF extra param 1", stats->sampleMean);
     685        psLogMsg ("psphot", PS_LOG_DETAIL, "PSF extra parameter 1: %f +/- %f", stats->sampleMean, stats->sampleStdev);
    530686    }
    531687
    532688    if (psfExtra2->n) {
    533       if (!psVectorStats (stats, psfExtra2, NULL, NULL, 0)) {
    534         psError(PS_ERR_UNKNOWN, false, "failure to measure stats for PSF EXTRA 2");
    535         goto escape;
    536       }
    537       psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "PSF_EXT2", PS_META_REPLACE, "PSF extra param 2", stats->sampleMean);
    538       psLogMsg ("psphot", PS_LOG_DETAIL, "PSF extra parameter 2: %f +/- %f", stats->sampleMean, stats->sampleStdev);
     689        if (!psVectorStats (stats, psfExtra2, NULL, NULL, 0)) {
     690            psError(PS_ERR_UNKNOWN, false, "failure to measure stats for PSF EXTRA 2");
     691            goto escape;
     692        }
     693        psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "PSF_EXT2", PS_META_REPLACE, "PSF extra param 2", stats->sampleMean);
     694        psLogMsg ("psphot", PS_LOG_DETAIL, "PSF extra parameter 2: %f +/- %f", stats->sampleMean, stats->sampleStdev);
    539695    }
    540696
  • branches/eam_branches/ipp-pv3-20140717-merge/psphot/src/psphotCleanup.c

    r36555 r37825  
    2525    // don't display memory leaks unless trace is on.
    2626    // fprintf (stderr, "found %d leaks at %s\n", psMemCheckLeaks (0, NULL, NULL, false), "psphot");
    27     fprintf (stderr, "found %d leaks at %s\n", psMemCheckLeaks (0, NULL, stdout, false), "psphot");
     27    fprintf (stderr, "found %d leaks at %s\n", psMemCheckLeaks2 (0, NULL, stdout, false, 500), "psphot");
    2828#endif
    2929    return;
  • branches/eam_branches/ipp-pv3-20140717-merge/psphot/src/psphotEfficiency.c

    r36863 r37825  
    502502
    503503    // measure the magnitudes and fluxes for the sources
    504     if (!psphotMagnitudesReadout(config, recipe, view, readout, fakeSourcesAll, psf)) {
     504    if (!psphotMagnitudesReadout(config, recipe, view, readout, fakeSourcesAll, psf, index)) {
    505505        psError(PS_ERR_UNKNOWN, false, "Unable to measure magnitudes of fake sources.");
    506506        psFree(fakeSources);
  • branches/eam_branches/ipp-pv3-20140717-merge/psphot/src/psphotExtendedSourceAnalysis.c

    r36375 r37825  
    3838
    3939/*** for the moment, this test code : it is not thread safe ***/
    40 int    Nall = 0;
    41 int  Nskip1 = 0;
    42 int  Nskip2 = 0;
    43 int  Nskip3 = 0;
    44 int  Nskip4 = 0;
    45 int  Nskip5 = 0;
    46 int  Nskip6 = 0;
     40static int    Nall = 0;
     41static int  Nskip1 = 0;
     42static int  Nskip2 = 0;
     43static int  Nskip3 = 0;
     44static int  Nskip4 = 0;
     45static int  Nskip5 = 0;
     46static int  Nskip6 = 0;
    4747
    4848# define SKIP(VALUE) { VALUE++; continue; }
  • branches/eam_branches/ipp-pv3-20140717-merge/psphot/src/psphotExtendedSourceFits.c

    r36375 r37825  
    629629          pmSourceCacheModel (source, maskVal);
    630630
    631 # if (PS_TRACE_ON)
     631# if (0 && PS_TRACE_ON)
    632632          pmModel *model = source->modelFits->data[0];
    633633          int flags = 0xffffffff;
  • branches/eam_branches/ipp-pv3-20140717-merge/psphot/src/psphotFitSourcesLinear.c

    r34418 r37825  
    263263            }
    264264        }
     265        if (modelSum == 0 ||  maskedSum == 0) {
     266            // no pixels at all drop the modelPSF (probably only an issue for external sources
     267            // which are created from a fake peak (full force))
     268            psFree(source->modelPSF);
     269            continue;
     270        }
    265271        if (modelSum < 0.5) continue; // skip sources with no model constraint (somewhat arbitrary limit)
    266272        if (modelSum < 0.8) {
  • branches/eam_branches/ipp-pv3-20140717-merge/psphot/src/psphotFullForceReadout.c

    r36663 r37825  
    106106    psphotKronFlux (config, view, filerule);
    107107
     108    psphotChipParams (config, view, filerule);
     109
    108110    // measure petro fluxes
    109111    psphotPetroFlux (config, view, filerule);
     
    114116    // measure galaxy shapes
    115117    psphotGalaxyShape (config, view, filerule);
     118
     119    // measure aperture photometry corrections
     120    if (!psphotApResid (config, view, filerule)) {
     121        psLogMsg ("psphot", 3, "failed on psphotApResid");
     122        return psphotReadoutCleanup (config, view, filerule);
     123    }
    116124
    117125    // calculate source magnitudes (psf mag and ap mag)
  • branches/eam_branches/ipp-pv3-20140717-merge/psphot/src/psphotMagnitudes.c

    r34404 r37825  
    3838        psAssert (psf, "missing psf?");
    3939
    40         if (!psphotMagnitudesReadout (config, recipe, view, readout, sources, psf)) {
     40        if (!psphotMagnitudesReadout (config, recipe, view, readout, sources, psf, i)) {
    4141            psError (PSPHOT_ERR_CONFIG, false, "failed to measure magnitudes for %s entry %d", filerule, i);
    4242            return false;
     
    4646}
    4747
    48 bool psphotMagnitudesReadout(pmConfig *config, psMetadata *recipe, const pmFPAview *view, pmReadout *readout, psArray *sources, pmPSF *psf) {
     48bool psphotMagnitudesReadout(pmConfig *config, psMetadata *recipe, const pmFPAview *view, pmReadout *readout, psArray *sources, pmPSF *psf, int index) {
    4949
    5050    bool status = false;
     
    6565
    6666    // if backModel or backStdev are missing, the values of sky and/or skyErr will be set to NAN
    67     pmReadout *backModel = psphotSelectBackground (config, view);
    68     pmReadout *backStdev = psphotSelectBackgroundStdev (config, view);
     67    pmReadout *backModel = psphotSelectBackground (config, view, index);
     68    pmReadout *backStdev = psphotSelectBackgroundStdev (config, view, index);
    6969
    7070    // bit-masks to test for good/bad pixels
  • branches/eam_branches/ipp-pv3-20140717-merge/psphot/src/psphotOutput.c

    r35769 r37825  
    2929}
    3030
    31 pmReadout *psphotSelectBackground (pmConfig *config, const pmFPAview *view) {
    32 
    33     bool status;
    34    
    35 
    36     pmFPAfile *file = psMetadataLookupPtr (&status, config->files, psphotGetFilerule("PSPHOT.BACKMDL"));
     31pmReadout *psphotSelectBackground (pmConfig *config, const pmFPAview *view, int index) {
     32
     33    pmFPAfile *file = pmFPAfileSelectSingle (config->files, psphotGetFilerule("PSPHOT.BACKMDL"), index);
    3734    if (!file) return NULL;
    3835
     
    4138}
    4239
    43 pmReadout *psphotSelectBackgroundStdev (pmConfig *config, const pmFPAview *view) {
    44 
    45     bool status;
    46 
    47     pmFPAfile *file = psMetadataLookupPtr (&status, config->files, psphotGetFilerule("PSPHOT.BACKMDL.STDEV"));
     40pmReadout *psphotSelectBackgroundStdev (pmConfig *config, const pmFPAview *view, int index) {
     41
     42    pmFPAfile *file = pmFPAfileSelectSingle (config->files, psphotGetFilerule("PSPHOT.BACKMDL.STDEV"), index);
    4843    if (!file) return NULL;
    4944
  • branches/eam_branches/ipp-pv3-20140717-merge/psphot/src/psphotPetrosianAnalysis.c

    r31154 r37825  
    1212    // XXX temporary user-supplied systematic sky noise measurement (derive from background model)
    1313    float skynoise = psMetadataLookupF32 (&status, recipe, "SKY.NOISE");
    14 
    15 # if (0)
    16     // if backModel or backStdev are missing, the values of sky and/or skyErr will be set to NAN
    17     // XXX use this to set skynoise
    18     pmReadout *backModel = psphotSelectBackground (config, view);
    19     pmReadout *backStdev = psphotSelectBackgroundStdev (config, view);
    20 # endif
    2114
    2215    // S/N limit to perform full non-linear fits
  • branches/eam_branches/ipp-pv3-20140717-merge/psphot/src/psphotReadout.c

    r36623 r37825  
    325325    psphotExtendedSourceAnalysis (config, view, filerule); // pass 1 (detections->allSources)
    326326    psphotExtendedSourceFits (config, view, filerule); // pass 1 (detections->allSources)
     327    // measure some parameters for galaxy science
     328    psphotGalaxyParams (config, view, filerule);
    327329    psphotRadialApertures(config, view, filerule, 0);
    328330
  • branches/eam_branches/ipp-pv3-20140717-merge/psphot/src/psphotReadoutCleanup.c

    r35771 r37825  
    5757    // use the psf-model to measure FWHM stats
    5858    if (psf) {
    59         if (!psphotPSFstats (readout, psf)) {
     59      if (!psphotPSFstatsSources (readout, sources, psf)) {
    6060            psError(PSPHOT_ERR_PROG, false, "Failed to measure PSF shape parameters");
    6161            return false;
  • branches/eam_branches/ipp-pv3-20140717-merge/psphot/src/psphotSetNFrames.c

    r33691 r37825  
    4545
    4646    pmDetections *detections = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.DETECTIONS");
    47     psAssert (detections, "missing detections?");
    48     psAssert (detections->allSources, "missing sources?");
     47    if (!detections) {
     48        psLogMsg ("psphot", PS_LOG_INFO, "No detections image input %d", index);
     49        return true;
     50    }
    4951
    5052    psArray *sources = detections->allSources;
     53    if (!sources) {
     54        psLogMsg ("psphot", PS_LOG_INFO, "No sources for input %d", index);
     55        return true;
     56    }
    5157
    5258    int col0 = expnum->col0;
  • branches/eam_branches/ipp-pv3-20140717-merge/psphot/src/psphotSetThreads.c

    r36375 r37825  
    8787    psFree(task);
    8888
     89    task = psThreadTaskAlloc("PSPHOT_CHIP_PARAMS", 2);
     90    task->function = &psphotChipParams_Threaded;
     91    psThreadTaskAdd(task);
     92    psFree(task);
     93
     94    task = psThreadTaskAlloc("PSPHOT_GALAXY_PARAMS", 11);
     95    task->function = &psphotGalaxyParams_Threaded;
     96    psThreadTaskAdd(task);
     97    psFree(task);
     98
    8999    return true;
    90100}
  • branches/eam_branches/ipp-pv3-20140717-merge/psphot/src/psphotSourceStats.c

    r36375 r37825  
    185185            psThreadJob *job = psThreadJobAlloc ("PSPHOT_SOURCE_STATS");
    186186
    187             psArrayAdd(job->args, 1, cells->data[j]); // sources
    188 
    189             PS_ARRAY_ADD_SCALAR(job->args, INNER,   PS_TYPE_F32);
    190             PS_ARRAY_ADD_SCALAR(job->args, MIN_SN,  PS_TYPE_F32);
    191             PS_ARRAY_ADD_SCALAR(job->args, RADIUS,  PS_TYPE_F32);
    192             PS_ARRAY_ADD_SCALAR(job->args, SIGMA,   PS_TYPE_F32);
    193             PS_ARRAY_ADD_SCALAR(job->args, MIN_KRON_RADIUS, PS_TYPE_F32);
    194 
    195             PS_ARRAY_ADD_SCALAR(job->args, maskVal, PS_TYPE_IMAGE_MASK);
    196             PS_ARRAY_ADD_SCALAR(job->args, markVal, PS_TYPE_IMAGE_MASK);
    197 
    198             PS_ARRAY_ADD_SCALAR(job->args, 0, PS_TYPE_S32); // this is used as a return value for Nmoments
    199             PS_ARRAY_ADD_SCALAR(job->args, 0, PS_TYPE_S32); // this is used as a return value for Nfail
    200             PS_ARRAY_ADD_SCALAR(job->args, 0, PS_TYPE_S32); // this is used as a return value for Nfaint
     187            psArrayAdd(job->args, 1, cells->data[j]); // 0 : sources
     188
     189            PS_ARRAY_ADD_SCALAR(job->args, INNER,   PS_TYPE_F32); // 1
     190            PS_ARRAY_ADD_SCALAR(job->args, MIN_SN,  PS_TYPE_F32); // 2
     191            PS_ARRAY_ADD_SCALAR(job->args, RADIUS,  PS_TYPE_F32); // 3
     192            PS_ARRAY_ADD_SCALAR(job->args, SIGMA,   PS_TYPE_F32); // 4
     193            PS_ARRAY_ADD_SCALAR(job->args, MIN_KRON_RADIUS, PS_TYPE_F32); // 5
     194
     195            PS_ARRAY_ADD_SCALAR(job->args, maskVal, PS_TYPE_IMAGE_MASK); // 6
     196            PS_ARRAY_ADD_SCALAR(job->args, markVal, PS_TYPE_IMAGE_MASK); // 7
     197
     198            PS_ARRAY_ADD_SCALAR(job->args, 0, PS_TYPE_S32); // 8  : this is used as a return value for Nmoments
     199            PS_ARRAY_ADD_SCALAR(job->args, 0, PS_TYPE_S32); // 9  : this is used as a return value for Nfail
     200            PS_ARRAY_ADD_SCALAR(job->args, 0, PS_TYPE_S32); // 10 : this is used as a return value for Nfaint
    201201
    202202            if (!psThreadJobAddPending(job)) {
     
    316316
    317317            // XXX: this must match the above
     318            psAbort ("this code is broken: must match psphotSourceStatsReadout above");
    318319            psArrayAdd(job->args, 1, cells->data[j]); // sources
    319320            psArrayAdd(job->args, 1, recipe);
     
    472473
    473474    // change the value of a scalar on the array (wrap this and put it in psArray.h)
    474     scalar = job->args->data[7];
     475    scalar = job->args->data[8];
    475476    scalar->data.S32 = Nmoments;
    476477
    477     scalar = job->args->data[8];
     478    scalar = job->args->data[9];
    478479    scalar->data.S32 = Nfail;
    479480
    480     scalar = job->args->data[9];
     481    scalar = job->args->data[10];
    481482    scalar->data.S32 = Nfaint;
    482483
  • branches/eam_branches/ipp-pv3-20140717-merge/psphot/src/psphotStackParseCamera.c

    r34528 r37825  
    262262    }
    263263
     264#ifdef MAKE_CHISQ_IMAGE
    264265    // generate an pmFPAimage for the chisqImage
    265266    {
     
    293294        chisqVariance->save = saveChisq;
    294295    }
     296#else
     297    (void) saveChisq;
     298#endif   // MAKE_CHISQ_IMAGE
    295299
    296300    psTrace("psphot", 1, "Done with psphotStackParseCamera...\n");
  • branches/eam_branches/ipp-pv3-20140717-merge/psphot/src/psphotStackReadout.c

    r36630 r37825  
    341341    // measure non-linear extended source models (exponential, deVaucouleur, Sersic) (sources sorted by S/N)
    342342    psphotExtendedSourceFits (config, view, STACK_RAW); // pass 1 (detections->allSources)
     343
     344    // measure some parameters for galxy science
     345    psphotGalaxyParams (config, view, STACK_RAW); // pass 1 (detections->allSources)
    343346
    344347    // create source children for the OUT filerule (for radial aperture photometry and output)
     
    354357        return psphotReadoutCleanup (config, view, STACK_RAW);
    355358    }
     359    // These arrays are no longer needed. The inputs' sources arrays have references to the data
     360    psFree (objects);
     361    psFree (objectsOut);
    356362
    357363    bool radial_apertures = psMetadataLookupBool(NULL, recipe, "RADIAL_APERTURES");
     
    410416    // measure aperture photometry corrections
    411417    if (!psphotApResid (config, view, STACK_RAW)) {
    412         psFree (objects);
    413         psFree (objectsOut);
    414418        psLogMsg ("psphot", 3, "failed on psphotApResid");
    415419        return psphotReadoutCleanup (config, view, STACK_RAW);
     
    432436
    433437    logMemStats("final");
    434 #if (1)
     438#if (0)
    435439    psphotSourceMemory(config, view, STACK_RAW);
    436440    psphotSourceMemory(config, view, STACK_OUT);
     
    448452    psphotStackRemoveChisqFromInputs(config, STACK_RAW);
    449453#endif
    450 
    451     psFree (objects);
    452     psFree (objectsOut);
    453454
    454455    // create the exported-metadata and free local data
Note: See TracChangeset for help on using the changeset viewer.