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 $globalname$name.vql: $!" unless
118 open(G,">$globalname$name.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 $globalname$name.vql > $globalname$name.vqh";
128 print ">>> $command\n";
129 die "Couldn't build latticebook.\n\tcommand:$command\n"
134 if($interleave=~/non/){
141 my $command="$restune $globalname$name.vqh $datafile 1 > temp$$.vqh";
142 print ">>> $command\n";
143 die "Couldn't tune latticebook.\n\tcommand:$command\n"
146 my $command="$restune $globalname$name.vqh $datafile > temp$$.vqh";
147 print ">>> $command\n";
148 die "Couldn't tune latticebook.\n\tcommand:$command\n"
152 my $command="mv temp$$.vqh $globalname$name.vqh";
153 print ">>> $command\n";
154 die "Couldn't rename latticebook.\n\tcommand:$command\n"
158 print "No matching training file; leaving this codebook untrained.\n";
161 my $command="rm $globalname$name.vql";
162 print ">>> $command\n";
163 die "Couldn't remove temp files.\n\tcommand:$command\n"
170 $command="rm -f temp$$.vqd";
171 print ">>> $command\n";
172 die "Couldn't remove temp files.\n\tcommand:$command\n"