IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 15418


Ignore:
Timestamp:
Oct 29, 2007, 2:59:23 PM (19 years ago)
Author:
gusciora
Message:

Adding several changes to the objects directory. Most of these changes are
mere additions of PS_ASSERTs to the beginning of psModule functions to ensure
that input parameters are correct.

Location:
branches/eam_branch_20071023/psModules/src/objects
Files:
37 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branch_20071023/psModules/src/objects/pmGrowthCurve.h

    r11253 r15418  
    44 * @author EAM, IfA
    55 *
    6  * @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
    7  * @date $Date: 2007-01-24 02:54:15 $
     6 * @version $Revision: 1.7.22.1 $ $Name: not supported by cvs2svn $
     7 * @date $Date: 2007-10-30 00:59:23 $
    88 * Copyright 2006 Institute for Astronomy, University of Hawaii
    99 */
     
    2727pmGrowthCurve;
    2828
     29bool psMemCheckGrowthCurve(psPtr ptr);
     30
    2931pmGrowthCurve *pmGrowthCurveAlloc (psF32 minRadius, psF32 maxRadius, psF32 refRadius);
    3032psF32 pmGrowthCurveCorrect (pmGrowthCurve *growth, psF32 radius);
  • branches/eam_branch_20071023/psModules/src/objects/pmModel.c

    r15398 r15418  
    66 *  @author EAM, IfA
    77 *
    8  *  @version $Revision: 1.15.6.2 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2007-10-29 01:37:48 $
     8 *  @version $Revision: 1.15.6.3 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2007-10-30 00:59:23 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4646    psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__);
    4747
    48     pmModel *tmp = (pmModel *) psAlloc(sizeof(pmModel));
    49     psMemSetDeallocator(tmp, (psFreeFunc) modelFree);
    50 
    5148    pmModelClass *class = pmModelClassSelect (type);
    5249    if (class == NULL) {
     
    5451        return(NULL);
    5552    }
     53
     54    pmModel *tmp = (pmModel *) psAlloc(sizeof(pmModel));
     55    psMemSetDeallocator(tmp, (psFreeFunc) modelFree);
    5656
    5757    tmp->type = type;
     
    8989}
    9090
     91bool psMemCheckModel(psPtr ptr)
     92{
     93    PS_ASSERT_PTR(ptr, false);
     94    return ( psMemGetDeallocator(ptr) == (psFreeFunc) modelFree);
     95}
     96
    9197// copy model to a new structure
    9298pmModel *pmModelCopy (pmModel *model)
    9399{
     100    PS_ASSERT_PTR_NON_NULL(model, NULL);
    94101
    95102    pmModel *new = pmModelAlloc (model->type);
  • branches/eam_branch_20071023/psModules/src/objects/pmModel.h

    r14652 r15418  
    55 * @author EAM, IfA
    66 *
    7  * @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
    8  * @date $Date: 2007-08-24 00:11:02 $
     7 * @version $Revision: 1.12.8.1 $ $Name: not supported by cvs2svn $
     8 * @date $Date: 2007-10-30 00:59:23 $
    99 *
    1010 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    122122 */
    123123pmModel *pmModelAlloc(pmModelType type);
     124bool psMemCheckModel(psPtr ptr);
    124125
    125126// copy model to a new structure
  • branches/eam_branch_20071023/psModules/src/objects/pmModelClass.c

    r14938 r15418  
    66 *  @author EAM, IfA
    77 *
    8  *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2007-09-21 00:09:05 $
     8 *  @version $Revision: 1.3.6.1 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2007-10-30 00:59:23 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    5757static void ModelClassFree (pmModelClass *modelClass)
    5858{
    59 
    6059    if (modelClass == NULL)
    6160        return;
     
    7069}
    7170
     71bool psMemCheckModelClass(psPtr ptr)
     72{
     73    PS_ASSERT_PTR(ptr, false);
     74    return ( psMemGetDeallocator(ptr) == (psFreeFunc) ModelClassFree);
     75}
     76
    7277void pmModelClassAdd (pmModelClass *model)
    7378{
    7479    if (models == NULL) {
    75         pmModelClassInit ();
     80        pmModelClassInit();
    7681    }
    7782
     
    8590{
    8691    // if we do not need to init, return false;
    87     if (models != NULL)
     92    if (models != NULL) {
    8893        return false;
     94    }
    8995
    9096    int Nnew = sizeof (defaultModels) / sizeof (pmModelClass);
     
    100106pmModelClass *pmModelClassSelect (pmModelType type)
    101107{
     108    if (models == NULL) {
     109        pmModelClassInit();
     110    }
     111
    102112    if ((type < 0) || (type >= Nmodels)) {
    103113        psError(PS_ERR_UNKNOWN, true, "Undefined pmModelType");
     
    111121    psFree (models);
    112122    models = NULL;
     123    Nmodels = 0;
    113124    return;
    114125}
     
    116127psS32 pmModelClassParameterCount (pmModelType type)
    117128{
     129    if (models == NULL) {
     130        pmModelClassInit();
     131    }
     132
    118133    if ((type < 0) || (type >= Nmodels)) {
    119134        psError(PS_ERR_UNKNOWN, true, "Undefined pmModelType");
     
    125140psS32 pmModelClassGetType (char *name)
    126141{
     142    if (models == NULL) {
     143        pmModelClassInit();
     144    }
     145
    127146    for (int i = 0; i < Nmodels; i++) {
    128147        if (!strcmp(models[i].name, name)) {
     
    135154char *pmModelClassGetName (pmModelType type)
    136155{
     156    if (models == NULL) {
     157        pmModelClassInit();
     158    }
     159
    137160    if ((type < 0) || (type >= Nmodels)) {
    138161        psError(PS_ERR_UNKNOWN, true, "Undefined pmModelType");
  • branches/eam_branch_20071023/psModules/src/objects/pmModelClass.h

    r14652 r15418  
    2121 * @author EAM, IfA
    2222 *
    23  * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
    24  * @date $Date: 2007-08-24 00:11:02 $
     23 * @version $Revision: 1.2.8.1 $ $Name: not supported by cvs2svn $
     24 * @date $Date: 2007-10-30 00:59:23 $
    2525 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii
    2626 */
     
    4949pmModelClass *pmModelClassAlloc (int nModels);
    5050
     51//
     52bool psMemCheckModelClass(psPtr ptr);
     53
    5154// initialize the internal (static) model class with the default models
    5255bool pmModelClassInit (void);
  • branches/eam_branch_20071023/psModules/src/objects/pmModelGroup.c

    r14652 r15418  
    66 *  @author EAM, IfA
    77 *
    8  *  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2007-08-24 00:11:02 $
     8 *  @version $Revision: 1.18.8.1 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2007-10-30 00:59:23 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    6868}
    6969
     70bool psMemCheckModelGroup(psPtr ptr)
     71{
     72    PS_ASSERT_PTR(ptr, false);
     73    return ( psMemGetDeallocator(ptr) == (psFreeFunc) ModelGroupFree);
     74}
     75
    7076void pmModelGroupAdd (pmModelGroup *model)
    7177{
  • branches/eam_branch_20071023/psModules/src/objects/pmModelGroup.h

    r14652 r15418  
    2121 * @author EAM, IfA
    2222 *
    23  * @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
    24  * @date $Date: 2007-08-24 00:11:02 $
     23 * @version $Revision: 1.8.8.1 $ $Name: not supported by cvs2svn $
     24 * @date $Date: 2007-10-30 00:59:23 $
    2525 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii
    2626 */
     
    7878pmModelGroup *pmModelGroupAlloc (int nModels);
    7979
     80bool psMemCheckModelGroup(psPtr ptr);
     81
    8082// initialize the internal (static) model group with the default models
    8183bool pmModelGroupInit (void);
  • branches/eam_branch_20071023/psModules/src/objects/pmModelUtils.c

    r14938 r15418  
    55 *  @author EAM, IfA
    66 *
    7  *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2007-09-21 00:04:30 $
     7 *  @version $Revision: 1.3.6.1 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2007-10-30 00:59:23 $
    99 *
    1010 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3636pmModel *pmModelFromPSF (pmModel *modelEXT, pmPSF *psf)
    3737{
     38    PS_ASSERT_PTR_NON_NULL(psf, NULL);
     39    PS_ASSERT_PTR_NON_NULL(modelEXT, NULL);
     40
    3841    // allocate a new pmModel to hold the PSF version
    3942    pmModel *modelPSF = pmModelAlloc (psf->type);
     
    5356// instantiate a model for the PSF at this location with peak flux
    5457// NOTE: psf and (Xo,Yo) are defined wrt chip coordinates
    55 pmModel *pmModelFromPSFforXY (pmPSF *psf, float Xo, float Yo, float Io) {
    56 
    57     assert (psf);
     58pmModel *pmModelFromPSFforXY (pmPSF *psf, float Xo, float Yo, float Io)
     59{
     60    PS_ASSERT_PTR_NON_NULL(psf, NULL);
    5861
    5962    // allocate a new pmModel to hold the PSF version
     
    7578// set this model to have the requested flux
    7679bool pmModelSetFlux (pmModel *model, float flux) {
     80    PS_ASSERT_PTR_NON_NULL(model, NULL);
     81    PS_ASSERT_PTR_NON_NULL(model->params, NULL);
    7782
    7883    // set Io to be 1.0
  • branches/eam_branch_20071023/psModules/src/objects/pmPSF.c

    r15089 r15418  
    66 *  @author EAM, IfA
    77 *
    8  *  @version $Revision: 1.32 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2007-09-29 00:15:32 $
     8 *  @version $Revision: 1.32.2.1 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2007-10-30 00:59:23 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    8181static void pmPSFFree (pmPSF *psf)
    8282{
    83 
    84     if (psf == NULL)
     83    if (psf == NULL) {
    8584        return;
     85    }
    8686
    8787    psFree (psf->ChiTrend);
     
    205205}
    206206
     207bool psMemCheckPSF(psPtr ptr)
     208{
     209    PS_ASSERT_PTR(ptr, false);
     210    return ( psMemGetDeallocator(ptr) == (psFreeFunc) pmPSFFree);
     211}
     212
     213
     214
    207215// the PSF models the \sigma_{xy} variation of the elliptical contour as a function of position in the image with a
    208216// polynomial.  an individual object has a contour of the form (x^2/2sx^2) + (y^2/2sy^2) + sxy*x*y
     
    217225double pmPSF_SXYfromModel (psF32 *modelPar)
    218226{
     227    PS_ASSERT_PTR_NON_NULL(modelPar, NAN);
    219228
    220229    double SXX = modelPar[PM_PAR_SXX];
     
    229238double pmPSF_SXYtoModel (psF32 *fittedPar)
    230239{
     240    PS_ASSERT_PTR_NON_NULL(fittedPar, NAN);
    231241
    232242    double SXX = fittedPar[PM_PAR_SXX];
     
    247257bool pmPSF_FitToModel (psF32 *fittedPar, float minMinorAxis)
    248258{
     259    PS_ASSERT_PTR_NON_NULL(fittedPar, false);
     260
    249261    psEllipsePol pol;
    250262
     
    272284psEllipsePol pmPSF_ModelToFit (psF32 *modelPar)
    273285{
     286//   XXX: must assert non-NULL input parameter
     287//    PS_ASSERT_PTR_NON_NULL(modelPar, NAN);
     288
    274289    psEllipseShape shape;
    275290
     
    289304    psEllipseShape shape;
    290305    psEllipseAxes axes;
     306//   XXX: must assert non-NULL input parameter
     307//    PS_ASSERT_PTR_NON_NULL(modelPar, axes);
    291308
    292309    shape.sx  = modelPar[PM_PAR_SXX] / M_SQRT2;
     
    310327bool pmPSF_AxesToModel (psF32 *modelPar, psEllipseAxes axes)
    311328{
     329    PS_ASSERT_PTR_NON_NULL(modelPar, false);
     330
    312331    if ((axes.major <= 0) || (axes.minor <= 0)) {
    313332        modelPar[PM_PAR_SXX] = 0.0;
     
    374393bool pmGrowthCurveGenerate (pmReadout *readout, pmPSF *psf, bool ignore, psMaskType maskVal, psMaskType mark)
    375394{
     395    PS_ASSERT_PTR_NON_NULL(readout, false);
     396    PS_ASSERT_PTR_NON_NULL(readout->image, false);
    376397
    377398    // bool status;
  • branches/eam_branch_20071023/psModules/src/objects/pmPSF.h

    r15016 r15418  
    66 * @author EAM, IfA
    77 *
    8  * @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
    9  * @date $Date: 2007-09-25 22:05:05 $
     8 * @version $Revision: 1.18.2.1 $ $Name: not supported by cvs2svn $
     9 * @date $Date: 2007-10-30 00:59:23 $
    1010 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii
    1111 */
     
    8787 *
    8888 */
     89
    8990pmPSF *pmPSFAlloc (pmPSFOptions *options);
    90 pmPSFOptions *pmPSFOptionsAlloc ();
     91bool psMemCheckPSF(psPtr ptr);
     92pmPSFOptions *pmPSFOptionsAlloc();
    9193
    9294double pmPSF_SXYfromModel (psF32 *modelPar);
  • branches/eam_branch_20071023/psModules/src/objects/pmPSF_IO.c

    r15359 r15418  
    66 *  @author EAM, IfA
    77 *
    8  *  @version $Revision: 1.27.2.1 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2007-10-23 20:54:53 $
     8 *  @version $Revision: 1.27.2.2 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2007-10-30 00:59:23 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    5050bool pmPSFmodelCheckDataStatusForView (const pmFPAview *view, const pmFPAfile *file)
    5151{
     52    PS_ASSERT_PTR_NON_NULL(view, false);
     53    PS_ASSERT_PTR_NON_NULL(file, false);
     54    PS_ASSERT_PTR_NON_NULL(file->fpa, false);
     55    PS_ASSERT_PTR_NON_NULL(file->fpa->chips, false);
     56
    5257    pmFPA *fpa = file->fpa;
    5358
     
    6166    }
    6267    pmChip *chip = fpa->chips->data[view->chip];
     68    PS_ASSERT_PTR_NON_NULL(chip, false);
     69    PS_ASSERT_PTR_NON_NULL(chip->cells, false);
    6370
    6471    if (view->cell == -1) {
     
    7582
    7683bool pmPSFmodelCheckDataStatusForFPA (const pmFPA *fpa) {
     84
     85    PS_ASSERT_PTR_NON_NULL(fpa, false);
     86    PS_ASSERT_PTR_NON_NULL(fpa->chips, false);
    7787
    7888    for (int i = 0; i < fpa->chips->n; i++) {
     
    8595
    8696bool pmPSFmodelCheckDataStatusForChip (const pmChip *chip) {
     97    PS_ASSERT_PTR_NON_NULL(chip, false);
    8798
    8899    bool status;
     
    93104}
    94105
    95 bool pmPSFmodelWriteForView (const pmFPAview *view, pmFPAfile *file, const pmConfig *config) {
     106bool pmPSFmodelWriteForView (const pmFPAview *view, pmFPAfile *file, const pmConfig *config)
     107{
     108    PS_ASSERT_PTR_NON_NULL(view, false);
     109    PS_ASSERT_PTR_NON_NULL(file, false);
     110    PS_ASSERT_PTR_NON_NULL(file->fpa, false);
     111    PS_ASSERT_PTR_NON_NULL(file->fpa->chips, false);
    96112
    97113    pmFPA *fpa = file->fpa;
     
    125141bool pmPSFmodelWriteFPA (pmFPA *fpa, const pmFPAview *view, pmFPAfile *file, const pmConfig *config)
    126142{
     143    PS_ASSERT_PTR_NON_NULL(view, false);
     144    PS_ASSERT_PTR_NON_NULL(fpa, false);
     145    PS_ASSERT_PTR_NON_NULL(fpa->chips, false);
    127146    pmFPAview *thisView = pmFPAviewAlloc (view->nRows);
    128147    *thisView = *view;
     
    144163bool pmPSFmodelWriteChip (pmChip *chip, const pmFPAview *view, pmFPAfile *file, const pmConfig *config)
    145164{
     165    PS_ASSERT_PTR_NON_NULL(view, false);
     166    PS_ASSERT_PTR_NON_NULL(chip, false);
     167
    146168    if (!pmPSFmodelWrite (chip->analysis, view, file, config)) {
    147169        psError(PS_ERR_IO, false, "Failed to write PSF for chip");
     
    161183bool pmPSFmodelWrite (psMetadata *analysis, const pmFPAview *view, pmFPAfile *file, const pmConfig *config)
    162184{
     185    PS_ASSERT_PTR_NON_NULL(view, false);
     186    PS_ASSERT_PTR_NON_NULL(file, false);
     187    PS_ASSERT_PTR_NON_NULL(file->fpa, false);
    163188    bool status;
    164189    pmHDU *hdu;
     
    449474
    450475// if this file needs to have a PHU written out, write one
    451 bool pmPSFmodelWritePHU (const pmFPAview *view, pmFPAfile *file, const pmConfig *config) {
    452 
     476bool pmPSFmodelWritePHU (const pmFPAview *view, pmFPAfile *file, const pmConfig *config)
     477{
     478    PS_ASSERT_PTR_NON_NULL(view, false);
     479    PS_ASSERT_PTR_NON_NULL(file, false);
     480    PS_ASSERT_PTR_NON_NULL(file->fpa, false);
    453481    // not needed if already written
    454482    if (file->wrote_phu) return true;
     
    493521bool pmPSFmodelReadForView (const pmFPAview *view, pmFPAfile *file, const pmConfig *config)
    494522{
     523    PS_ASSERT_PTR_NON_NULL(view, false);
     524    PS_ASSERT_PTR_NON_NULL(file, false);
     525    PS_ASSERT_PTR_NON_NULL(file->fpa, false);
    495526
    496527    pmFPA *fpa = file->fpa;
     
    516547bool pmPSFmodelReadFPA (pmFPA *fpa, const pmFPAview *view, pmFPAfile *file, const pmConfig *config)
    517548{
     549    PS_ASSERT_PTR_NON_NULL(view, false);
     550    PS_ASSERT_PTR_NON_NULL(file, false);
     551    PS_ASSERT_PTR_NON_NULL(file->fpa, false);
     552
    518553    bool success = true;                // Was everything successful?
    519554    for (int i = 0; i < fpa->chips->n; i++) {
     
    527562bool pmPSFmodelReadChip (pmChip *chip, const pmFPAview *view, pmFPAfile *file, const pmConfig *config)
    528563{
     564    PS_ASSERT_PTR_NON_NULL(view, false);
     565    PS_ASSERT_PTR_NON_NULL(file, false);
     566    PS_ASSERT_PTR_NON_NULL(file->fpa, false);
     567
    529568    if (!pmPSFmodelRead (chip->analysis, view, file, config)) {
    530569        psError(PS_ERR_IO, false, "Failed to write PSF for chip");
     
    538577bool pmPSFmodelRead (psMetadata *analysis, const pmFPAview *view, pmFPAfile *file, const pmConfig *config)
    539578{
     579    PS_ASSERT_PTR_NON_NULL(view, false);
     580    PS_ASSERT_PTR_NON_NULL(file, false);
     581    PS_ASSERT_PTR_NON_NULL(file->fpa, false);
     582
    540583    bool status;
    541584    char *rule = NULL;
     
    762805}
    763806
    764 // create a psMetadata representation (human-readable) of a psf model
    765807// XXX pmPSF to/from Metadata functions were defined for 1.22 and earlier, but were dropped
  • branches/eam_branch_20071023/psModules/src/objects/pmPSFtry.c

    r15254 r15418  
    55 *  @author EAM, IfA
    66 *
    7  *  @version $Revision: 1.49 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2007-10-09 19:26:25 $
     7 *  @version $Revision: 1.49.2.1 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2007-10-30 00:59:23 $
    99 *
    1010 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    8181}
    8282
     83bool psMemCheckPSFtry(psPtr ptr)
     84{
     85    PS_ASSERT_PTR(ptr, false);
     86    return ( psMemGetDeallocator(ptr) == (psFreeFunc) pmPSFtryFree);
     87}
     88
     89
    8390// build a pmPSFtry for the given model:
    8491// - fit each source with the free-floating model
     
    249256bool pmPSFtryMetric (pmPSFtry *psfTry, float RADIUS)
    250257{
     258    PS_ASSERT_PTR_NON_NULL(psfTry, false);
     259    PS_ASSERT_PTR_NON_NULL(psfTry->sources, false);
     260
    251261    // the measured (aperture - fit) magnitudes (dA == psfTry->metric)
    252262    //   depend on both the true ap-fit (dAo) and the bias in the sky measurement:
     
    346356bool pmPSFFromPSFtry (pmPSFtry *psfTry)
    347357{
     358    PS_ASSERT_PTR_NON_NULL(psfTry, false);
     359    PS_ASSERT_PTR_NON_NULL(psfTry->sources, false);
     360
    348361    pmPSF *psf = psfTry->psf;
    349362
  • branches/eam_branch_20071023/psModules/src/objects/pmPSFtry.h

    r15016 r15418  
    66 * @author EAM, IfA
    77 *
    8  * @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
    9  * @date $Date: 2007-09-25 22:05:05 $
     8 * @version $Revision: 1.16.2.1 $ $Name: not supported by cvs2svn $
     9 * @date $Date: 2007-10-30 00:59:23 $
    1010 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii
    1111 */
     
    7878 *
    7979 */
     80
    8081pmPSFtry *pmPSFtryAlloc (psArray *sources, pmPSFOptions *options);
     82bool psMemCheckPSFtry(psPtr ptr);
    8183
    8284/** pmPSFtryModel()
  • branches/eam_branch_20071023/psModules/src/objects/pmPeaks.c

    r15039 r15418  
    66 *  @author EAM, IfA: significant modifications.
    77 *
    8  *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2007-09-27 03:35:29 $
     8 *  @version $Revision: 1.17.2.1 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2007-10-30 00:59:23 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    150150}
    151151
     152// XXX: Get rid of this:
    152153bool pmPeakTest(const psPtr ptr)
    153154{
     
    155156}
    156157
     158bool psMemCheckPeak(psPtr ptr)
     159{
     160    PS_ASSERT_PTR(ptr, false);
     161    return ( psMemGetDeallocator(ptr) == (psFreeFunc) peakFree);
     162}
     163
     164
    157165// psSort comparison function for peaks
     166// XXX: Add error-checking for NULL args
    158167int pmPeaksCompareAscend (const void **a, const void **b)
    159168{
     
    177186
    178187// psSort comparison function for peaks
     188// XXX: Add error-checking for NULL args
    179189int pmPeaksCompareDescend (const void **a, const void **b)
    180190{
  • branches/eam_branch_20071023/psModules/src/objects/pmPeaks.h

    r15039 r15418  
    1010 * @author GLG, MHPCC
    1111 *
    12  * @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
    13  * @date $Date: 2007-09-27 03:35:29 $
     12 * @version $Revision: 1.8.2.1 $ $Name: not supported by cvs2svn $
     13 * @date $Date: 2007-10-30 00:59:23 $
    1414 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii
    1515 */
     
    7575
    7676bool pmPeakTest(const psPtr ptr);
     77bool psMemCheckPeak(psPtr ptr);
    7778
    7879/** pmPeaksInVector()
  • branches/eam_branch_20071023/psModules/src/objects/pmResiduals.c

    r12949 r15418  
    44 *
    55 * @author EAM, IfA
    6  * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
    7  * @date $Date: 2007-04-21 19:47:14 $
     6 * @version $Revision: 1.2.16.1 $ $Name: not supported by cvs2svn $
     7 * @date $Date: 2007-10-30 00:59:23 $
    88 * Copyright 2004 IfA, University of Hawaii
    99 */
     
    5151    return resid;
    5252}
     53
     54bool psMemCheckResiduals(psPtr ptr)
     55{
     56    PS_ASSERT_PTR(ptr, false);
     57    return ( psMemGetDeallocator(ptr) == (psFreeFunc) pmResidualsFree);
     58}
     59
  • branches/eam_branch_20071023/psModules/src/objects/pmResiduals.h

    r12949 r15418  
    44 *
    55 * @author EAM, IfA
    6  * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
    7  * @date $Date: 2007-04-21 19:47:14 $
     6 * @version $Revision: 1.2.16.1 $ $Name: not supported by cvs2svn $
     7 * @date $Date: 2007-10-30 00:59:23 $
    88 * Copyright 2004 IfA, University of Hawaii
    99 */
     
    2929
    3030pmResiduals *pmResidualsAlloc (int xSize, int ySize, int xBin, int yBin);
     31bool psMemCheckResiduals(psPtr ptr);
    3132
    3233/// @}
  • branches/eam_branch_20071023/psModules/src/objects/pmSource.c

    r15232 r15418  
    66 *  @author EAM, IfA: significant modifications.
    77 *
    8  *  @version $Revision: 1.40 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2007-10-06 02:29:47 $
     8 *  @version $Revision: 1.40.2.1 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2007-10-30 00:59:23 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    7777}
    7878
     79bool psMemCheckSource(psPtr ptr)
     80{
     81    PS_ASSERT_PTR(ptr, false);
     82    return ( psMemGetDeallocator(ptr) == (psFreeFunc) sourceFree);
     83}
     84
    7985/******************************************************************************
    8086pmSourceAlloc(): Allocate the pmSource structure and initialize its members
    8187to NULL.
    8288*****************************************************************************/
     89
    8390pmSource *pmSourceAlloc()
    8491{
     
    132139pmSource *pmSourceCopy(pmSource *in)
    133140{
     141    if (in == NULL) {
     142        return(NULL);
     143    }
    134144    // this copy is used to allow multiple fit attempts on the
    135145    // same object.  the pixels, weight, and mask arrays all point to
     
    139149
    140150    // this is actually the same peak as the original, is this the correct way to handle this?
    141     source->peak = pmPeakAlloc (in->peak->x, in->peak->y, in->peak->value, in->peak->type);
    142     source->peak->xf = in->peak->xf;
    143     source->peak->yf = in->peak->yf;
    144     source->peak->flux = in->peak->flux;
    145     source->peak->SN = in->peak->SN;
     151    if (in->peak != NULL) {
     152        source->peak = pmPeakAlloc (in->peak->x, in->peak->y, in->peak->value, in->peak->type);
     153        source->peak->xf = in->peak->xf;
     154        source->peak->yf = in->peak->yf;
     155        source->peak->flux = in->peak->flux;
     156        source->peak->SN = in->peak->SN;
     157    }
    146158
    147159    // copy the values in the moments structure
    148     source->moments  =  pmMomentsAlloc();
    149     *source->moments = *in->moments;
     160    if (in->moments != NULL) {
     161        source->moments  =  pmMomentsAlloc();
     162        *source->moments = *in->moments;
     163    }
    150164
    151165    // These images are all views to the parent.
    152166    // We want a new view, but pointing at the same pixels.
    153     source->pixels   = psImageCopyView (NULL, in->pixels);
    154     source->weight   = psImageCopyView (NULL, in->weight);
    155     source->maskView = psImageCopyView (NULL, in->maskView);
     167    source->pixels   = psImageCopyView(NULL, in->pixels);
     168    source->weight   = psImageCopyView(NULL, in->weight);
     169    source->maskView = psImageCopyView(NULL, in->maskView);
    156170
    157171    // the maskObj is a unique mask array; create a new mask image
     
    173187                          psF32 Radius)
    174188{
     189    PS_ASSERT_PTR_NON_NULL(mySource, false);
     190    PS_ASSERT_PTR_NON_NULL(readout, false);
     191    PS_ASSERT_PTR_NON_NULL(readout->image, false);
     192    PS_ASSERT_INT_POSITIVE(Radius, false);
     193
    175194    psRegion srcRegion;
    176195
     
    200219                            psF32 Radius)
    201220{
     221    PS_ASSERT_PTR_NON_NULL(mySource, false);
     222    PS_ASSERT_PTR_NON_NULL(readout, false);
     223    PS_ASSERT_PTR_NON_NULL(readout->image, false);
     224    PS_ASSERT_INT_POSITIVE(Radius, false);
     225
    202226    bool extend;
    203227    psRegion newRegion;
    204 
    205     if (Radius == 0)
    206         return false;
    207228
    208229    // check to see if new region is completely contained within old region
     
    814835
    815836// should we call pmSourceCacheModel if it does not exist?
    816 bool pmSourceOp (pmSource *source, pmModelOpMode mode, bool add, psMaskType maskVal, int dx, int dy) {
    817 
     837bool pmSourceOp (pmSource *source, pmModelOpMode mode, bool add,
     838                 psMaskType maskVal, int dx, int dy)
     839{
     840    PS_ASSERT_PTR_NON_NULL(source, false);
    818841    bool status;
    819842
     
    904927pmModel *pmSourceGetModel (bool *isPSF, const pmSource *source)
    905928{
     929    PS_ASSERT_PTR_NON_NULL(source, NULL);
    906930
    907931    pmModel *model;
  • branches/eam_branch_20071023/psModules/src/objects/pmSource.h

    r15398 r15418  
    33 * @author EAM, IfA; GLG, MHPCC
    44 *
    5  * @version $Revision: 1.18.2.2 $ $Name: not supported by cvs2svn $
    6  * @date $Date: 2007-10-29 01:37:48 $
     5 * @version $Revision: 1.18.2.3 $ $Name: not supported by cvs2svn $
     6 * @date $Date: 2007-10-30 00:59:23 $
    77 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii
    88 */
     
    114114 *
    115115 */
     116
     117bool psMemCheckSource(psPtr ptr);
     118
    116119pmSource  *pmSourceCopy(pmSource *source);
    117120
     
    181184 */
    182185pmPSFClump pmSourcePSFClump(
    183     psArray *source,   ///< The input pmSource
    184     psMetadata *metadata  ///< Contains classification parameters
    185 );
    186 
     186    psArray *source,                    ///< The input pmSource
     187    psMetadata *metadata                ///< Contains classification parameters
     188);
    187189
    188190/** pmSourceRoughClass()
     
    197199 */
    198200bool pmSourceRoughClass(
    199     psArray *source,   ///< The input pmSource
    200     psMetadata *metadata,  ///< Contains classification parameters
    201     pmPSFClump clump,   ///< Statistics about the PSF clump
     201    psArray *source,                    ///< The input pmSource
     202    psMetadata *metadata,               ///< Contains classification parameters
     203    pmPSFClump clump,                   ///< Statistics about the PSF clump
    202204    psMaskType maskSat                  ///< Mask value for saturated pixels
    203205);
  • branches/eam_branch_20071023/psModules/src/objects/pmSourceContour.c

    r14938 r15418  
    66 *  @author EAM, IfA: significant modifications.
    77 *
    8  *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2007-09-21 00:09:05 $
     8 *  @version $Revision: 1.9.6.1 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2007-10-30 00:59:23 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    220220psArray *pmSourceContour (psImage *image, int xc, int yc, float threshold)
    221221{
     222    PS_ASSERT_PTR_NON_NULL(image, NULL);
    222223
    223224    int xR, yR, x0, x1, x0s, x1s;
  • branches/eam_branch_20071023/psModules/src/objects/pmSourceFitSet.c

    r15055 r15418  
    66 *  @author GLG, MHPCC
    77 *
    8  *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2007-09-28 00:39:41 $
     8 *  @version $Revision: 1.7.2.1 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2007-10-30 00:59:23 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    7979}
    8080
     81bool psMemCheckSourceFitSetData(psPtr ptr)
     82{
     83    PS_ASSERT_PTR(ptr, false);
     84    return ( psMemGetDeallocator(ptr) == (psFreeFunc) pmSourceFitSetDataFree);
     85}
     86
     87
    8188// this function is called with the full set of parameters and the beta values in a single vector
    82 bool pmSourceFitSetCheckLimits (psMinConstraintMode mode, int nParam, float *params, float *betas)
    83 {
    84     assert (thisSet);
     89bool pmSourceFitSetCheckLimits (psMinConstraintMode mode, int nParam, float *params,
     90                                float *betas)
     91{
     92    PS_ASSERT_PTR_NON_NULL(thisSet, false);
    8593
    8694    // nParam is the parameter in the full sequence.  determine which single model this comes from
     
    109117
    110118// merge parameters from FitSet models into single param and deriv vectors
    111 bool pmSourceFitSetJoin (psVector *deriv, psVector *param, pmSourceFitSetData *set) {
    112 
    113     assert (set);
     119bool pmSourceFitSetJoin (psVector *deriv, psVector *param, pmSourceFitSetData *set)
     120{
     121    PS_ASSERT_PTR_NON_NULL(set, false);
     122    PS_ASSERT_PTR_NON_NULL(param, false);
     123
    114124    assert (set->paramSet->n == set->derivSet->n);
    115125
     
    138148// distribute parameters from single param and deriv vectors into FitSet models
    139149bool pmSourceFitSetSplit (pmSourceFitSetData *set, const psVector *deriv, const psVector *param) {
    140 
    141     assert (set);
     150    PS_ASSERT_PTR_NON_NULL(set, false);
     151    PS_ASSERT_PTR_NON_NULL(param, false);
     152
    142153    assert (set->paramSet->n == set->derivSet->n);
    143154
     
    159170}
    160171
    161 bool pmSourceFitSetValues (pmSourceFitSetData *set, const psVector *dparam, const psVector *param, pmSource *source, psMinimization *myMin, int nPix, bool fitStatus) {
    162 
     172bool pmSourceFitSetValues (pmSourceFitSetData *set, const psVector *dparam,
     173                           const psVector *param, pmSource *source,
     174                           psMinimization *myMin, int nPix, bool fitStatus)
     175{
     176    PS_ASSERT_PTR_NON_NULL(set, false);
    163177    bool onPic = true;
    164 
    165     assert (set);
    166178
    167179    int n = 0;
     
    203215psF32 pmSourceFitSetFunction(psVector *deriv, const psVector *param, const psVector *x)
    204216{
     217    PS_ASSERT_PTR_NON_NULL(thisSet, NAN);
    205218    float chisqSum = 0.0;
    206219    float chisqOne = 0.0;
    207 
    208     assert (thisSet);
    209220    pmSourceFitSetSplit (thisSet, deriv, param);
    210221
     
    225236
    226237// XXX allow the mode to be a function of the object (eg, S/N)
    227 bool pmSourceFitSetMasks (psMinConstraint *constraint, pmSourceFitSetData *set, pmSourceFitMode mode) {
     238bool pmSourceFitSetMasks (psMinConstraint *constraint, pmSourceFitSetData *set,
     239                          pmSourceFitMode mode)
     240{
     241    PS_ASSERT_PTR_NON_NULL(set, false);
     242    PS_ASSERT_PTR_NON_NULL(constraint, false);
    228243
    229244    // unmask everyone
  • branches/eam_branch_20071023/psModules/src/objects/pmSourceFitSet.h

    r15055 r15418  
    33 * @author EAM, IfA; GLG, MHPCC
    44 *
    5  * @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
    6  * @date $Date: 2007-09-28 00:39:47 $
     5 * @version $Revision: 1.5.2.1 $ $Name: not supported by cvs2svn $
     6 * @date $Date: 2007-10-30 00:59:23 $
    77 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii
    88 */
     
    2323// initialize data for a group of object models
    2424pmSourceFitSetData *pmSourceFitSetDataAlloc (psArray *modelSet);
     25bool psMemCheckSourceFitSetData(psPtr ptr);
    2526
    2627// function used to set limits for a group of models
  • branches/eam_branch_20071023/psModules/src/objects/pmSourceIO.c

    r15398 r15418  
    33 *  @author EAM, IfA
    44 *
    5  *  @version $Revision: 1.52.2.2 $ $Name: not supported by cvs2svn $
    6  *  @date $Date: 2007-10-29 01:37:48 $
     5 *  @version $Revision: 1.52.2.3 $ $Name: not supported by cvs2svn $
     6 *  @date $Date: 2007-10-30 00:59:23 $
    77 *
    88 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4747int pmSourceGetDophotType (pmSource *source)
    4848{
     49    PS_ASSERT_PTR_NON_NULL(source, -1);
     50
    4951    switch (source->type) {
    5052
     
    7476bool pmSourceSetDophotType (pmSource *source, int type)
    7577{
     78    PS_ASSERT_PTR_NON_NULL(source, false);
     79
    7680    if (type == 4) {
    7781        source->mode |= PM_SOURCE_MODE_FAIL;
     
    106110bool pmFPAviewWriteObjects (const pmFPAview *view, pmFPAfile *file, const pmConfig *config)
    107111{
     112    PS_ASSERT_PTR_NON_NULL(view, false);
     113    PS_ASSERT_PTR_NON_NULL(file, false);
     114    PS_ASSERT_PTR_NON_NULL(file->fpa, false);
    108115
    109116    pmFPA *fpa = file->fpa;
     
    165172bool pmFPAWriteObjects (pmFPA *fpa, const pmFPAview *view, pmFPAfile *file, const pmConfig *config)
    166173{
     174    PS_ASSERT_PTR_NON_NULL(view, false);
     175    PS_ASSERT_PTR_NON_NULL(fpa, false);
     176    PS_ASSERT_PTR_NON_NULL(fpa->chips, false);
     177
    167178    pmFPAview *thisView = pmFPAviewAlloc (view->nRows);
    168179    *thisView = *view;
     
    184195bool pmChipWriteObjects (pmChip *chip, const pmFPAview *view, pmFPAfile *file, const pmConfig *config)
    185196{
     197    PS_ASSERT_PTR_NON_NULL(chip, false);
     198    PS_ASSERT_PTR_NON_NULL(chip->cells, false);
     199    PS_ASSERT_PTR_NON_NULL(view, false);
     200
    186201    pmFPAview *thisView = pmFPAviewAlloc (view->nRows);
    187202    *thisView = *view;
     
    203218bool pmCellWriteObjects (pmCell *cell, const pmFPAview *view, pmFPAfile *file, const pmConfig *config)
    204219{
     220    PS_ASSERT_PTR_NON_NULL(cell, false);
     221    PS_ASSERT_PTR_NON_NULL(cell->readouts, false);
     222    PS_ASSERT_PTR_NON_NULL(view, false);
     223
    205224    pmFPAview *thisView = pmFPAviewAlloc (view->nRows);
    206225    *thisView = *view;
     
    222241bool pmReadoutWriteObjects (pmReadout *readout, const pmFPAview *view, pmFPAfile *file, const pmConfig *config)
    223242{
     243    PS_ASSERT_PTR_NON_NULL(readout, false);
     244    PS_ASSERT_PTR_NON_NULL(view, false);
     245    PS_ASSERT_PTR_NON_NULL(file, false);
     246    PS_ASSERT_PTR_NON_NULL(file->fpa, false);
    224247
    225248    bool status;
     
    418441
    419442// if this file needs to have a PHU written out, write one
    420 bool pmSource_CMF_WritePHU (const pmFPAview *view, pmFPAfile *file, const pmConfig *config) {
     443bool pmSource_CMF_WritePHU (const pmFPAview *view, pmFPAfile *file, const pmConfig *config)
     444{
     445    PS_ASSERT_PTR_NON_NULL(view, false);
     446    PS_ASSERT_PTR_NON_NULL(file, false);
    421447
    422448    bool status;
     
    527553bool pmFPAviewReadObjects (const pmFPAview *view, pmFPAfile *file, const pmConfig *config)
    528554{
     555    PS_ASSERT_PTR_NON_NULL(view, false);
     556    PS_ASSERT_PTR_NON_NULL(file, false);
     557    PS_ASSERT_PTR_NON_NULL(file->fpa, false);
     558
    529559    pmFPA *fpa = file->fpa;
    530560
     
    566596bool pmFPAReadObjects (pmFPA *fpa, const pmFPAview *view, pmFPAfile *file, const pmConfig *config)
    567597{
     598    PS_ASSERT_PTR_NON_NULL(view, false);
     599    PS_ASSERT_PTR_NON_NULL(file, false);
     600    PS_ASSERT_PTR_NON_NULL(file->fpa, false);
     601    PS_ASSERT_PTR_NON_NULL(file->fpa->chips, false);
     602
    568603    pmFPAview *thisView = pmFPAviewAlloc (view->nRows);
    569604    *thisView = *view;
     
    587622bool pmChipReadObjects (pmChip *chip, const pmFPAview *view, pmFPAfile *file, const pmConfig *config)
    588623{
     624    PS_ASSERT_PTR_NON_NULL(view, false);
     625    PS_ASSERT_PTR_NON_NULL(chip, false);
     626    PS_ASSERT_PTR_NON_NULL(chip->cells, false);
     627
    589628    pmFPAview *thisView = pmFPAviewAlloc (view->nRows);
    590629    *thisView = *view;
     
    611650bool pmCellReadObjects (pmCell *cell, const pmFPAview *view, pmFPAfile *file, const pmConfig *config)
    612651{
     652    PS_ASSERT_PTR_NON_NULL(view, false);
     653    PS_ASSERT_PTR_NON_NULL(cell, false);
     654    PS_ASSERT_PTR_NON_NULL(cell->readouts, false);
     655
    613656    pmFPAview *thisView = pmFPAviewAlloc (view->nRows);
    614657    *thisView = *view;
     
    652695bool pmReadoutReadObjects (pmReadout *readout, const pmFPAview *view, pmFPAfile *file, const pmConfig *config)
    653696{
     697    PS_ASSERT_PTR_NON_NULL(view, false);
     698    PS_ASSERT_PTR_NON_NULL(file, false);
    654699
    655700    bool status;
     
    789834bool pmFPAviewCheckDataStatusForSources (const pmFPAview *view, const pmFPAfile *file)
    790835{
     836    PS_ASSERT_PTR_NON_NULL(view, false);
     837    PS_ASSERT_PTR_NON_NULL(file, false);
     838    PS_ASSERT_PTR_NON_NULL(file->fpa, false);
     839
    791840    pmFPA *fpa = file->fpa;
    792841
     
    826875}
    827876
    828 bool pmFPACheckDataStatusForSources (const pmFPA *fpa) {
     877bool pmFPACheckDataStatusForSources (const pmFPA *fpa)
     878{
     879    PS_ASSERT_PTR_NON_NULL(fpa, false);
     880    PS_ASSERT_PTR_NON_NULL(fpa->chips, false);
    829881
    830882    for (int i = 0; i < fpa->chips->n; i++) {
     
    836888}
    837889
    838 bool pmChipCheckDataStatusForSources (const pmChip *chip) {
     890bool pmChipCheckDataStatusForSources (const pmChip *chip)
     891{
     892    PS_ASSERT_PTR_NON_NULL(chip, false);
     893    PS_ASSERT_PTR_NON_NULL(chip->cells, false);
    839894
    840895    for (int i = 0; i < chip->cells->n; i++) {
     
    846901}
    847902
    848 bool pmCellCheckDataStatusForSources (const pmCell *cell) {
     903bool pmCellCheckDataStatusForSources (const pmCell *cell)
     904{
     905    PS_ASSERT_PTR_NON_NULL(cell, false);
     906    PS_ASSERT_PTR_NON_NULL(cell->readouts, false);
    849907
    850908    for (int i = 0; i < cell->readouts->n; i++) {
     
    856914}
    857915
    858 bool pmReadoutCheckDataStatusForSources (const pmReadout *readout) {
     916bool pmReadoutCheckDataStatusForSources (const pmReadout *readout)
     917{
     918    PS_ASSERT_PTR_NON_NULL(readout, false);
    859919
    860920    bool status;
  • branches/eam_branch_20071023/psModules/src/objects/pmSourceIO_CMP.c

    r14938 r15418  
    33 *  @author EAM, IfA
    44 *
    5  *  @version $Revision: 1.31 $ $Name: not supported by cvs2svn $
    6  *  @date $Date: 2007-09-21 00:09:05 $
     5 *  @version $Revision: 1.31.6.1 $ $Name: not supported by cvs2svn $
     6 *  @date $Date: 2007-10-30 00:59:23 $
    77 *
    88 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4848bool pmSourcesWriteCMP (psArray *sources, char *filename, psMetadata *header)
    4949{
     50    PS_ASSERT_PTR_NON_NULL(sources, false);
     51    PS_ASSERT_PTR_NON_NULL(filename, false);
     52    PS_ASSERT_PTR_NON_NULL(header, false);
    5053
    5154    int i, type;
     
    5861    // find config information for output header
    5962    float ZERO_POINT = psMetadataLookupF32 (&status, header, "ZERO_PT");
    60     if (!status)
     63    if (!status) {
    6164        ZERO_POINT = 25.0;
     65    }
    6266
    6367    // MEF elements have XTENSION, not SIMPLE: remove this (replace with SIMPLE)
    6468    psMetadataLookupStr (&status, header, "XTENSION");
    65     if (status)
     69    if (status) {
    6670        psMetadataRemoveKey (header, "XTENSION");
     71    }
    6772
    6873    // create file, write-out header
     
    148153psArray *pmSourcesReadCMP (char *filename, psMetadata *header)
    149154{
     155    PS_ASSERT_PTR_NON_NULL(filename, false);
     156    PS_ASSERT_PTR_NON_NULL(header, false);
    150157
    151158    bool status;
  • branches/eam_branch_20071023/psModules/src/objects/pmSourceIO_OBJ.c

    r14938 r15418  
    33 *  @author EAM, IfA
    44 *
    5  *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
    6  *  @date $Date: 2007-09-21 00:09:05 $
     5 *  @version $Revision: 1.15.6.1 $ $Name: not supported by cvs2svn $
     6 *  @date $Date: 2007-10-30 00:59:23 $
    77 *
    88 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4242bool pmSourcesWriteOBJ (psArray *sources, char *filename)
    4343{
     44    PS_ASSERT_PTR_NON_NULL(sources, false);
     45    PS_ASSERT_PTR_NON_NULL(filename, false);
    4446
    4547    int type;
  • branches/eam_branch_20071023/psModules/src/objects/pmSourceIO_PS1_DEV_0.c

    r14938 r15418  
    33 *  @author EAM, IfA
    44 *
    5  *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
    6  *  @date $Date: 2007-09-21 00:09:05 $
     5 *  @version $Revision: 1.13.6.1 $ $Name: not supported by cvs2svn $
     6 *  @date $Date: 2007-10-30 00:59:23 $
    77 *
    88 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4646// values derived in the DVO database.
    4747// XXX how do I generate the source tables which I need to send to PSPS?
    48 
    49 bool pmSourcesWrite_PS1_DEV_0 (psFits *fits, psArray *sources, psMetadata *imageHeader, psMetadata *tableHeader, char *extname)
     48// XXX: input parameter imageHeader is never used.
     49bool pmSourcesWrite_PS1_DEV_0 (psFits *fits, psArray *sources, psMetadata *imageHeader,
     50                               psMetadata *tableHeader, char *extname)
    5051{
     52    PS_ASSERT_PTR_NON_NULL(fits, false);
     53    PS_ASSERT_PTR_NON_NULL(sources, false);
     54    PS_ASSERT_PTR_NON_NULL(extname, false);
    5155
    5256    psArray *table;
     
    147151psArray *pmSourcesRead_PS1_DEV_0 (psFits *fits, psMetadata *header)
    148152{
     153    PS_ASSERT_PTR_NON_NULL(fits, false);
     154    PS_ASSERT_PTR_NON_NULL(header, false);
    149155
    150156    bool status;
  • branches/eam_branch_20071023/psModules/src/objects/pmSourceIO_RAW.c

    r14938 r15418  
    33 *  @author EAM, IfA
    44 *
    5  *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
    6  *  @date $Date: 2007-09-21 00:09:05 $
     5 *  @version $Revision: 1.17.6.1 $ $Name: not supported by cvs2svn $
     6 *  @date $Date: 2007-10-30 00:59:23 $
    77 *
    88 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4444{
    4545
     46    PS_ASSERT_PTR_NON_NULL(sources, false);
     47    PS_ASSERT_PTR_NON_NULL(filename, false);
     48
    4649    char *name = (char *) psAlloc (strlen(filename) + 10);
    4750
     
    6568bool pmSourcesWritePSFs (psArray *sources, char *filename)
    6669{
     70    PS_ASSERT_PTR_NON_NULL(sources, false);
     71    PS_ASSERT_PTR_NON_NULL(filename, false);
    6772
    6873    double dPos;
     
    124129bool pmSourcesWriteEXTs (psArray *sources, char *filename, bool requireEXT)
    125130{
     131    PS_ASSERT_PTR_NON_NULL(sources, false);
     132    PS_ASSERT_PTR_NON_NULL(filename, false);
    126133
    127134    double dPos;
     
    184191bool pmSourcesWriteNULLs (psArray *sources, char *filename)
    185192{
     193    PS_ASSERT_PTR_NON_NULL(sources, false);
     194    PS_ASSERT_PTR_NON_NULL(filename, false);
    186195
    187196    int i;
     
    230239bool pmMomentsWriteText (psArray *sources, char *filename)
    231240{
     241    PS_ASSERT_PTR_NON_NULL(sources, false);
     242    PS_ASSERT_PTR_NON_NULL(filename, false);
    232243
    233244    int i;
  • branches/eam_branch_20071023/psModules/src/objects/pmSourceIO_SMPDATA.c

    r14938 r15418  
    33 *  @author EAM, IfA
    44 *
    5  *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
    6  *  @date $Date: 2007-09-21 00:09:05 $
     5 *  @version $Revision: 1.11.6.1 $ $Name: not supported by cvs2svn $
     6 *  @date $Date: 2007-10-30 00:59:23 $
    77 *
    88 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4242// this format consists of a header derived from the image header
    4343// followed by a zero-size matrix, followed by the table data
    44 bool pmSourcesWrite_SMPDATA (psFits *fits, psArray *sources, psMetadata *imageHeader, psMetadata *tableHeader, char *extname)
     44// XXX: input parameter imageHeader is never used
     45bool pmSourcesWrite_SMPDATA (psFits *fits, psArray *sources, psMetadata *imageHeader,
     46                             psMetadata *tableHeader, char *extname)
    4547{
     48    PS_ASSERT_PTR_NON_NULL(fits, false);
     49    PS_ASSERT_PTR_NON_NULL(sources, false);
     50    PS_ASSERT_PTR_NON_NULL(extname, false);
    4651
    4752    psArray *table;
     
    126131psArray *pmSourcesRead_SMPDATA (psFits *fits, psMetadata *header)
    127132{
     133    PS_ASSERT_PTR_NON_NULL(fits, false);
     134    PS_ASSERT_PTR_NON_NULL(header, false);
    128135
    129136    bool status;
  • branches/eam_branch_20071023/psModules/src/objects/pmSourceIO_SX.c

    r14938 r15418  
    33 *  @author EAM, IfA
    44 *
    5  *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
    6  *  @date $Date: 2007-09-21 00:09:05 $
     5 *  @version $Revision: 1.13.6.1 $ $Name: not supported by cvs2svn $
     6 *  @date $Date: 2007-10-30 00:59:23 $
    77 *
    88 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4242bool pmSourcesWriteSX (psArray *sources, char *filename)
    4343{
     44    PS_ASSERT_PTR_NON_NULL(sources, false);
     45    PS_ASSERT_PTR_NON_NULL(filename, false);
    4446
    4547    psF32 *PAR, *dPAR;
  • branches/eam_branch_20071023/psModules/src/objects/pmSourcePhotometry.c

    r15107 r15418  
    33 *  @author EAM, IfA; GLG, MHPCC
    44 *
    5  *  @version $Revision: 1.36 $ $Name: not supported by cvs2svn $
    6  *  @date $Date: 2007-09-29 03:14:55 $
     5 *  @version $Revision: 1.36.2.1 $ $Name: not supported by cvs2svn $
     6 *  @date $Date: 2007-10-30 00:59:23 $
    77 *
    88 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3939bool pmSourceMagnitudesInit (psMetadata *config)
    4040{
    41 
     41    PS_ASSERT_PTR_NON_NULL(config, false);
    4242    bool status;
    4343
     
    6464
    6565// XXX masked region should be (optionally) elliptical
    66 bool pmSourceMagnitudes (pmSource *source, pmPSF *psf, pmSourcePhotometryMode mode, psMaskType maskVal, psMaskType mark)
    67 {
     66bool pmSourceMagnitudes (pmSource *source, pmPSF *psf, pmSourcePhotometryMode mode,
     67                         psMaskType maskVal, psMaskType mark)
     68{
     69    PS_ASSERT_PTR_NON_NULL(source, false);
     70    PS_ASSERT_PTR_NON_NULL(psf, false);
    6871
    6972    int status = false;
     
    269272bool pmSourcePhotometryModel (float *fitMag, pmModel *model)
    270273{
     274    PS_ASSERT_PTR_NON_NULL(fitMag, false);
     275    if (model == NULL) {
     276        return false;
     277    }
    271278
    272279    float fitSum = 0;
    273280    *fitMag = NAN;
    274 
    275     if (model == NULL) {
    276         return false;
    277     }
    278281
    279282    // measure fitMag
     
    289292
    290293// return source aperture magnitude
    291 bool pmSourcePhotometryAper (float *apMag, pmModel *model, psImage *image, psImage *mask, psMaskType maskVal)
    292 {
     294bool pmSourcePhotometryAper (float *apMag, pmModel *model, psImage *image, psImage *mask,
     295                             psMaskType maskVal)
     296{
     297    PS_ASSERT_PTR_NON_NULL(apMag, false);
     298    PS_ASSERT_PTR_NON_NULL(image, false);
     299    PS_ASSERT_PTR_NON_NULL(mask, false);
     300    PS_ASSERT_PTR_NON_NULL(model, false);
     301
    293302    float apSum = 0;
    294303    float sky = 0;
    295304    *apMag = NAN;
    296 
    297     if (model == NULL) {
    298         psError(PM_ERR_OBJECTS, true, "Model is NULL");
    299         return false;
    300     }
    301305
    302306    if (DO_SKY) {
     
    327331
    328332// return source aperture magnitude
    329 bool pmSourcePixelWeight (float *pixWeight, pmModel *model, psImage *image, psImage *mask, psMaskType maskVal)
    330 {
     333bool pmSourcePixelWeight (float *pixWeight, pmModel *model, psImage *image, psImage *mask,
     334                          psMaskType maskVal)
     335{
     336    PS_ASSERT_PTR_NON_NULL(pixWeight, false);
     337    PS_ASSERT_PTR_NON_NULL(image, false);
     338    PS_ASSERT_PTR_NON_NULL(mask, false);
     339    PS_ASSERT_PTR_NON_NULL(model, false);
     340
    331341    float modelSum = 0;
    332342    float validSum = 0;
     
    339349
    340350    *pixWeight = 0.0;
    341 
    342     if (model == NULL)
    343         return false;
    344351
    345352    // we only care about the value of the object model, not the local sky
     
    412419                             const bool unweighted_sum) // should the cross product be weighted?
    413420{
     421    PS_ASSERT_PTR_NON_NULL(Mi, NAN);
     422    PS_ASSERT_PTR_NON_NULL(Mj, NAN);
    414423
    415424    int Xs, Xe, Ys, Ye;
     
    475484                           const bool unweighted_sum) // should the cross product be weighted?
    476485{
     486    PS_ASSERT_PTR_NON_NULL(Mi, NAN);
     487    PS_ASSERT_PTR_NON_NULL(Mj, NAN);
    477488
    478489    int Xs, Xe, Ys, Ye;
     
    538549                      const bool unweighted_sum) // should the cross product be weighted?
    539550{
     551    PS_ASSERT_PTR_NON_NULL(Mi, NAN);
    540552    double flux = 0, wt = 0, factor = 0;
    541553
     
    587599# endif
    588600
    589 bool pmSourceChisq (pmModel *model, psImage *image, psImage *mask, psImage *weight, psMaskType maskVal)
    590 {
     601bool pmSourceChisq (pmModel *model, psImage *image, psImage *mask, psImage *weight,
     602                    psMaskType maskVal)
     603{
     604    PS_ASSERT_PTR_NON_NULL(model, false);
     605    PS_ASSERT_PTR_NON_NULL(image, false);
     606    PS_ASSERT_PTR_NON_NULL(mask, false);
     607    PS_ASSERT_PTR_NON_NULL(weight, false);
    591608
    592609    double dC = 0.0;
     
    613630                      const bool unweighted_sum) // should the cross product be weighted?
    614631{
     632    PS_ASSERT_PTR_NON_NULL(Mi, NAN);
    615633    double flux = 0, wt = 0, factor = 0;
    616634
     
    662680                              const bool unweighted_sum) // should the cross product be weighted?
    663681{
     682    PS_ASSERT_PTR_NON_NULL(Mi, NAN);
     683    PS_ASSERT_PTR_NON_NULL(Mj, NAN);
    664684    int Xs, Xe, Ys, Ye;
    665685    int xi, xj, yi, yj;
     
    724744                             const bool unweighted_sum) // should the cross product be weighted?
    725745{
    726 
     746    PS_ASSERT_PTR_NON_NULL(Mi, NAN);
     747    PS_ASSERT_PTR_NON_NULL(Mj, NAN);
    727748    int Xs, Xe, Ys, Ye;
    728749    int xi, xj, yi, yj;
  • branches/eam_branch_20071023/psModules/src/objects/pmSourcePlotApResid.c

    r14938 r15418  
    44 *  @author EAM, IfA
    55 *
    6  *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
    7  *  @date $Date: 2007-09-21 00:09:05 $
     6 *  @version $Revision: 1.4.6.1 $ $Name: not supported by cvs2svn $
     7 *  @date $Date: 2007-10-30 00:59:23 $
    88 *  Copyright 2006 IfA, University of Hawaii
    99 */
     
    4040    # include <kapa.h>
    4141
    42     // plot the sx, sy, sxy as vector field,
    43     // plot the PSF measured sx, sy, sxy as vector field
    44     // pull the sources from the config / file?
    45     bool pmSourcePlotApResid (const pmFPAview *view, pmFPAfile *file, const pmConfig *config, pmSourcePlotLayout *layout)
     42// plot the sx, sy, sxy as vector field,
     43// plot the PSF measured sx, sy, sxy as vector field
     44// pull the sources from the config / file?
     45bool pmSourcePlotApResid (const pmFPAview *view, pmFPAfile *file, const pmConfig *config,
     46                          pmSourcePlotLayout *layout)
    4647{
     48    PS_ASSERT_PTR_NON_NULL(view, false);
     49    PS_ASSERT_PTR_NON_NULL(file, false);
     50    PS_ASSERT_PTR_NON_NULL(config, false);
     51    PS_ASSERT_PTR_NON_NULL(layout, false);
    4752
    4853    Graphdata graphdata;
     
    150155# else
    151156
    152     bool pmSourcePlotApResid (const pmFPAview *view, pmFPAfile *file, const pmConfig *config, pmSourcePlotLayout *layout)
     157bool pmSourcePlotApResid (const pmFPAview *view, pmFPAfile *file, const pmConfig *config, pmSourcePlotLayout *layout)
    153158{
    154159    psLogMsg ("psphot", 3, "skipping ap-mag resid plot");
  • branches/eam_branch_20071023/psModules/src/objects/pmSourcePlotMoments.c

    r14938 r15418  
    55 *  @author EAM, IfA
    66 *
    7  *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2007-09-21 00:09:05 $
     7 *  @version $Revision: 1.9.6.1 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2007-10-30 00:59:23 $
    99 *
    1010 *  Copyright 2006 IfA, University of Hawaii
     
    4141// this variable is defined in psmodules.h if ohana-config is found
    4242# if (HAVE_KAPA)
    43     # include <kapa.h>
     43# include <kapa.h>
    4444
    45     // plot the sx, sy moments plane (faint and bright sources)
    46     bool pmSourcePlotMoments (const pmFPAview *view, pmFPAfile *file, const pmConfig *config, pmSourcePlotLayout *layout)
     45// plot the sx, sy moments plane (faint and bright sources)
     46bool pmSourcePlotMoments (const pmFPAview *view, pmFPAfile *file, const pmConfig *config,
     47                          pmSourcePlotLayout *layout)
    4748{
     49    PS_ASSERT_PTR_NON_NULL(view, false);
     50    PS_ASSERT_PTR_NON_NULL(file, false);
     51    PS_ASSERT_PTR_NON_NULL(config, false);
     52    PS_ASSERT_PTR_NON_NULL(layout, false);
    4853
    4954    Graphdata graphdata;
  • branches/eam_branch_20071023/psModules/src/objects/pmSourcePlotPSFModel.c

    r14938 r15418  
    55 *  @author EAM, IfA
    66 *
    7  *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2007-09-21 00:09:05 $
     7 *  @version $Revision: 1.11.6.1 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2007-10-30 00:59:23 $
    99 *
    1010 *  Copyright 2006 IfA, University of Hawaii
     
    4141// this variable is defined in psmodules.h if ohana-config is found
    4242# if (HAVE_KAPA)
    43     # include <kapa.h>
    44 
    45     // plot the sx, sy, sxy as vector field,
    46     // plot the PSF measured sx, sy, sxy as vector field
    47     // pull the sources from the config / file?
    48     bool pmSourcePlotPSFModel (const pmFPAview *view, pmFPAfile *file, const pmConfig *config, pmSourcePlotLayout *layout)
     43# include <kapa.h>
     44
     45// plot the sx, sy, sxy as vector field,
     46// plot the PSF measured sx, sy, sxy as vector field
     47// pull the sources from the config / file?
     48bool pmSourcePlotPSFModel (const pmFPAview *view, pmFPAfile *file, const pmConfig *config,
     49                           pmSourcePlotLayout *layout)
    4950{
     51    PS_ASSERT_PTR_NON_NULL(view, false);
     52    PS_ASSERT_PTR_NON_NULL(file, false);
     53    PS_ASSERT_PTR_NON_NULL(config, false);
     54    PS_ASSERT_PTR_NON_NULL(layout, false);
    5055
    5156    Graphdata graphdata;
  • branches/eam_branch_20071023/psModules/src/objects/pmSourcePlots.c

    r13214 r15418  
    55 *  @author EAM, IfA
    66 *
    7  *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2007-05-04 00:54:09 $
     7 *  @version $Revision: 1.4.16.1 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2007-10-30 00:59:23 $
    99 *
    1010 *  Copyright 2006 IfA, University of Hawaii
     
    3636    PS_ASSERT_PTR_NON_NULL(view, false);
    3737    PS_ASSERT_PTR_NON_NULL(file, false);
     38    PS_ASSERT_PTR_NON_NULL(config, false);
    3839
    3940    if ((view->readout != -1) || (view->cell != -1)) {
     
    149150}
    150151
     152bool psMemCheckSourcePlotLayout(psPtr ptr)
     153{
     154    PS_ASSERT_PTR(ptr, false);
     155    return ( psMemGetDeallocator(ptr) == (psFreeFunc) pmSourcePlotLayoutFree);
     156}
     157
     158
    151159/* we have three types of plots to produce (maybe more?)
    152160 * for each plot, we need to supply the following information:
  • branches/eam_branch_20071023/psModules/src/objects/pmSourcePlots.h

    r13214 r15418  
    44 * @author EAM, IfA
    55 *
    6  * @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
    7  * @date $Date: 2007-05-04 00:54:09 $
     6 * @version $Revision: 1.4.16.1 $ $Name: not supported by cvs2svn $
     7 * @date $Date: 2007-10-30 00:59:23 $
    88 * Copyright 2006 Institute for Astronomy, University of Hawaii
    99 */
     
    3030
    3131pmSourcePlotLayout *pmSourcePlotLayoutAlloc();
     32bool psMemCheckSourcePlotLayout(psPtr ptr);
    3233
    3334bool pmFPAviewWriteSourcePlot(const pmFPAview *view, pmFPAfile *file, const pmConfig *config);
  • branches/eam_branch_20071023/psModules/src/objects/pmSourceUtils.c

    r14938 r15418  
    66 *  @author EAM, IfA: significant modifications.
    77 *
    8  *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2007-09-21 00:09:05 $
     8 *  @version $Revision: 1.3.6.1 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2007-10-30 00:59:23 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    6363}
    6464
    65 pmSource *pmSourceFromModel (pmModel *model, pmReadout *readout, float radius, pmSourceType type) {
     65pmSource *pmSourceFromModel (pmModel *model, pmReadout *readout, float radius,
     66                             pmSourceType type)
     67{
     68    PS_ASSERT_PTR_NON_NULL(model, NULL);
     69    PS_ASSERT_PTR_NON_NULL(readout, NULL);
    6670
    6771    pmSource *source = pmSourceAlloc ();
  • branches/eam_branch_20071023/psModules/src/objects/pmTrend2D.h

    r15000 r15418  
    55 * @author EAM, IfA
    66 *
    7  * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
    8  * @date $Date: 2007-09-24 21:27:58 $
     7 * @version $Revision: 1.3.4.1 $ $Name: not supported by cvs2svn $
     8 * @date $Date: 2007-10-30 00:59:23 $
    99 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii
    1010 */
     
    3434pmTrend2D *pmTrend2DAlloc (pmTrend2DMode mode, psImage *image, int nXtrend, int nYtrend, psStats *stats);
    3535
     36bool psMemCheckTrend2D(psPtr ptr);
     37
    3638pmTrend2D *pmTrend2DNoImageAlloc (pmTrend2DMode mode, psImageBinning *binning, psStats *stats);
    3739
Note: See TracChangeset for help on using the changeset viewer.