📄 dtw_rec.t
字号:
#! /bin/csh -x# This material contains proprietary software of Entropic Speech, Inc.# Any reproduction, distribution, or publication without the prior# written permission of Entropic Speech, Inc. is strictly prohibited.# Any public distribution of copies of this work authorized in writing by# Entropic Speech, Inc. must bear the notice## "Copyright (c) 1990 Entropic Speech, Inc.; All rights reserved"## testscript for dtw_rec @(#)dtw_rec.t 1.1 2/25/91 ERLset PROG = dtw_recsetenv USE_ESPS_COMMON offalias vecho 'if $VERBOSE echo'alias ndrec 'hditem -i ndrec'alias errex 'exit(1)'alias passex 'exit(0)'\rm params >& /dev/null# test script parameters# ----------------------# if test script finds an error, it exits with errex# if program passes the test, test scripts exits with passex# VERBOSE: 0 script works silently# 1 script actual and correct test results are echoedset VERBOSE = 1vecho "$PROG test script: `date`"vecho "generating test data"# generate sample data to test dtw testsd -p100 t1.sd >& /dev/nullvecho "constructing vq codebook to use for testing..."echo "double conv_ratio = 0.1;" > vqdes.pecho "int vq_size = 8;" >> vqdes.p echo 'string cbk_struct = "FULL_SEARCH";' >> vqdes.pecho 'string dist_type = "MSE";' >> vqdes.pecho 'string fea_field = "samples";' >> vqdes.pecho "int fea_dim = 1;" >> vqdes.pvqdes -P vqdes.p t1.sd cbk >& /dev/nullvecho "finding codebook distances..."cbkd cbk cbk.dist >& /dev/nullif ( `ndrec cbk` == 4 && `ndrec cbk.dist` == 4 ) then vecho "test codebook constructed" \rm in.asc vqdes.p vqdesaschist vqdesasc.chk >& /dev/nullelse vecho "can't make test codebook" errexendif#vq -f samples cbk.dist t1.sd t1.vcopysd -r2: t1.sd t2.sdvq -f samples cbk.dist t2.sd t2.vcopysd -r3: t1.sd t3.sdvq -f samples cbk.dist t3.sd t3.vvecho "test time warping comparisons"echo "t1.v" > tlist echo "t2.v" >> tlist echo "t3.v" >> tlist $PROG -f samples tlist tlist resset cval = `awk 'BEGIN{i=1}{if ($2 != $3 &&$4 != 0.0) i = 0} END{print i}'<res`if ( $cval == 1 ) then vecho "self test works."else vecho "self test failed." errexendifvecho "testing delta option"echo "t1.v" > tlistecho "t2.v" > rlist$PROG -f samples tlist rlist resset cval = `awk 'BEGIN{i=1}{if ($2 == $3 && $4 == 0.0) i = 0} END{print i}'<res`$PROG -f samples -d 1 tlist rlist resset dval = `awk 'BEGIN{i=1}{if ($2 != $3 && $4 != 0.0) i = 0} END{print i}'<res`echo "int delta = 1;" > dtw.params$PROG -f samples -P dtw.params tlist rlist resset eval = `awk 'BEGIN{i=1}{if ($2 != $3 && $4 != 0.0) i = 0} END{print i}'<res`if ( $cval == 1 && $dval == 1 && $eval == 1 ) then vecho "delta option/parameter ok."else vecho "delta option/parameter fails." errexendifvecho "checking table lookup"echo "t1.v" > tlistecho "t2.v" >> tlistecho "t2.v" > rlistecho "t3.v" >> rlist$PROG -f samples rlist tlist res1$PROG -f samples_cwndx -c cbk.dist rlist tlist res2echo 'string distance_table_file = "cbk.dist";' > dtw.paramsecho 'string sequence_field = "samples_cwndx";' >> dtw.params$PROG -P dtw.params -c cbk.dist rlist tlist res3diff -b res1 res2 >& /dev/nullset c1 = $statusdiff -b res1 res3 >& /dev/nullif ( $c1 == 0 && $status == 0 ) then vecho "table lookup agrees with direct computation"else vecho "table lookup and direct computation don't agree." errexendifvecho "checking list length"echo "t1.v" > tlistecho "t1.v" > rlistecho "t2.v" >> rlistecho "t3.v" >> rlist$PROG -f samples -l 2 rlist tlist res1echo 'string sequence_field = "samples";' > dtw.paramsecho "int best_list_length = 3;" >> dtw.params$PROG -P dtw.params rlist tlist res2if ( `awk 'END{print NR}'<res1` == 2 && `awk 'END{print NR}'<res2` == 3 ) then vecho "list length option/parameter ok."else vecho "list length option/parameter failure." errexendifvecho "comparing dtw to dtw_rec"echo "t1.v" > tlistecho "t2.v" > rlist$PROG -f samples rlist tlist res1set d2 = `dtw -f samples t2.v t1.v`set d1 = `awk '{print $4}' < res1`if ( $d2 == $d1 ) then vecho "numerical results of dtw and dtw_rec agree."else vecho "numerical results of dtw and dtw_rec disagree." errexendif\rm cbk cbk.dist t1.sd t1.v vqdes.chk vqdeshist vqhist res1 res2 res3\rm dtw.params t2.sd t2.v t3.sd t3.v tlist rlist resvecho "$PROG passed: `date`"passex
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -