IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 15726


Ignore:
Timestamp:
Nov 30, 2007, 1:08:23 PM (18 years ago)
Author:
gusciora
Message:

This is the first version of most of these.

Location:
trunk/psModules/test/objects
Files:
16 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/test/objects/Makefile.am

    r15015 r15726  
    1111        $(PSMODULES_LIBS)
    1212
    13 TEST_PROGS =
     13TEST_PROGS = \
     14        tap_pmPeaks \
     15        tap_pmGrowthCurve \
     16        tap_pmGrowthCurve02 \
     17        tap_pmMoments \
     18        tap_pmSource \
     19        tap_pmModel \
     20        tap_pmModelUtils \
     21        tap_pmModelClass \
     22        tap_pmPSF \
     23        tap_pmTrend2D \
     24        tap_pmResiduals \
     25        tap_pmSourceExtendedPars \
     26        tap_pmSourceSky \
     27        tap_pmSourceIO_PS1_DEV_0 \
     28        tap_pmSourceIO_PS1_DEV_1 \
     29        tap_pmSourceIO_SMPDATA \
     30        tap_pmSourceContour \
     31        tap_pmSourceUtils \
     32        tap_pmSourceFitSet \
     33        tap_pmPSF_IO \
     34        tap_pmSourceIO_SMPDATA
    1435
    1536if BUILD_TESTS
  • trunk/psModules/test/objects/tap_pmFringe.c

    r13879 r15726  
    129129    }
    130130}
    131 //HERE
  • trunk/psModules/test/objects/tap_pmGrowthCurve.c

    r9922 r15726  
    33#include <pslib.h>
    44#include <psmodules.h>
    5 
    65#include "tap.h"
    76#include "pstap.h"
    87
    9 int main (void)
     8#define VERBOSE                 0
     9#define ERR_TRACE_LEVEL         10
     10
     11int main(int argc, char* argv[])
    1012{
    11     pmModelGroupInit ();
    12 
    13     plan_tests(57);
    14 
    15     diag("pmGrowthCurve tests");
    16 
    17     // test allocation
    18     diag("offset of 0.0,0.0 wrt growth ref source");
     13    psLogSetFormat("HLNM");
     14    psLogSetLevel(PS_LOG_INFO);
     15    psTraceSetLevel("err", ERR_TRACE_LEVEL);
     16    plan_tests(15);
     17
     18    // ----------------------------------------------------------------------
     19    // pmGrowthCurveAlloc() tests
     20    // call pmGrowthCurveAlloc() with acceptable input parameters.
     21    {
     22        psMemId id = psMemGetId();
     23        pmGrowthCurve *growthCurve = pmGrowthCurveAlloc(1.0, 2.0, 3.0);
     24        ok(growthCurve && psMemCheckGrowthCurve(growthCurve), "pmGrowthCurveAlloc() allocated a pmGrowthCurve correctly");
     25        ok(growthCurve->radius && psMemCheckVector(growthCurve->radius), "pmGrowthCurveAlloc() allocated the radius psVector correctly");
     26        ok(growthCurve->apMag  && psMemCheckVector(growthCurve->apMag) &&
     27           growthCurve->apMag->n == growthCurve->radius->n, "pmGrowthCurveAlloc() allocated the apMag psVector correctly");
     28        ok(growthCurve->refRadius == 3.0, "pmGrowthCurveAlloc() set growthCurve->refRadius correctly");
     29        ok(growthCurve->maxRadius == 2.0, "pmGrowthCurveAlloc() set growthCurve->maxRadius correctly");
     30        ok(growthCurve->apLoss == 0.0, "pmGrowthCurveAlloc() set growthCurve->apLoss correctly");
     31        ok(growthCurve->fitMag == 0.0, "pmGrowthCurveAlloc() set growthCurve->fitMag correctly");
     32        psFree(growthCurve);
     33        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     34    }
     35
     36
     37    // ----------------------------------------------------------------------
     38    // pmGrowthCurveCorrect() tests
     39    // Call pmGrowthCurveCorrect() with NULL input pmGrowthCurve
     40    {
     41        psMemId id = psMemGetId();
     42        pmGrowthCurve *growthCurve = pmGrowthCurveAlloc(1.0, 2.0, 3.0);
     43        ok(isnan(pmGrowthCurveCorrect(NULL, 0.0)), "pmGrowthCurveCorrect() returned NAN with NULL input pmGrowthCurve");
     44        psFree(growthCurve);
     45        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     46    }
     47
     48    // Call pmGrowthCurveCorrect() with bad type for input pmGrowthCurve arg
     49    // XX: This is commented out for now because we are not asserting, inside
     50    // pmGrowthCurveCorrect(), that input parameters are of the correct type.
     51    if (0) {
     52        psMemId id = psMemGetId();
     53        pmGrowthCurve *growthCurve = pmGrowthCurveAlloc(1.0, 2.0, 3.0);
     54        psVector *junkVec = psVectorAlloc(10, PS_TYPE_F32);
     55        ok(isnan(pmGrowthCurveCorrect((pmGrowthCurve *) junkVec, 0.0)), "pmGrowthCurveCorrect() returned NAN with NULL input pmGrowthCurve");
     56        psFree(growthCurve);
     57        psFree(junkVec);
     58        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     59    }
     60
     61
     62    // Call pmGrowthCurveCorrect() with acceptable input parameters.
     63    {
     64        #define RADIUS 0.5
     65        psMemId id = psMemGetId();
     66        pmGrowthCurve *growthCurve = pmGrowthCurveAlloc(1.0, 2.0, 3.0);
     67        float testCor = pmGrowthCurveCorrect(growthCurve, RADIUS);
     68        float actRad = psVectorInterpolate (growthCurve->radius, growthCurve->apMag, RADIUS);
     69        float actCor = growthCurve->apRef - actRad;
     70
     71        ok(!isnan(testCor), "pmGrowthCurveCorrect() call was successful");
     72        ok(actCor == testCor, "pmGrowthCurveCorrect() calculated the correction correctly");
     73
     74        psFree(growthCurve);
     75        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     76    }
     77
     78
     79    // EM test 01: test allocation
     80    // offset of 0.0,0.0 wrt growth ref source
    1981    {
    2082        psMemId id = psMemGetId();
     
    43105
    44106        // generate a simple psf
    45         pmPSF *psf = pmPSFBuildSimple ("PS_MODEL_GAUSS", 1.5, 1.5, 0.0);
     107        pmModelClassInit();
     108        pmPSF *psf = pmPSFBuildSimple("PS_MODEL_GAUSS", 1.5, 1.5, 0.0);
    46109        psf->growth = growth;
    47110
    48         pmGrowthCurveGenerate (readout, psf, false);
     111        pmGrowthCurveGenerate(readout, psf, false, 0, 0);
    49112
    50113        // check ap mags for a few radii set by hand
     
    71134        source->type = PM_SOURCE_TYPE_STAR;
    72135        source->pixels = psMemIncrRefCounter (readout->image);
    73         source->mask = psMemIncrRefCounter (readout->mask);
     136        source->maskObj = psMemIncrRefCounter (readout->mask);
    74137
    75138        source->modelPSF->dparams->data.F32[PM_PAR_I0] = 1;
     
    77140
    78141        source->modelPSF->radiusFit = 15.0;
    79         pmSourceMagnitudes (source, psf, PM_SOURCE_PHOT_GROWTH | PM_SOURCE_PHOT_INTERP);
     142
     143        pmSourceMagnitudes (source, psf, PM_SOURCE_PHOT_GROWTH | PM_SOURCE_PHOT_INTERP, 0, 0);
    80144        double refMag = source->apMag;
    81145
    82146        source->modelPSF->radiusFit = 10.0;
    83         pmSourceMagnitudes (source, psf, PM_SOURCE_PHOT_GROWTH | PM_SOURCE_PHOT_INTERP);
     147        pmSourceMagnitudes (source, psf, PM_SOURCE_PHOT_GROWTH | PM_SOURCE_PHOT_INTERP, 0, 0);
    84148        ok_float_tol(refMag - source->apMag, +0.0000, 0.0001, "growth offset is is %f", refMag - source->apMag);
    85149
    86150        source->modelPSF->radiusFit = 8.0;
    87         pmSourceMagnitudes (source, psf, PM_SOURCE_PHOT_GROWTH | PM_SOURCE_PHOT_INTERP);
     151        pmSourceMagnitudes (source, psf, PM_SOURCE_PHOT_GROWTH | PM_SOURCE_PHOT_INTERP, 0, 0);
    88152        ok_float_tol(refMag - source->apMag, +0.0000, 0.0001, "growth offset is is %f", refMag - source->apMag);
    89153
    90154        source->modelPSF->radiusFit = 6.0;
    91         pmSourceMagnitudes (source, psf, PM_SOURCE_PHOT_GROWTH | PM_SOURCE_PHOT_INTERP);
     155        pmSourceMagnitudes (source, psf, PM_SOURCE_PHOT_GROWTH | PM_SOURCE_PHOT_INTERP, 0, 0);
    92156        ok_float_tol(refMag - source->apMag, +0.0003, 0.0001, "growth offset is is %f", refMag - source->apMag);
    93157
    94158        source->modelPSF->radiusFit = 4.0;
    95         pmSourceMagnitudes (source, psf, PM_SOURCE_PHOT_GROWTH | PM_SOURCE_PHOT_INTERP);
     159        pmSourceMagnitudes (source, psf, PM_SOURCE_PHOT_GROWTH | PM_SOURCE_PHOT_INTERP, 0, 0);
    96160        ok_float_tol(refMag - source->apMag, +0.0020, 0.0001, "growth offset is is %f", refMag - source->apMag);
    97161
    98162        source->modelPSF->radiusFit = 3.0;
    99         pmSourceMagnitudes (source, psf, PM_SOURCE_PHOT_GROWTH | PM_SOURCE_PHOT_INTERP);
     163        pmSourceMagnitudes (source, psf, PM_SOURCE_PHOT_GROWTH | PM_SOURCE_PHOT_INTERP, 0, 0);
    100164        ok_float_tol(refMag - source->apMag, -0.0001, 0.0001, "growth offset is is %f", refMag - source->apMag);
    101165
    102166        source->modelPSF->radiusFit = 2.0;
    103         pmSourceMagnitudes (source, psf, PM_SOURCE_PHOT_GROWTH | PM_SOURCE_PHOT_INTERP);
     167        pmSourceMagnitudes (source, psf, PM_SOURCE_PHOT_GROWTH | PM_SOURCE_PHOT_INTERP, 0, 0);
    104168        ok_float_tol(refMag - source->apMag, -0.0075, 0.0001, "growth offset is is %f", refMag - source->apMag);
    105169
     
    116180    }
    117181
    118     // test allocation
    119     diag("offset of 0.2,0.2 wrt growth ref source");
     182
     183    // EM test 02: test allocation
     184    // offset of 0.2,0.2 wrt growth ref source
    120185    {
    121186        psMemId id = psMemGetId();
     
    147212        psf->growth = growth;
    148213
    149         pmGrowthCurveGenerate (readout, psf, false);
     214        pmGrowthCurveGenerate (readout, psf, false, 0, 0);
    150215
    151216        // check ap mags for a few radii set by hand
     
    172237        source->type = PM_SOURCE_TYPE_STAR;
    173238        source->pixels = psMemIncrRefCounter (readout->image);
    174         source->mask = psMemIncrRefCounter (readout->mask);
     239        source->maskObj = psMemIncrRefCounter (readout->mask);
    175240
    176241        source->modelPSF->dparams->data.F32[PM_PAR_I0] = 1;
     
    178243
    179244        source->modelPSF->radiusFit = 15.0;
    180         pmSourceMagnitudes (source, psf, PM_SOURCE_PHOT_GROWTH | PM_SOURCE_PHOT_INTERP);
     245        pmSourceMagnitudes (source, psf, PM_SOURCE_PHOT_GROWTH | PM_SOURCE_PHOT_INTERP, 0, 0);
    181246        double refMag = source->apMag;
    182247
    183248        source->modelPSF->radiusFit = 10.0;
    184         pmSourceMagnitudes (source, psf, PM_SOURCE_PHOT_GROWTH | PM_SOURCE_PHOT_INTERP);
     249        pmSourceMagnitudes (source, psf, PM_SOURCE_PHOT_GROWTH | PM_SOURCE_PHOT_INTERP, 0, 0);
    185250        ok_float_tol(refMag - source->apMag, +0.0000, 0.0001, "growth offset is is %f", refMag - source->apMag);
    186251
    187252        source->modelPSF->radiusFit = 8.0;
    188         pmSourceMagnitudes (source, psf, PM_SOURCE_PHOT_GROWTH | PM_SOURCE_PHOT_INTERP);
     253        pmSourceMagnitudes (source, psf, PM_SOURCE_PHOT_GROWTH | PM_SOURCE_PHOT_INTERP, 0, 0);
    189254        ok_float_tol(refMag - source->apMag, +0.0000, 0.0001, "growth offset is is %f", refMag - source->apMag);
    190255
    191256        source->modelPSF->radiusFit = 6.0;
    192         pmSourceMagnitudes (source, psf, PM_SOURCE_PHOT_GROWTH | PM_SOURCE_PHOT_INTERP);
     257        pmSourceMagnitudes (source, psf, PM_SOURCE_PHOT_GROWTH | PM_SOURCE_PHOT_INTERP, 0, 0);
    193258        ok_float_tol(refMag - source->apMag, +0.0004, 0.0001, "growth offset is is %f", refMag - source->apMag);
    194259
    195260        source->modelPSF->radiusFit = 4.0;
    196         pmSourceMagnitudes (source, psf, PM_SOURCE_PHOT_GROWTH | PM_SOURCE_PHOT_INTERP);
     261        pmSourceMagnitudes (source, psf, PM_SOURCE_PHOT_GROWTH | PM_SOURCE_PHOT_INTERP, 0, 0);
    197262        ok_float_tol(refMag - source->apMag, +0.0026, 0.0001, "growth offset is is %f", refMag - source->apMag);
    198263
    199264        source->modelPSF->radiusFit = 3.0;
    200         pmSourceMagnitudes (source, psf, PM_SOURCE_PHOT_GROWTH | PM_SOURCE_PHOT_INTERP);
     265        pmSourceMagnitudes (source, psf, PM_SOURCE_PHOT_GROWTH | PM_SOURCE_PHOT_INTERP, 0, 0);
    201266        ok_float_tol(refMag - source->apMag, -0.0001, 0.0001, "growth offset is is %f", refMag - source->apMag);
    202267
    203268        source->modelPSF->radiusFit = 2.0;
    204         pmSourceMagnitudes (source, psf, PM_SOURCE_PHOT_GROWTH | PM_SOURCE_PHOT_INTERP);
     269        pmSourceMagnitudes (source, psf, PM_SOURCE_PHOT_GROWTH | PM_SOURCE_PHOT_INTERP, 0, 0);
    205270        ok_float_tol(refMag - source->apMag, -0.0103, 0.0001, "growth offset is is %f", refMag - source->apMag);
    206271
     
    217282    }
    218283
    219     // test allocation
    220     diag("offset of 0.4,0.4 wrt growth ref source");
     284
     285    // EM test 03: test allocation
     286    // offset of 0.4,0.4 wrt growth ref source
    221287    {
    222288        psMemId id = psMemGetId();
     
    248314        psf->growth = growth;
    249315
    250         pmGrowthCurveGenerate (readout, psf, false);
     316        pmGrowthCurveGenerate(readout, psf, false, 0, 0);
    251317
    252318        // check ap mags for a few radii set by hand
     
    273339        source->type = PM_SOURCE_TYPE_STAR;
    274340        source->pixels = psMemIncrRefCounter (readout->image);
    275         source->mask = psMemIncrRefCounter (readout->mask);
     341        source->maskObj = psMemIncrRefCounter (readout->mask);
    276342
    277343        source->modelPSF->dparams->data.F32[PM_PAR_I0] = 1;
     
    279345
    280346        source->modelPSF->radiusFit = 15.0;
    281         pmSourceMagnitudes (source, psf, PM_SOURCE_PHOT_GROWTH | PM_SOURCE_PHOT_INTERP);
     347        pmSourceMagnitudes (source, psf, PM_SOURCE_PHOT_GROWTH | PM_SOURCE_PHOT_INTERP, 0, 0);
    282348        double refMag = source->apMag;
    283349
    284350        source->modelPSF->radiusFit = 10.0;
    285         pmSourceMagnitudes (source, psf, PM_SOURCE_PHOT_GROWTH | PM_SOURCE_PHOT_INTERP);
     351        pmSourceMagnitudes (source, psf, PM_SOURCE_PHOT_GROWTH | PM_SOURCE_PHOT_INTERP, 0, 0);
    286352        ok_float_tol(refMag - source->apMag, +0.0000, 0.0001, "growth offset is is %f", refMag - source->apMag);
    287353
    288354        source->modelPSF->radiusFit = 8.0;
    289         pmSourceMagnitudes (source, psf, PM_SOURCE_PHOT_GROWTH | PM_SOURCE_PHOT_INTERP);
     355        pmSourceMagnitudes (source, psf, PM_SOURCE_PHOT_GROWTH | PM_SOURCE_PHOT_INTERP, 0, 0);
    290356        ok_float_tol(refMag - source->apMag, +0.0000, 0.0001, "growth offset is is %f", refMag - source->apMag);
    291357
    292358        source->modelPSF->radiusFit = 6.0;
    293         pmSourceMagnitudes (source, psf, PM_SOURCE_PHOT_GROWTH | PM_SOURCE_PHOT_INTERP);
     359        pmSourceMagnitudes (source, psf, PM_SOURCE_PHOT_GROWTH | PM_SOURCE_PHOT_INTERP, 0, 0);
    294360        ok_float_tol(refMag - source->apMag, +0.0006, 0.0001, "growth offset is is %f", refMag - source->apMag);
    295361
    296362        source->modelPSF->radiusFit = 4.0;
    297         pmSourceMagnitudes (source, psf, PM_SOURCE_PHOT_GROWTH | PM_SOURCE_PHOT_INTERP);
     363        pmSourceMagnitudes (source, psf, PM_SOURCE_PHOT_GROWTH | PM_SOURCE_PHOT_INTERP, 0, 0);
    298364        ok_float_tol(refMag - source->apMag, +0.0038, 0.0001, "growth offset is is %f", refMag - source->apMag);
    299365
    300366        source->modelPSF->radiusFit = 3.0;
    301         pmSourceMagnitudes (source, psf, PM_SOURCE_PHOT_GROWTH | PM_SOURCE_PHOT_INTERP);
     367        pmSourceMagnitudes (source, psf, PM_SOURCE_PHOT_GROWTH | PM_SOURCE_PHOT_INTERP, 0, 0);
    302368        ok_float_tol(refMag - source->apMag, +0.0000, 0.0001, "growth offset is is %f", refMag - source->apMag);
    303369
    304370        source->modelPSF->radiusFit = 2.0;
    305         pmSourceMagnitudes (source, psf, PM_SOURCE_PHOT_GROWTH | PM_SOURCE_PHOT_INTERP);
     371        pmSourceMagnitudes (source, psf, PM_SOURCE_PHOT_GROWTH | PM_SOURCE_PHOT_INTERP, 0, 0);
    306372        ok_float_tol(refMag - source->apMag, -0.0164, 0.0001, "growth offset is is %f", refMag - source->apMag);
    307373
     
    317383        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
    318384    }
    319 
    320     return exit_status();
    321385}
     386
  • trunk/psModules/test/objects/tap_pmMoments.c

    r13879 r15726  
    3232    }
    3333}
    34 
  • trunk/psModules/test/objects/tap_pmPeaks.c

    r15161 r15726  
    1414Must test
    1515    pmCullPeaks()
     16        Doesn't exist
     17    pmPeakTest()
     18        Get rid of this
     19    pmPeakSortBySN()
     20        Easy
     21    pmPeakSortByY()
     22        Easy
    1623*/
    1724
     
    698705        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
    699706    }
    700 //HERE
    701707}
    702708
Note: See TracChangeset for help on using the changeset viewer.