IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 2206


Ignore:
Timestamp:
Oct 26, 2004, 3:15:47 PM (22 years ago)
Author:
gusciora
Message:

...

Location:
trunk/psLib/src
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/astro/psCoord.c

    r2204 r2206  
    1010*  @author George Gusciora, MHPCC
    1111*
    12 *  @version $Revision: 1.29 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2004-10-27 00:57:30 $
     12*  @version $Revision: 1.30 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2004-10-27 01:15:47 $
    1414*
    1515*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    8181                               const psPlane* coords)
    8282{
    83     PS_CHECK_NULL_PTR_RETURN_NULL(transform);
    84     PS_CHECK_NULL_PTR_RETURN_NULL(coords);
     83    PS_CHECK_NULL_PTR(transform, NULL);
     84    PS_CHECK_NULL_PTR(coords, NULL);
    8585    if (out == NULL) {
    8686        out = (psPlane* ) psAlloc(sizeof(psPlane));
     
    117117                             float magnitude)
    118118{
    119     PS_CHECK_NULL_PTR_RETURN_NULL(transform);
    120     PS_CHECK_NULL_PTR_RETURN_NULL(coords);
     119    PS_CHECK_NULL_PTR(transform, NULL);
     120    PS_CHECK_NULL_PTR(coords, NULL);
    121121    if (out == NULL) {
    122122        out = (psPlane* ) psAlloc(sizeof(psPlane));
     
    156156                                 const psSphere* coord)
    157157{
    158     PS_CHECK_NULL_PTR_RETURN_NULL(transform);
    159     PS_CHECK_NULL_PTR_RETURN_NULL(coord);
     158    PS_CHECK_NULL_PTR(transform, NULL);
     159    PS_CHECK_NULL_PTR(coord, NULL);
    160160    double sinY = 0.0;
    161161    double cosY = 0.0;
     
    228228                   const psProjection* projection)
    229229{
    230     PS_CHECK_NULL_PTR_RETURN_NULL(coord);
    231     PS_CHECK_NULL_PTR_RETURN_NULL(projection);
     230    PS_CHECK_NULL_PTR(coord, NULL);
     231    PS_CHECK_NULL_PTR(projection, NULL);
    232232
    233233    float R = 0.0;
     
    280280                      const psProjection* projection)
    281281{
    282     PS_CHECK_NULL_PTR_RETURN_NULL(coord);
    283     PS_CHECK_NULL_PTR_RETURN_NULL(projection);
     282    PS_CHECK_NULL_PTR(coord, NULL);
     283    PS_CHECK_NULL_PTR(projection, NULL);
    284284
    285285    float R = 0.0;
     
    348348                            psSphereOffsetUnit unit)
    349349{
    350     PS_CHECK_NULL_PTR_RETURN_NULL(position1);
    351     PS_CHECK_NULL_PTR_RETURN_NULL(position2);
     350    PS_CHECK_NULL_PTR(position1, NULL);
     351    PS_CHECK_NULL_PTR(position2, NULL);
    352352
    353353    psPlane* lin;
     
    416416                            psSphereOffsetUnit unit)
    417417{
    418     PS_CHECK_NULL_PTR_RETURN_NULL(position);
    419     PS_CHECK_NULL_PTR_RETURN_NULL(offset);
     418    PS_CHECK_NULL_PTR(position, NULL);
     419    PS_CHECK_NULL_PTR(offset, NULL);
    420420
    421421    psPlane lin;
  • trunk/psLib/src/astronomy/psAstrometry.c

    r2204 r2206  
    88 *  @author George Gusciora, MHPCC
    99 *
    10  *  @version $Revision: 1.43 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2004-10-27 00:57:30 $
     10 *  @version $Revision: 1.44 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2004-10-27 01:15:47 $
    1212 *
    1313 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    5858static psS32 isProjectionLinear(psPlaneTransform *transform)
    5959{
    60     psS32 i = 0;
    61     PS_CHECK_NULL_PTR_RETURN_ZERO(transform);
     60    int i = 0;
     61    PS_CHECK_NULL_PTR(transform, 0);
    6262
    6363    for (i=2;i<(transform->x->nX);i++) {
     
    114114    double F = transform->y->coeff[0][1];
    115115
    116     PS_CHECK_NULL_PTR_RETURN_NULL(transform);
     116    PS_CHECK_NULL_PTR(transform, NULL);
    117117    psPlaneTransform *out = psAlloc(sizeof(psPlaneTransform));
    118118
     
    286286                            const psObservatory* observatory)
    287287{
    288     PS_CHECK_NULL_PTR_RETURN_NULL(observatory);
     288    PS_CHECK_NULL_PTR(observatory, NULL);
    289289    psExposure* exp = psAlloc(sizeof(psExposure));
    290290
     
    463463psGrommit* psGrommitAlloc(const psExposure* exp)
    464464{
    465     PS_CHECK_NULL_PTR_RETURN_NULL(exp);
     465    PS_CHECK_NULL_PTR(exp, NULL);
    466466
    467467    double date = psTimeToMJD(exp->time);
     
    493493                    const psFPA* FPA)
    494494{
    495     PS_CHECK_NULL_PTR_RETURN_NULL(fpaCoord);
    496     PS_CHECK_NULL_PTR_RETURN_NULL(FPA);
     495    PS_CHECK_NULL_PTR(fpaCoord, NULL);
     496    PS_CHECK_NULL_PTR(FPA, NULL);
    497497    psChip* tmpChip = NULL;
    498498    psPlane chipCoord;
     
    517517                    const psFPA* FPA)
    518518{
    519     PS_CHECK_NULL_PTR_RETURN_NULL(fpaCoord);
    520     PS_CHECK_NULL_PTR_RETURN_NULL(FPA);
    521     PS_CHECK_NULL_PTR_RETURN_NULL(FPA->chips);
     519    PS_CHECK_NULL_PTR(fpaCoord, NULL);
     520    PS_CHECK_NULL_PTR(FPA, NULL);
     521    PS_CHECK_NULL_PTR(FPA->chips, NULL);
    522522    psArray* chips = FPA->chips;
    523523    psS32 nChips = chips->n;
     
    545545                     const psChip* chip)
    546546{
    547     PS_CHECK_NULL_PTR_RETURN_NULL(chipCoord);
    548     PS_CHECK_NULL_PTR_RETURN_NULL(chip);
     547    PS_CHECK_NULL_PTR(chipCoord, NULL);
     548    PS_CHECK_NULL_PTR(chip, NULL);
    549549
    550550    psPlane cellCoord;
     
    588588                           const psCell* cell)
    589589{
    590     PS_CHECK_NULL_PTR_RETURN_NULL(inCoord);
    591     PS_CHECK_NULL_PTR_RETURN_NULL(cell);
     590    PS_CHECK_NULL_PTR(inCoord, NULL);
     591    PS_CHECK_NULL_PTR(cell, NULL);
    592592
    593593    return (psPlaneTransformApply(outCoord, cell->toChip, inCoord));
     
    598598                          const psChip* chip)
    599599{
    600     PS_CHECK_NULL_PTR_RETURN_NULL(inCoord);
    601     PS_CHECK_NULL_PTR_RETURN_NULL(chip);
     600    PS_CHECK_NULL_PTR(inCoord, NULL);
     601    PS_CHECK_NULL_PTR(chip, NULL);
    602602
    603603    return (psPlaneTransformApply(outCoord, chip->toFPA, inCoord));
     
    610610                        const psFPA* fpa)
    611611{
    612     PS_CHECK_NULL_PTR_RETURN_NULL(inCoord);
    613     PS_CHECK_NULL_PTR_RETURN_NULL(fpa);
     612    PS_CHECK_NULL_PTR(inCoord, NULL);
     613    PS_CHECK_NULL_PTR(fpa, NULL);
    614614
    615615    return(psPlaneDistortApply(outCoord, fpa->toTangentPlane, inCoord,
     
    624624                         const psGrommit* grommit)
    625625{
    626     PS_CHECK_NULL_PTR_RETURN_NULL(tpCoord);
    627     PS_CHECK_NULL_PTR_RETURN_NULL(grommit);
     626    PS_CHECK_NULL_PTR(tpCoord, NULL);
     627    PS_CHECK_NULL_PTR(grommit, NULL);
    628628
    629629    double AOB = 0.0;
     
    644644                          const psCell* cell)
    645645{
    646     PS_CHECK_NULL_PTR_RETURN_NULL(cellCoord);
    647     PS_CHECK_NULL_PTR_RETURN_NULL(cell);
     646    PS_CHECK_NULL_PTR(cellCoord, NULL);
     647    PS_CHECK_NULL_PTR(cell, NULL);
    648648
    649649    return (psPlaneTransformApply(fpaCoord, cell->toFPA, cellCoord));
     
    656656                           const psCell* cell)
    657657{
    658     PS_CHECK_NULL_PTR_RETURN_NULL(cellCoord);
    659     PS_CHECK_NULL_PTR_RETURN_NULL(cell);
     658    PS_CHECK_NULL_PTR(cellCoord, NULL);
     659    PS_CHECK_NULL_PTR(cell, NULL);
    660660
    661661    psPlane* fpaCoord = NULL;
     
    688688                                const psCell* cell)
    689689{
    690     PS_CHECK_NULL_PTR_RETURN_NULL(cellCoord);
    691     PS_CHECK_NULL_PTR_RETURN_NULL(cell);
     690    PS_CHECK_NULL_PTR(cellCoord, NULL);
     691    PS_CHECK_NULL_PTR(cell, NULL);
    692692
    693693    psPlane *tpCoord = NULL;
     
    724724                        const psGrommit* grommit)
    725725{
    726     PS_CHECK_NULL_PTR_RETURN_NULL(in);
    727     PS_CHECK_NULL_PTR_RETURN_NULL(grommit);
     726    PS_CHECK_NULL_PTR(in, NULL);
     727    PS_CHECK_NULL_PTR(grommit, NULL);
    728728
    729729    char* type = "RA";
     
    745745                        const psFPA* fpa)
    746746{
    747     PS_CHECK_NULL_PTR_RETURN_NULL(tpCoord);
    748     PS_CHECK_NULL_PTR_RETURN_NULL(fpa);
     747    PS_CHECK_NULL_PTR(tpCoord, NULL);
     748    PS_CHECK_NULL_PTR(fpa, NULL);
    749749
    750750    return (psPlaneDistortApply(fpaCoord, fpa->fromTangentPlane,
     
    756756                          const psChip* chip)
    757757{
    758     PS_CHECK_NULL_PTR_RETURN_NULL(fpaCoord);
    759     PS_CHECK_NULL_PTR_RETURN_NULL(chip);
    760     PS_CHECK_NULL_PTR_RETURN_NULL(chip->parent);
     758    PS_CHECK_NULL_PTR(fpaCoord, NULL);
     759    PS_CHECK_NULL_PTR(chip, NULL);
     760    PS_CHECK_NULL_PTR(chip->parent, NULL);
    761761
    762762    chipCoord = psPlaneTransformApply(chipCoord, chip->fromFPA, fpaCoord);
     
    768768                           const psCell* cell)
    769769{
    770     PS_CHECK_NULL_PTR_RETURN_NULL(chipCoord);
    771     PS_CHECK_NULL_PTR_RETURN_NULL(cell);
    772     PS_CHECK_NULL_PTR_RETURN_NULL(cell->parent);
     770    PS_CHECK_NULL_PTR(chipCoord, NULL);
     771    PS_CHECK_NULL_PTR(cell, NULL);
     772    PS_CHECK_NULL_PTR(cell->parent, NULL);
    773773
    774774    cellCoord = psPlaneTransformApply(cellCoord, cell->fromChip, chipCoord);
     
    782782                          const psCell* cell)
    783783{
    784     PS_CHECK_NULL_PTR_RETURN_NULL(skyCoord);
    785     PS_CHECK_NULL_PTR_RETURN_NULL(cell);
     784    PS_CHECK_NULL_PTR(skyCoord, NULL);
     785    PS_CHECK_NULL_PTR(cell, NULL);
    786786
    787787    psChip *parChip = cell->parent;
     
    813813                               const psCell* cell)
    814814{
    815     PS_CHECK_NULL_PTR_RETURN_NULL(skyCoord);
    816     PS_CHECK_NULL_PTR_RETURN_NULL(cell);
     815    PS_CHECK_NULL_PTR(skyCoord, NULL);
     816    PS_CHECK_NULL_PTR(cell, NULL);
    817817
    818818    psPlane *tpCoord = NULL;
  • trunk/psLib/src/astronomy/psCoord.c

    r2204 r2206  
    1010*  @author George Gusciora, MHPCC
    1111*
    12 *  @version $Revision: 1.29 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2004-10-27 00:57:30 $
     12*  @version $Revision: 1.30 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2004-10-27 01:15:47 $
    1414*
    1515*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    8181                               const psPlane* coords)
    8282{
    83     PS_CHECK_NULL_PTR_RETURN_NULL(transform);
    84     PS_CHECK_NULL_PTR_RETURN_NULL(coords);
     83    PS_CHECK_NULL_PTR(transform, NULL);
     84    PS_CHECK_NULL_PTR(coords, NULL);
    8585    if (out == NULL) {
    8686        out = (psPlane* ) psAlloc(sizeof(psPlane));
     
    117117                             float magnitude)
    118118{
    119     PS_CHECK_NULL_PTR_RETURN_NULL(transform);
    120     PS_CHECK_NULL_PTR_RETURN_NULL(coords);
     119    PS_CHECK_NULL_PTR(transform, NULL);
     120    PS_CHECK_NULL_PTR(coords, NULL);
    121121    if (out == NULL) {
    122122        out = (psPlane* ) psAlloc(sizeof(psPlane));
     
    156156                                 const psSphere* coord)
    157157{
    158     PS_CHECK_NULL_PTR_RETURN_NULL(transform);
    159     PS_CHECK_NULL_PTR_RETURN_NULL(coord);
     158    PS_CHECK_NULL_PTR(transform, NULL);
     159    PS_CHECK_NULL_PTR(coord, NULL);
    160160    double sinY = 0.0;
    161161    double cosY = 0.0;
     
    228228                   const psProjection* projection)
    229229{
    230     PS_CHECK_NULL_PTR_RETURN_NULL(coord);
    231     PS_CHECK_NULL_PTR_RETURN_NULL(projection);
     230    PS_CHECK_NULL_PTR(coord, NULL);
     231    PS_CHECK_NULL_PTR(projection, NULL);
    232232
    233233    float R = 0.0;
     
    280280                      const psProjection* projection)
    281281{
    282     PS_CHECK_NULL_PTR_RETURN_NULL(coord);
    283     PS_CHECK_NULL_PTR_RETURN_NULL(projection);
     282    PS_CHECK_NULL_PTR(coord, NULL);
     283    PS_CHECK_NULL_PTR(projection, NULL);
    284284
    285285    float R = 0.0;
     
    348348                            psSphereOffsetUnit unit)
    349349{
    350     PS_CHECK_NULL_PTR_RETURN_NULL(position1);
    351     PS_CHECK_NULL_PTR_RETURN_NULL(position2);
     350    PS_CHECK_NULL_PTR(position1, NULL);
     351    PS_CHECK_NULL_PTR(position2, NULL);
    352352
    353353    psPlane* lin;
     
    416416                            psSphereOffsetUnit unit)
    417417{
    418     PS_CHECK_NULL_PTR_RETURN_NULL(position);
    419     PS_CHECK_NULL_PTR_RETURN_NULL(offset);
     418    PS_CHECK_NULL_PTR(position, NULL);
     419    PS_CHECK_NULL_PTR(offset, NULL);
    420420
    421421    psPlane lin;
  • trunk/psLib/src/dataManip/psConstants.h

    r2204 r2206  
    66 *  @author GLG, MHPCC
    77 *
    8  *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2004-10-27 00:57:31 $
     8 *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2004-10-27 01:15:47 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    9494
    9595/** Preprocessor macro to generate error on an incorrect type */
    96 #define PS_CHECK_VECTOR_TYPE_RETURN_NULL(NAME, TYPE) \
     96#define PS_CHECK_VECTOR_TYPE(NAME, TYPE, RVAL) \
    9797if (NAME->type.type != TYPE) { \
    9898    psError(__func__,"Unallowable operation: %s has incorrect type.", #NAME); \
    99     return(NULL); \
     99    return(RVAL); \
    100100}
    101101
    102102/** Preprocessor macro to generate error on a NULL vector */
    103 #define PS_CHECK_NULL_VECTOR_RETURN_NULL(NAME) \
     103#define PS_CHECK_NULL_VECTOR(NAME, RVAL) \
    104104if (NAME == NULL || NAME->data.V == NULL) { \
    105105    psError(__func__,"Unallowable operation: %s or its data is NULL.", #NAME); \
    106     return(NULL); \
    107 } \
    108 
    109 /** Preprocessor macro to generate error on a NULL vector */
    110 #define PS_CHECK_NULL_VECTOR_RETURN_F0(NAME) \
    111 if (NAME == NULL || NAME->data.V == NULL) { \
    112     psError(__func__,"Unallowable operation: %s or its data is NULL.", #NAME); \
    113     return(0.0); \
     106    return(RVAL); \
    114107} \
    115108
    116109/** Preprocessor macro to generate error on a NULL poniter */
    117 #define PS_CHECK_NULL_PTR_RETURN_NULL(NAME) \
     110#define PS_CHECK_NULL_PTR(NAME, RVAL) \
    118111if (NAME == NULL) { \
    119112    psError(__func__,"Unallowable operation: %s is NULL.", #NAME); \
    120     return(NULL); \
    121 }
    122 
    123 /** Preprocessor macro to generate error on a NULL poniter */
    124 #define PS_CHECK_NULL_PTR_RETURN_F0(NAME) \
    125 if (NAME == NULL) { \
    126     psError(__func__,"Unallowable operation: %s is NULL.", #NAME); \
    127     return(0.0); \
    128 }
    129 
    130 /** Preprocessor macro to generate error on a NULL poniter */
    131 #define PS_CHECK_NULL_PTR_RETURN_ZERO(NAME) \
    132 if (NAME == NULL) { \
    133     psError(__func__,"Unallowable operation: %s is NULL.", #NAME); \
    134     return(0); \
    135 }
     113    return(RVAL); \
     114}
     115
     116
    136117
    137118/** Preprocessor macro to generate error for zero length vector */
  • trunk/psLib/src/dataManip/psMinimize.c

    r2204 r2206  
    77 *  fit a 1-D polynomial to a set of data points.
    88 *
    9  *  @author GLF, MHPCC
     9 *  @author GLG, MHPCC
    1010 *
    11  *  @version $Revision: 1.61 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2004-10-27 00:57:31 $
     11 *  @version $Revision: 1.62 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2004-10-27 01:15:47 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    252252    static psVector *yErr32Static = NULL;
    253253
    254     PS_CHECK_NULL_PTR_RETURN_NULL(mySpline);
    255     PS_CHECK_NULL_PTR_RETURN_NULL(y);
     254    PS_CHECK_NULL_PTR(mySpline, NULL);
     255    PS_CHECK_NULL_PTR(y, NULL);
    256256    VECTOR_CHECK_TYPE_F32_OR_F64_RETURN_NULL(y);
    257257    CONVERT_VECTOR_F64_TO_F32(y, y32, y32Static);
     
    425425                        psMinimizeLMChi2Func func)
    426426{
    427     PS_CHECK_NULL_PTR_RETURN_NULL(min);
    428     PS_CHECK_NULL_VECTOR_RETURN_NULL(params);
     427    PS_CHECK_NULL_PTR(min, NULL);
     428    PS_CHECK_NULL_VECTOR(params, NULL);
    429429    PS_CHECK_EMPTY_VECTOR_RETURN_NULL(params);
    430     PS_CHECK_NULL_PTR_RETURN_NULL(x);
    431     PS_CHECK_NULL_VECTOR_RETURN_NULL(y);
     430    PS_CHECK_NULL_PTR(x, NULL);
     431    PS_CHECK_NULL_VECTOR(y, NULL);
    432432    PS_CHECK_EMPTY_VECTOR_RETURN_NULL(y);
    433433    PS_CHECK_VECTOR_SIZE_EQUAL_RETURN_NULL(x, y);
     
    856856    psPolynomial1D *tmpPoly;
    857857    PS_CHECK_NULL_1DPOLY_RETURN_NULL(myPoly);
    858     PS_CHECK_NULL_VECTOR_RETURN_NULL(y);
     858    PS_CHECK_NULL_VECTOR(y, NULL);
    859859    PS_CHECK_EMPTY_VECTOR_RETURN_NULL(y);
    860860    psVector *x64 = NULL;
     
    13191319                        psMinimizePowellFunc func)
    13201320{
    1321     PS_CHECK_NULL_VECTOR_RETURN_NULL(params);
     1321    PS_CHECK_NULL_VECTOR(params, NULL);
    13221322    PS_CHECK_EMPTY_VECTOR_RETURN_NULL(params);
    1323     PS_CHECK_NULL_PTR_RETURN_NULL(min);
    1324     PS_CHECK_NULL_PTR_RETURN_NULL(coords);
    1325     PS_CHECK_NULL_PTR_RETURN_NULL(func);
     1323    PS_CHECK_NULL_PTR(min, NULL);
     1324    PS_CHECK_NULL_PTR(coords, NULL);
     1325    PS_CHECK_NULL_PTR(func, NULL);
    13261326
    13271327    psS32 numDims = params->n;
  • trunk/psLib/src/dataManip/psMinimize.h

    r2204 r2206  
    88 *  @author GLG, MHPCC
    99 *
    10  *  @version $Revision: 1.32 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2004-10-27 00:57:31 $
     10 *  @version $Revision: 1.33 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2004-10-27 01:15:47 $
    1212 *
    1313 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    8888                                  const psArray *x);
    8989
     90/*
     91psVector *psMinimizeLMChi2Gauss1D(psImage *deriv,
     92                                  const psVector *params,
     93                                  const psArray *coords)
     94{
     95    psVector *x = (psVector *) coords->data[0];
     96    psVector *y = (psVector *) coords->data[1];
     97    psVector *yErr = NULL;
     98    int i;
     99    int j;
     100    float normalization = params->data.F32[0];
     101    float center = params->data.F32[1];
     102    float stdev = params->data.F32[2];
     103    psVector *out = psVectorAlloc(x->n, PS_TYPE_F32);
     104 
     105 
     106    if (deriv == NULL) {
     107        deriv = psImageAlloc(params->n, x->n, PS_TYPE_F32);
     108    }
     109 
     110    if (coords->n == 2) {
     111        yErr = (psVector *) coords->data[2];
     112    }
     113 
     114    for (i=0;i<x->n;i++) {
     115        out->data.F32[i] = psGaussian(x->data.F32[i], center, stdev, 1);
     116    }
     117 
     118    for (i=0;i<x->n;i++) {
     119        for (j=0;j<params->n;j++) {
     120            deriv->data.F32[i][j] = the derivative of the gaussian w.r.t. the j-th parameter at the coord x[i]
     121        }
     122    }
     123    return(out);
     124}
     125*/
     126
    90127psBool psMinimizeLMChi2(psMinimization *min,
    91128                        psImage *covar,
  • trunk/psLib/src/dataManip/psStats.c

    r2204 r2206  
    99 *  @author GLG, MHPCC
    1010 *
    11  *  @version $Revision: 1.69 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2004-10-27 00:57:31 $
     11 *  @version $Revision: 1.70 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2004-10-27 01:15:47 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    17331733        return(stats);
    17341734    }
    1735     PS_CHECK_NULL_PTR_RETURN_NULL(stats);
     1735    PS_CHECK_NULL_PTR(stats, NULL);
    17361736
    17371737    inF32 = p_psConvertToF32((psVector *) in);
     
    17471747    if (mask != NULL) {
    17481748        PS_CHECK_VECTOR_SIZE_EQUAL_RETURN_NULL(mask, in);
    1749         PS_CHECK_VECTOR_TYPE_RETURN_NULL(mask, PS_TYPE_U8);
     1749        PS_CHECK_VECTOR_TYPE(mask, PS_TYPE_U8, NULL);
    17501750    }
    17511751    // ************************************************************************
  • trunk/psLib/src/image/psImageStats.c

    r2204 r2206  
    99*  @author GLG, MHPCC
    1010*
    11 *  @version $Revision: 1.44 $ $Name: not supported by cvs2svn $
    12 *  @date $Date: 2004-10-27 00:57:31 $
     11*  @version $Revision: 1.45 $ $Name: not supported by cvs2svn $
     12*  @date $Date: 2004-10-27 01:15:47 $
    1313*
    1414*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    101101    NOTE: We assume that the psHistogram structure out has already been
    102102    allocated and initialized.
    103     NOTE: verify that image/mask have the, correct types and sizes.
     103    NOTE: verify that image/mask have the correct types and sizes.
    104104 *****************************************************************************/
    105105psHistogram* psImageHistogram(psHistogram* out,
     
    112112
    113113    // NOTE: Verify this action.
    114     PS_CHECK_NULL_PTR_RETURN_NULL(out);
    115     PS_CHECK_NULL_PTR_RETURN_NULL(in);
     114    PS_CHECK_NULL_PTR(out, NULL);
     115    PS_CHECK_NULL_PTR(in, NULL);
    116116
    117117    junkData = psAlloc(sizeof(psVector));
     
    171171p_psCalcScaleFactorsEval(n): The Chebyshev polynomials are defined over the
    172172interval [-1.0 : 1.0].  Images typically have sizes of 512x512 or more.  In
    173 order to use Chebyshev polynomials, we must scales the coordinates from
     173order to use Chebyshev polynomials, we must scale the coordinates from
    1741740:512 to -1:1.  This routine takes as input an integer N and produces as
    175175output a vector of evenly spaced floating point values between -1.0:1.0.
  • trunk/psLib/src/imageops/psImageStats.c

    r2204 r2206  
    99*  @author GLG, MHPCC
    1010*
    11 *  @version $Revision: 1.44 $ $Name: not supported by cvs2svn $
    12 *  @date $Date: 2004-10-27 00:57:31 $
     11*  @version $Revision: 1.45 $ $Name: not supported by cvs2svn $
     12*  @date $Date: 2004-10-27 01:15:47 $
    1313*
    1414*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    101101    NOTE: We assume that the psHistogram structure out has already been
    102102    allocated and initialized.
    103     NOTE: verify that image/mask have the, correct types and sizes.
     103    NOTE: verify that image/mask have the correct types and sizes.
    104104 *****************************************************************************/
    105105psHistogram* psImageHistogram(psHistogram* out,
     
    112112
    113113    // NOTE: Verify this action.
    114     PS_CHECK_NULL_PTR_RETURN_NULL(out);
    115     PS_CHECK_NULL_PTR_RETURN_NULL(in);
     114    PS_CHECK_NULL_PTR(out, NULL);
     115    PS_CHECK_NULL_PTR(in, NULL);
    116116
    117117    junkData = psAlloc(sizeof(psVector));
     
    171171p_psCalcScaleFactorsEval(n): The Chebyshev polynomials are defined over the
    172172interval [-1.0 : 1.0].  Images typically have sizes of 512x512 or more.  In
    173 order to use Chebyshev polynomials, we must scales the coordinates from
     173order to use Chebyshev polynomials, we must scale the coordinates from
    1741740:512 to -1:1.  This routine takes as input an integer N and produces as
    175175output a vector of evenly spaced floating point values between -1.0:1.0.
  • trunk/psLib/src/math/psConstants.h

    r2204 r2206  
    66 *  @author GLG, MHPCC
    77 *
    8  *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2004-10-27 00:57:31 $
     8 *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2004-10-27 01:15:47 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    9494
    9595/** Preprocessor macro to generate error on an incorrect type */
    96 #define PS_CHECK_VECTOR_TYPE_RETURN_NULL(NAME, TYPE) \
     96#define PS_CHECK_VECTOR_TYPE(NAME, TYPE, RVAL) \
    9797if (NAME->type.type != TYPE) { \
    9898    psError(__func__,"Unallowable operation: %s has incorrect type.", #NAME); \
    99     return(NULL); \
     99    return(RVAL); \
    100100}
    101101
    102102/** Preprocessor macro to generate error on a NULL vector */
    103 #define PS_CHECK_NULL_VECTOR_RETURN_NULL(NAME) \
     103#define PS_CHECK_NULL_VECTOR(NAME, RVAL) \
    104104if (NAME == NULL || NAME->data.V == NULL) { \
    105105    psError(__func__,"Unallowable operation: %s or its data is NULL.", #NAME); \
    106     return(NULL); \
    107 } \
    108 
    109 /** Preprocessor macro to generate error on a NULL vector */
    110 #define PS_CHECK_NULL_VECTOR_RETURN_F0(NAME) \
    111 if (NAME == NULL || NAME->data.V == NULL) { \
    112     psError(__func__,"Unallowable operation: %s or its data is NULL.", #NAME); \
    113     return(0.0); \
     106    return(RVAL); \
    114107} \
    115108
    116109/** Preprocessor macro to generate error on a NULL poniter */
    117 #define PS_CHECK_NULL_PTR_RETURN_NULL(NAME) \
     110#define PS_CHECK_NULL_PTR(NAME, RVAL) \
    118111if (NAME == NULL) { \
    119112    psError(__func__,"Unallowable operation: %s is NULL.", #NAME); \
    120     return(NULL); \
    121 }
    122 
    123 /** Preprocessor macro to generate error on a NULL poniter */
    124 #define PS_CHECK_NULL_PTR_RETURN_F0(NAME) \
    125 if (NAME == NULL) { \
    126     psError(__func__,"Unallowable operation: %s is NULL.", #NAME); \
    127     return(0.0); \
    128 }
    129 
    130 /** Preprocessor macro to generate error on a NULL poniter */
    131 #define PS_CHECK_NULL_PTR_RETURN_ZERO(NAME) \
    132 if (NAME == NULL) { \
    133     psError(__func__,"Unallowable operation: %s is NULL.", #NAME); \
    134     return(0); \
    135 }
     113    return(RVAL); \
     114}
     115
     116
    136117
    137118/** Preprocessor macro to generate error for zero length vector */
  • trunk/psLib/src/math/psMinimize.c

    r2204 r2206  
    77 *  fit a 1-D polynomial to a set of data points.
    88 *
    9  *  @author GLF, MHPCC
     9 *  @author GLG, MHPCC
    1010 *
    11  *  @version $Revision: 1.61 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2004-10-27 00:57:31 $
     11 *  @version $Revision: 1.62 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2004-10-27 01:15:47 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    252252    static psVector *yErr32Static = NULL;
    253253
    254     PS_CHECK_NULL_PTR_RETURN_NULL(mySpline);
    255     PS_CHECK_NULL_PTR_RETURN_NULL(y);
     254    PS_CHECK_NULL_PTR(mySpline, NULL);
     255    PS_CHECK_NULL_PTR(y, NULL);
    256256    VECTOR_CHECK_TYPE_F32_OR_F64_RETURN_NULL(y);
    257257    CONVERT_VECTOR_F64_TO_F32(y, y32, y32Static);
     
    425425                        psMinimizeLMChi2Func func)
    426426{
    427     PS_CHECK_NULL_PTR_RETURN_NULL(min);
    428     PS_CHECK_NULL_VECTOR_RETURN_NULL(params);
     427    PS_CHECK_NULL_PTR(min, NULL);
     428    PS_CHECK_NULL_VECTOR(params, NULL);
    429429    PS_CHECK_EMPTY_VECTOR_RETURN_NULL(params);
    430     PS_CHECK_NULL_PTR_RETURN_NULL(x);
    431     PS_CHECK_NULL_VECTOR_RETURN_NULL(y);
     430    PS_CHECK_NULL_PTR(x, NULL);
     431    PS_CHECK_NULL_VECTOR(y, NULL);
    432432    PS_CHECK_EMPTY_VECTOR_RETURN_NULL(y);
    433433    PS_CHECK_VECTOR_SIZE_EQUAL_RETURN_NULL(x, y);
     
    856856    psPolynomial1D *tmpPoly;
    857857    PS_CHECK_NULL_1DPOLY_RETURN_NULL(myPoly);
    858     PS_CHECK_NULL_VECTOR_RETURN_NULL(y);
     858    PS_CHECK_NULL_VECTOR(y, NULL);
    859859    PS_CHECK_EMPTY_VECTOR_RETURN_NULL(y);
    860860    psVector *x64 = NULL;
     
    13191319                        psMinimizePowellFunc func)
    13201320{
    1321     PS_CHECK_NULL_VECTOR_RETURN_NULL(params);
     1321    PS_CHECK_NULL_VECTOR(params, NULL);
    13221322    PS_CHECK_EMPTY_VECTOR_RETURN_NULL(params);
    1323     PS_CHECK_NULL_PTR_RETURN_NULL(min);
    1324     PS_CHECK_NULL_PTR_RETURN_NULL(coords);
    1325     PS_CHECK_NULL_PTR_RETURN_NULL(func);
     1323    PS_CHECK_NULL_PTR(min, NULL);
     1324    PS_CHECK_NULL_PTR(coords, NULL);
     1325    PS_CHECK_NULL_PTR(func, NULL);
    13261326
    13271327    psS32 numDims = params->n;
  • trunk/psLib/src/math/psMinimize.h

    r2204 r2206  
    88 *  @author GLG, MHPCC
    99 *
    10  *  @version $Revision: 1.32 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2004-10-27 00:57:31 $
     10 *  @version $Revision: 1.33 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2004-10-27 01:15:47 $
    1212 *
    1313 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    8888                                  const psArray *x);
    8989
     90/*
     91psVector *psMinimizeLMChi2Gauss1D(psImage *deriv,
     92                                  const psVector *params,
     93                                  const psArray *coords)
     94{
     95    psVector *x = (psVector *) coords->data[0];
     96    psVector *y = (psVector *) coords->data[1];
     97    psVector *yErr = NULL;
     98    int i;
     99    int j;
     100    float normalization = params->data.F32[0];
     101    float center = params->data.F32[1];
     102    float stdev = params->data.F32[2];
     103    psVector *out = psVectorAlloc(x->n, PS_TYPE_F32);
     104 
     105 
     106    if (deriv == NULL) {
     107        deriv = psImageAlloc(params->n, x->n, PS_TYPE_F32);
     108    }
     109 
     110    if (coords->n == 2) {
     111        yErr = (psVector *) coords->data[2];
     112    }
     113 
     114    for (i=0;i<x->n;i++) {
     115        out->data.F32[i] = psGaussian(x->data.F32[i], center, stdev, 1);
     116    }
     117 
     118    for (i=0;i<x->n;i++) {
     119        for (j=0;j<params->n;j++) {
     120            deriv->data.F32[i][j] = the derivative of the gaussian w.r.t. the j-th parameter at the coord x[i]
     121        }
     122    }
     123    return(out);
     124}
     125*/
     126
    90127psBool psMinimizeLMChi2(psMinimization *min,
    91128                        psImage *covar,
  • trunk/psLib/src/math/psStats.c

    r2204 r2206  
    99 *  @author GLG, MHPCC
    1010 *
    11  *  @version $Revision: 1.69 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2004-10-27 00:57:31 $
     11 *  @version $Revision: 1.70 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2004-10-27 01:15:47 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    17331733        return(stats);
    17341734    }
    1735     PS_CHECK_NULL_PTR_RETURN_NULL(stats);
     1735    PS_CHECK_NULL_PTR(stats, NULL);
    17361736
    17371737    inF32 = p_psConvertToF32((psVector *) in);
     
    17471747    if (mask != NULL) {
    17481748        PS_CHECK_VECTOR_SIZE_EQUAL_RETURN_NULL(mask, in);
    1749         PS_CHECK_VECTOR_TYPE_RETURN_NULL(mask, PS_TYPE_U8);
     1749        PS_CHECK_VECTOR_TYPE(mask, PS_TYPE_U8, NULL);
    17501750    }
    17511751    // ************************************************************************
Note: See TracChangeset for help on using the changeset viewer.