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 res0_96_128aux.vqd 0,4,2
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 res0_96_128aux.vqd 0,4,2
49 # build a huffman book (no mapping)
50 my($name,$datafile,$arg)=split(' ',$1);
52 my $command="huffbuild $datafile $arg";
53 print ">>> $command\n";
54 die "Couldn't build huffbook.\n\tcommand:$command\n"
59 # :1 res0_128_128_1.vqd, 4, nonseq, 0 +- 1
61 my($namedata,$dim,$seqp,$vals)=split(',',$1);
62 my($name,$datafile)=split(' ',$namedata);
68 foreach my$val (split(' ',$vals)){
69 if($val=~/\-?\+?\d+/){
72 # got an explicit threshhint?
73 if($val=~/([0-9\.]+)\(([^\)]+)/){
81 $thlist.="," if(defined($thlist));
89 $thlist.="," if(defined($thlist));
98 die "Couldn't open temp file temp$$.vql: $!" unless
99 open(G,">temp$$.vql");
100 print G "$count $dim 0 ";
102 print G "0\n$list\n";
104 print G "1\n$list\n";
108 my $command="latticebuild temp$$.vql > $globalname$name.vqh";
109 print ">>> $command\n";
110 die "Couldn't build latticebook.\n\tcommand:$command\n"
113 my $command="latticehint $globalname$name.vqh $thlist > temp$$.vqh";
114 print ">>> $command\n";
115 die "Couldn't pre-hint latticebook.\n\tcommand:$command\n"
120 if($interleave=~/non/){
127 my $command="$restune temp$$.vqh $datafile 1 > $globalname$name.vqh";
128 print ">>> $command\n";
129 die "Couldn't tune latticebook.\n\tcommand:$command\n"
132 my $command="$restune temp$$.vqh $datafile > $globalname$name.vqh";
133 print ">>> $command\n";
134 die "Couldn't tune latticebook.\n\tcommand:$command\n"
138 my $command="latticehint $globalname$name.vqh $thlist > temp$$.vqh";
139 print ">>> $command\n";
140 die "Couldn't post-hint latticebook.\n\tcommand:$command\n"
144 print "No matching training file; leaving this codebook untrained.\n";
147 my $command="mv temp$$.vqh $globalname$name.vqh";
148 print ">>> $command\n";
149 die "Couldn't rename latticebook.\n\tcommand:$command\n"
152 my $command="rm temp$$.vql";
153 print ">>> $command\n";
154 die "Couldn't remove temp files.\n\tcommand:$command\n"
161 $command="rm -f temp$$.vqd";
162 print ">>> $command\n";
163 die "Couldn't remove temp files.\n\tcommand:$command\n"