IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 17, 2014, 12:30:45 PM (12 years ago)
Author:
eugene
Message:

merge changes (from past YEAR) into trunk

Location:
branches/eam_branches/ipp-ops-20130712/psModules
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-ops-20130712/psModules

    • Property svn:mergeinfo deleted
  • branches/eam_branches/ipp-ops-20130712/psModules/src/objects

    • Property svn:ignore
      •  

        old new  
        1212pmSourceIO_CMF_PS1_V1.v1.c
        1313pmSourceIO_CMF_PS1_V4.c
         14pmSourceIO_CMF_PS1_V5.c
        1415pmSourceIO_CMF_PS1_SV1.c
        1516pmSourceIO_CMF_PS1_SV2.c
         17pmSourceIO_CMF_PS1_SV3.c
        1618pmSourceIO_CMF_PS1_DV1.c
        1719pmSourceIO_CMF_PS1_DV2.c
        1820pmSourceIO_CMF_PS1_DV3.c
        19 
         21pmSourceIO_CMF_PS1_DV4.c
  • branches/eam_branches/ipp-ops-20130712/psModules/src/objects/pmSourcePhotometry.c

    r34498 r37066  
    3333#include "pmMoments.h"
    3434#include "pmModelFuncs.h"
     35#include "pmModelClass.h"
    3536#include "pmModel.h"
    3637#include "pmModelUtils.h"
    37 #include "pmModelClass.h"
    3838#include "pmSourceMasks.h"
    3939#include "pmSourceExtendedPars.h"
    4040#include "pmSourceDiffStats.h"
    4141#include "pmSourceSatstar.h"
     42#include "pmSourceLensing.h"
    4243#include "pmSource.h"
    4344#include "pmSourceFitModel.h"
     
    113114    source->apFluxErr = NAN;
    114115
     116    pmModelStatus badModel = PM_MODEL_STATUS_NONE;
     117    badModel |= PM_MODEL_STATUS_BADARGS;
     118    badModel |= PM_MODEL_STATUS_OFFIMAGE;
     119    badModel |= PM_MODEL_STATUS_NAN_CHISQ;
     120    badModel |= PM_MODEL_SERSIC_PCM_FAIL_GUESS;
     121    badModel |= PM_MODEL_SERSIC_PCM_FAIL_GRID;
     122    badModel |= PM_MODEL_PCM_FAIL_GUESS;
     123
    115124    // XXXXXX review:
    116125    // Select the 'best' model -- this is used for PSF_QF,_PERFECT & ???. isPSF is true if this
     
    162171        for (int i = 0; i < source->modelFits->n; i++) {
    163172            pmModel *model = source->modelFits->data[i];
    164             if (model->flags & PM_MODEL_STATUS_BADARGS) continue;
     173            if (model->flags & badModel) continue;
    165174            status = pmSourcePhotometryModel (&model->mag, NULL, model);
    166175            if (model == source->modelEXT) foundEXT = true;
     
    321330
    322331    // measure fitMag
    323     flux = model->modelFlux (model->params);
     332    flux = model->class->modelFlux (model->params);
    324333    if (flux > 0) {
    325334        mag = -2.5*log10(flux);
     
    350359
    351360    bool status;
    352     int nPix = 0;
    353     status = pmSourcePhotometryAper(&nPix, &source->apMagRaw, &source->apFlux, &source->apFluxErr, model, image, variance, mask, maskVal);
     361    status = pmSourcePhotometryAper(&source->apNpixels, &source->apMagRaw, &source->apFlux, &source->apFluxErr, model, image, variance, mask, maskVal);
    354362    if (status) {
    355363        source->mode |= PM_SOURCE_MODE_AP_MAGS;
     
    481489
    482490            // for the full model, add all points
    483             value = fabs(model->modelFunc (NULL, params, coord) - sky);
     491            value = fabs(model->class->modelFunc (NULL, params, coord) - sky);
    484492            modelSum += value;
    485493
     
    884892
    885893            // for the full model, add all points
    886             float value = model->modelFunc (NULL, params, coord);
     894            float value = model->class->modelFunc (NULL, params, coord);
    887895
    888896            // fprintf (stderr, "%d, %d : %f, %f : %f - %f : %f\n",
     
    899907
    900908    psFree (coord);
     909    return (true);
     910}
     911
     912bool pmSourceChisqModelFlux (pmSource *source, pmModel *model, psImageMaskType maskVal)
     913{
     914    PS_ASSERT_PTR_NON_NULL(source, false);
     915    PS_ASSERT_PTR_NON_NULL(model, false);
     916
     917    float dC = 0.0;
     918    int Npix = 0;
     919
     920    psVector *params = model->params;
     921    psImage  *image = source->pixels;
     922    psImage  *modelFlux = source->modelFlux;
     923    psImage  *mask = source->maskObj;
     924    psImage  *variance = source->variance;
     925
     926    float Io = params->data.F32[PM_PAR_I0];
     927
     928    for (int iy = 0; iy < image->numRows; iy++) {
     929        for (int ix = 0; ix < image->numCols; ix++) {
     930
     931            // skip pixels which are masked
     932            if (mask->data.PS_TYPE_IMAGE_MASK_DATA[iy][ix] & maskVal) continue;
     933
     934            if (variance->data.F32[iy][ix] <= 0) continue;
     935
     936            dC += PS_SQR (image->data.F32[iy][ix] - Io*modelFlux->data.F32[iy][ix]) / variance->data.F32[iy][ix];
     937            Npix ++;
     938        }
     939    }
     940    model->nPix = Npix;
     941    model->nDOF = Npix - model->nPar;
     942    model->chisq = dC;
     943    model->chisqNorm = dC / model->nDOF;
     944
    901945    return (true);
    902946}
Note: See TracChangeset for help on using the changeset viewer.