IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 13, 2014, 6:25:48 AM (12 years ago)
Author:
eugene
Message:

I added a new model function class, pmModelSetFHWM; also added a boolean useReff to the model class for use instead of pmModelUseReff everywhere

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/objects/models/pmModel_QGAUSS.c

    r36623 r36857  
    3535#include "pmMoments.h"
    3636#include "pmModelFuncs.h"
     37#include "pmModelClass.h"
    3738#include "pmModel.h"
    3839#include "pmModelUtils.h"
    39 #include "pmModelClass.h"
    4040#include "pmSourceMasks.h"
    4141#include "pmSourceExtendedPars.h"
     
    5757# define PM_MODEL_LIMITS          pmModelLimits_QGAUSS
    5858# define PM_MODEL_RADIUS          pmModelRadius_QGAUSS
     59# define PM_MODEL_SET_FWHM        pmModelSetFWHM_QGAUSS
    5960# define PM_MODEL_FROM_PSF        pmModelFromPSF_QGAUSS
    6061# define PM_MODEL_PARAMS_FROM_PSF pmModelParamsFromPSF_QGAUSS
     
    337338}
    338339
     340// I used the script in models/fwhm.sh to generate the trend of FWHM scaling vs the K value
     341// FWHM = Scale * Sigma (not that PAR[PM_PAR_SXX] = sigma * sqrt(2)
     342//  K : z_hm  : FWHM
     343//  0 : 1.000 : 2.83
     344//  1 : 0.648 : 2.28
     345//  2 : 0.430 : 1.85
     346//  3 : 0.310 : 1.58
     347//  4 : 0.244 : 1.40
     348//  5 : 0.200 : 1.26
     349//  6 : 0.165 : 1.15
     350//  7 : 0.149 : 1.09
     351//  8 : 0.125 : 1.00
     352//  9 : 0.116 : 0.96
     353// 10 : 0.101 : 0.90
     354// 11 : 0.095 : 0.87
     355// 12 : 0.083 : 0.82
     356// 13 : 0.082 : 0.81
     357// 14 : 0.080 : 0.80
     358// 15 : 0.074 : 0.77
     359// 16 : 0.064 : 0.71
     360// 17 : 0.068 : 0.74
     361// 18 : 0.057 : 0.67
     362// 19 : 0.058 : 0.68
     363
     364// static float QGAUSS_Core[] = { 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0};
     365static float QGAUSS_Scale[] = {2.83, 2.28, 1.85, 1.58, 1.40, 1.26, 1.15, 1.09, 1.00, 0.96, 0.90, 0.87, 0.82, 0.81, 0.80, 0.77, 0.71, 0.74, 0.67, 0.68};
     366
     367psF64 PM_MODEL_SET_FWHM (const psVector *params, psF64 sigma) {
     368
     369    psF32 *PAR = params->data.F32;
     370
     371    float core = PAR[PM_PAR_7];
     372
     373    if (!isfinite(core)) return (2.0*M_SQRT2*sigma);
     374
     375    // QGAUSS_Core is defined as a set of integer steps, so we can simplify:
     376    int binCore = MAX(0, MIN (19, (int)core));
     377
     378    float scale = NAN;
     379    if (binCore == 0) {
     380        scale = (core - binCore + 0) * (QGAUSS_Scale[binCore + 1] - QGAUSS_Scale[binCore + 0]) + QGAUSS_Scale[binCore + 0];
     381    } else {
     382        scale = (core - binCore - 1) * (QGAUSS_Scale[binCore + 0] - QGAUSS_Scale[binCore - 1]) + QGAUSS_Scale[binCore - 1];
     383    }
     384
     385    return (scale * sigma);
     386}
     387
    339388bool PM_MODEL_FROM_PSF (pmModel *modelPSF, pmModel *modelFLT, const pmPSF *psf)
    340389{
     
    358407    // the 2D PSF model fits polarization terms (E0,E1,E2)
    359408    // convert to shape terms (SXX,SYY,SXY)
    360     bool useReff = pmModelUseReff (modelPSF->type);
     409    bool useReff = modelPSF->class->useReff;
    361410    if (!pmPSF_FitToModel (out, 0.1, useReff)) {
    362411        psTrace("psModules.objects", 5, "Failed to fit object at (r,c) = (%.1f,%.1f)", in[PM_PAR_YPOS], in[PM_PAR_XPOS]);
     
    416465    // the 2D PSF model fits polarization terms (E0,E1,E2)
    417466    // convert to shape terms (SXX,SYY,SXY)
    418     bool useReff = pmModelUseReff (model->type);
     467    bool useReff = model->class->useReff;
    419468    if (!pmPSF_FitToModel (PAR, 0.1, useReff)) {
    420469        psTrace ("psModules.objects", 3, "Failed to fit object at (r,c) = (%.1f,%.1f)", Xo, Yo);
Note: See TracChangeset for help on using the changeset viewer.