IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 35560 for trunk/psModules


Ignore:
Timestamp:
May 9, 2013, 12:19:21 PM (13 years ago)
Author:
eugene
Message:

do not crash psphot if variance is not supplied; include mask and mark in modelGuess functions (needed for trail angle guess); fix Reff sx,sy,sxx relationships; define new function to measure guess at the trail angle; tell pmSourceIO if MATCHED_REFS have been read (& skip); do not read sources for WCS type

Location:
trunk/psModules/src/objects
Files:
29 edited

Legend:

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

    r34403 r35560  
    295295// make an initial guess for parameters
    296296// 0.5 PIX: moments and peaks are in pixel coords, thus so are model parameters
    297 bool PM_MODEL_GUESS (pmModel *model, pmSource *source)
     297bool PM_MODEL_GUESS (pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal)
    298298{
    299299    psF32 *PAR  = model->params->data.F32;
  • trunk/psModules/src/objects/models/pmModel_DEV.h

    r29004 r35560  
    55psF32 pmModelFunc_DEV(psVector *deriv, const psVector *params, const psVector *pixcoord);
    66bool pmModelLimits_DEV(psMinConstraintMode mode, int nParam, float *params, float *beta);
    7 bool pmModelGuess_DEV(pmModel *model, pmSource *source);
     7bool pmModelGuess_DEV(pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal);
    88psF64 pmModelFlux_DEV(const psVector *params);
    99psF64 pmModelRadius_DEV(const psVector *params, psF64 flux);
  • trunk/psModules/src/objects/models/pmModel_EXP.c

    r34403 r35560  
    287287// make an initial guess for parameters
    288288// 0.5 PIX: moments and peaks are in pixel coords, thus so are model parameters
    289 bool PM_MODEL_GUESS (pmModel *model, pmSource *source)
     289bool PM_MODEL_GUESS (pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal)
    290290{
    291291    psF32 *PAR  = model->params->data.F32;
  • trunk/psModules/src/objects/models/pmModel_EXP.h

    r29004 r35560  
    55psF32 pmModelFunc_EXP(psVector *deriv, const psVector *params, const psVector *pixcoord);
    66bool pmModelLimits_EXP(psMinConstraintMode mode, int nParam, float *params, float *beta);
    7 bool pmModelGuess_EXP(pmModel *model, pmSource *source);
     7bool pmModelGuess_EXP(pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal);
    88psF64 pmModelFlux_EXP(const psVector *params);
    99psF64 pmModelRadius_EXP(const psVector *params, psF64 flux);
  • trunk/psModules/src/objects/models/pmModel_GAUSS.c

    r34403 r35560  
    192192// make an initial guess for parameters
    193193// 0.5 PIX: moments and peaks are in pixel coords, thus so are model parameters
    194 bool PM_MODEL_GUESS (pmModel *model, pmSource *source)
     194bool PM_MODEL_GUESS (pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal)
    195195{
    196196    psF32 *PAR  = model->params->data.F32;
  • trunk/psModules/src/objects/models/pmModel_GAUSS.h

    r25738 r35560  
    55psF32 pmModelFunc_GAUSS(psVector *deriv, const psVector *params, const psVector *pixcoord);
    66bool pmModelLimits_GAUSS(psMinConstraintMode mode, int nParam, float *params, float *beta);
    7 bool pmModelGuess_GAUSS(pmModel *model, pmSource *source);
     7bool pmModelGuess_GAUSS(pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal);
    88psF64 pmModelFlux_GAUSS(const psVector *params);
    99psF64 pmModelRadius_GAUSS(const psVector *params, psF64 flux);
  • trunk/psModules/src/objects/models/pmModel_PGAUSS.c

    r34403 r35560  
    193193// make an initial guess for parameters
    194194// 0.5 PIX: moments and peaks are in pixel coords, thus so are model parameters
    195 bool PM_MODEL_GUESS (pmModel *model, pmSource *source)
     195bool PM_MODEL_GUESS (pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal)
    196196{
    197197    psF32 *PAR  = model->params->data.F32;
  • trunk/psModules/src/objects/models/pmModel_PGAUSS.h

    r25738 r35560  
    55psF32 pmModelFunc_PGAUSS(psVector *deriv, const psVector *params, const psVector *pixcoord);
    66bool pmModelLimits_PGAUSS(psMinConstraintMode mode, int nParam, float *params, float *beta);
    7 bool pmModelGuess_PGAUSS(pmModel *model, pmSource *source);
     7bool pmModelGuess_PGAUSS(pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal);
    88psF64 pmModelFlux_PGAUSS(const psVector *params);
    99psF64 pmModelRadius_PGAUSS(const psVector *params, psF64 flux);
  • trunk/psModules/src/objects/models/pmModel_PS1_V1.c

    r34403 r35560  
    212212// make an initial guess for parameters
    213213// 0.5 PIX: moments and peaks are in pixel coords, thus so are model parameters
    214 bool PM_MODEL_GUESS (pmModel *model, pmSource *source)
     214bool PM_MODEL_GUESS (pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal)
    215215{
    216216    psF32 *PAR  = model->params->data.F32;
  • trunk/psModules/src/objects/models/pmModel_PS1_V1.h

    r25738 r35560  
    55psF32 pmModelFunc_PS1_V1(psVector *deriv, const psVector *params, const psVector *pixcoord);
    66bool pmModelLimits_PS1_V1(psMinConstraintMode mode, int nParam, float *params, float *beta);
    7 bool pmModelGuess_PS1_V1(pmModel *model, pmSource *source);
     7bool pmModelGuess_PS1_V1(pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal);
    88psF64 pmModelFlux_PS1_V1(const psVector *params);
    99psF64 pmModelRadius_PS1_V1(const psVector *params, psF64 flux);
  • trunk/psModules/src/objects/models/pmModel_QGAUSS.c

    r34403 r35560  
    213213// make an initial guess for parameters
    214214// 0.5 PIX: moments and peaks are in pixel coords, thus so are model parameters
    215 bool PM_MODEL_GUESS (pmModel *model, pmSource *source)
     215bool PM_MODEL_GUESS (pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal)
    216216{
    217217    psF32 *PAR  = model->params->data.F32;
  • trunk/psModules/src/objects/models/pmModel_QGAUSS.h

    r25738 r35560  
    55psF32 pmModelFunc_QGAUSS(psVector *deriv, const psVector *params, const psVector *pixcoord);
    66bool pmModelLimits_QGAUSS(psMinConstraintMode mode, int nParam, float *params, float *beta);
    7 bool pmModelGuess_QGAUSS(pmModel *model, pmSource *source);
     7bool pmModelGuess_QGAUSS(pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal);
    88psF64 pmModelFlux_QGAUSS(const psVector *params);
    99psF64 pmModelRadius_QGAUSS(const psVector *params, psF64 flux);
  • trunk/psModules/src/objects/models/pmModel_RGAUSS.c

    r34403 r35560  
    202202// make an initial guess for parameters
    203203// 0.5 PIX: moments and peaks are in pixel coords, thus so are model parameters
    204 bool PM_MODEL_GUESS (pmModel *model, pmSource *source)
     204bool PM_MODEL_GUESS (pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal)
    205205{
    206206    psF32 *PAR  = model->params->data.F32;
  • trunk/psModules/src/objects/models/pmModel_RGAUSS.h

    r25738 r35560  
    55psF32 pmModelFunc_RGAUSS(psVector *deriv, const psVector *params, const psVector *pixcoord);
    66bool pmModelLimits_RGAUSS(psMinConstraintMode mode, int nParam, float *params, float *beta);
    7 bool pmModelGuess_RGAUSS(pmModel *model, pmSource *source);
     7bool pmModelGuess_RGAUSS(pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal);
    88psF64 pmModelFlux_RGAUSS(const psVector *params);
    99psF64 pmModelRadius_RGAUSS(const psVector *params, psF64 flux);
  • trunk/psModules/src/objects/models/pmModel_SERSIC.c

    r34403 r35560  
    307307// make an initial guess for parameters
    308308// 0.5 PIX: moments and peaks are in pixel coords, thus so are model parameters
    309 bool PM_MODEL_GUESS (pmModel *model, pmSource *source)
     309bool PM_MODEL_GUESS (pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal)
    310310{
    311311    pmMoments *moments = source->moments;
  • trunk/psModules/src/objects/models/pmModel_SERSIC.h

    r25738 r35560  
    55psF32 pmModelFunc_SERSIC(psVector *deriv, const psVector *params, const psVector *pixcoord);
    66bool pmModelLimits_SERSIC(psMinConstraintMode mode, int nParam, float *params, float *beta);
    7 bool pmModelGuess_SERSIC(pmModel *model, pmSource *source);
     7bool pmModelGuess_SERSIC(pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal);
    88psF64 pmModelFlux_SERSIC(const psVector *params);
    99psF64 pmModelRadius_SERSIC(const psVector *params, psF64 flux);
  • trunk/psModules/src/objects/models/pmModel_TRAIL.c

    r35215 r35560  
    168168        dPAR[PM_PAR_THETA]  = PAR[PM_PAR_I0] * dPdT;
    169169        dPAR[PM_PAR_SIGMA]  = 0;        // we don't actually allow this to vary, so we do not need to calculate it
     170
     171        for (int i = 0; i < 7; i++) {
     172          if (isnan(dPAR[i])) {
     173            fprintf (stderr, "*");
     174          }
     175        }
     176    }
     177    if (isnan(f)) {
     178      fprintf (stderr, "!");
    170179    }
    171180    return(f);
     
    228237}
    229238
     239# define NA 21
     240# define NR 21
     241static float flux[NA][NR];
     242static float npix[NA][NR];
     243
     244bool pmTrailGetAngle (float *To, float *Io, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal, float sigma) {
     245
     246  float Xo, Yo;
     247  if (!pmModelSetPosition(&Xo, &Yo, source)) return false;
     248
     249  psImage *image = source->pixels;
     250  psImage *mask = source->maskObj;
     251  psF32 **imData = image->data.F32;
     252  psImageMaskType **mkData = mask->data.PS_TYPE_IMAGE_MASK_DATA;
     253
     254  // do a loop over the pixels, generating (dX,dY) dot (cos(theta),sin(theta))
     255  int dP;
     256  int dX = Xo - mask->col0;
     257  dP = mask->numCols - dX;
     258  int DX = PS_MAX(dP, dX);
     259  int NX = mask->numCols;
     260
     261  int dY = Yo - mask->row0;
     262  dP = mask->numRows - dY;
     263  int DY = PS_MAX(dP, dY);
     264  int NY = mask->numRows;
     265
     266  // just hard wire this for now...
     267  float radius = 10.0;
     268  float radius2 = PS_SQR(radius);
     269
     270  // we have an array of Angles x Radii
     271  float dT = M_PI / NA;
     272  for (int na = 0; na < NA; na++) {
     273    memset (flux[na], 0, NR*sizeof(float));
     274    memset (npix[na], 0, NR*sizeof(float));
     275  }
     276
     277  // we skip any pixels [real or virtual] outside of the specified radius (nominally the aperture radius)
     278  // ix and iy track pixels relative to the centroid
     279  for (int ix = -DX; ix < DX + 1; ix++) {
     280    if (ix > radius) continue;
     281    int mx = ix + dX;
     282    for (int iy = -DY; iy < DY + 1; iy++) {
     283      if (iy > radius) continue;
     284      if (ix*ix + iy*iy > radius2) continue;
     285      int my = iy + dY;
     286     
     287      // include count only the unmasked pixels within the image area
     288      if (mx < 0) continue;
     289      if (my < 0) continue;
     290      if (mx >= NX) continue;
     291      if (my >= NY) continue;
     292     
     293      // count pixels which are masked only with bad pixels
     294      if (mkData[my][mx] & maskVal)continue;
     295
     296      // we have defined NA to be 21
     297      int na = 0;
     298      for (float angle = 0.0; na < NA; angle += dT, na ++) {
     299
     300        // XXX optimization : pre-compute the angle sines and cosines
     301        float Rad = (ix * cos(angle)) + (iy * sin(angle));
     302        int nr = PS_MAX (PS_MIN (NR, Rad + 0.5*NR), 0);
     303
     304        flux[na][nr] += imData[my][mx];
     305        npix[na][nr] ++;
     306      }
     307    }
     308  }
     309
     310  // generate a psf model (with integral of 1.0)
     311  float Ao = 1.0 / sqrt(2*M_PI) / sigma;
     312  float psf[NR];
     313  for (int nr = 0; nr < NR; nr++) {
     314    psf[nr] = Ao*exp(-0.5*PS_SQR((nr - 0.5*NR)/sigma));
     315  }
     316
     317  float fangle[NA];
     318  for (int na = 0; na < NA; na++) {
     319    float fpsf = 0.0;
     320    for (int nr = 0; nr < NR; nr++) {
     321      fpsf += psf[nr]*flux[na][nr];
     322    }
     323    fangle[na] = fpsf;
     324    // fprintf (stderr, "fpsf: %f, theta = %f\n", fpsf, PS_DEG_RAD*dT*na);
     325  }
     326
     327  float peak = fangle[0];
     328  int pbin = 0;
     329  for (int na = 0; na < NA; na++) {
     330    if (fangle[na] > peak) {
     331      peak = fangle[na];
     332      pbin = na;
     333    }
     334  }
     335
     336  // result is peak, pbin -> angle
     337  *To = dT * pbin;
     338  *Io = peak * Ao;
     339 
     340  return true;
     341}
     342
    230343// make an initial guess for parameters
    231344// 0.5 PIX: moments and peaks are in pixel coords, thus so are model parameters
    232 bool PM_MODEL_GUESS (pmModel *model, pmSource *source)
     345bool PM_MODEL_GUESS (pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal)
    233346{
    234347    psF32 *PAR  = model->params->data.F32;
     
    260373    //else { size = psfAxes.major; }
    261374
     375    float theta, peak;
     376    pmTrailGetAngle (&theta, &peak, source, maskVal, markVal, psfAxes.major);
     377
    262378    // axes.major is a sigma in the major direction; scale to
    263379    PAR[PM_PAR_LENGTH] = 1.5*2.35*size; // a tophat of length L has L = 1.5 * 2.35 * sigma
     
    266382
    267383    // set the model normalization
    268     if (!pmModelSetNorm(&PAR[PM_PAR_I0], source)) {
    269       return false;
    270     }
     384    // if (!pmModelSetNorm(&PAR[PM_PAR_I0], source)) {
     385    //   return false;
     386    // }
     387    PAR[PM_PAR_I0] = peak;
    271388
    272389    // set the model position
  • trunk/psModules/src/objects/models/pmModel_TRAIL.h

    r34259 r35560  
    55psF32 pmModelFunc_TRAIL(psVector *deriv, const psVector *params, const psVector *pixcoord);
    66bool pmModelLimits_TRAIL(psMinConstraintMode mode, int nParam, float *params, float *beta);
    7 bool pmModelGuess_TRAIL(pmModel *model, pmSource *source);
     7bool pmModelGuess_TRAIL(pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal);
    88psF64 pmModelFlux_TRAIL(const psVector *params);
    99psF64 pmModelRadius_TRAIL(const psVector *params, psF64 flux);
  • trunk/psModules/src/objects/pmModelFuncs.h

    r34259 r35560  
    107107//  This function provides the model guess parameters based on the details of
    108108//  the given source.
    109 typedef bool (*pmModelGuessFunc)(pmModel *model, pmSource *source);
     109typedef bool (*pmModelGuessFunc)(pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal);
    110110
    111111//  This function constructs the PSF model for the given source based on the
  • trunk/psModules/src/objects/pmPSF.c

    r35455 r35560  
    350350        shape.sx  = modelPar[PM_PAR_SXX];
    351351        shape.sy  = modelPar[PM_PAR_SYY];
    352         shape.sxy = modelPar[PM_PAR_SXY]; // This is potentially wrong?
     352        shape.sxy = modelPar[PM_PAR_SXY] / 2.0;
     353        // XXX I *think* dividing by 2.0 is the right direction, but this
     354        // needs to be checked with a real test
    353355    } else {
    354356        shape.sx  = modelPar[PM_PAR_SXX] / M_SQRT2;
     
    392394        modelPar[PM_PAR_SXX] = shape.sx;
    393395        modelPar[PM_PAR_SYY] = shape.sy;
    394         modelPar[PM_PAR_SXY] = shape.sxy; // This is potentially wrong?
     396        modelPar[PM_PAR_SXY] = shape.sxy * 2.0; // XXX NEED factor of 2 here for correct angle conversion
    395397    } else {
    396398        modelPar[PM_PAR_SXX] = shape.sx * M_SQRT2;
  • trunk/psModules/src/objects/pmPSFtryFitEXT.c

    r34403 r35560  
    8383        }
    8484
    85         source->modelEXT = pmSourceModelGuess (source, options->type);
     85        source->modelEXT = pmSourceModelGuess (source, options->type, maskVal, markVal);
    8686        if (source->modelEXT == NULL) {
    8787            psTrace ("psModules.objects", 4, "masking %d (%d,%d) : failed to generate model guess\n", i, source->peak->x, source->peak->y);
  • trunk/psModules/src/objects/pmSourceFitModel.c

    r34403 r35560  
    7575    PS_ASSERT_PTR_NON_NULL(source->pixels, false);
    7676    PS_ASSERT_PTR_NON_NULL(source->maskObj, false);
    77     PS_ASSERT_PTR_NON_NULL(source->variance, false);
     77
     78    // XXX if variance is NULL, use pixels instead (wrong, but not badly wrong)
     79    // PS_ASSERT_PTR_NON_NULL(source->variance, false);
    7880
    7981    psBool fitStatus = true;
     
    9395    float Xo = model->params->data.F32[PM_PAR_XPOS];
    9496    float Yo = model->params->data.F32[PM_PAR_YPOS];
     97
     98    // if variance is NULL, we pretend pixels == variance
     99    float **vWgt = source->variance ? source->variance->data.F32 : source->pixels->data.F32;
    95100
    96101    // fill in the coordinate and value entries
     
    103108            }
    104109            // skip zero-variance points
    105             if (source->variance->data.F32[i][j] == 0) {
     110            if (vWgt[i][j] == 0) {
    106111                continue;
    107112            }
    108113            // skip nan values in image
    109114            if (!isfinite(source->pixels->data.F32[i][j])) {
     115                fprintf (stderr, "WARNING: unmasked nan in image : %x vs %x\n", source->maskObj->data.PS_TYPE_IMAGE_MASK_DATA[i][j], maskVal);
    110116                continue;
    111117            }
    112118
    113119            // skip nan values in image
    114             if (!isfinite(source->variance->data.F32[i][j])) {
    115                 fprintf (stderr, "impossible! %x vs %x\n", source->maskObj->data.PS_TYPE_IMAGE_MASK_DATA[i][j], maskVal);
     120            if (!isfinite(vWgt[i][j])) {
     121                fprintf (stderr, "WARNING: unmasked nan in variance : %x vs %x\n", source->maskObj->data.PS_TYPE_IMAGE_MASK_DATA[i][j], maskVal);
    116122                continue;
    117123            }
     
    140146            // source sky variance
    141147            if (options->poissonErrors) {
    142                 yErr->data.F32[nPix] = 1.0 / source->variance->data.F32[i][j];
     148                yErr->data.F32[nPix] = 1.0 / vWgt[i][j];
    143149            } else {
    144150                yErr->data.F32[nPix] = 1.0 / options->weight;
  • trunk/psModules/src/objects/pmSourceFitPCM.c

    r34403 r35560  
    145145bool pmSourceModelGuessPCM (pmPCMdata *pcm, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal) {
    146146
    147     if (!pcm->modelConv->modelGuess(pcm->modelConv, source)) {
     147  if (!pcm->modelConv->modelGuess(pcm->modelConv, source, maskVal, markVal)) {
    148148        return false;
    149149    }
  • trunk/psModules/src/objects/pmSourceIO.c

    r34720 r35560  
    980980            return false;
    981981        }
     982
    982983        // if this is not TRUE, the output files only contain the psf measurements.
    983984        bool XSRC_OUTPUT = psMetadataLookupBool(&status, recipe, "EXTENDED_SOURCE_ANALYSIS");
     
    10051006            hdu->header = psFitsReadHeader (NULL, file->fits);
    10061007        }
     1008
     1009        // "WCS" is CMF without detected objects
     1010        if (file->type == PM_FPA_FILE_WCS) {
     1011          psTrace("psModules.objects", 6, "read CMF table from %s : %s : %s", file->filename, headname, dataname);
     1012          psFree (headname);
     1013          psFree (dataname);
     1014          psFree (deteffname);
     1015          break;
     1016        }
     1017
     1018        // EXTDATA is the PSF data associated with this image header
    10071019
    10081020        // we need to find the corresponding table EXTNAME.
     
    11261138    readout->data_exists = true;
    11271139
     1140    // if we have a prior set of detections on this readout, we will replace them here
    11281141    pmDetections *detections = pmDetectionsAlloc();
    11291142    detections->allSources = sources;
    1130     status = psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSPHOT.DETECTIONS", PS_DATA_ARRAY, "input sources", detections);
     1143    status = psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSPHOT.DETECTIONS", PS_DATA_ARRAY | PS_META_REPLACE, "input sources", detections);
    11311144    psFree (detections);
    11321145    return true;
  • trunk/psModules/src/objects/pmSourceIO_MatchedRefs.c

    r34403 r35560  
    200200    psFree (rows);
    201201
     202    // note that we have already read this dataa
     203    psMetadataAddBool (fpa->analysis, PS_LIST_TAIL, "READ.REFMATCH", PS_META_REPLACE, "attempted to read MATCHED_REFS", true);
     204
    202205    return true;
    203206}
  • trunk/psModules/src/objects/pmSourceMoments.c

    r34403 r35560  
    151151
    152152        float *vPix = source->pixels->data.F32[row];
    153         float *vWgt = source->variance->data.F32[row];
     153        float *vWgt = source->variance ? source->variance->data.F32[row] : source->pixels->data.F32[row];
    154154
    155155        psImageMaskType  *vMsk = (source->maskObj == NULL) ? NULL : source->maskObj->data.PS_TYPE_IMAGE_MASK_DATA[row];
     
    266266
    267267    float **vPix = source->pixels->data.F32;
    268     float **vWgt = source->variance->data.F32;
    269     psImageMaskType  **vMsk = (source->maskObj == NULL) ? NULL : source->maskObj->data.PS_TYPE_IMAGE_MASK_DATA;
     268    float **vWgt = source->variance ? source->variance->data.F32 : source->pixels->data.F32;
     269    psImageMaskType **vMsk = (source->maskObj == NULL) ? NULL : source->maskObj->data.PS_TYPE_IMAGE_MASK_DATA;
    270270
    271271    float RF = 0.0;
     
    467467
    468468        float *vPix = source->pixels->data.F32[row];
    469         float *vWgt = source->variance->data.F32[row];
     469        float *vWgt = source->variance ? source->variance->data.F32[row] : source->pixels->data.F32[row];
    470470
    471471        psImageMaskType *vMsk = (source->maskObj == NULL) ? NULL : source->maskObj->data.PS_TYPE_IMAGE_MASK_DATA[row];
  • trunk/psModules/src/objects/pmSourceSky.c

    r34403 r35560  
    122122    psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__);
    123123    PS_ASSERT_PTR_NON_NULL(source, false);
    124     PS_ASSERT_IMAGE_NON_NULL(source->variance, false);
    125124    PS_ASSERT_IMAGE_NON_NULL(source->maskObj, false);
    126125    PS_ASSERT_PTR_NON_NULL(source->peak, false);
    127126    PS_ASSERT_INT_POSITIVE(Radius, false);
     127
     128    if (source->variance == NULL) {
     129      // XXX this is needed so psphotCheckRadiusPSF has a real value
     130      source->moments->dSky = 1.0;
     131      return true;
     132    }
    128133
    129134    // maskVal is used to test for rejected pixels, and must include markVal
  • trunk/psModules/src/objects/pmSourceUtils.c

    r34403 r35560  
    4646
    4747/******************************************************************************
    48     pmSourceModelGuess(source, model): This function allocates a new
    49     pmModel structure based on the given modelType specified in the argument list.
    50     The corresponding pmModelGuess function is returned, and used to
    51     supply the values of the params array in the pmModel structure.
     48    pmSourceModelGuess(source, model, maskVal, markVal): This function allocates a new
     49    pmModel structure based on the given modelType specified in the argument list.  The
     50    corresponding pmModelGuess function is returned, and used to supply the values of the
     51    params array in the pmModel structure.
    5252 
    5353    XXX: Many parameters are based on the src->moments structure, which is in
     
    5555    functions will be in image, not subImage coords.  Remember this.
    5656*****************************************************************************/
    57 pmModel *pmSourceModelGuess(pmSource *source,
    58                             pmModelType modelType)
     57pmModel *pmSourceModelGuess(pmSource *source, pmModelType modelType, psImageMaskType maskVal, psImageMaskType markVal)
    5958{
    6059    psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__);
     
    6564    pmModel *model = pmModelAlloc(modelType);
    6665
    67     if (!model->modelGuess(model, source)) {
     66    if (!model->modelGuess(model, source, maskVal, markVal)) {
    6867        psFree (model);
    6968        return NULL;
  • trunk/psModules/src/objects/pmSourceUtils.h

    r31451 r35560  
    2727pmModel *pmSourceModelGuess(
    2828    pmSource *source,   ///< The input pmSource
    29     pmModelType model   ///< The type of model to be created.
     29    pmModelType model,   ///< The type of model to be created.
     30    psImageMaskType maskVal,
     31    psImageMaskType markVal
    3032);
    3133
Note: See TracChangeset for help on using the changeset viewer.