IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 16056


Ignore:
Timestamp:
Jan 14, 2008, 1:42:49 PM (18 years ago)
Author:
eugene
Message:

adding new tests from mark pitts

Location:
trunk/Ohana/src/opihi
Files:
10 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/cmd.data/test/fit2d.sh

    r14176 r16056  
    33 test1
    44 test2
    5  test3
    6  test4
    7  test5
    8  test6
    9  test7
    10  test8
     5 memtest1
    116end
    127
    13 # fit a line without errors
     8# fit a function without errors
    149macro test1
    1510 $PASS = 1
    1611 break -auto off
    1712
    18  create x 0 100
    19  create y 0 100
    20  set z = 3 + 5*x + 3*y
    21  fit -q x y z 1
     13 create x 0 5 0.01
     14 set y = sin((2*3.14159*x)/2)
     15 set z = 5-4*x+x^2-3*y+6*x*y-2*y^2
    2216
    23  if ($Cn != 1)
     17 fit2d -q x y z 2
     18
     19 if ($Cnn != 2)
    2420   $PASS = 0
     21   echo "Function Order Incorrect!"
    2522 end
    26  if (abs($C0 - 3) > 1e-5)
     23 if (abs($CX0Y0 - 5) > 1e-5)
    2724   $PASS = 0
     25   echo "Term CX0Y0 Incorrect!"
    2826 end
    29  if (abs($C1 - 5) > 1e-5)
     27 if (abs($CX1Y0 + 4) > 1e-5)
    3028   $PASS = 0
     29   echo "Term CX1Y0 Incorrect!"
     30 end
     31 if (abs($CX2Y0 - 1) > 1e-5)
     32   $PASS = 0
     33   echo "Term CX2Y0 Incorrect!"
     34 end
     35 if (abs($CX0Y1 + 3) > 1e-5)
     36   $PASS = 0
     37   echo "Term CX0Y1 Incorrect!"
     38 end
     39 if (abs($CX1Y1 - 6) > 1e-5)
     40   $PASS = 0
     41   echo "Term CX1Y1 Incorrect!"
     42 end
     43 if (abs($CX0Y2 + 2) > 1e-5)
     44   $PASS = 0
     45   echo "Term CX0Y2 Incorrect!"
    3146 end
    3247end
    3348
    34 # fit a line with errors
     49# fit a function with errors
    3550macro test2
    3651 $PASS = 1
    3752 break -auto off
    3853
    39  create x 0 100
    40  set dy = 0.1*rnd(x) - 0.05
    41  set y = 3 + 5*x + dy
    42  fit -q x y 1
     54 create x 0 5 0.01
     55 set y = sin((2*3.14159*x)/2)
     56 set dz = 0.1*rnd(x) - 0.05
     57 set z = 5-4*x+x^2-3*y+6*x*y-2*y^2+dz
    4358
    44  if ($Cn != 1)
     59 fit2d -q x y z 2
     60
     61 if ($Cnn != 2)
    4562   $PASS = 0
     63   echo "Function Order Incorrect!"
    4664 end
    47  if (abs($C0 - 3) > 0.01)
     65 if (abs($CX0Y0 - 5) > 0.01)
    4866   $PASS = 0
     67   echo "Term CX0Y0 Incorrect!"
    4968 end
    50  if (abs($C1 - 5) > 0.01)
     69 if (abs($CX1Y0 + 4) > 0.01)
    5170   $PASS = 0
     71   echo "Term CX1Y0 Incorrect!"
     72 end
     73 if (abs($CX2Y0 - 1) > 0.01)
     74   $PASS = 0
     75   echo "Term CX2Y0 Incorrect!"
     76 end
     77 if (abs($CX0Y1 + 3) > 0.01)
     78   $PASS = 0
     79   echo "Term CX0Y1 Incorrect!"
     80 end
     81 if (abs($CX1Y1 - 6) > 0.01)
     82   $PASS = 0
     83   echo "Term CX1Y1 Incorrect!"
     84 end
     85 if (abs($CX0Y2 + 2) > 0.01)
     86   $PASS = 0
     87   echo "Term CX0Y2 Incorrect!"
    5288 end
    5389end
    5490
    55 # fit a line with errors and weights
    56 macro test3
     91# Memory Test
     92macro memtest1
     93
     94 local i
     95
     96 list word -x "ps -p $PID -o rss"
     97 $startmem = $word:1
     98
     99 create x 0 5 0.01
     100 set y = sin((2*3.14159*x)/2)
     101 set dz = 0.1*rnd(x) - 0.05
     102 set z = 5-4*x+x^2-3*y+6*x*y-2*y^2+dz
     103
     104 for i 0 1000
     105  fit2d -q x y z 2
     106 end
     107 
     108 list word -x "ps -p $PID -o rss"
     109 $endmem = $word:1
     110
    57111 $PASS = 1
    58  break -auto off
    59112
    60  create x 0 100
    61  set dy = 0.1*rnd(x) - 0.05
    62  set y = 3 + 5*x + dy
    63  set dy = 0.1 + zero(x)
    64  fit -q x y 1 -dy dy
    65 
    66  if ($Cn != 1)
     113 if ($endmem - $startmem > 10)
    67114   $PASS = 0
    68  end
    69  if (abs($C0 - 3) > 0.02)
    70    $PASS = 0
    71  end
    72  if (abs($C1 - 5) > 0.02)
    73    $PASS = 0
     115   echo "growth: {$endmem-$startmem}"
     116   echo "kB/loop: {($endmem-$startmem)/1000}"
    74117 end
    75118end
    76 
    77 # fit a line with errors, weights, and outliers
    78 macro test4
    79  $PASS = 1
    80  break -auto off
    81 
    82  create x 0 100
    83  set dy = 0.1*rnd(x) - 0.05
    84  set y = 3 + 5*x + dy
    85  set dy = 0.1 + zero(x)
    86  y[5] = 23
    87  y[20] = -10
    88  y[50] = 0.0
    89  fit -q x y 1 -dy dy -clip 3 3
    90 
    91  if ($Cn != 1)
    92    $PASS = 0
    93  end
    94  if ($Cnv != 97)
    95    $PASS = 0
    96  end
    97  if (abs($C0 - 3) > 0.02)
    98    $PASS = 0
    99  end
    100  if (abs($C1 - 5) > 0.02)
    101    $PASS = 0
    102  end
    103 end
    104 
    105 # fit a quadratic without errors
    106 macro test5
    107  $PASS = 1
    108  break -auto off
    109 
    110  create x 0 100
    111  set y = 3 + 5*x - 4*x^2
    112  fit -q x y 2
    113 
    114  if ($Cn != 2)
    115    $PASS = 0
    116  end
    117  if (abs($C0 - 3) > 1e-5)
    118    $PASS = 0
    119  end
    120  if (abs($C1 - 5) > 1e-5)
    121    $PASS = 0
    122  end
    123  if (abs($C2 + 4) > 1e-5)
    124    $PASS = 0
    125  end
    126 end
    127 
    128 # fit a quadratic with errors
    129 macro test6
    130  $PASS = 1
    131  break -auto off
    132 
    133  create x 0 100
    134  set dy = 0.1*rnd(x) - 0.05
    135  set y = 3 + 5*x - 4*x^2 + dy
    136  fit -q x y 2
    137 
    138  if ($Cn != 2)
    139    $PASS = 0
    140  end
    141  if (abs($C0 - 3) > 0.05)
    142    $PASS = 0
    143  end
    144  if (abs($C1 - 5) > 0.05)
    145    $PASS = 0
    146  end
    147  if (abs($C2 + 4) > 0.05)
    148    $PASS = 0
    149  end
    150 end
    151 
    152 # fit a quadratic with errors and weights
    153 macro test7
    154  $PASS = 1
    155  break -auto off
    156 
    157  create x 0 100
    158  set dy = 0.1*rnd(x) - 0.05
    159  set y = 3 + 5*x - 4*x^2 + dy
    160  set dy = 0.1 + zero(x)
    161  fit -q x y 2 -dy dy
    162 
    163  if ($Cn != 2)
    164    $PASS = 0
    165  end
    166  if (abs($C0 - 3) > 0.05)
    167    $PASS = 0
    168  end
    169  if (abs($C1 - 5) > 0.05)
    170    $PASS = 0
    171  end
    172  if (abs($C2 + 4) > 0.05)
    173    $PASS = 0
    174  end
    175 end
    176 
    177 # fit a quadratic with errors, weights, and outliers
    178 macro test8
    179  $PASS = 1
    180  break -auto off
    181 
    182  create x 0 100
    183  set dy = 0.1*rnd(x) - 0.05
    184  set y = 3 + 5*x - 4*x^2 + dy
    185  set dy = 0.1 + zero(x)
    186  y[5] = 23
    187  y[20] = -10
    188  y[50] = 0.0
    189 
    190  # it takes 4 iterations to successfully reject the outliers above...
    191  fit -q x y 2 -dy dy -clip 3 4
    192 
    193  if ($Cn != 2)
    194    $PASS = 0
    195  end
    196  if ($Cnv != 97)
    197    $PASS = 0
    198  end
    199  if (abs($C0 - 3) > 0.05)
    200    $PASS = 0
    201  end
    202  if (abs($C1 - 5) > 0.05)
    203    $PASS = 0
    204  end
    205  if (abs($C2 + 4) > 0.05)
    206    $PASS = 0
    207  end
    208 end
  • trunk/Ohana/src/opihi/cmd.data/test/integrate.sh

    r14176 r16056  
    1515 integrate x y 1 5
    1616
    17  if (($sum-152) > 0.5)
     17 if (abs ($sum-152) > 0.5)
    1818  $PASS = 0
    1919  echo "Inaccurate result (should be 152): $sum"
  • trunk/Ohana/src/opihi/cmd.data/test/interpolate.sh

    r14176 r16056  
    1616 integrate x1 y1 1 5
    1717
    18  if (($sum-152) > 0.08)
     18 if (abs ($sum-152) > 0.08)
    1919  $PASS = 0
    2020  echo "Inaccurate result (should be 152): $sum"
  • trunk/Ohana/src/opihi/cmd.data/test/periodogram.sh

    r14176 r16056  
    44 test2
    55 test3
     6 memtest1
    67end
    78
     
    100101 end
    101102end
     103
     104# Memory test
     105macro memtest1
     106
     107 local i
     108 local P PI
     109 $PI = 3.14159265359
     110 $P  = 15.0
     111
     112 create x 500 800
     113 set t = 300 * rnd(x) + 500
     114 set f = sin(2*$PI*t/$P)
     115
     116 list word -x "ps -p $PID -o rss"
     117 $startmem = $word:1
     118
     119 for i 0 1000
     120  periodogram t f 2 30 period power
     121 end
     122 
     123 list word -x "ps -p $PID -o rss"
     124 $endmem = $word:1
     125
     126 $PASS = 1
     127
     128 if ($endmem - $startmem > 10)
     129   $PASS = 0
     130   echo "growth: {$endmem-$startmem}"
     131   echo "kB/loop: {($endmem-$startmem)/1000}"
     132 end
     133end
Note: See TracChangeset for help on using the changeset viewer.