You are not logged in.

#1 2009-01-15 20:44:41

jnwebb
Member
Registered: 2008-07-07
Posts: 52

help using bash to interpolate

I need some help using the following file to interplote:

ACC         FG         LFG        FN            LFN
0.04936    0.1000    -2.30258    0.100000    -2.30258
0.05197    0.1023    -2.27984    0.104713    -2.25653
0.05490    0.1047    -2.25665    0.109648    -2.21048
0.05815    0.1072    -2.23305    0.114815    -2.16443
0.06172    0.1096    -2.21091    0.120226    -2.11838
0.06572    0.1122    -2.18747    0.125893    -2.07232
0.07015    0.1148    -2.16456    0.131826    -2.02627
0.07504    0.1175    -2.14131    0.138038    -1.98022
0.08039    0.1202    -2.11859    0.144544    -1.93417
0.08622    0.1230    -2.09557    0.151356    -1.88812
0.09254    0.1259    -2.07226    0.158489    -1.84207
0.09935    0.1288    -2.04949    0.165959    -1.79601
0.10664    0.1318    -2.02646    0.173780    -1.74996
0.11442    0.1349    -2.00322    0.181970    -1.70391
0.12267    0.1380    -1.98050    0.190546    -1.65786
0.13139    0.1413    -1.95686    0.199526    -1.61181
0.14175    0.1445    -1.93447    0.208930    -1.56575
0.15294    0.1479    -1.91121    0.218776    -1.51970
0.16456    0.1514    -1.88782    0.229087    -1.47365
0.17655    0.1549    -1.86497    0.239883    -1.42760
0.18884    0.1585    -1.84200    0.251189    -1.38154
0.20132    0.1622    -1.81892    0.263027    -1.33549
0.21390    0.1660    -1.79576    0.275423    -1.28944
0.22644    0.1698    -1.77313    0.288403    -1.24339
0.23881    0.1738    -1.74985    0.301995    -1.19734
0.25080    0.1778    -1.72709    0.316228    -1.15129
0.26223    0.1820    -1.70374    0.331131    -1.10524
0.27291    0.1862    -1.68093    0.346737    -1.05918
0.28258    0.1905    -1.65810    0.363078    -1.01313
0.29093    0.1950    -1.63475    0.380190    -.96708
0.29770    0.1995    -1.61194    0.398107    -.92103
0.30263    0.2042    -1.58865    0.416870    -.87498
0.30537    0.2089    -1.56589    0.436516    -.82893
0.30544    0.2138    -1.54271    0.457088    -.78287
0.30247    0.2188    -1.51959    0.478630    -.73682
0.29615    0.2239    -1.49655    0.501187    -.69077
0.28960    0.2291    -1.47359    0.524808    -.64472
0.28485    0.2344    -1.45072    0.549541    -.59867
0.30136    0.2399    -1.42753    0.575440    -.55262
0.31710    0.2455    -1.40445    0.602560    -.50656
0.33128    0.2512    -1.38150    0.630958    -.46051
0.34313    0.2570    -1.35867    0.660694    -.41446
0.35188    0.2630    -1.33560    0.691831    -.36841
0.35718    0.2692    -1.31230    0.724436    -.32236
0.35917    0.2754    -1.28953    0.758578    -.27630
0.36316    0.2818    -1.26655    0.794329    -.23025
0.37290    0.2884    -1.24340    0.831764    -.18420
0.38344    0.2951    -1.22044    0.870964    -.13815
0.39043    0.3020    -1.19732    0.912011    -.09210
0.39396    0.3090    -1.17441    0.954993    -.04605
0.39985    0.3162    -1.15138    1.000000    0
0.41450    0.3236    -1.12824    1.047130    .04605
0.43143    0.3311    -1.10533    1.096480    .09210
0.44771    0.3388    -1.08234    1.148150    .13815
0.47168    0.3467    -1.05929    1.202260    .18420
0.49490    0.3548    -1.03620    1.258930    .23026
0.51511    0.3631    -1.01307    1.318260    .27631
0.53186    0.3715    -.99020    1.380380    .32235
0.54563    0.3802    -.96705    1.445440    .36841
0.55633    0.3890    -.94417    1.513560    .41446
0.56362    0.3981    -.92105    1.584890    .46051
0.56727    0.4074    -.89795    1.659590    .50657
0.56788    0.4169    -.87490    1.737800    .55261
0.56728    0.4266    -.85190    1.819700    .59867
0.57641    0.4365    -.82896    1.905460    .64472
0.58603    0.4467    -.80586    1.995260    .69077
0.59643    0.4571    -.78285    2.089300    .73682
0.60814    0.4677    -.75992    2.187760    .78287
0.62118    0.4786    -.73689    2.290870    .82893
0.63586    0.4898    -.71375    2.398830    .87498
0.65233    0.5012    -.69075    2.500000    .91629
0.67060    0.5129    -.66767    2.630270    .96708
0.69073    0.5248    -.64473    2.754230    1.01313
0.71189    0.5370    -.62175    2.884030    1.05918
0.73317    0.5495    -.59874    3.019950    1.10524
0.75327    0.5623    -.57571    3.162280    1.15129
0.77126    0.5754    -.55268    3.311310    1.19734
0.78658    0.5888    -.52966    3.467370    1.24339
0.80114    0.6026    -.50650    3.630780    1.28944
0.81494    0.6166    -.48353    3.801900    1.33550
0.82465    0.6310    -.46044    3.981070    1.38155
0.83545    0.6457    -.43742    4.168700    1.42760
0.87192    0.6607    -.41445    4.365160    1.47365
0.89542    0.6761    -.39141    4.570880    1.51970
0.90286    0.6918    -.36845    4.786300    1.56575
0.90188    0.7079    -.34545    5.000000    1.60943
0.93310    0.7244    -.32241    5.248080    1.65786
0.95971    0.7413    -.29934    5.495410    1.70391
0.98382    0.7586    -.27628    5.754400    1.74996
1.00700    0.7762    -.25334    6.025600    1.79601
1.03343    0.7943    -.23029    6.309580    1.84206
1.06588    0.8128    -.20727    6.606940    1.88812
1.09747    0.8318    -.18416    6.918310    1.93417
1.12372    0.8511    -.16122    7.244360    1.98022
1.14197    0.8710    -.13811    7.585780    2.02627
1.17310    0.8912    -.11518    7.943290    2.07232
1.19864    0.9120    -.09211    8.317640    2.11837
1.21004    0.9333    -.06902    8.709640    2.16443
1.23936    0.9550    -.04604    9.120110    2.21048
1.29665    0.9772    -.02306    9.549930    2.25653
1.35156    1.0000    0    10.000000    2.30258
1.35588    1.0233    .02303    10.471300    2.34863
1.35028    1.0471    .04602    10.964800    2.39469
1.45814    1.0715    .06905    11.481500    2.44073
1.58646    1.0965    .09212    12.022600    2.48678
1.65768    1.1220    .11511    12.589300    2.53284
1.68015    1.1482    .13819    13.182600    2.57889
1.66828    1.1749    .16118    13.803800    2.62494
1.63280    1.2023    .18423    14.454400    2.67099
1.57554    1.2303    .20725    15.135600    2.71704
1.68957    1.2589    .23023    15.848900    2.76310
1.77789    1.2882    .25324    16.595900    2.80915
1.83007    1.3183    .27634    17.378000    2.85520
1.83569    1.3490    .29936    18.197000    2.90125
1.81752    1.3804    .32237    19.054600    2.94730
1.82825    1.4125    .34536    19.952600    2.99335
1.90654    1.4454    .36838    20.893000    3.03941
2.01562    1.4791    .39143    21.877600    3.08546
2.12612    1.5136    .41449    22.908700    3.13151
2.17426    1.5488    .43748    23.988300    3.17756
2.08774    1.5849    .46052    25.000000    3.21887
2.08716    1.6218    .48353    26.302700    3.26967
2.20898    1.6596    .50657    27.542300    3.31572
2.17779    1.6982    .52956    28.840300    3.36177
2.13162    1.7378    .55261    30.199500    3.40782
2.14360    1.7783    .57565    31.622800    3.45387
2.08715    1.8197    .59867    33.113100    3.49992
2.13486    1.8621    .62170    34.673700    3.54598
2.17637    1.9055    .64474    36.307800    3.59203
2.18294    1.9498    .66772    38.019000    3.63808
2.13124    1.9953    .69079    39.810700    3.68413
2.08390    2.0417    .71378    41.687000    3.73018
2.05038    2.0893    .73682    43.651600    3.77623
2.03115    2.1380    .75987    45.708800    3.82229
2.00959    2.1878    .78289    47.863000    3.86834    
1.98717    2.2387    .80589    
1.97323    2.2909    .82894    
1.95447    2.3442    .85194    
1.92595    2.3988    .87496    
1.90616    2.4547    .89800    
1.89283    2.5119    .92103    
1.85890    2.5704    .94406    
1.83043    2.6303    .96709    
1.85724    2.6915    .99009    
1.88505    2.7542    1.01312    
1.77733    2.8184    1.03616    
1.69180    2.8840    1.05917    
1.76313    2.9512    1.08221    
1.78077    3.0199    1.10522    
1.74368    3.0903    1.12826    
1.76858    3.1623    1.15129    
1.91199    3.2359    1.17430    
1.89218    3.3113    1.19734    
1.85754    3.3884    1.22035    
1.84201    3.4674    1.24340    
1.72153    3.5481    1.26641    
1.73611    3.6308    1.28945    
1.78069    3.7153    1.31245    
1.76714    3.8019    1.33550    
1.74338    3.8904    1.35851    
1.72076    3.9811    1.38155    
1.76225    4.0738    1.40457    
1.81493    4.1687    1.42760    
1.85171    4.2658    1.45062    
1.80727    4.3651    1.47364    
1.63550    4.4668    1.49667    
1.64390    4.5709    1.51971    
1.63947    4.6773    1.54272    
1.76661    4.7863    1.56575    
1.75548    4.8978    1.58878    
1.68376    5.0119    1.61181    
1.59784    5.1286    1.63483    
1.65352    5.2481    1.65786    
1.68904    5.3703    1.68088    
1.67658    5.4954    1.70391    
1.58422    5.6234    1.72693    
1.57403    5.7544    1.74996    
1.59865    5.8884    1.77298    
1.60265    6.0256    1.79601    
1.57255    6.1659    1.81903    
1.56872    6.3096    1.84207    
1.57285    6.4565    1.86508    
1.58116    6.6069    1.88811    
1.58493    6.7608    1.91114    
1.58029    6.9183    1.93417    
1.55489    7.0794    1.95718    
1.48551    7.2443    1.98021    
1.42415    7.4131    2.00324    
1.39205    7.5858    2.02627    
1.38055    7.7625    2.04930    
1.37548    7.9433    2.07232    
1.35374    8.1283    2.09535    
1.32928    8.3176    2.11837    
1.32623    8.5114    2.14140    
1.27869    8.7096    2.16442    
1.20828    8.9125    2.18745    
1.17138    9.1201    2.21048    
1.17550    9.3325    2.23350    
1.15527    9.5499    2.25653    
1.11919    9.7723    2.27955    
1.09127    10.0000    2.30258    
1.00977    10.2329    2.32560    
1.02664    10.4713    2.34863    
1.03375    10.7152    2.37166    
1.01483    10.9648    2.39469    
0.96235    11.2202    2.41771    
0.91432    11.4815    2.44073    
0.91424    11.7489    2.46375    
0.93165    12.0226    2.48678    
0.96171    12.3027    2.50981    
0.97677    12.5892    2.53283    
0.96434    12.8825    2.55586    
0.93766    13.1825    2.57889    
0.91964    13.4896    2.60191    
0.90807    13.8038    2.62494    
0.89788    14.1253    2.64796    
0.88560    14.4544    2.67099    
0.87609    14.7910    2.69401    
0.87397    15.1356    2.71704    
0.87727    15.4881    2.74007    
0.88753    15.8489    2.76310    
0.90663    16.2181    2.78612    
0.93287    16.5958    2.80914    
0.94922    16.9824    2.83217    
0.95826    17.3780    2.85520    
0.94872    17.7827    2.87822    
0.95501    18.1970    2.90125    
0.94370    18.6208    2.92427    
0.91786    19.0545    2.94730    
0.87897    19.4984    2.97033    
0.83182    19.9526    2.99335    
0.82762    20.4173    3.01638    
0.85347    20.8929    3.03940    
0.86560    21.3796    3.06243    
0.88492    21.8775    3.08545    
0.89277    22.3871    3.10848    
0.89428    22.9086    3.13151    
0.87937    23.4422    3.15453    
0.86698    23.9883    3.17756    
0.85060    24.5470    3.20058    
0.83791    25.1188    3.22361    
0.83129    25.7039    3.24664    
0.82787    26.3026    3.26966    
0.82560    26.9153    3.29269    
0.82381    27.5422    3.31571    
0.82228    28.1837    3.33874    
0.82094    28.8402    3.36177    
0.81973    29.5120    3.38479    
0.81863    30.1994    3.40782    
0.81763    30.9028    3.43084    
0.81680    31.6227    3.45387    
0.81619    32.3593    3.47690    
0.81561    33.1130    3.49992    
0.81506    33.8843    3.52295    
0.81455    34.6736    3.54597    
0.81406    35.4812    3.56900    
0.81359    36.3077    3.59202    
0.81316    37.1534    3.61505    
0.81274    38.0188    3.63808    
0.81235    38.9044    3.66110    
0.81197    39.8106    3.68413    
0.81162    40.7379    3.70715    
0.81128    41.6868    3.73018    
0.81096    42.6578    3.75321    
0.81065    43.6514    3.77623    
0.81036    44.6682    3.79926    
0.81009    45.7087    3.82228    
0.80983    46.7733    3.84531    
0.80958    47.8628    3.86833    
0.80934    48.9777    3.89136

