annotate tools/rdock/data/pmf/smoothed/m2pmf.awk @ 2:0faa03a92843 draft default tip

Uploaded
author dzesikah
date Fri, 26 Aug 2016 10:19:49 -0400
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
1 #!/bin/awk -f
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
2 BEGIN{
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
3 true = 1;
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
4 false = !true;
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
5 hashmarkcount = 0;
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
6 iscomment = true; # true for the first lines
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
7 i=0;
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
8 j=0;
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
9 }{
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
10 if("#" == $1) {
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
11 hashmarkcount++;
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
12 iscomment = true;
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
13 } else
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
14 iscomment = false;
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
15 if(hashmarkcount < 6 && !iscomment ){ #get the first vector (x)
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
16 x[i]=$1;
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
17 i++;
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
18 }
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
19 else if ( !iscomment ){ # so we are at y
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
20 y[j]=$1;
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
21 j++;
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
22 }
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
23
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
24 }END{
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
25 # first padding at the beginning
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
26 for (j=0.2;j<x[0];j+=0.2) {
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
27 printf("%6.3f %6.4f\n", j,3.0);
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
28 }
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
29 # note i sould be equal to y
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
30 # we are considering 'i' number of data (
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
31 # ys without x values will be discarded, xs without y will
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
32 # get y value 0
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
33 # we are treating 'i' as the length of the vectors
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
34 for (j=0;j<i;j++) {
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
35 printf("%6.3f %6.4f\n", x[j],y[j]);
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
36 }
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
37 # zero padding at the end
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
38 for(j=x[j-1]+0.2;j<=12.0;j+=0.2) {
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
39 printf("%6.3f %6.4f\n", j,0.0);
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
40 }
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
41 }