Changeset 16056
- Timestamp:
- Jan 14, 2008, 1:42:49 PM (18 years ago)
- Location:
- trunk/Ohana/src/opihi
- Files:
-
- 10 added
- 4 edited
-
cmd.basic/test/module.sh (added)
-
cmd.data/test/applyfit2d.sh (added)
-
cmd.data/test/book.sh (added)
-
cmd.data/test/cut.sh (added)
-
cmd.data/test/dimendown.sh (added)
-
cmd.data/test/dimenup.sh (added)
-
cmd.data/test/fit2d.sh (modified) (1 diff)
-
cmd.data/test/gaussj.sh (added)
-
cmd.data/test/histogram.sh (added)
-
cmd.data/test/imhist.sh (added)
-
cmd.data/test/imsmooth.sh (added)
-
cmd.data/test/integrate.sh (modified) (1 diff)
-
cmd.data/test/interpolate.sh (modified) (1 diff)
-
cmd.data/test/periodogram.sh (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/cmd.data/test/fit2d.sh
r14176 r16056 3 3 test1 4 4 test2 5 test3 6 test4 7 test5 8 test6 9 test7 10 test8 5 memtest1 11 6 end 12 7 13 # fit a linewithout errors8 # fit a function without errors 14 9 macro test1 15 10 $PASS = 1 16 11 break -auto off 17 12 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 22 16 23 if ($Cn != 1) 17 fit2d -q x y z 2 18 19 if ($Cnn != 2) 24 20 $PASS = 0 21 echo "Function Order Incorrect!" 25 22 end 26 if (abs($C 0 - 3) > 1e-5)23 if (abs($CX0Y0 - 5) > 1e-5) 27 24 $PASS = 0 25 echo "Term CX0Y0 Incorrect!" 28 26 end 29 if (abs($C 1 - 5) > 1e-5)27 if (abs($CX1Y0 + 4) > 1e-5) 30 28 $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!" 31 46 end 32 47 end 33 48 34 # fit a linewith errors49 # fit a function with errors 35 50 macro test2 36 51 $PASS = 1 37 52 break -auto off 38 53 39 create x 0 10040 set dy = 0.1*rnd(x) - 0.0541 set y = 3 + 5*x + dy42 fit -q x y 154 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 43 58 44 if ($Cn != 1) 59 fit2d -q x y z 2 60 61 if ($Cnn != 2) 45 62 $PASS = 0 63 echo "Function Order Incorrect!" 46 64 end 47 if (abs($C 0 - 3) > 0.01)65 if (abs($CX0Y0 - 5) > 0.01) 48 66 $PASS = 0 67 echo "Term CX0Y0 Incorrect!" 49 68 end 50 if (abs($C 1 - 5) > 0.01)69 if (abs($CX1Y0 + 4) > 0.01) 51 70 $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!" 52 88 end 53 89 end 54 90 55 # fit a line with errors and weights 56 macro test3 91 # Memory Test 92 macro 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 57 111 $PASS = 1 58 break -auto off59 112 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) 67 114 $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}" 74 117 end 75 118 end 76 77 # fit a line with errors, weights, and outliers78 macro test479 $PASS = 180 break -auto off81 82 create x 0 10083 set dy = 0.1*rnd(x) - 0.0584 set y = 3 + 5*x + dy85 set dy = 0.1 + zero(x)86 y[5] = 2387 y[20] = -1088 y[50] = 0.089 fit -q x y 1 -dy dy -clip 3 390 91 if ($Cn != 1)92 $PASS = 093 end94 if ($Cnv != 97)95 $PASS = 096 end97 if (abs($C0 - 3) > 0.02)98 $PASS = 099 end100 if (abs($C1 - 5) > 0.02)101 $PASS = 0102 end103 end104 105 # fit a quadratic without errors106 macro test5107 $PASS = 1108 break -auto off109 110 create x 0 100111 set y = 3 + 5*x - 4*x^2112 fit -q x y 2113 114 if ($Cn != 2)115 $PASS = 0116 end117 if (abs($C0 - 3) > 1e-5)118 $PASS = 0119 end120 if (abs($C1 - 5) > 1e-5)121 $PASS = 0122 end123 if (abs($C2 + 4) > 1e-5)124 $PASS = 0125 end126 end127 128 # fit a quadratic with errors129 macro test6130 $PASS = 1131 break -auto off132 133 create x 0 100134 set dy = 0.1*rnd(x) - 0.05135 set y = 3 + 5*x - 4*x^2 + dy136 fit -q x y 2137 138 if ($Cn != 2)139 $PASS = 0140 end141 if (abs($C0 - 3) > 0.05)142 $PASS = 0143 end144 if (abs($C1 - 5) > 0.05)145 $PASS = 0146 end147 if (abs($C2 + 4) > 0.05)148 $PASS = 0149 end150 end151 152 # fit a quadratic with errors and weights153 macro test7154 $PASS = 1155 break -auto off156 157 create x 0 100158 set dy = 0.1*rnd(x) - 0.05159 set y = 3 + 5*x - 4*x^2 + dy160 set dy = 0.1 + zero(x)161 fit -q x y 2 -dy dy162 163 if ($Cn != 2)164 $PASS = 0165 end166 if (abs($C0 - 3) > 0.05)167 $PASS = 0168 end169 if (abs($C1 - 5) > 0.05)170 $PASS = 0171 end172 if (abs($C2 + 4) > 0.05)173 $PASS = 0174 end175 end176 177 # fit a quadratic with errors, weights, and outliers178 macro test8179 $PASS = 1180 break -auto off181 182 create x 0 100183 set dy = 0.1*rnd(x) - 0.05184 set y = 3 + 5*x - 4*x^2 + dy185 set dy = 0.1 + zero(x)186 y[5] = 23187 y[20] = -10188 y[50] = 0.0189 190 # it takes 4 iterations to successfully reject the outliers above...191 fit -q x y 2 -dy dy -clip 3 4192 193 if ($Cn != 2)194 $PASS = 0195 end196 if ($Cnv != 97)197 $PASS = 0198 end199 if (abs($C0 - 3) > 0.05)200 $PASS = 0201 end202 if (abs($C1 - 5) > 0.05)203 $PASS = 0204 end205 if (abs($C2 + 4) > 0.05)206 $PASS = 0207 end208 end -
trunk/Ohana/src/opihi/cmd.data/test/integrate.sh
r14176 r16056 15 15 integrate x y 1 5 16 16 17 if ( ($sum-152) > 0.5)17 if (abs ($sum-152) > 0.5) 18 18 $PASS = 0 19 19 echo "Inaccurate result (should be 152): $sum" -
trunk/Ohana/src/opihi/cmd.data/test/interpolate.sh
r14176 r16056 16 16 integrate x1 y1 1 5 17 17 18 if ( ($sum-152) > 0.08)18 if (abs ($sum-152) > 0.08) 19 19 $PASS = 0 20 20 echo "Inaccurate result (should be 152): $sum" -
trunk/Ohana/src/opihi/cmd.data/test/periodogram.sh
r14176 r16056 4 4 test2 5 5 test3 6 memtest1 6 7 end 7 8 … … 100 101 end 101 102 end 103 104 # Memory test 105 macro 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 133 end
Note:
See TracChangeset
for help on using the changeset viewer.
