IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 5, 2006, 11:55:41 AM (20 years ago)
Author:
rhl
Message:

Check return codes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psphot/src/psphotApResid.c

    r7326 r7342  
    100100        pmPSF_MaskApTrend (psf->ApTrend, PM_PSF_CONSTANT);
    101101        psf->ApTrend  = psVectorClipFitPolynomial4D (psf->ApTrend, stats, mask, PSFTRY_MASK_ALL, apResid, dMag, xPos, yPos, r2rflux, flux);
    102 
    103         stats->clipIter = 3;
    104         pmPSF_MaskApTrend (psf->ApTrend, PM_PSF_CONSTANT);
    105         psf->ApTrend  = psVectorChiClipFitPolynomial4D (psf->ApTrend, stats, mask, PSFTRY_MASK_ALL, apResid, dMag, xPos, yPos, r2rflux, flux);
     102        if (psf->ApTrend == NULL) {
     103            psError(PSPHOT_ERR_PHOTOM, false, "clipping, fitting nothing");
     104            return false;
     105        }
     106
     107        // apply the fit
     108        stats->clipIter = 3;
     109        pmPSF_MaskApTrend (psf->ApTrend, PM_PSF_CONSTANT);
     110        psf->ApTrend  = psVectorChiClipFitPolynomial4D (psf->ApTrend, stats, mask, PSFTRY_MASK_ALL, apResid, dMag, xPos, yPos, r2rflux, flux);
     111        if (psf->ApTrend == NULL) {
     112            psError(PSPHOT_ERR_PHOTOM, false, "Fitting aperture correction");
     113            return false;
     114        }
    106115    }
    107116
     
    112121        pmPSF_MaskApTrend (psf->ApTrend, PM_PSF_CONSTANT);
    113122        psf->ApTrend  = psVectorClipFitPolynomial4D (psf->ApTrend, stats, mask, PSFTRY_MASK_ALL, apResid, dMag, xPos, yPos, r2rflux, flux);
     123        if (psf->ApTrend == NULL) {
     124            psError(PSPHOT_ERR_PHOTOM, false, "clipping, fitting nothing");
     125            return false;
     126        }
    114127
    115128        // apply the fit
     
    117130        pmPSF_MaskApTrend (psf->ApTrend, PM_PSF_SKYBIAS);
    118131        psf->ApTrend  = psVectorChiClipFitPolynomial4D (psf->ApTrend, stats, mask, PSFTRY_MASK_ALL, apResid, dMag, xPos, yPos, r2rflux, flux);
     132        if (psf->ApTrend == NULL) {
     133            psError(PSPHOT_ERR_PHOTOM, false, "clipping, fitting sky bias");
     134            return false;
     135        }
    119136    }
    120137
     
    124141        pmPSF_MaskApTrend (psf->ApTrend, PM_PSF_CONSTANT);
    125142        psf->ApTrend  = psVectorClipFitPolynomial4D (psf->ApTrend, stats, mask, PSFTRY_MASK_ALL, apResid, dMag, xPos, yPos, r2rflux, flux);
     143        if (psf->ApTrend == NULL) {
     144            psError(PSPHOT_ERR_PHOTOM, false, "clipping, fitting nothing");
     145            return false;
     146        }
    126147
    127148        // apply the fit
     
    129150        pmPSF_MaskApTrend (psf->ApTrend, PM_PSF_SKYBIAS);
    130151        psf->ApTrend  = psVectorChiClipFitPolynomial4D (psf->ApTrend, stats, mask, PSFTRY_MASK_ALL, apResid, dMag, xPos, yPos, r2rflux, flux);
     152        if (psf->ApTrend == NULL) {
     153            psError(PSPHOT_ERR_PHOTOM, false, "clipping, fitting sky bias");
     154            return false;
     155        }
    131156
    132157        // apply the fit
     
    134159        pmPSF_MaskApTrend (psf->ApTrend, PM_PSF_SKYSAT);
    135160        psf->ApTrend  = psVectorChiClipFitPolynomial4D (psf->ApTrend, stats, mask, PSFTRY_MASK_ALL, apResid, dMag, xPos, yPos, r2rflux, flux);
     161        if (psf->ApTrend == NULL) {
     162            psError(PSPHOT_ERR_PHOTOM, false, "clipping, fitting skysat");
     163            return false;
     164        }
    136165    }
    137166
     
    142171        pmPSF_MaskApTrend (psf->ApTrend, PM_PSF_CONSTANT);
    143172        psf->ApTrend  = psVectorClipFitPolynomial4D (psf->ApTrend, stats, mask, PSFTRY_MASK_ALL, apResid, dMag, xPos, yPos, r2rflux, flux);
     173        if (psf->ApTrend == NULL) {
     174            psError(PSPHOT_ERR_PHOTOM, false, "clipping, fitting nothing");
     175            return false;
     176        }
    144177
    145178        // apply the fit
     
    147180        pmPSF_MaskApTrend (psf->ApTrend, PM_PSF_XY_LIN);
    148181        psf->ApTrend  = psVectorChiClipFitPolynomial4D (psf->ApTrend, stats, mask, PSFTRY_MASK_ALL, apResid, dMag, xPos, yPos, r2rflux, flux);
     182        if (psf->ApTrend == NULL) {
     183            psError(PSPHOT_ERR_PHOTOM, false, "fitting, XY_LIN");
     184            return false;
     185        }
    149186    }
    150187
     
    155192        pmPSF_MaskApTrend (psf->ApTrend, PM_PSF_CONSTANT);
    156193        psf->ApTrend  = psVectorClipFitPolynomial4D (psf->ApTrend, stats, mask, PSFTRY_MASK_ALL, apResid, dMag, xPos, yPos, r2rflux, flux);
     194        if (psf->ApTrend == NULL) {
     195            psError(PSPHOT_ERR_PHOTOM, false, "clipping, fitting nothing");
     196            return false;
     197        }
    157198
    158199        // apply the fit
     
    160201        pmPSF_MaskApTrend (psf->ApTrend, PM_PSF_XY_QUAD);
    161202        psf->ApTrend  = psVectorChiClipFitPolynomial4D (psf->ApTrend, stats, mask, PSFTRY_MASK_ALL, apResid, dMag, xPos, yPos, r2rflux, flux);
     203        if (psf->ApTrend == NULL) {
     204            psError(PSPHOT_ERR_PHOTOM, false, "Fitting XY_QUAD");
     205            return false;
     206        }
    162207    }
    163208
     
    168213        pmPSF_MaskApTrend (psf->ApTrend, PM_PSF_CONSTANT);
    169214        psf->ApTrend  = psVectorClipFitPolynomial4D (psf->ApTrend, stats, mask, PSFTRY_MASK_ALL, apResid, dMag, xPos, yPos, r2rflux, flux);
     215        if (psf->ApTrend == NULL) {
     216            psError(PSPHOT_ERR_PHOTOM, false, "clipping, fitting nothing");
     217            return false;
     218        }
    170219
    171220        // apply the fit
     
    173222        pmPSF_MaskApTrend (psf->ApTrend, PM_PSF_SKY_XY_LIN);
    174223        psf->ApTrend  = psVectorChiClipFitPolynomial4D (psf->ApTrend, stats, mask, PSFTRY_MASK_ALL, apResid, dMag, xPos, yPos, r2rflux, flux);
     224        if (psf->ApTrend == NULL) {
     225            psError(PSPHOT_ERR_PHOTOM, false, "Fitting sky xy_lin");
     226            return false;
     227        }
    175228    }
    176229
     
    181234        pmPSF_MaskApTrend (psf->ApTrend, PM_PSF_CONSTANT);
    182235        psf->ApTrend  = psVectorClipFitPolynomial4D (psf->ApTrend, stats, mask, PSFTRY_MASK_ALL, apResid, dMag, xPos, yPos, r2rflux, flux);
     236        if (psf->ApTrend == NULL) {
     237            psError(PSPHOT_ERR_PHOTOM, false, "clipping, fitting nothing");
     238            return false;
     239        }
    183240
    184241        // apply the fit
     
    186243        pmPSF_MaskApTrend (psf->ApTrend, PM_PSF_SKYBIAS);
    187244        psf->ApTrend  = psVectorChiClipFitPolynomial4D (psf->ApTrend, stats, mask, PSFTRY_MASK_ALL, apResid, dMag, xPos, yPos, r2rflux, flux);
     245        if (psf->ApTrend == NULL) {
     246            psError(PSPHOT_ERR_PHOTOM, false, "clipping, fitting sky bias");
     247            return false;
     248        }
    188249
    189250        // apply the fit
     
    191252        pmPSF_MaskApTrend (psf->ApTrend, PM_PSF_SKYSAT_XY_LIN);
    192253        psf->ApTrend  = psVectorChiClipFitPolynomial4D (psf->ApTrend, stats, mask, PSFTRY_MASK_ALL, apResid, dMag, xPos, yPos, r2rflux, flux);
     254        if (psf->ApTrend == NULL) {
     255            psError(PSPHOT_ERR_PHOTOM, false, "Fitting skyset xy_lin");
     256            return false;
     257        }
    193258    }
    194259
     
    198263        pmPSF_MaskApTrend (psf->ApTrend, PM_PSF_CONSTANT);
    199264        psf->ApTrend  = psVectorClipFitPolynomial4D (psf->ApTrend, stats, mask, PSFTRY_MASK_ALL, apResid, dMag, xPos, yPos, r2rflux, flux);
     265        if (psf->ApTrend == NULL) {
     266            psError(PSPHOT_ERR_PHOTOM, false, "constant");
     267            return false;
     268        }
    200269
    201270        // fit just SkyBias and clip out objects which are too far from the median
     
    203272        pmPSF_MaskApTrend (psf->ApTrend, PM_PSF_SKYBIAS);
    204273        psf->ApTrend  = psVectorChiClipFitPolynomial4D (psf->ApTrend, stats, mask, PSFTRY_MASK_ALL, apResid, dMag, xPos, yPos, r2rflux, flux);
     274        if (psf->ApTrend == NULL) {
     275            psError(PSPHOT_ERR_PHOTOM, false, "fitting skyBias");
     276            return false;
     277        }
    205278
    206279        // finally, fit x, y, SkyBias and clip out objects which are too far from the median
     
    208281        pmPSF_MaskApTrend (psf->ApTrend, PM_PSF_ALL);
    209282        psf->ApTrend  = psVectorChiClipFitPolynomial4D (psf->ApTrend, stats, mask, PSFTRY_MASK_ALL, apResid, dMag, xPos, yPos, r2rflux, flux);
     283        if (psf->ApTrend == NULL) {
     284            psError(PSPHOT_ERR_PHOTOM, false, "fitting all");
     285            return false;
     286        }
    210287    }
    211288
Note: See TracChangeset for help on using the changeset viewer.