ACC:  acceleration in g's
FG: the given frequencies that correspond to each acc
LFG:  the natural log of the given frequencies
FN:  the freq values I need to use
LFN:  the log of the freq values I need to use

I would now like to create a file that has two columns:  the first being the FN column (frequencies needed) and the second being the acceleration value that goes w/ that frequency using a semi log interpolation.  In essence, look at the LFN column, go to the closest corresponding LFG and interpolate to find the acc that would go w/ the LFN column.

Offline

#2 2009-01-15 22:21:47

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: help using bash to interpolate

I am not sure if I get it. I made an awk script that doesn't do any interpolating, so it takes an FN-LFN pair and gets the corresponding ACC-LFG, where LFG is the closest number to LFN.

The FG column is unused.

awk 'BEGIN {nr_acc=-1; nr_fn=-1}
{ nr_acc++; if (NF==5) {nr_fn++;FN[nr_fn]=$4;LFN[nr_fn]=$5}; ACC[nr_acc]=$1; LFG[nr_acc]=$3}
END { 
nr_acc++; ACC[nr_acc]=99999; LFG[nr_acc]=99999
for (logneed=1;logneed<=nr_fn;logneed++) {
    previousclosest=999
    for (loggive=1;loggive<=nr_acc;loggive++) {
        closest=LFN[logneed]-LFG[loggive]
        if (closest < 0) { closest=-closest }
        if (closest > previousclosest) {
            print FN[logneed] " --> " ACC[loggive-1] "\t\tbecause " LFN[logneed] " is the closest number to " LFG[loggive-1];
            break
        }
        previousclosest=closest
    }
}
}' allcol.txt

EDIT:
NB. Right you want to edit the print line to match your needs. Note that FN[logneed] matches every ACC[loggive-1] because the second for-loop is already one loop further.
So, print FN[logneed] "\t" ACC[loggive-1] is command line you want

Last edited by Procyon (2009-01-15 22:41:24)

Offline

#3 2009-01-15 22:41:03

vogt
Member
From: Toronto, Canada
Registered: 2006-11-25
Posts: 389

Re: help using bash to interpolate

You could fit the apropriate curve to the data using ex. gnuplot, and then calculate from there.

Offline

#4 2009-01-16 00:36:31

jnwebb
Member
Registered: 2008-07-07
Posts: 52

Re: help using bash to interpolate

Procyon:

I would need to lookup/find the two given logs and two given acc. that correspond to the needed log.  I then would use the interpolation equation of find the exact acceleration at the needed frequency.  As you can see, the given and neededs match up rather well but as you move down they grow further apart.

Offline

#5 2009-01-16 01:03:01

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: help using bash to interpolate

jnwebb wrote:

Procyon:

I would need to lookup/find the two given logs and two given acc. that correspond to the needed log.  I then would use the interpolation equation of find the exact acceleration at the needed frequency.  As you can see, the given and neededs match up rather well but as you move down they grow further apart.

OK, I get it a little better now. I used ACC totally wrong (FG matches FN of course). I don't know much about interpolation.


Let's solve one together so I understand it a little better.

Let's take FN/LFN pair 0.104713    -2.25653 on line 2

The closest ACC/FG/LFG pair is 0.05490    0.1047    -2.25665 on line 3
The second closest ACC/FG/LFG pair is 0.05815    0.1072    -2.23305 on line 4

LFG1 < LFG2 because it's sorted.

LFG1/LFG2 = -2.25665/-2.23305= 1.0105685
Interpolated ACC = 0.05490*1.0105685= 0.0554802106

You want the output
0.104713      0.0554802106

?


EDIT:

No that can't be right (it would divide by 0 at some point)

Better use wikipedia

ACC1 < ACC2 and LFG1 < LFG2

