3 # quick, very dirty little script so that we can put all the
4 # information for building a residue book set (except the original
5 # partitioning) in one spec file.
9 # >res0_128_128 interleaved
10 # haux 44c0_s/resaux_0.vqd res0_96_128aux 0,4,2 9
11 # :1 res0_128_128_1.vqd, 4, nonseq cull, 0 +- 1
12 # :2 res0_128_128_2.vqd, 4, nonseq, 0 +- 1(.7) 2
13 # :3 res0_128_128_3.vqd, 4, nonseq, 0 +- 1(.7) 3 5
14 # :4 res0_128_128_4.vqd, 2, nonseq, 0 +- 1(.7) 3 5 8 11
15 # :5 res0_128_128_5.vqd, 1, nonseq, 0 +- 1 3 5 8 11 14 17 20 24 28 31 35 39
18 die "Could not open $ARGV[0]: $!" unless open (F
,$ARGV[0]);
30 if($line=~m/\S+/ && !($line=~m/^\#/) ){
33 die "Couldn't shell command.\n\tcommand:$command\n"
40 if($line=~m/^>(\S+)\s+(\S*)/){
47 # haux 44c0_s/resaux_0.vqd res0_96_128aux 0,4,2 9
49 # build a huffman book (no mapping)
50 my($name,$datafile,$bookname,$interval,$range)=split(' ',$1);
52 # check the desired subdir to see if the data file exists
54 my $command="cp $datafile $bookname.tmp";
55 print ">>> $command\n";
56 die "Couldn't access partition data file.\n\tcommand:$command\n"
59 my $command="huffbuild $bookname.tmp $interval";
60 print ">>> $command\n";
61 die "Couldn't build huffbook.\n\tcommand:$command\n"
64 my $command="rm $bookname.tmp";
65 print ">>> $command\n";
66 die "Couldn't remove temporary file.\n\tcommand:$command\n"
69 my $command="huffbuild $bookname.tmp 0-$range";
70 print ">>> $command\n";
71 die "Couldn't build huffbook.\n\tcommand:$command\n"
78 # :1 res0_128_128_1.vqd, 4, nonseq, 0 +- 1
80 my($namedata,$dim,$seqp,$vals)=split(',',$1);
81 my($name,$datafile)=split(' ',$namedata);
87 foreach my$val (split(' ',$vals)){
88 if($val=~/\-?\+?\d+/){
91 # got an explicit threshhint?
92 if($val=~/([0-9\.]+)\(([^\)]+)/){
100 $thlist.="," if(defined($thlist));
105 if($plusminus=~/\+/){
108 $thlist.="," if(defined($thlist));
117 die "Couldn't open temp file temp$$.vql: $!" unless
118 open(G
,">temp$$.vql");
119 print G
"$count $dim 0 ";
121 print G
"0\n$list\n";
123 print G
"1\n$list\n";
127 my $command="latticebuild temp$$.vql > $globalname$name.vqh";
128 print ">>> $command\n";
129 die "Couldn't build latticebook.\n\tcommand:$command\n"
132 my $command="latticehint $globalname$name.vqh $thlist > temp$$.vqh";
133 print ">>> $command\n";
134 die "Couldn't pre-hint latticebook.\n\tcommand:$command\n"
139 if($interleave=~/non/){
146 my $command="$restune temp$$.vqh $datafile 1 > $globalname$name.vqh";
147 print ">>> $command\n";
148 die "Couldn't tune latticebook.\n\tcommand:$command\n"
151 my $command="$restune temp$$.vqh $datafile > $globalname$name.vqh";
152 print ">>> $command\n";
153 die "Couldn't tune latticebook.\n\tcommand:$command\n"
157 my $command="latticehint $globalname$name.vqh $thlist > temp$$.vqh";
158 print ">>> $command\n";
159 die "Couldn't post-hint latticebook.\n\tcommand:$command\n"
163 print "No matching training file; leaving this codebook untrained.\n";
166 my $command="mv temp$$.vqh $globalname$name.vqh";
167 print ">>> $command\n";
168 die "Couldn't rename latticebook.\n\tcommand:$command\n"
171 my $command="rm temp$$.vql";
172 print ">>> $command\n";
173 die "Couldn't remove temp files.\n\tcommand:$command\n"
180 $command="rm -f temp$$.vqd";
181 print ">>> $command\n";
182 die "Couldn't remove temp files.\n\tcommand:$command\n"