Changeset 40165 for trunk/Ohana/src/opihi/cmd.data/test/periodogram.sh
- Timestamp:
- Oct 11, 2017, 10:10:18 AM (9 years ago)
- Location:
- trunk/Ohana
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
src/opihi/cmd.data/test/periodogram.sh (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana
- Property svn:mergeinfo changed
/branches/eam_branches/ohana.20170822 (added) merged: 40122-40125,40141-40146,40155-40156,40158-40159,40163-40164
- Property svn:mergeinfo changed
-
trunk/Ohana/src/opihi/cmd.data/test/periodogram.sh
r27435 r40165 1 2 if (not($?PLOT)) set PLOT = 0 1 3 2 4 list tests … … 28 30 echo "OFFSET: {$peakpos - $P}" 29 31 end 32 33 if ($PLOT) 34 lim period power; clear; box; line -c red70 -lw 3 $P 0 to $P $peakval; plot period power -x line 35 end 30 36 end 31 37 … … 99 105 100 106 periodogram t f 2 30 period power 107 108 # lim -n 0 t f; clear; box; plot -x 2 -pt 2 t f 109 # lim -n 1 period power; clear; box; plot period power 110 111 peak -q period power 112 113 if (abs ($peakpos - $P) > 0.05) 114 $PASS = 0 115 end 116 end 117 118 # test using random samples, offset start, non-zero DC 119 macro test5 120 $PASS = 1 121 break -auto off 122 123 local P PI 124 $PI = 3.14159265359 125 $P = 15.0 126 127 delete -q x t f period power 128 129 create x 500 800 130 set t = 300 * rnd(x) + 500 131 set f = sin(2*$PI*t/$P) + 0.5 132 133 periodogram t f 2 30 period power 134 135 # lim -n 0 t f; clear; box; plot -x 2 -pt 2 t f 136 # lim -n 1 period power; clear; box; plot period power 137 138 peak -q period power 139 140 if (abs ($peakpos - $P) > 0.05) 141 $PASS = 0 142 end 143 end 144 145 # test using random samples, offset start, non-zero DC, some noise 146 macro test6 147 $PASS = 1 148 break -auto off 149 150 local P PI 151 $PI = 3.14159265359 152 $P = 15.0 153 154 delete -q x t f period power 155 156 create x 500 800 157 set t = 300 * rnd(x) + 500 158 set fraw = sin(2*$PI*t/$P) + 0.5 159 160 # 0.05 : peakpos = 14.95 161 # 0.10 : peakpos = 15.04 ( 162 gaussdev df t[] 0.0 0.25 163 set f = fraw + df 164 165 periodogram t f 2 30 period power 166 167 # lim -n 0 t f; clear; box; plot -x 2 -pt 2 t f 168 # lim -n 1 period power; clear; box; plot period power 169 170 peak -q period power 171 172 if (abs ($peakpos - $P) > 0.05) 173 $PASS = 0 174 end 175 end 176 177 # test using fewer random samples, offset start, non-zero DC, some noise 178 macro test7 179 $PASS = 1 180 break -auto off 181 182 local P PI 183 $PI = 3.14159265359 184 $P = 15.0 185 186 delete -q x t f period power 187 188 create x 0 100 189 set t = 100 * rnd(x) 190 set fraw = sin(2*$PI*t/$P) + 0.5 191 192 # 0.05 : peakpos = 14.95 193 # 0.10 : peakpos = 15.04 ( 194 gaussdev df t[] 0.0 0.25 195 set f = fraw + df 196 197 periodogram t f 2 30 period power 198 199 # lim -n 0 t f; clear; box; plot -x 2 -pt 2 t f 200 # lim -n 1 period power; clear; box; plot period power 201 202 peak -q period power 203 204 if (abs ($peakpos - $P) > 0.05) 205 $PASS = 0 206 end 207 end 208 209 # test using fewer random samples, high frequency, non-zero DC, some noise 210 macro test8 211 if ($0 != 2) 212 echo "USAGE: test8: Ndays") 213 break 214 end 215 216 local Ndays 217 $Ndays = $1 218 219 $PASS = 1 220 break -auto off 221 222 local P PI 223 $PI = 3.14159265359 224 $P = 0.8*rnd(0) + 0.2 225 $trueP = $P 226 227 delete -q x t f period power 228 229 create x 0 $Ndays 230 231 # t is a time in days, but we always have 4 within 1 hour: 232 set t0 = int(100 * rnd(x)) 233 set dtx = (3/24) * rnd(x) 234 set t0 = t0 + dtx 235 236 set dt1 = (15.0 / 1440) * rnd(x) + ( 0 + 7.5) / 1440 237 set dt2 = (15.0 / 1440) * rnd(x) + (15 + 7.5) / 1440 238 set dt3 = (15.0 / 1440) * rnd(x) + (30 + 7.5) / 1440 239 240 delete -q t 241 concat t0 t 242 set tmp = t0 + dt1; concat tmp t 243 set tmp = t0 + dt2; concat tmp t 244 set tmp = t0 + dt3; concat tmp t 245 246 set fraw = sin(2*$PI*t/$P) + 0.5 247 248 # 0.05 : peakpos = 14.95 249 # 0.10 : peakpos = 15.04 ( 250 gaussdev df t[] 0.0 0.25 251 set f = fraw + df 252 253 periodogram t f 0.1 2.0 period power 101 254 102 255 # lim -n 0 t f; clear; box; plot -x 2 -pt 2 t f
Note:
See TracChangeset
for help on using the changeset viewer.