Interpolated ACC = ACC1 + (( LFN - LFG1 ) * ( ACC2 - ACC1 ) / ( LFG2 - LFG1 ) )
                               = 0.05490+((-2.25653--2.25665)*(0.05815-0.05490)/(-2.23305--2.25665)= 0.0549165254

?

Last edited by Procyon (2009-01-16 01:24:21)

Offline

#6 2009-01-16 01:18:40

jnwebb
Member
Registered: 2008-07-07
Posts: 52

Re: help using bash to interpolate

Thank you....pretty much....the formula for interpolation:

acc=acc1+((LFN-LFG1)*(acc2-acc1))/(LFG2-LFG1)

0.0549171=0.05490+((-2.25653--2.25665)*(0.05815-0.5490))/(-2.23305--2.25665)

Offline

#7 2009-01-16 01:30:31

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: help using bash to interpolate

Haha yeah, that's what I needed to know.

Offline

#8 2009-01-16 01:33:17

jnwebb
Member
Registered: 2008-07-07
Posts: 52

Re: help using bash to interpolate

sorry, i didn't scroll down to the end of your last post...I just wrote what you did w/o knowing it.

Offline

#9 2009-01-16 02:03:03

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: help using bash to interpolate

jnwebb wrote:

sorry, i didn't scroll down to the end of your last post...I just wrote what you did w/o knowing it.

Well my edit was later than your post, so you weren't mistaken.

Here is another attempt. I checked several of the results and it seems to be correct.

awk 'BEGIN {nr_acc=-1; nr_fn=-1}
{ nr_acc++; if (NF==5) {nr_fn++;FN[nr_fn]=$4;LFN[nr_fn]=$5}; ACC[nr_acc]=$1; LFG[nr_acc]=$3}
END { 
nr_acc++; ACC[nr_acc]=99999; LFG[nr_acc]=99999
for (logneed=1;logneed<=nr_fn;logneed++) {
    secondpreviousclosest=999
    previousclosest=999
    for (loggive=1;loggive<=nr_acc;loggive++) {
        closest=LFN[logneed]-LFG[loggive]
        if (closest < 0) { closest=-closest }
        if (closest > previousclosest) {
            if (closest < secondpreviousclosest) {
                ACC1=ACC[loggive-1];ACC2=ACC[loggive]
                LFG1=LFG[loggive-1];LFG2=LFG[loggive]
                LFN1=LFN[logneed]                
            }
            else {
                ACC1=ACC[loggive-2];ACC2=ACC[loggive-1]
                LFG1=LFG[loggive-2];LFG2=LFG[loggive-1]
                LFN1=LFN[logneed]
            }
#switch around if necessary
            if (ACC1 > ACC2) {
                ACC3=ACC2
                LFG3=LFG2
                ACC2=ACC1
                LFG2=LFG1
                ACC1=ACC3
                LFG1=LFG3
            }
#print LFG1 ":" LFN1 ":" LFG2
#print ACC1 " < " ACC2
            ACC_INT=ACC1+((LFN1-LFG1)*(ACC2-ACC1)/(LFG2-LFG1))
            print LFN1 "\t" ACC_INT
            break
        }
        secondpreviousclosest=previousclosest
        previousclosest=closest
    }
}
}' allcol.txt

EDIT:
ah wait there is a mistake

EDIT:
Forgot to update secondpreviousclosest.

But now there is a new error where LNF isn't in between LFG1 and LFG2. I don't really see why it is happening.

EDIT:
I understand now. The second previous one may be smaller because the numbers may be closer together.
So 1 - 1.2 - 99
1.3 would be reported as between 1 and 1.2!

Will update in a second.

Last edited by Procyon (2009-01-16 02:56:52)

Offline

#10 2009-01-16 03:02:09

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: help using bash to interpolate

So secondpreviousclosest is redundant. It will now compare LFN and LFG1

awk 'BEGIN {nr_acc=-1; nr_fn=-1}
{ nr_acc++; if (NF==5) {nr_fn++;FN[nr_fn]=$4;LFN[nr_fn]=$5}; ACC[nr_acc]=$1; LFG[nr_acc]=$3}
END { 
nr_acc++; ACC[nr_acc]=99999; LFG[nr_acc]=99999
for (logneed=1;logneed<=nr_fn;logneed++) {
    previousclosest=999
    for (loggive=1;loggive<=nr_acc;loggive++) {
        closest=LFN[logneed]-LFG[loggive]
        if (closest < 0) { closest=-closest }
        if (closest > previousclosest) {
            if (LFN[logneed] > LFG[loggive-1]) {
                ACC1=ACC[loggive-1];ACC2=ACC[loggive]
                LFG1=LFG[loggive-1];LFG2=LFG[loggive]
                LFN1=LFN[logneed]                
            }
            else {
                ACC1=ACC[loggive-2];ACC2=ACC[loggive-1]
                LFG1=LFG[loggive-2];LFG2=LFG[loggive-1]
                LFN1=LFN[logneed]
            }
#switch around if necessary
            if (ACC1 > ACC2) {
                ACC3=ACC2
                LFG3=LFG2
                ACC2=ACC1
                LFG2=LFG1
                ACC1=ACC3
                LFG1=LFG3
            }
#print ACC1 " < " ACC2 " ?"
#print LFG1 ":" LFN1 ":" LFG2
            ACC_INT=ACC1+((LFN1-LFG1)*(ACC2-ACC1)/(LFG2-LFG1))
            print LFN1 "\t" ACC_INT
            break
        }
        previousclosest=closest
    }
}
}' allcol.txt

Offline

#11 2009-01-16 03:12:58

jnwebb
Member
Registered: 2008-07-07
Posts: 52

Re: help using bash to interpolate

the only thing is I need it to have frequencies needed FN in the first column...not the logs of them.  You are awesome!!!!

Offline

#12 2009-01-16 03:34:17

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: help using bash to interpolate

Haha, well it was quite a fun one, I really like it when you post these things.

On this line
            print LFN1 "\t" ACC_INT

LFN1 should then be FN[logneed]

Offline

#13 2009-01-16 03:34:57

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,390
Website

Re: help using bash to interpolate

This sounds a lot like homework...

Offline

#14 2009-01-16 04:03:29

jnwebb
Member
Registered: 2008-07-07
Posts: 52

Re: help using bash to interpolate

its not homework...its a research project I am working on for work...i am just new to scripting

Offline

#15 2009-01-16 10:56:03

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: help using bash to interpolate

There is still a boundary problem if the first or last LFN is less or more than the first or last LFG, because then it will use the very first item in the array which is a string so "0" and the last is "99999".

Perhaps it should be hard-coded to not use those values, unless none of the data is like that.

Offline

#16 2009-01-16 15:54:16

jnwebb
Member
Registered: 2008-07-07
Posts: 52

Re: help using bash to interpolate

it is ok...they all start and stop w/ the same frequencies.  Quick couple of ?'s so I can get better at scripting:

1.  Where in the script would I be able to scale all the interpolated accelerations to the same number of digits?

2.  Does LFN[nr_fn]=$5 mean assign all of column 5 to the array LFN?

Offline

#17 2009-01-16 17:16:29

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: help using bash to interpolate

1. I don't know what you mean, can you give an example?

2. Yeah, nr_fn is counting how many FN-LFN there.
It is in an if statement that presumes FN-LFN makes 5 columns:
if (NF==5) {nr_fn++;FN[nr_fn]=$4;LFN[nr_fn]=$5};

NF is awk's own 'Number of Fields' variable.

For example, LFN[0] is the string "LFN". That is why the for-loops start at 1.


EDIT: Rephrase

Last edited by Procyon (2009-01-16 22:36:36)

Offline

#18 2009-01-26 21:09:42

jnwebb
Member
Registered: 2008-07-07
Posts: 52

Re: help using bash to interpolate

thanks...another ?  Suppose I have the following file:

    
Freq       PSD
0    1.48949E-08
0.024414063    7.29445E-05
0.048828125    0.00035897
0.073242188    0.000250713
0.09765625    0.000421121
0.122070313    0.004537666
0.146484375    0.012490833
0.170898438    0.016910983
0.1953125    0.012997485
0.219726563    0.005330209
0.244140625    0.000944883
0.268554688    0.002047857
0.29296875    0.007425774
0.317382813    0.015317194
0.341796875    0.02239152
0.366210938    0.024547514
0.390625    0.022855976
0.415039063    0.023574201
0.439453125    0.027185406
0.463867188    0.025474563
0.48828125    0.015170239
0.512695313    0.004639872
0.537109375    0.00303077
0.561523438    0.011653888
0.5859375    0.025489397
0.610351563    0.036556284
0.634765625    0.040271548
0.659179688    0.040438497
0.68359375    0.041203584
0.708007813    0.03864312
0.732421875    0.02912489
0.756835938    0.017838081
0.78125    0.01102319
0.805664063    0.008213878
0.830078125    0.00612728
0.854492188    0.003158635
0.87890625    0.00055528
0.903320313    0.003230662
0.927734375    0.015962451
0.952148438    0.038356147
0.9765625    0.065970027
1.000976563    0.090864553
1.025390625    0.100140518
1.049804688    0.084746594
1.07421875    0.051924022
1.098632813    0.020593216
1.123046875    0.004491316
1.147460938    0.003895958
1.171875    0.009846116
1.196289063    0.012964832
1.220703125    0.010733054
1.245117188    0.007682353
1.26953125    0.008926689
1.293945313    0.015327938
1.318359375    0.024457867
1.342773438    0.033450125
1.3671875    0.040046021
1.391601563    0.042819916
1.416015625    0.042604423
1.440429688    0.04294279
1.46484375    0.046753294
1.489257813    0.053294518
1.513671875    0.060022002
1.538085938    0.065177353
1.5625    0.0669616
1.586914063    0.063046681
1.611328125    0.052784721
1.635742188    0.038474711
1.66015625    0.024007566
1.684570313    0.013400787
1.708984375    0.010416312
1.733398438    0.017271137
1.7578125    0.031700065
1.782226563    0.046572758
1.806640625    0.054930224
1.831054688    0.05468237
1.85546875    0.047452082
1.879882813    0.035857229
1.904296875    0.023463981
1.928710938    0.014099708
1.953125    0.009370435
1.977539063    0.008218499
2.001953125    0.008754719
2.026367188    0.009409732
2.05078125    0.009070194
2.075195313    0.007420779
2.099609375    0.005424788
2.124023438    0.004640031
2.1484375    0.005227841
2.172851563    0.005469802
2.197265625    0.004325524
2.221679688    0.004032346
2.24609375    0.009828152
2.270507813    0.026140691
2.294921875    0.050748369
2.319335938    0.073608498
2.34375    0.084436895
2.368164063    0.080266065
2.392578125    0.064790666
2.416992188    0.044684469
2.44140625    0.027353037
2.465820313    0.017282251
2.490234375    0.013384709
2.514648438    0.011770363
2.5390625    0.009828681
2.563476563    0.007161281
2.587890625    0.004885374
2.612304688    0.00422006
2.63671875    0.004816631
2.661132813    0.005403624
2.685546875    0.005938555
2.709960938    0.0074383
2.734375    0.009953846
2.758789063    0.012126814
2.783203125    0.012501646
2.807617188    0.01060304
2.83203125    0.007377648
2.856445313    0.004915566
2.880859375    0.004716644
2.905273438    0.006063091
2.9296875    0.007147713
2.954101563    0.007404212
2.978515625    0.007532599
3.002929688    0.008000885
3.02734375    0.008672846
3.051757813    0.009248109
3.076171875    0.009542535
3.100585938    0.009963653
3.125    0.011515669
3.149414063    0.014459083
3.173828125    0.017548281
3.198242188    0.019919376
3.22265625    0.023419326
3.247070313    0.031986661
3.271484375    0.048638367
3.295898438    0.072142363
3.3203125    0.09490249
3.344726563    0.10588895
3.369140625    0.099781186
3.393554688    0.083585901
3.41796875    0.071702342
3.442382813    0.073227422
3.466796875    0.083575903
3.491210938    0.088653639
3.515625    0.078426552
3.540039063    0.055970178
3.564453125    0.032582938
3.588867188    0.016723174
3.61328125    0.009366337
3.637695313    0.007032484
3.662109375    0.006462404
3.686523438    0.006656046
3.7109375    0.007564629
3.735351563    0.008406423
3.759765625    0.008392588
3.784179688    0.007963497
3.80859375    0.008045555
3.833007813    0.008743095
3.857421875    0.009361789
3.881835938    0.009182519
3.90625    0.007927535
3.930664063    0.005892274
3.955078125    0.003843571
3.979492188    0.002472711
4.00390625    0.00191024
4.028320313    0.00205271
4.052734375    0.002929626
4.077148438    0.004422022
4.1015625    0.006585198
4.125976563    0.010880183
4.150390625    0.020335084
4.174804688    0.037375793
4.19921875    0.060225299
4.223632813    0.081196625
4.248046875    0.090647953
4.272460938    0.084154871
4.296875    0.065227111
4.321289063    0.041789498
4.345703125    0.021511065
4.370117188    0.008751214
4.39453125    0.00328692
4.418945313    0.001895848
4.443359375    0.001595265
4.467773438    0.001190807
4.4921875    0.000685505
4.516601563    0.000347425
4.541015625    0.000221765
4.565429688    0.000155072
4.58984375    9.02602E-05
4.614257813    7.12745E-05
4.638671875    7.49656E-05
4.663085938    7.17454E-05
4.6875    9.7085E-05
4.711914063    0.000170962
4.736328125    0.000257547
4.760742188    0.000295963
4.78515625    0.00025735
4.809570313    0.00019907
4.833984375    0.00021065
4.858398438    0.000300179
4.8828125    0.000394201
4.907226563    0.000460316
4.931640625    0.000584949
4.956054688    0.000896361
4.98046875    0.001514763
5.004882813    0.002682703
5.029296875    0.004834947
5.053710938    0.008537774
5.078125    0.014408232
5.102539063    0.022589481
5.126953125    0.031966052
5.151367188    0.040577497
5.17578125    0.047119138
5.200195313    0.051300898
5.224609375    0.052886515
5.249023438    0.051537851
5.2734375    0.047491944
5.297851563    0.041427335
5.322265625    0.033889309
5.346679688    0.025464022
5.37109375    0.017233928
5.395507813    0.010892976
5.419921875    0.008641724
5.444335938    0.012355542
5.46875    0.021907845
5.493164063    0.034422237
5.517578125    0.045661006
5.541992188    0.052123649
5.56640625    0.052185406
5.590820313    0.046226428
5.615234375    0.036046016
5.639648438    0.023950279
5.6640625    0.012412178
5.688476563    0.004012525
5.712890625    0.000339254
5.737304688    0.000647021
5.76171875    0.002462702
5.786132813    0.003669804
5.810546875    0.003667395
5.834960938    0.002958625
5.859375    0.002217725
5.883789063    0.001686393
5.908203125    0.001233456
5.932617188    0.000784957
5.95703125    0.000450132
5.981445313    0.000319442
6.005859375    0.00038013
6.030273438    0.000594699
6.0546875    0.000980412
6.079101563    0.001615874
6.103515625    0.002564919
6.127929688    0.00385938
6.15234375    0.00554939
6.176757813    0.007751389
6.201171875    0.010818772
6.225585938    0.015139613
6.25    0.019986195
6.274414063    0.022976372
6.298828125    0.021948468
6.323242188    0.017324074
6.34765625    0.011825921
6.372070313    0.008088465
6.396484375    0.006826619
6.420898438    0.006834933
6.4453125    0.00654439
6.469726563    0.005580908
6.494140625    0.00455579
6.518554688    0.003784578
6.54296875    0.003089959
6.567382813    0.002638782
6.591796875    0.003249041
6.616210938    0.006039208
6.640625    0.012198461
6.665039063    0.02271921
6.689453125    0.037436063
6.713867188    0.053799253
6.73828125    0.067024134
6.762695313    0.072368533
6.787109375    0.067901705
6.811523438    0.055534716
6.8359375    0.039783713
6.860351563    0.025281205
6.884765625    0.01463478
6.909179688    0.007982331
6.93359375    0.004149752
6.958007813    0.001988596
6.982421875    0.000858231
7.006835938    0.000420823
7.03125    0.000408601
7.055664063    0.000706911
7.080078125    0.001620468
7.104492188    0.004085884
7.12890625    0.009749386
7.153320313    0.020712804
7.177734375    0.038474817
7.202148438    0.06201513
7.2265625    0.08635186
7.250976563    0.103587408
7.275390625    0.106675612
7.299804688    0.093593652
7.32421875    0.069173931
7.348632813    0.043073246
7.373046875    0.024342746
7.397460938    0.016194727
7.421875    0.015462774
7.446289063    0.0167011
7.470703125    0.016320464
7.495117188    0.013694701
7.51953125    0.010035587
7.543945313    0.006759731
7.568359375    0.004450643
7.592773438    0.002986958
7.6171875    0.002194285
7.641601563    0.001924567
7.666015625    0.00182296
7.690429688    0.001573114
7.71484375    0.001233556
7.739257813    0.001042266
7.763671875    0.001065702
7.788085938    0.001165417
7.8125    0.001146701
7.836914063    0.000907853
7.861328125    0.000527456
7.885742188    0.000186761
7.91015625    1.30563E-05
7.934570313    5.24419E-05
7.958984375    0.000338158
7.983398438    0.000851369
8.0078125    0.001384392
8.032226563    0.001601422
8.056640625    0.001415531
8.081054688    0.001308333
8.10546875    0.002105443
8.129882813    0.004078363
8.154296875    0.006065991
8.178710938    0.006156833
8.203125    0.00415414
8.227539063    0.002989919
8.251953125    0.006589159
8.276367188    0.01599923
8.30078125    0.027655472
8.325195313    0.035444611
8.349609375    0.035135968
8.374023438    0.027538335
8.3984375    0.017369495
8.422851563    0.009267243
8.447265625    0.005092879
8.471679688    0.004027644
8.49609375    0.004074876
8.520507813    0.003693354
8.544921875    0.002647139
8.569335938    0.001512437
8.59375    0.000714831
8.618164063    0.000270501
8.642578125    7.48372E-05
8.666992188    9.97029E-05
8.69140625    0.000371545
8.715820313    0.000801618
8.740234375    0.001082714
8.764648438    0.000935651
8.7890625    0.000457663
8.813476563    6.41701E-05
8.837890625    0.000126436
8.862304688    0.000750542
8.88671875    0.001764145
8.911132813    0.002811691
8.935546875    0.003539203
8.959960938    0.003709562
8.984375    0.003213824
9.008789063    0.002196787
9.033203125    0.001130821
9.057617188    0.000484076
9.08203125    0.000325565
9.106445313    0.000403117
9.130859375    0.000492843
9.155273438    0.000557665
9.1796875    0.000655937
9.204101563    0.000790867
9.228515625    0.000890046
9.252929688    0.0009048
9.27734375    0.00084642
9.301757813    0.000768458
9.326171875    0.000768676
9.350585938    0.00088993
9.375    0.001013684
9.399414063    0.001002264
9.423828125    0.000886146
9.448242188    0.000787535
9.47265625    0.000753378
9.497070313    0.00071627
9.521484375    0.000566416
9.545898438    0.000320308
9.5703125    0.000200033
9.594726563    0.000384591
9.619140625    0.000748329
9.643554688    0.001038469
9.66796875    0.001219732
9.692382813    0.001475939
9.716796875    0.001935118
9.741210938    0.002448339
9.765625    0.002611616
9.790039063    0.002128274
9.814453125    0.001220284
9.838867188    0.000503034
9.86328125    0.000432982
9.887695313    0.001072002
9.912109375    0.002270677
9.936523438    0.00378045
9.9609375    0.005251413
9.985351563    0.006306156
10.00976563    0.00661392
10.03417969    0.006012712
10.05859375    0.004719171
10.08300781    0.003259425
10.10742188    0.002058804
10.13183594    0.001233021
10.15625    0.000737124
10.18066406    0.00048499
10.20507813    0.000355234
10.22949219    0.000253196
10.25390625    0.000161348
10.27832031    9.44659E-05
10.30273438    5.51708E-05
10.32714844    3.69858E-05
10.3515625    3.469E-05
10.37597656    4.41882E-05
10.40039063    5.43563E-05
10.42480469    5.01614E-05
10.44921875    3.22612E-05
10.47363281    1.63421E-05
10.49804688    1.03298E-05
10.52246094    9.66445E-06
10.546875    9.36331E-06
10.57128906    7.97622E-06
10.59570313    5.53774E-06
10.62011719    3.97833E-06
10.64453125    7.4666E-06
10.66894531    1.6663E-05
10.69335938    2.27991E-05
10.71777344    1.79404E-05
10.7421875    8.65629E-06
10.76660156    6.22154E-06
10.79101563    1.07433E-05
10.81542969    1.49596E-05
10.83984375    1.39743E-05
10.86425781    8.53366E-06
10.88867188    4.58258E-06
10.91308594    6.11152E-06
10.9375    9.26705E-06
10.96191406    8.53131E-06
10.98632813    4.2133E-06
11.01074219    7.17751E-07
11.03515625    7.34055E-07
11.05957031    3.03407E-06
11.08398438    5.26779E-06
11.10839844    6.64106E-06
11.1328125    8.5395E-06
11.15722656    1.23969E-05
11.18164063    1.45265E-05
11.20605469    1.13072E-05
11.23046875    8.47637E-06
11.25488281    8.2714E-06
11.27929688    5.22689E-06
11.30371094    2.48664E-05
11.328125    0.000160347
11.35253906    0.000583263
11.37695313    0.001525143
11.40136719    0.003178096
11.42578125    0.005545308
11.45019531    0.008297856
11.47460938    0.010663373
11.49902344    0.011672827
11.5234375    0.010950842
11.54785156    0.00919901
11.57226563    0.007564428
11.59667969    0.006673992
11.62109375    0.006447467
11.64550781    0.006521797
11.66992188    0.006682774
11.69433594    0.007012124
11.71875    0.00754328
11.74316406    0.007864685
11.76757813    0.007448116
11.79199219    0.006270318
11.81640625    0.004756338
11.84082031    0.003314366
11.86523438    0.002171031
11.88964844    0.001391088
11.9140625    0.000884368
11.93847656    0.000530145
11.96289063    0.000291415
11.98730469    0.000166514
12.01171875    0.000136749
12.03613281    0.000169898
12.06054688    0.000208062
12.08496094    0.000196486
12.109375    0.000142237
12.13378906    9.15322E-05
12.15820313    6.8715E-05
12.18261719    7.07325E-05
12.20703125    8.96936E-05
12.23144531    0.00012058
12.25585938    0.000153464
12.28027344    0.000167343
12.3046875    0.000153434
12.32910156    0.000135549
12.35351563    0.000134376
12.37792969    0.000134252
12.40234375    0.000116706
12.42675781    9.16953E-05
12.45117188    7.35212E-05
12.47558594    6.1038E-05
12.5    4.92124E-05
12.52441406    3.54785E-05
12.54882813    2.03598E-05
12.57324219    1.07716E-05
12.59765625    9.45086E-06
12.62207031    7.73429E-06
12.64648438    2.63221E-06
12.67089844    4.03562E-06
12.6953125    1.64164E-05
12.71972656    3.31618E-05
12.74414063    5.0832E-05
12.76855469    7.49245E-05
12.79296875    0.00011663
12.81738281    0.000194659
12.84179688    0.000338024
12.86621094    0.000574659
12.890625    0.000915514
12.91503906    0.001384866
12.93945313    0.00206051
12.96386719    0.00295208
12.98828125    0.003756945
13.01269531    0.003888509
13.03710938    0.002957791
13.06152344    0.001311092
13.0859375    8.2777E-05
13.11035156    0.000545794
13.13476563    0.003096941
13.15917969    0.006781547
13.18359375    0.009958957
13.20800781    0.011461272
13.23242188    0.011126377
13.25683594    0.009524108
13.28125    0.007439742
13.30566406    0.005486154
13.33007813    0.003942992
13.35449219    0.002834256
13.37890625    0.002092627
13.40332031    0.001640547
13.42773438    0.001390698
13.45214844    0.001241711
13.4765625    0.001106909
13.50097656    0.000958851
13.52539063    0.000832409
13.54980469    0.000779866
13.57421875    0.000832938
13.59863281    0.000995629
13.62304688    0.001252854
13.64746094    0.001564127
13.671875    0.00183329
13.69628906    0.001934381
13.72070313    0.001824024
13.74511719    0.001583478
13.76953125    0.001321046
13.79394531    0.00110891
13.81835938    0.001013786
13.84277344    0.001078327
13.8671875    0.001262997
13.89160156    0.001469098
13.91601563    0.001593757
13.94042969    0.00155358
13.96484375    0.001337025
13.98925781    0.001041575
14.01367188    0.000786597
14.03808594    0.000604266
14.0625    0.000464647
14.08691406    0.000356888
14.11132813    0.000291102
14.13574219    0.000261183
14.16015625    0.00024614
14.18457031    0.000227327
14.20898438    0.000192527
14.23339844    0.000141948
14.2578125    9.32617E-05
14.28222656    6.98052E-05
14.30664063    8.51118E-05
14.33105469    0.000139498
14.35546875    0.000222407
14.37988281    0.000314352
14.40429688    0.000388617
14.42871094    0.000419803
14.453125    0.000408389
14.47753906    0.000390113
14.50195313    0.000399677
14.52636719    0.000453425
14.55078125    0.000588951
14.57519531    0.000849356
14.59960938    0.00118973
14.62402344    0.001481648
14.6484375    0.00163659
14.67285156    0.001657358
14.69726563    0.001591675
14.72167969    0.001500228
14.74609375    0.001426801
14.77050781    0.001374631
14.79492188    0.001363647
14.81933594    0.001464575
14.84375    0.001689316
14.86816406    0.001911363
14.89257813    0.001976184
14.91699219    0.00183427
14.94140625    0.001533542
14.96582031    0.001158364
14.99023438    0.000801783
15.01464844    0.000536954
15.0390625    0.000384635
15.06347656    0.000311106
15.08789063    0.000255087
15.11230469    0.000173395
15.13671875    7.78918E-05
15.16113281    1.51108E-05
15.18554688    8.96945E-06
15.20996094    4.03105E-05
15.234375    7.31305E-05
15.25878906    8.83006E-05
15.28320313    9.8367E-05
15.30761719    0.000123964
15.33203125    0.0001578
15.35644531    0.000176908
15.38085938    0.000177569
15.40527344    0.000165554
15.4296875    0.000138811
15.45410156    0.000110934
15.47851563    0.000117919
15.50292969    0.000179614
15.52734375    0.000279752
15.55175781    0.000381771
15.57617188    0.00044447
15.60058594    0.000446297
15.625    0.000414274
15.64941406    0.000399344
15.67382813    0.000414352
15.69824219    0.000432293
15.72265625    0.000440181
15.74707031    0.000447853
15.77148438    0.000454329
15.79589844    0.000451556
15.8203125    0.000447869
15.84472656    0.000458731
15.86914063    0.000495326
15.89355469    0.000565099
15.91796875    0.000648394
15.94238281    0.000688655
15.96679688    0.000648144
15.99121094    0.000557653
16.015625    0.000482028
16.04003906    0.000457746
16.06445313    0.000481767
16.08886719    0.000534358
16.11328125    0.000589919
16.13769531    0.000623519
16.16210938    0.000633895
16.18652344    0.000648959
16.2109375    0.000678334
16.23535156    0.000676131
16.25976563    0.000590862
16.28417969    0.000436514
16.30859375    0.000280178
16.33300781    0.000182935
16.35742188    0.000171303
16.38183594    0.00022998
16.40625    0.000311888
16.43066406    0.00038014
16.45507813    0.00042571
16.47949219    0.000435401
16.50390625    0.000390969
16.52832031    0.00031134
16.55273438    0.000244144
16.57714844    0.000209954
16.6015625    0.000192764
16.62597656    0.000174797
16.65039063    0.000151399
16.67480469    0.00012735
16.69921875    0.000114513
16.72363281    0.000117451
16.74804688    0.000121209
16.77246094    0.000111495
16.796875    9.81751E-05
16.82128906    0.000100258
16.84570313    0.00011904
16.87011719    0.000141134
16.89453125    0.000156567
16.91894531    0.00016277
16.94335938    0.000161011
16.96777344    0.000159759
16.9921875    0.00017376
17.01660156    0.000206126
17.04101563    0.000239866
17.06542969    0.000266561
17.08984375    0.000309101
17.11425781    0.000389778
17.13867188    0.000494568
17.16308594    0.000591945
17.1875    0.000664128
17.21191406    0.000711707
17.23632813    0.000755554
17.26074219    0.000826156
17.28515625    0.000922813
17.30957031    0.001004059
17.33398438    0.001042254
17.35839844    0.001059072
17.3828125    0.001084768
17.40722656    0.001111223
17.43164063    0.001108849
17.45605469    0.001066209
17.48046875    0.000994191
17.50488281    0.000918461
17.52929688    0.000878139
17.55371094    0.000890082
17.578125    0.00091101
17.60253906    0.000887785
17.62695313    0.000836374
17.65136719    0.000814122
17.67578125    0.000837989
17.70019531    0.000882005
17.72460938    0.000917351
17.74902344    0.000912789
17.7734375    0.000835855
17.79785156    0.000682845
17.82226563    0.000488097
17.84667969    0.000309094
17.87109375    0.000209199
17.89550781    0.000218191
17.91992188    0.000298132
17.94433594    0.000378118
17.96875    0.000418722
17.99316406    0.000423989
18.01757813    0.000413353
18.04199219    0.000398455
18.06640625    0.000372159
18.09082031    0.000322601
18.11523438    0.000263186
18.13964844    0.000223405
18.1640625    0.00020606
18.18847656    0.000185943
18.21289063    0.000151357
18.23730469    0.00011632
18.26171875    9.44346E-05
18.28613281    8.49651E-05
18.31054688    8.04833E-05
18.33496094    7.31465E-05
18.359375    5.9723E-05
18.38378906    4.75311E-05
18.40820313    4.76664E-05
18.43261719    6.0682E-05
18.45703125    7.63092E-05
18.48144531    8.63E-05
18.50585938    9.15978E-05
18.53027344    9.70836E-05
18.5546875    0.000104041
18.57910156    0.000110288
18.60351563    0.000112183
18.62792969    0.000104113
18.65234375    8.72811E-05
18.67675781    7.74521E-05
18.70117188    8.44929E-05
18.72558594    9.25087E-05
18.75    8.36827E-05
18.77441406    6.54036E-05
18.79882813    5.33732E-05
18.82324219    4.90962E-05
18.84765625    4.60333E-05
18.87207031    4.00741E-05
18.89648438    3.28167E-05
18.92089844    3.15305E-05
18.9453125    3.75213E-05
18.96972656    3.97761E-05
18.99414063    3.25101E-05
19.01855469    2.55727E-05
19.04296875    2.71327E-05
19.06738281    3.18971E-05
19.09179688    3.22193E-05
19.11621094    2.80819E-05
19.140625    2.47495E-05
19.16503906    2.77614E-05
19.18945313    3.97482E-05
19.21386719    6.14941E-05
19.23828125    9.49012E-05
19.26269531    0.000136455
19.28710938    0.000170354
19.31152344    0.000184979
19.3359375    0.00019314
19.36035156    0.000216211
19.38476563    0.000253383
19.40917969    0.000281287
19.43359375    0.000275119
19.45800781    0.000231044
19.48242188    0.000183866
19.50683594    0.000183113
19.53125    0.000233116
19.55566406    0.000291864
19.58007813    0.000334885
19.60449219    0.000365601
19.62890625    0.000369442
19.65332031    0.000323603
19.67773438    0.00024798
19.70214844    0.000202949
19.7265625    0.000236487
19.75097656    0.000329243
19.77539063    0.000388189
19.79980469    0.000339416
19.82421875    0.000230819
19.84863281    0.000180061
19.87304688    0.000228612
19.89746094    0.000309902
19.921875    0.000343399
19.94628906    0.000309617
19.97070313    0.000248571
19.99511719    0.000217902
20.01953125    0.000253271
20.04394531    0.000354999
20.06835938    0.000494442
20.09277344    0.000628807
20.1171875    0.000721529
20.14160156    0.000752688
20.16601563    0.00072009
20.19042969    0.000644458
20.21484375    0.000558353
20.23925781    0.000481646
20.26367188    0.000428608
20.28808594    0.000422692
20.3125    0.000466112
20.33691406    0.000515089
20.36132813    0.000517317
20.38574219    0.000455314
20.41015625    0.000343458
20.43457031    0.000210626
20.45898438    9.28356E-05
20.48339844    2.03175E-05
20.5078125    3.48417E-07
20.53222656    1.57773E-05
20.55664063    3.96488E-05
20.58105469    5.03231E-05
20.60546875    4.1908E-05
20.62988281    2.78861E-05
20.65429688    2.63809E-05
20.67871094    3.70663E-05
20.703125    4.34441E-05
20.72753906    3.71883E-05
20.75195313    2.55873E-05
20.77636719    1.75923E-05
20.80078125    1.51009E-05
20.82519531    1.47769E-05
20.84960938    1.22077E-05
20.87402344    7.79688E-06
20.8984375    7.34354E-06
20.92285156    1.20124E-05
20.94726563    1.44577E-05
20.97167969    1.10427E-05
20.99609375    8.5012E-06
21.02050781    1.27415E-05
21.04492188    2.06021E-05
21.06933594    2.54659E-05
21.09375    2.45314E-05
21.11816406    2.25753E-05
21.14257813    2.82387E-05
21.16699219    4.00124E-05
21.19140625    4.50368E-05
21.21582031    3.98415E-05
21.24023438    3.56063E-05
21.26464844    3.74473E-05
21.2890625    3.84082E-05
21.31347656    3.53628E-05
21.33789063    3.44693E-05
21.36230469    4.27259E-05
21.38671875    6.14043E-05
21.41113281    8.31793E-05
21.43554688    9.62332E-05
21.45996094    9.56627E-05
21.484375    8.6608E-05
21.50878906    7.51813E-05
21.53320313    6.27264E-05
21.55761719    5.01233E-05
21.58203125    4.71772E-05
21.60644531    7.91515E-05
21.63085938    0.000177495
21.65527344    0.000358289
21.6796875    0.00061268
21.70410156    0.000907455
21.72851563    0.001181189
21.75292969    0.001369863
21.77734375    0.001472673
21.80175781    0.001564832
21.82617188    0.001711503
21.85058594    0.001895045
21.875    0.002032948
21.89941406    0.002022597
21.92382813    0.001782528
21.94824219    0.001319686
21.97265625    0.00076571
21.99707031    0.000316319
22.02148438    0.000128478
22.04589844    0.000241149
22.0703125    0.000537038
22.09472656    0.000799322
22.11914063    0.000868097
22.14355469    0.000749429
22.16796875    0.00056772
22.19238281    0.00044223
22.21679688    0.000406894
22.24121094    0.000409021
22.265625    0.000378471
22.29003906    0.000303042
22.31445313    0.000219389
22.33886719    0.000147845
22.36328125    8.15883E-05
22.38769531    2.65926E-05
22.41210938    5.64707E-06
22.43652344    2.57603E-05
22.4609375    6.51969E-05
22.48535156    8.99408E-05
22.50976563    8.24122E-05
22.53417969    6.0023E-05
22.55859375    5.42901E-05
22.58300781    7.08102E-05
22.60742188    8.95032E-05
22.63183594    9.87688E-05
22.65625    0.000104746
22.68066406    0.00011321
22.70507813    0.000122118
22.72949219    0.000125662
22.75390625    0.000116924
22.77832031    9.51692E-05
22.80273438    7.04981E-05
22.82714844    5.24032E-05
22.8515625    3.96907E-05
22.87597656    2.87116E-05
22.90039063    2.17149E-05
22.92480469    2.06556E-05
22.94921875    2.15479E-05
22.97363281    1.97171E-05
22.99804688    1.49132E-05
23.02246094    9.50122E-06
23.046875    5.96646E-06
23.07128906    6.23085E-06
23.09570313    9.77796E-06
23.12011719    1.29591E-05
23.14453125    1.2725E-05
23.16894531    1.03142E-05
23.19335938    9.71202E-06
23.21777344    1.3024E-05
23.2421875    1.84413E-05
23.26660156    2.24165E-05
23.29101563    2.23735E-05
23.31542969    1.87632E-05
23.33984375    1.7365E-05
23.36425781    2.49356E-05
23.38867188    3.8319E-05
23.41308594    4.67179E-05
23.4375    4.78958E-05
23.46191406    4.89972E-05
23.48632813    5.15066E-05
23.51074219    5.02937E-05
23.53515625    4.41407E-05
23.55957031    3.60569E-05
23.58398438    2.89435E-05
23.60839844    2.46329E-05
23.6328125    2.12401E-05
23.65722656    1.49021E-05
23.68164063    7.32967E-06
23.70605469    3.83869E-06
23.73046875    4.4547E-06
23.75488281    5.10572E-06
23.77929688    4.42904E-06
23.80371094    3.77611E-06
23.828125    4.05034E-06
23.85253906    5.30578E-06
23.87695313    8.02675E-06
23.90136719    1.35131E-05
23.92578125    2.07883E-05
23.95019531    2.49252E-05
23.97460938    2.44213E-05
23.99902344    2.64701E-05
24.0234375    3.67667E-05
24.04785156    5.01886E-05
24.07226563    5.84093E-05
24.09667969    5.83224E-05
24.12109375    5.02059E-05
24.14550781    3.65355E-05
24.16992188    2.14402E-05
24.19433594    8.18396E-06
24.21875    3.0692E-06
24.24316406    1.46932E-05
24.26757813    3.82318E-05
24.29199219    5.39356E-05
24.31640625    5.10135E-05
24.34082031    3.79089E-05
24.36523438    2.68617E-05
24.38964844    2.27033E-05
24.4140625    2.38234E-05
24.43847656    2.62154E-05
24.46289063    2.98828E-05
24.48730469    3.76342E-05
24.51171875    4.48222E-05
24.53613281    4.2206E-05
24.56054688    3.03823E-05
24.58496094    1.88592E-05
24.609375    1.29555E-05
24.63378906    1.12619E-05
24.65820313    1.19135E-05
24.68261719    1.48965E-05
24.70703125    1.99832E-05
24.73144531    2.53625E-05
24.75585938    3.07777E-05
24.78027344    4.09516E-05
24.8046875    5.89114E-05
24.82910156    7.75223E-05
24.85351563    8.81363E-05
24.87792969    9.37525E-05
24.90234375    0.000102439
24.92675781    0.000114525
24.95117188    0.000124056
24.97558594    0.000124488
25    0.000113206
25.02441406    9.81173E-05
25.04882813    8.94227E-05
25.07324219    8.13839E-05
25.09765625    6.17646E-05
25.12207031    3.75741E-05
25.14648438    2.84938E-05
25.17089844    4.01573E-05
25.1953125    6.13286E-05
25.21972656    7.86567E-05
25.24414063    8.47462E-05
25.26855469    8.05165E-05
25.29296875    7.32852E-05
25.31738281    6.85138E-05
25.34179688    6.49079E-05
25.36621094    6.07656E-05
25.390625    6.49743E-05
25.41503906    9.5895E-05
25.43945313    0.000161418
25.46386719    0.000242399
25.48828125    0.000301333
25.51269531    0.000306773
25.53710938    0.000258293
25.56152344    0.000196807
25.5859375    0.000173848
25.61035156    0.000200269
25.63476563    0.00024389
25.65917969    0.000274923
25.68359375    0.000285744
25.70800781    0.000275236
25.73242188    0.000244648
25.75683594    0.00020429
25.78125    0.000168229
25.80566406    0.00014615
25.83007813    0.000141045
25.85449219    0.000149308
25.87890625    0.000163494
25.90332031    0.000173341
25.92773438    0.000169851
25.95214844    0.000161224
25.9765625    0.000173066
26.00097656    0.000215588
26.02539063    0.000265676
26.04980469    0.000291818
26.07421875    0.000281525
26.09863281    0.000247955
26.12304688    0.000221105
26.14746094    0.000216964
26.171875    0.000216106
26.19628906    0.000196938
26.22070313    0.00017395
26.24511719    0.000173757
26.26953125    0.000196102
26.29394531    0.000221512
26.31835938    0.000234114
26.34277344    0.000225886
26.3671875    0.000197586
26.39160156    0.00015798
26.41601563    0.00011511
26.44042969    7.38527E-05
26.46484375    3.97437E-05
26.48925781    1.65655E-05
26.51367188    4.33367E-06
26.53808594    3.62945E-06
26.5625    1.82689E-05
26.58691406    5.2771E-05
26.61132813    0.000106405
26.63574219    0.00016869
26.66015625    0.000220288
26.68457031    0.000234881
26.70898438    0.000191574
26.73339844    0.00010716
26.7578125    4.29416E-05
26.78222656    5.04581E-05
26.80664063    0.000122004
26.83105469    0.000210505
26.85546875    0.000277876
26.87988281    0.000319886
26.90429688    0.000363165
26.92871094    0.000431162
26.953125    0.000510159
26.97753906    0.000571584
27.00195313    0.000613579
27.02636719    0.000646578
27.05078125    0.00066273
27.07519531    0.000653469
27.09960938    0.000630328
27.12402344    0.000608608
27.1484375    0.000597394
27.17285156    0.000605398
27.19726563    0.00062592
27.22167969    0.000624095
27.24609375    0.000564099
27.27050781    0.000440964
27.29492188    0.000279866
27.31933594    0.000124441
27.34375    3.00554E-05
27.36816406    4.58103E-05
27.39257813    0.00018508
27.41699219    0.000408398
27.44140625    0.000634234
27.46582031    0.000774044
27.49023438    0.000780564
27.51464844    0.000686564
27.5390625    0.000584836
27.56347656    0.000536556
27.58789063    0.000507749
27.61230469    0.000425978
27.63671875    0.000277901
27.66113281    0.000120112
27.68554688    1.94177E-05
27.70996094    4.8378E-06
27.734375    5.76766E-05
27.75878906    0.00013656
27.78320313    0.000210785
27.80761719    0.000261925
27.83203125    0.000275908
27.85644531    0.000261125
27.88085938    0.00024952
27.90527344    0.000256405
27.9296875    0.000263354
27.95410156    0.000248632
27.97851563    0.000210306
28.00292969    0.000162268
28.02734375    0.000124894
28.05175781    0.000110149
28.07617188    0.000108671
28.10058594    0.000102505
28.125    8.54698E-05
28.14941406    6.03447E-05
28.17382813    3.1323E-05
28.19824219    1.00892E-05
28.22265625    1.21627E-05
28.24707031    3.88736E-05
28.27148438    7.33179E-05
28.29589844    9.48378E-05
28.3203125    9.52623E-05
28.34472656    8.6016E-05
28.36914063    8.46977E-05
28.39355469    9.13221E-05
28.41796875    9.04461E-05
28.44238281    7.62635E-05
28.46679688    5.80774E-05
28.49121094    4.35754E-05
28.515625    3.23932E-05
28.54003906    2.32956E-05
28.56445313    1.8348E-05
28.58886719    2.11735E-05
28.61328125    3.21999E-05
28.63769531    4.5745E-05
28.66210938    5.59777E-05
28.68652344    6.36141E-05
28.7109375    7.07487E-05
28.73535156    7.50695E-05
28.75976563    7.60314E-05
28.78417969    7.82354E-05
28.80859375    8.3706E-05
28.83300781    8.93044E-05
28.85742188    9.08265E-05
28.88183594    8.35605E-05
28.90625    6.71562E-05
28.93066406    5.0575E-05
28.95507813    3.96347E-05
28.97949219    2.88948E-05
29.00390625    1.90165E-05
29.02832031    2.33173E-05
29.05273438    4.59733E-05
29.07714844    7.29731E-05
29.1015625    8.84297E-05
29.12597656    8.81358E-05
29.15039063    8.18046E-05
29.17480469    8.31524E-05
29.19921875    9.11265E-05
29.22363281    9.24236E-05
29.24804688    8.61077E-05
29.27246094    8.43568E-05
29.296875    8.88507E-05
29.32128906    8.8931E-05
29.34570313    7.97706E-05
29.37011719    6.61781E-05
29.39453125    5.43195E-05
29.41894531    4.75878E-05
29.44335938    4.51167E-05
29.46777344    4.33797E-05
29.4921875    4.16681E-05
29.51660156    4.29139E-05
29.54101563    5.04264E-05
29.56542969    6.68138E-05
29.58984375    9.10124E-05
29.61425781    0.000114596
29.63867188    0.000125753
29.66308594    0.000116602
29.6875    8.77664E-05
29.71191406    5.07642E-05
29.73632813    2.18874E-05
29.76074219    1.11939E-05
29.78515625    2.30786E-05
29.80957031    5.90947E-05
29.83398438    0.000109741
29.85839844    0.000158034
29.8828125    0.000198742
29.90722656    0.000237429
29.93164063    0.00027097
29.95605469    0.00028399
29.98046875    0.00026372
30.00488281    0.000222077
30.02929688    0.000206058
30.05371094    0.000256997
30.078125    0.00034708
30.10253906    0.000393571
30.12695313    0.000347815
30.15136719    0.000238688
30.17578125    0.000129153
30.20019531    5.7865E-05
30.22460938    2.16629E-05
30.24902344    3.66018E-06
30.2734375    1.62165E-05
30.29785156    0.000100024
30.32226563    0.00027205
30.34667969    0.000495133
30.37109375    0.00070492
30.39550781    0.000849156
30.41992188    0.000908518
30.44433594    0.000898566
30.46875    0.000840858
30.49316406    0.000729417
30.51757813    0.000555166
30.54199219    0.000366232
30.56640625    0.000269115
30.59082031    0.000350745
30.61523438    0.000591747
30.63964844    0.000852713
30.6640625    0.00098147
30.68847656    0.000963124
30.71289063    0.000925024
30.73730469    0.000969532
30.76171875    0.001049151
30.78613281    0.001029069
30.81054688    0.000846978
30.83496094    0.000601939
30.859375    0.00046822
30.88378906    0.000501163
30.90820313    0.000573671
30.93261719    0.000535274
30.95703125    0.00037214
30.98144531    0.000186545
31.00585938    8.48263E-05
31.03027344    0.000105802
31.0546875    0.000213442
31.07910156    0.000332063
31.10351563    0.000387628
31.12792969    0.000344624
31.15234375    0.00024529
31.17675781    0.000189664
31.20117188    0.000230977
31.22558594    0.000315978
31.25    0.000352169
31.27441406    0.000299725
31.29882813    0.000193186
31.32324219    0.00010295
31.34765625    7.30324E-05
31.37207031    9.10988E-05
31.39648438    0.000122118
31.42089844    0.000145508
31.4453125    0.000152259
31.46972656    0.000141823
31.49414063    0.000127602
31.51855469    0.000120855
31.54296875    0.000115997
31.56738281    0.000104309
31.59179688    8.73219E-05
31.61621094    7.17521E-05
31.640625    6.38235E-05
31.66503906    6.69565E-05
31.68945313    7.69253E-05
31.71386719    8.36437E-05
31.73828125    8.20041E-05
31.76269531    7.60482E-05
31.78710938    7.03256E-05
31.81152344    6.30793E-05
31.8359375    5.09165E-05
31.86035156    3.4922E-05
31.88476563    1.9441E-05
31.90917969    8.67153E-06
31.93359375    4.76305E-06
31.95800781    6.96237E-06
31.98242188    1.45792E-05
32.00683594    2.88185E-05
32.03125    4.6057E-05
32.05566406    5.48944E-05
32.08007813    4.79021E-05
32.10449219    3.09916E-05
32.12890625    1.73374E-05
32.15332031    1.70974E-05
32.17773438    3.06411E-05
32.20214844    4.82334E-05
32.2265625    6.18025E-05
32.25097656    7.32933E-05
32.27539063    8.38659E-05
32.29980469    8.72207E-05
32.32421875    8.19367E-05
32.34863281    7.46161E-05
32.37304688    6.66762E-05
32.39746094    5.32317E-05
32.421875    3.41133E-05
32.44628906    1.5724E-05
32.47070313    5.63963E-06
32.49511719    7.14572E-06
32.51953125    1.43262E-05
32.54394531    1.7232E-05
32.56835938    1.45222E-05
32.59277344    1.28956E-05
32.6171875    1.51083E-05
32.64160156    1.76318E-05
32.66601563    1.74484E-05
32.69042969    1.44648E-05
32.71484375    1.00379E-05
32.73925781    6.16301E-06
32.76367188    3.99672E-06
32.78808594    2.91726E-06
32.8125    1.98711E-06
32.83691406    1.21904E-06
32.86132813    1.09857E-06
32.88574219    1.59672E-06
32.91015625    1.82454E-06
32.93457031    1.25691E-06
32.95898438    1.21024E-06
32.98339844    4.05337E-06
33.0078125    1.10482E-05
33.03222656    2.03431E-05
33.05664063    2.62044E-05
33.08105469    2.32997E-05
33.10546875    1.34516E-05
33.12988281    4.17237E-06
33.15429688    4.64561E-07
33.17871094    2.41256E-06
33.203125    8.16188E-06
33.22753906    1.45035E-05
33.25195313    1.74477E-05
33.27636719    1.51113E-05
33.30078125    8.79767E-06
33.32519531    2.37447E-06
33.34960938    9.22732E-07
33.37402344    6.27775E-06
33.3984375    1.40289E-05
33.42285156    1.84731E-05
33.44726563    1.89011E-05
33.47167969    1.79926E-05
33.49609375    1.69318E-05
33.52050781    1.51122E-05
33.54492188    1.22341E-05
33.56933594    8.74737E-06
33.59375    5.57028E-06
33.61816406    3.49504E-06
33.64257813    2.61305E-06
33.66699219    3.32811E-06
33.69140625    6.33819E-06
33.71582031    1.02787E-05
33.74023438    1.26317E-05
33.76464844    1.35397E-05
33.7890625    1.53818E-05
33.81347656    1.95368E-05
33.83789063    2.47631E-05
33.86230469    2.68297E-05
33.88671875    2.26009E-05
33.91113281    1.60354E-05
33.93554688    1.34625E-05
33.95996094    1.38651E-05
33.984375    1.26446E-05
34.00878906    1.07373E-05
34.03320313    1.13989E-05
34.05761719    1.37193E-05
34.08203125    1.47348E-05
34.10644531    1.32093E-05
34.13085938    1.0904E-05
34.15527344    1.20415E-05
34.1796875    1.74904E-05
34.20410156    2.13669E-05
34.22851563    1.98017E-05
34.25292969    1.74041E-05
34.27734375    1.86661E-05
34.30175781    2.10547E-05
34.32617188    2.09353E-05
34.35058594    1.83971E-05
34.375    1.51892E-05
34.39941406    1.28029E-05
34.42382813    1.06403E-05
34.44824219    6.46756E-06
34.47265625    1.99397E-06
34.49707031    2.1165E-06
34.52148438    6.39459E-06
34.54589844    1.01819E-05
34.5703125    1.29485E-05
34.59472656    1.66477E-05
34.61914063    2.01677E-05
34.64355469    2.10725E-05
34.66796875    1.86628E-05
34.69238281    1.51475E-05
34.71679688    1.49549E-05
34.74121094    1.83773E-05
34.765625    1.91412E-05
34.79003906    1.41688E-05
34.81445313    8.43412E-06
34.83886719    5.89299E-06
34.86328125    4.63676E-06
34.88769531    2.57909E-06
34.91210938    6.43011E-07
34.93652344    7.08694E-07
34.9609375    3.22095E-06
34.98535156    5.92104E-06
35.00976563    6.80324E-06
35.03417969    7.85165E-06
35.05859375    1.09455E-05
35.08300781    1.31432E-05
35.10742188    1.17614E-05
35.13183594    9.06131E-06
35.15625    7.75927E-06
35.18066406    7.31623E-06
35.20507813    6.05024E-06
35.22949219    3.3724E-06
35.25390625    8.85702E-07
35.27832031    1.10072E-06
35.30273438    3.21523E-06
35.32714844    4.03055E-06
35.3515625    3.68623E-06
35.37597656    4.45208E-06
35.40039063    5.53353E-06
35.42480469    4.91218E-06
35.44921875    3.15767E-06
35.47363281    2.15213E-06
35.49804688    2.83896E-06
35.52246094    4.24001E-06
35.546875    4.25598E-06
35.57128906    3.49101E-06
35.59570313    5.21566E-06
35.62011719    9.18049E-06
35.64453125    1.13123E-05
35.66894531    1.06796E-05
35.69335938    1.01687E-05
35.71777344    1.09949E-05
35.7421875    1.17669E-05
35.76660156    1.09983E-05
35.79101563    8.4556E-06
35.81542969    6.25861E-06
35.83984375    6.91622E-06
35.86425781    8.69813E-06
35.88867188    7.73903E-06
35.91308594    4.70007E-06
35.9375    3.12991E-06
35.96191406    3.18925E-06
35.98632813    2.69219E-06
36.01074219    1.35064E-06
36.03515625    6.14902E-07
36.05957031    1.51971E-06
36.08398438    3.00701E-06
36.10839844    2.88164E-06
36.1328125    2.13176E-06
36.15722656    4.1264E-06
36.18164063    7.96374E-06
36.20605469    9.64479E-06
36.23046875    9.47738E-06
36.25488281    1.10054E-05
36.27929688    1.50474E-05
36.30371094    1.92017E-05
36.328125    2.01794E-05
36.35253906    1.70211E-05
36.37695313    1.36062E-05
36.40136719    1.35089E-05
36.42578125    1.41601E-05
36.45019531    1.23135E-05
36.47460938    9.7713E-06
36.49902344    8.28382E-06
36.5234375    6.37014E-06
36.54785156    4.09308E-06
36.57226563    4.13224E-06
36.59667969    7.98828E-06
36.62109375    1.4294E-05
36.64550781    1.87902E-05
36.66992188    1.76236E-05
36.69433594    1.33642E-05
36.71875    1.21418E-05
36.74316406    1.39712E-05
36.76757813    1.40042E-05
36.79199219    1.1479E-05
36.81640625    9.29217E-06
36.84082031    8.21122E-06
36.86523438    6.85346E-06
36.88964844    4.2718E-06
36.9140625    1.31702E-06
36.93847656    2.31609E-07
36.96289063    1.26736E-06
36.98730469    2.29132E-06
37.01171875    3.3889E-06
37.03613281    6.2454E-06
37.06054688    9.29894E-06
37.08496094    9.86388E-06
37.109375    8.77834E-06
37.13378906    9.02065E-06
37.15820313    1.2437E-05
37.18261719    1.76694E-05
37.20703125    2.04727E-05
37.23144531    1.97286E-05
37.25585938    2.02675E-05
37.28027344    2.43706E-05
37.3046875    2.68781E-05
37.32910156    2.38446E-05
37.35351563    1.83873E-05
37.37792969    1.48929E-05
37.40234375    1.40701E-05
37.42675781    1.41638E-05
37.45117188    1.28198E-05
37.47558594    9.29373E-06
37.5    6.00017E-06
37.52441406    5.12625E-06
37.54882813    5.14163E-06
37.57324219    3.8659E-06
37.59765625    2.18377E-06
37.62207031    1.92936E-06
37.64648438    2.99636E-06
37.67089844    4.25487E-06
37.6953125    5.08867E-06
37.71972656    5.34764E-06
37.74414063    5.24519E-06
37.76855469    5.84581E-06
37.79296875    8.74144E-06
37.81738281    1.39443E-05
37.84179688    1.91046E-05
37.86621094    2.32342E-05
37.890625    2.93366E-05
37.91503906    3.99773E-05
37.93945313    5.26053E-05
37.96386719    6.16236E-05
37.98828125    6.23838E-05
38.01269531    5.40814E-05
38.03710938    4.24336E-05
38.06152344    3.53887E-05
38.0859375    3.27904E-05
38.11035156    2.73265E-05
38.13476563    1.72968E-05
38.15917969    9.03821E-06
38.18359375    6.61961E-06
38.20800781    7.79777E-06
38.23242188    8.62582E-06
38.25683594    6.89877E-06
38.28125    3.48502E-06
38.30566406    9.79824E-07
38.33007813    3.82608E-07
38.35449219    2.71798E-06
38.37890625    1.07318E-05
38.40332031    2.27704E-05
38.42773438    3.14641E-05
38.45214844    3.3305E-05
38.4765625    3.17424E-05
38.50097656    3.04039E-05
38.52539063    3.0014E-05
38.54980469    2.91499E-05
38.57421875    2.59406E-05
38.59863281    2.22833E-05
38.62304688    2.17566E-05
38.64746094    2.1795E-05
38.671875    1.70604E-05
38.69628906    9.00083E-06
38.72070313    2.88081E-06
38.74511719    2.54951E-07
38.76953125    7.296E-07
38.79394531    5.24667E-06
38.81835938    1.4545E-05
38.84277344    2.67669E-05
38.8671875    3.58263E-05
38.89160156    3.47069E-05
38.91601563    2.38483E-05
38.94042969    1.12738E-05
38.96484375    3.09294E-06
38.98925781    8.18289E-07
39.01367188    5.67714E-06
39.03808594    1.7282E-05
39.0625    3.05119E-05
39.08691406    3.83075E-05
39.11132813    3.65777E-05
39.13574219    2.84714E-05
39.16015625    2.34011E-05
39.18457031    2.57328E-05
39.20898438    2.87103E-05
39.23339844    2.66575E-05
39.2578125    2.38682E-05
39.28222656    2.50179E-05
39.30664063    2.78214E-05
39.33105469    2.85534E-05
39.35546875    2.63869E-05
39.37988281    2.30033E-05
39.40429688    2.10636E-05
39.42871094    1.98875E-05
39.453125    1.57105E-05
39.47753906    9.47363E-06
39.50195313    6.80378E-06
39.52636719    8.64407E-06
39.55078125    1.03936E-05
39.57519531    9.50495E-06
39.59960938    7.22397E-06
39.62402344    5.2001E-06
39.6484375    4.11404E-06
39.67285156    3.57936E-06
39.69726563    2.73951E-06
39.72167969    1.69231E-06
39.74609375    1.14953E-06
39.77050781    1.45331E-06
39.79492188    3.04361E-06
39.81933594    5.84068E-06
39.84375    8.14073E-06
39.86816406    8.46505E-06
39.89257813    7.51895E-06
39.91699219    7.31833E-06
39.94140625    9.49963E-06
39.96582031    1.30974E-05
39.99023438    1.44283E-05
40.01464844    1.28827E-05
40.0390625    1.31158E-05
40.06347656    1.66452E-05
40.08789063    1.84468E-05
40.11230469    1.59477E-05
40.13671875    1.28108E-05
40.16113281    1.22983E-05
40.18554688    1.36639E-05
40.20996094    1.39328E-05
40.234375    1.11859E-05
40.25878906    8.26672E-06
40.28320313    9.53536E-06
40.30761719    1.30496E-05
40.33203125    1.37802E-05
40.35644531    1.2543E-05
40.38085938    1.29623E-05
40.40527344    1.42971E-05
40.4296875    1.39592E-05
40.45410156    1.18664E-05
40.47851563    9.63105E-06
40.50292969    8.86715E-06
40.52734375    9.04224E-06
40.55175781    7.1388E-06
40.57617188    3.13169E-06
40.60058594    1.86149E-06
40.625    5.40935E-06
40.64941406    9.9749E-06
40.67382813    1.26514E-05
40.69824219    1.44083E-05
40.72265625    1.63966E-05
40.74707031    1.82217E-05
40.77148438    1.82499E-05
40.79589844    1.51859E-05
40.8203125    1.15305E-05
40.84472656    1.11244E-05
40.86914063    1.2256E-05
40.89355469    1.05899E-05
40.91796875    7.21245E-06
40.94238281    5.85671E-06
40.96679688    6.18426E-06
40.99121094    5.61667E-06
41.015625    3.55116E-06
41.04003906    1.65447E-06
41.06445313    2.15717E-06
41.08886719    4.69818E-06
41.11328125    6.10455E-06
41.13769531    5.64645E-06
41.16210938    5.95438E-06
41.18652344    7.2507E-06
41.2109375    6.97787E-06
41.23535156    4.96637E-06
41.25976563    3.43386E-06
41.28417969    3.44916E-06
41.30859375    4.26703E-06
41.33300781    4.26745E-06
41.35742188    2.87033E-06
41.38183594    2.18027E-06
41.40625    3.76737E-06
41.43066406    5.37571E-06
41.45507813    5.00096E-06
41.47949219    4.46837E-06
41.50390625    5.35684E-06
41.52832031    6.23911E-06
41.55273438    5.73832E-06
41.57714844    4.41625E-06
41.6015625    4.0067E-06
41.62597656    5.71596E-06
41.65039063    7.68898E-06
41.67480469    7.00711E-06
41.69921875    5.15249E-06
41.72363281    5.62252E-06
41.74804688    7.30402E-06
41.77246094    7.01226E-06
41.796875    5.35272E-06
41.82128906    4.8942E-06
41.84570313    6.25229E-06
41.87011719    7.83136E-06
41.89453125    7.36052E-06
41.91894531    5.08582E-06
41.94335938    4.43301E-06
41.96777344    6.43387E-06
41.9921875    7.69283E-06
42.01660156    6.66446E-06
42.04101563    5.84009E-06
42.06542969    6.4595E-06
42.08984375    6.9484E-06
42.11425781    6.13522E-06
42.13867188    4.41722E-06
42.16308594    3.24394E-06
42.1875    3.63588E-06
42.21191406    4.04338E-06
42.23632813    2.87876E-06
42.26074219    2.59761E-06
42.28515625    5.76087E-06
42.30957031    9.82326E-06
42.33398438    1.13648E-05
42.35839844    1.10643E-05
42.3828125    1.10775E-05
42.40722656    1.18045E-05
42.43164063    1.17138E-05
42.45605469    8.88281E-06
42.48046875    4.78781E-06
42.50488281    3.73353E-06
42.52929688    5.81171E-06
42.55371094    6.86424E-06
42.578125    6.23793E-06
42.60253906    6.57899E-06
42.62695313    7.75465E-06
42.65136719    7.62504E-06
42.67578125    5.88221E-06
42.70019531    4.3658E-06
42.72460938    5.50658E-06
42.74902344    8.98043E-06
42.7734375    1.07118E-05
42.79785156    9.00956E-06
42.82226563    7.51976E-06
42.84667969    8.37802E-06
42.87109375    8.9837E-06
42.89550781    7.64678E-06
42.91992188    5.88985E-06
42.94433594    5.15433E-06
42.96875    5.35515E-06
42.99316406    5.25606E-06
43.01757813    3.89657E-06
43.04199219    3.03747E-06
43.06640625    4.8008E-06
43.09082031    7.04545E-06
43.11523438    6.86626E-06
43.13964844    6.14394E-06
43.1640625    7.66166E-06
43.18847656    1.01072E-05
43.21289063    1.08962E-05
43.23730469    9.69705E-06
43.26171875    8.43777E-06
43.28613281    9.43698E-06
43.31054688    1.14239E-05
43.33496094    1.01338E-05
43.359375    5.92963E-06
43.38378906    4.12622E-06
43.40820313    6.05463E-06
43.43261719    8.22172E-06
43.45703125    9.35624E-06
43.48144531    1.11183E-05
43.50585938    1.45058E-05
43.53027344    1.86746E-05
43.5546875    2.09243E-05
43.57910156    1.97539E-05
43.60351563    1.83456E-05
43.62792969    1.96026E-05
43.65234375    2.02883E-05
43.67675781    1.66011E-05
43.70117188    1.0697E-05
43.72558594    6.47199E-06
43.75    4.42338E-06
43.77441406    3.2572E-06
43.79882813    2.12749E-06
43.82324219    1.06852E-06
43.84765625    8.94604E-07
43.87207031    1.43901E-06
43.89648438    1.40116E-06
43.92089844    1.23481E-06
43.9453125    2.39674E-06
43.96972656    3.79622E-06
43.99414063    3.60696E-06
44.01855469    2.91437E-06
44.04296875    3.84033E-06
44.06738281    6.24454E-06
44.09179688    7.68285E-06
44.11621094    5.68201E-06
44.140625    1.4808E-06
44.16503906    2.16877E-07
44.18945313    4.49021E-06
44.21386719    1.15714E-05
44.23828125    1.92018E-05
44.26269531    2.79467E-05
44.28710938    3.67805E-05
44.31152344    4.24663E-05
44.3359375    4.28517E-05
44.36035156    3.78613E-05
44.38476563    3.03252E-05
44.40917969    2.54649E-05
44.43359375    2.50324E-05
44.45800781    2.50195E-05
44.48242188    2.28066E-05
44.50683594    2.07213E-05
44.53125    2.01203E-05
44.55566406    1.88301E-05
44.58007813    1.56433E-05
44.60449219    1.20153E-05
44.62890625    9.62178E-06
44.65332031    9.32074E-06
44.67773438    1.21358E-05
44.70214844    1.99734E-05
44.7265625    3.33207E-05
44.75097656    4.78162E-05
44.77539063    5.73881E-05
44.79980469    6.0856E-05
44.82421875    6.02463E-05
44.84863281    5.52403E-05
44.87304688    4.49541E-05
44.89746094    3.1679E-05
44.921875    1.93334E-05
44.94628906    1.06743E-05
44.97070313    6.30738E-06
44.99511719    5.81766E-06
45.01953125    1.00924E-05
45.04394531    1.96706E-05
45.06835938    3.13667E-05
45.09277344    4.06941E-05
45.1171875    4.4963E-05
45.14160156    4.19547E-05
45.16601563    3.12273E-05
45.19042969    1.72073E-05
45.21484375    7.24813E-06
45.23925781    8.20607E-06
45.26367188    2.2027E-05
45.28808594    4.01246E-05
45.3125    5.0721E-05
45.33691406    5.59594E-05
45.36132813    6.92707E-05
45.38574219    9.49526E-05
45.41015625    0.000124166
45.43457031    0.000148863
45.45898438    0.000169501
45.48339844    0.000193748
45.5078125    0.000229458
45.53222656    0.000270815
45.55664063    0.000297951
45.58105469    0.00030082
45.60546875    0.000290901
45.62988281    0.000279189
45.65429688    0.000260022
45.67871094    0.00022682
45.703125    0.000187449
45.72753906    0.000156481
45.75195313    0.000142418
45.77636719    0.00014138
45.80078125    0.000137038
45.82519531    0.000115737
45.84960938    8.53139E-05
45.87402344    6.60116E-05
45.8984375    6.31426E-05
45.92285156    6.37603E-05
45.94726563    5.74533E-05
45.97167969    4.65832E-05
45.99609375    3.89782E-05
46.02050781    3.90679E-05
46.04492188    4.37204E-05
46.06933594    4.47264E-05
46.09375    3.77232E-05
46.11816406    2.70628E-05
46.14257813    2.06155E-05
46.16699219    2.2599E-05
46.19140625    3.19963E-05
46.21582031    4.49041E-05
46.24023438    5.6066E-05
46.26464844    6.00797E-05
46.2890625    5.58999E-05
46.31347656    4.91054E-05
46.33789063    4.51349E-05
46.36230469    4.37469E-05
46.38671875    4.31158E-05
46.41113281    4.207E-05
46.43554688    3.72126E-05
46.45996094    2.64605E-05
46.484375    1.39669E-05
46.50878906    5.14581E-06
46.53320313    1.11275E-06
46.55761719    1.10679E-06
46.58203125    5.21175E-06
46.60644531    1.35336E-05
46.63085938    2.43286E-05
46.65527344    3.20943E-05
46.6796875    3.0799E-05
46.70410156    2.18092E-05
46.72851563    1.32896E-05
46.75292969    1.00058E-05
46.77734375    9.64244E-06
46.80175781    8.72184E-06
46.82617188    6.47082E-06
46.85058594    3.87501E-06
46.875    2.14263E-06
46.89941406    1.42727E-06
46.92382813    1.13605E-06
46.94824219    1.42367E-06
46.97265625    2.34234E-06
46.99707031    3.03433E-06
47.02148438    3.92817E-06
47.04589844    6.74367E-06
47.0703125    1.12489E-05
47.09472656    1.49762E-05
47.11914063    1.57483E-05
47.14355469    1.36826E-05
47.16796875    1.19633E-05
47.19238281    1.31833E-05
47.21679688    1.44997E-05
47.24121094    1.17148E-05
47.265625    6.3596E-06
47.29003906    2.55712E-06
47.31445313    9.24496E-07
47.33886719    3.32455E-07
47.36328125    9.35783E-07
47.38769531    3.20982E-06
47.41210938    6.71924E-06
47.43652344    9.63721E-06
47.4609375    1.04064E-05
47.48535156    1.11096E-05
47.50976563    1.48147E-05
47.53417969    1.92357E-05
47.55859375    1.94748E-05
47.58300781    1.57288E-05
47.60742188    1.2062E-05
47.63183594    1.04087E-05
47.65625    9.99475E-06
47.68066406    9.35326E-06
47.70507813    7.57333E-06
47.72949219    5.77934E-06
47.75390625    5.48807E-06
47.77832031    5.26725E-06
47.80273438    3.33272E-06
47.82714844    1.57621E-06
47.8515625    2.12292E-06
47.87597656    3.4338E-06
47.90039063    3.42254E-06
47.92480469    2.5385E-06
47.94921875    2.46316E-06
47.97363281    4.06897E-06
47.99804688    5.97012E-06
48.02246094    5.97868E-06
48.046875    5.21896E-06
48.07128906    6.45961E-06
48.09570313    8.3845E-06
48.12011719    7.90984E-06
48.14453125    6.11981E-06
48.16894531    5.93359E-06
48.19335938    7.31841E-06
48.21777344    8.20021E-06
48.2421875    7.08622E-06
48.26660156    4.69369E-06
48.29101563    3.77175E-06
48.31542969    5.00289E-06
48.33984375    5.39403E-06
48.36425781    3.68403E-06
48.38867188    2.50339E-06
48.41308594    3.13968E-06
48.4375    3.78312E-06
48.46191406    3.34971E-06
48.48632813    2.749E-06
48.51074219    3.28163E-06
48.53515625    5.13032E-06
48.55957031    6.36947E-06
48.58398438    5.54942E-06
48.60839844    5.0107E-06
48.6328125    6.97999E-06
48.65722656    8.98108E-06
48.68164063    8.49623E-06
48.70605469    7.46568E-06
48.73046875    8.2095E-06
48.75488281    1.00262E-05
48.77929688    1.0972E-05
48.80371094    9.86227E-06
48.828125    7.97814E-06
48.85253906    8.05582E-06
48.87695313    9.27829E-06
48.90136719    8.2109E-06
48.92578125    5.76882E-06
48.95019531    5.76981E-06
48.97460938    7.80135E-06
48.99902344    8.60536E-06
49.0234375    7.46533E-06
49.04785156    6.01932E-06
49.07226563    5.90436E-06
49.09667969    7.07371E-06
49.12109375    7.28924E-06
49.14550781    5.76399E-06
49.16992188    5.29374E-06
49.19433594    7.00395E-06
49.21875    7.75377E-06
49.24316406    5.9871E-06
49.26757813    4.2824E-06
49.29199219    4.64969E-06
49.31640625    6.21718E-06
49.34082031    7.08047E-06
49.36523438    6.27902E-06
49.38964844    5.43183E-06
49.4140625    6.78544E-06
49.43847656    8.62115E-06
49.46289063    7.704E-06
49.48730469    5.59562E-06
49.51171875    5.82235E-06
49.53613281    7.59963E-06
49.56054688    8.13924E-06
49.58496094    7.17615E-06
49.609375    6.33467E-06
49.63378906    7.03995E-06
49.65820313    8.53932E-06
49.68261719    8.07687E-06
49.70703125    5.75349E-06
49.73144531    5.27383E-06
49.75585938    7.13112E-06
49.78027344    7.72042E-06
49.8046875    6.17812E-06
49.82910156    5.11525E-06
49.85351563    5.69187E-06
49.87792969    6.74328E-06
49.90234375    6.71684E-06
49.92675781    5.36537E-06
49.95117188    4.81493E-06
49.97558594    6.5071E-06
50    7.85524E-06

I would like to find the rolling average of each value of the second column over a range of +\- 20% of the first column...which means for example:  at 5.004882813 (freq) I have a PSD of 0.002682703.  I would then take find the +\- 20% of 5.004882813....which is 4.00390625 and 6.005859375.  I would then take the average of the PSD's over that range (from 0.00191024 to 0.00038013) which would give me a PSD of 0.017240039.  Do this for each PSD value. For the front and back end of the file, if there is less 20% available....say at 0 (freq) you can only take the +20% because there is no -20%...just take that. ....Hope that makes sense..

remember...you Procyon...you said you liked these!!!!!

Offline

#19 2009-01-26 22:25:24

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: help using bash to interpolate

I am close, but there is a rounding error,

It counts all freq for every freq-20%:freq+20%

here is some debugging output of the format:
"is freq-20% : freq : freq+20%   those are from freq"

is 4.00391 : 4.00390625 : 6.00586   those are from 5.004882813
is 4.00391 : 4.028320313 : 6.00586   those are from 5.004882813
Match!
is 4.00391 : 4.052734375 : 6.00586   those are from 5.004882813
Match!

The calculation of the percentage is:
freqmt[i]=$1-($1/5)

I'll look for a better way.

EDIT:

Actually:

echo 5.004882813 | awk '{printf "%.10f", $1-$1/5}'
4.0039062504

It seems it doesn't round enough. I wonder if there is a function for that, otherwise all numbers will become int(number*100,000,000)

Last edited by Procyon (2009-01-26 22:38:02)

Offline

#20 2009-01-26 23:02:56

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: help using bash to interpolate

OK here it is

If someone knows a way to round numbers better, then let me know.
Right now it just rounds when it needs to, so average calculation is not affected.

You have to force it to give more accurate results at the end with printf %.10g

awk 'BEGIN { i=0 }
/^[^F]*$/{freq[i]=$1;psd[i]=$2;freqmt[i]=$1-($1/5);freqpt[i]=$1+($1/5);i++}
 END {
for (b=0;b<i;b++) {
    count=0
    sum=0
    for (a=0;a<i;a++) {
#        print "is " freqmt[b] " : " freq[a] " : " freqpt[b] "   those are from " freq[b]
        if (int(100000000*freqmt[b]) <= int(100000000*freq[a]) && int(100000000*freqpt[b]) >= int(100000000*freq[a])) {
#            print "Match!"
            count=count+1
            sum=sum+psd[a]
        }
        if (freqpt[b] < freq[a]) {break}
    }
    if ( count > 0) { avg[b]=sum/count }
    else {avg[b]=psd[b]}
}
for (a=0;a<i;a++) {
    printf "%.10g\t%.10g\n", psd[a], avg[a]
}
}' table

Your example gives:
0.002682703        0.0172400387


edit:
actually for speed it's alright it must have been all the debugging output.

edit2:

I have a much better idea and that is changing the percentage slightly in the favor of finding something. Now I wonder if the number is enough. I will run a small test.

awk 'BEGIN { i=0; FMT="%.10g" }
/^[^F]*$/{freq[i]=$1;psd[i]=$2;freqmt[i]=$1-($1/5)-0.0000001;freqpt[i]=$1+($1/5)+0.0000001;i++}
 END {
for (b=0;b<i;b++) {
    count=0
    sum=0
    for (a=0;a<i;a++) {
#        print "is " freqmt[b] " : " freq[a] " : " freqpt[b] "   those are from " freq[b]
        if (freqmt[b] <= freq[a] && freqpt[b] >= freq[a]) {
#            print "Match!"
            count=count+1
            sum=sum+psd[a]
        }
        if (freqpt[b] < freq[a]) {break}
    }
    if ( count > 0) { avg[b]=sum/count }
    else {avg[b]=psd[b]}
}
for (a=0;a<i;a++) {
    print psd[a] "\t" avg[a]
}
}' table

(for your example the result is the same)

EDIT:
I did a rough scan and I think the largest of small differences are:
negative number means that it is matching, positive means that it isn't
The number means by what margin

0.0048828080    -0.0195312520
0.0048828080    -0.0195312520
0.0000000040    -0.0244140590
0.0000000040    -0.0244140590
.....
0.0000000004    -0.0244140626

my number 
0.000000001

You see the gap. And you see that 0.000000001 is not enough.

I have changed 0.000000001 to 0.0000001 in the code above (the second code block)

EDIT:
Just for the record, and this is something that applies to anything previously too, FMT="%.10g" is a good idea to put in the BEGIN section. This makes all print statements use that accuracy. I have edited the previous answer to do it that way.

Last edited by Procyon (2009-01-27 15:15:34)

Offline

#21 2009-01-27 15:14:18

jnwebb
Member
Registered: 2008-07-07
Posts: 52

Re: help using bash to interpolate

This looks great...I checked it w/ excel and all is good!!!  A few ?'s for my growth:

Can you pt me to a site that gives basic knowledge of the character meanings:

for example you start your script w/ 

awk 'BEGIN { i=0 }
/^[^F]*$/{freq[i]=$1;psd[i]=$2;freqmt[i]=$1-($1/10)-0.0000001;freqpt[i]=$1+($1/10)+0.0000001;i++}
END {

I understand the defining of the variables, the awk command,etc....just want to truly understand 'BEGIN { i=0 }
/^[^F]*$/{.........}END

Thanks again.

Offline

#22 2009-01-27 15:22:56

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: help using bash to interpolate

I edited the previous post right after your reply by the way.

'BEGIN { i=0 }
/^[^F]*$/{.........}END

That means
The BEGIN block, before the script runs. it initializes variables. (I put FMT= there too)
BEGIN { ... }

The second block is usually just
{ ... }
But now I put a regex that that it has to match
/^[^F]*$/ { ... }
That one means
Match the start: ^
Match any number of characters that are not F: [^F]*
Match the end: $
(EDIT: and this block is run for every line, but we don't want it to match the first line with Freq:)

And the END block, which is run afterwards.
END { ... }

'man awk' has lots of info on data-types, variables and functions.
Here is a good tutorial: unix grymoire

Last edited by Procyon (2009-01-27 18:02:59)

Offline

Board footer

Powered by FluxBB