IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 36279


Ignore:
Timestamp:
Nov 11, 2013, 10:28:05 AM (13 years ago)
Author:
eugene
Message:

fix errors in the test

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20130904/psLib/test/imageops/tap_psImageConvolve2dCache.c

    r36278 r36279  
    1414#include "pstap.h"
    1515
     16bool tap_convolve_delta (int Nx, int Ny, int Xo, int Yo, float sigma, float kappa);
     17
    1618int main(int argc, char **argv) {
    1719
    18     bool status;
    19 
    20     plan_tests(62);
     20    plan_tests(141);
    2121
    2222    psMemId id = psMemGetId();
    2323
    2424    // generate an image to convolve
     25    tap_convolve_delta (301, 301, 150, 150, 2.0, 1.0);
     26    tap_convolve_delta (301, 301, 100, 200, 2.0, 1.0);
     27    tap_convolve_delta (301, 301, 200, 100, 2.0, 1.0);
     28    tap_convolve_delta (301, 301, 200, 200, 2.0, 1.0);
     29    tap_convolve_delta (301, 301, 100, 100, 2.0, 1.0);
    2530
    26     int Nx = 301;
    27     int Ny = 301;
     31    tap_convolve_delta (301, 301, 150, 150, 3.0, 1.0);
     32    tap_convolve_delta (301, 301, 100, 200, 3.0, 1.0);
     33    tap_convolve_delta (301, 301, 200, 100, 3.0, 1.0);
     34    tap_convolve_delta (301, 301, 200, 200, 3.0, 1.0);
     35    tap_convolve_delta (301, 301, 100, 100, 3.0, 1.0);
    2836
    29     int Xo = (Nx - 1) / 2;
    30     int Yo = (Ny - 1) / 2;
     37    tap_convolve_delta (301, 301, 150, 150, 1.0, 1.0);
     38    tap_convolve_delta (301, 301, 100, 200, 1.0, 1.0);
     39    tap_convolve_delta (301, 301, 200, 100, 1.0, 1.0);
     40    tap_convolve_delta (301, 301, 200, 200, 1.0, 1.0);
     41    tap_convolve_delta (301, 301, 100, 100, 1.0, 1.0);
     42
     43    tap_convolve_delta (301, 301, 150, 150, 2.0, 2.0);
     44    tap_convolve_delta (301, 301, 100, 200, 2.0, 2.0);
     45    tap_convolve_delta (301, 301, 200, 100, 2.0, 2.0);
     46    tap_convolve_delta (301, 301, 200, 200, 2.0, 2.0);
     47    tap_convolve_delta (301, 301, 100, 100, 2.0, 2.0);
     48
     49    ok(!psMemCheckLeaks (id, NULL, stdout, false), "no memory leaks");
     50
     51    return exit_status();
     52}
     53
     54bool tap_convolve_delta (int Nx, int Ny, int Xo, int Yo, float sigma, float kappa) {
     55
     56    bool status;
    3157
    3258    psImage *input = psImageAlloc (Nx, Ny, PS_TYPE_F32);
    3359    psImageInit (input, 0.0);
    34     input->data.F32[Xo][Yo] = 1.0;
     60    input->data.F32[Yo][Xo] = 1.0;
    3561
    3662    psImageSmooth2dCacheData *smdata = psImageSmooth2dCacheAlloc ();
     
    3965    ok(smdata->Nsigma == 3, "init Nsigma to 3");
    4066   
    41     float sigma = 2.0;
    42     float kappa = 1.0;
    4367    status = psImageSmooth2dCacheKernel_PS1_V1 (smdata, sigma, kappa);
    4468    ok(status, "generate a kernel");
     
    80104    ok (fabs(max_df) < 1e-5, "minor deviations");
    81105
    82     /*
    83     psFits *fits = NULL;
    84     fits = psFitsOpen ("input.fits", "w");
    85     psFitsWriteImage (fits, NULL, input, 0, NULL);
    86     psFitsClose (fits);
     106    if ((fabs(min_df) >= 1e-5) || (fabs(max_df) >= 1e-5)) {
     107        psFits *fits = NULL;
     108        fits = psFitsOpen ("input.fits", "w");
     109        psFitsWriteImage (fits, NULL, input, 0, NULL);
     110        psFitsClose (fits);
    87111
    88     fits = psFitsOpen ("model.fits", "w");
    89     psFitsWriteImage (fits, NULL, model, 0, NULL);
    90     psFitsClose (fits);
    91     */
     112        fits = psFitsOpen ("model.fits", "w");
     113        psFitsWriteImage (fits, NULL, model, 0, NULL);
     114        psFitsClose (fits);
     115    }
    92116
    93117    psFree (input);
    94118    psFree (model);
    95119    psFree (smdata);
    96     ok(!psMemCheckLeaks (id, NULL, stdout, false), "no memory leaks");
    97120
    98     return exit_status();
     121    return true;
    99122}
Note: See TracChangeset for help on using the changeset viewer.