IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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;
Note: See TracChangeset for help on using the changeset viewer.