This file is indexed.

/usr/share/doc/pyxplot/html/ex-interpolation.html is in pyxplot-doc 0.8.4-3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta name="generator" content="plasTeX" />
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
<title>PyXPlot Users' Guide: Datafile Interpolation</title>

<link href="sect0028.html" title="Fourier Transforms" rel="next" />
<link href="sec-fit_command.html" title="Function Fitting" rel="prev" />
<link href="ch-numerics.html" title="Working with Data" rel="up" />
<link rel="stylesheet" href="styles/styles.css" />
</head>
<body>

<div class="navigation">
<table cellspacing="2" cellpadding="0" width="100%">
<tr>
<td><a href="sec-fit_command.html" title="Function Fitting"><img alt="Previous: Function Fitting" border="0" src="icons/previous.gif" width="32" height="32" /></a></td>

<td><a href="ch-numerics.html" title="Working with Data"><img alt="Up: Working with Data" border="0" src="icons/up.gif" width="32" height="32" /></a></td>

<td><a href="sect0028.html" title="Fourier Transforms"><img alt="Next: Fourier Transforms" border="0" src="icons/next.gif" width="32" height="32" /></a></td>

<td class="navtitle" align="center">PyXPlot Users' Guide</td>
<td><a href="index.html" title="Table of Contents"><img border="0" alt="" src="icons/contents.gif" width="32" height="32" /></a></td>

<td><a href="sect0255.html" title="Index"><img border="0" alt="" src="icons/index.gif" width="32" height="32" /></a></td>

<td><img border="0" alt="" src="icons/blank.gif" width="32" height="32" /></td>
</tr>
</table>
</div>

<div class="breadcrumbs">
<span>
<span>
<a href="index.html">PyXPlot Users' Guide</a> <b>:</b>
</span>

</span><span>
<span>
<a href="sect0001.html">Introduction to PyXPlot</a> <b>:</b>
</span>

</span><span>
<span>
<a href="ch-numerics.html">Working with Data</a> <b>:</b>
</span>

</span><span>

<span>
<b class="current">Datafile Interpolation</b>
</span>
</span>
<hr />
</div>

<div><h1 id="ex:interpolation">5.7 Datafile Interpolation</h1>
<p>  <a name="a0000000519" id="a0000000519"></a> </p><p>The <tt class="tt">interpolate</tt> command<a name="a0000000520" id="a0000000520"></a> can be used to generate a special function within PyXPlot’s mathematical environment which interpolates a set of datapoints supplied from a datafile. Either one- or two-dimensional interpolation is possible. </p><p>In the case of one-dimensional interpolation, various different types of interpolation are supported: linear interpolation, power law interpolation, polynomial interpolation, cubic spline interpolation and akima spline interpolation. Stepwise interpolation returns the value of the datapoint nearest to the requested point in argument space. The use of polynomial interpolation with large datasets is strongly discouraged, as polynomial fits tend to show severe oscillations between datapoints. Except in the case of stepwise interpolation, extrapolation is not permitted; if an attempt is made to evaluate an interpolated function beyond the limits of the datapoints which it interpolates, PyXPlot returns an error or value of not-a-number. </p><p>In the case of two-dimensional interpolation, the type of interpolation to be used is set using the <tt class="tt">interpolate</tt> modifier to the <tt class="tt">set samples</tt> command<a name="a0000000521" id="a0000000521"></a>, and may be changed at any time after the interpolation function has been created. The options available are nearest neighbour interpolation – which is the two-dimensional equivalent of stepwise interpolation, inverse square interpolation – which returns a weighted average of the supplied datapoints, using the inverse squares of their distances from the requested point in argument space as weights, and Monaghan Lattanzio interpolation, which uses the weighting function (Monaghan &amp; Lattanzio 1985) </p><table id="a0000000522" cellpadding="7" width="100%" cellspacing="0" class="eqnarray">
<tr id="a0000000523">
    
    <td style="width:40%">&nbsp;</td>
    
    
        <td style="vertical-align:middle;                                    text-align:right"><img src="images/img-0172.png" alt="$\displaystyle  w(x)  $" style="vertical-align:-4px; width:36px;                     height:18px" class="math gen" /></td>
    
    
    
        <td style="vertical-align:middle;                                    text-align:center"><img src="images/img-0173.png" alt="$\displaystyle  = 1 - \nicefrac {3}{2}v^2 + \nicefrac {3}{4}v^3  $" style="vertical-align:-5px; width:146px;                     height:22px" class="math gen" /></td>
    
    
    
        <td style="vertical-align:middle;                                    text-align:left"><img src="images/img-0174.png" alt="$\displaystyle  \, \mathrm{for~ }0\leq v\leq 1  $" style="vertical-align:-3px; width:103px;                     height:15px" class="math gen" /></td>
    
    
    
    <td style="width:40%">&nbsp;</td>
    <td style="width:20%" class="eqnnum">&nbsp;</td>
</tr><tr id="a0000000524">
    
    <td style="width:40%">&nbsp;</td>
    
    
        <td style="vertical-align:middle;                                    text-align:right"><img src="images/img-0175.png" alt="$\displaystyle  $" style="vertical-align:0px; width:1px;                     height:1px" class="math gen" /></td>
    
    
    
        <td style="vertical-align:middle;                                    text-align:center"><img src="images/img-0176.png" alt="$\displaystyle  = \nicefrac {1}{4}(2-v)^3  $" style="vertical-align:-5px; width:100px;                     height:22px" class="math gen" /></td>
    
    
    
        <td style="vertical-align:middle;                                    text-align:left"><img src="images/img-0177.png" alt="$\displaystyle  \, \mathrm{for~ }1\leq v\leq 2  $" style="vertical-align:-3px; width:104px;                     height:15px" class="math gen" /></td>
    
    
    
    <td style="width:40%">&nbsp;</td>
    <td style="width:20%" class="eqnnum">&nbsp;</td>
</tr>
</table><p> where <img src="images/img-0178.png" alt="$v=r/h$" style="vertical-align:-5px; 
                                     width:61px; 
                                     height:18px" class="math gen" /> for <img src="images/img-0179.png" alt="$h=\sqrt {A/n}$" style="vertical-align:-5px; 
                                     width:86px; 
                                     height:22px" class="math gen" />, <img src="images/img-0180.png" alt="$A$" style="vertical-align:0px; 
                                     width:13px; 
                                     height:12px" class="math gen" /> is the product <img src="images/img-0181.png" alt="$(x_\mathrm {max}-x_\mathrm {min})(y_\mathrm {max}-y_\mathrm {min})$" style="vertical-align:-4px; 
                                     width:212px; 
                                     height:18px" class="math gen" /> and <img src="images/img-0014.png" alt="$n$" style="vertical-align:0px; 
                                     width:11px; 
                                     height:8px" class="math gen" /> is the number of input datapoints. These are selected as follows: </p><pre>
set samples interpolate NearestNeighbour
set samples interpolate InverseSquare
set samples interpolate MonaghanLattanzio
</pre><p>Finally, data can be imported from graphical images in bitmap (<tt class="tt">.bmp</tt>) format to produce a function of two arguments returning a value in the range <img src="images/img-0182.png" alt="$0\to 1$" style="vertical-align:-1px; 
                                     width:45px; 
                                     height:13px" class="math gen" /> which represents the data in one of the image’s three colour channels. The two arguments are the horizontal and vertical position within the bitmap image, as measured in pixels. </p><p>The <tt class="tt">interpolate</tt> command<a name="a0000000525" id="a0000000525"></a> has similar syntax to the <tt class="tt">fit</tt> command<a name="a0000000526" id="a0000000526"></a>: </p><pre>
interpolate ( akima | linear | loglinear | polynomial |
              spline | stepwise |
              2d [( bmp_r | bmp_g | bmp_b )] )
            [&lt;range specification&gt;] &lt;function name&gt;"()"
            '&lt;filename&gt;'
            [ every &lt;expression&gt; {:&lt;expression} ]
            [ index &lt;value&gt; ]
            [ select &lt;expression&gt; ]
            [ using &lt;expression&gt; {:&lt;expression} ]
</pre><p>A very common application of the <tt class="tt">interpolate</tt> command<a name="a0000000527" id="a0000000527"></a> is to perform arithmetic functions such as addition or subtraction on datasets which are not sampled at the same abscissa values. The following example would plot the difference between two such datasets: </p><pre>
interpolate linear f() 'data1.dat'
interpolate linear g() 'data2.dat'
plot [min:max] f(x)-g(x)
</pre><p>Note that it is advisable to supply a range to the <tt class="tt">plot</tt> command in this example: because the two datasets have been turned into continuous functions, the <tt class="tt">plot</tt> command has to guess a range over which to plot them unless one is explicitly supplied. </p><p>The <tt class="tt">spline</tt> command<a name="a0000000528" id="a0000000528"></a> is an alias for <tt class="tt">interpolate spline</tt>; the following two statements are equivalent: </p><pre>
spline f() 'data1.dat'
interpolate spline f() 'data1.dat'
</pre><p> <span class="upshape"><span class="mdseries"><span class="rm">A demonstration of the <tt class="tt">linear</tt>, <tt class="tt">spline</tt> and <tt class="tt">akima</tt> modes of interpolation.</span></span></span></p><div>

<table cellspacing="0" class="tabular">
<tr>

    
    <td style="border-top-style:solid; border-left:1px solid black; border-right:1px solid black; border-top-color:black; border-top-width:1px; text-align:left"><p> In this example, we demonstrate the <tt class="tt">linear</tt>, <tt class="tt">spline</tt> and <tt class="tt">akima</tt> modes of interpolation using an example datafile with non-smooth data generated using the <tt class="tt">tabulate</tt> command (see Section <a href="sec-tabulate.html">5.5</a>): </p></td>

</tr><tr>

    
    <td style="text-align:left; border-right:1px solid black; border-left:1px solid black"><p><tt class="tt">f(x) = 0</tt><br /><tt class="tt">f(x)[0:1] = 0.5</tt><br /><tt class="tt">f(x)[2:4] = cos((x-3)*pi/2)</tt><br /><tt class="tt">set samples 20</tt><br /><tt class="tt">tabulate [0:4] f(x)</tt> </p></td>

</tr><tr>

    
    <td style="text-align:left; border-right:1px solid black; border-left:1px solid black"><p>Having set three functions to interpolate these non-smooth data in different ways, we plot them with a vertical offset of <img src="images/img-0183.png" alt="$0.1$" style="vertical-align:0px; 
                                     width:22px; 
                                     height:12px" class="math gen" /> between them for clarity. The interpolated datafileis plotted with points three times to show where each of the interpolation functions is pinned. </p></td>

</tr><tr>

    
    <td style="text-align:left; border-right:1px solid black; border-left:1px solid black"><p><tt class="tt">interpolate linear f_linear() "data.dat"</tt><br /><tt class="tt">interpolate spline f_spline() "data.dat"</tt><br /><tt class="tt">interpolate akima f_akima () "data.dat"</tt><br /></p></td>

</tr><tr>

    
    <td style="text-align:left; border-right:1px solid black; border-left:1px solid black"><p><tt class="tt">set key top left</tt><br /><tt class="tt">plot [0:4][-0.1:1.3] <img src="images/img-0006.png" alt="$\backslash $" style="vertical-align:-5px; 
                                     width:7px; 
                                     height:18px" class="math gen" /></tt><br /><tt class="tt">"data.dat" using 1:($2+0.0) notitle with points pt 1, <img src="images/img-0006.png" alt="$\backslash $" style="vertical-align:-5px; 
                                     width:7px; 
                                     height:18px" class="math gen" /></tt><br /><tt class="tt">f_linear(x)+0.0 title "Linear", <img src="images/img-0006.png" alt="$\backslash $" style="vertical-align:-5px; 
                                     width:7px; 
                                     height:18px" class="math gen" /></tt><br /><tt class="tt">"data.dat" using 1:($2+0.1) notitle with points pt 1, <img src="images/img-0006.png" alt="$\backslash $" style="vertical-align:-5px; 
                                     width:7px; 
                                     height:18px" class="math gen" /></tt><br /><tt class="tt">f_spline(x)+0.1 title "Spline", <img src="images/img-0006.png" alt="$\backslash $" style="vertical-align:-5px; 
                                     width:7px; 
                                     height:18px" class="math gen" /></tt><br /><tt class="tt">"data.dat" using 1:($2+0.2) notitle with points pt 1, <img src="images/img-0006.png" alt="$\backslash $" style="vertical-align:-5px; 
                                     width:7px; 
                                     height:18px" class="math gen" /></tt><br /><tt class="tt">f_akima (x)+0.2 title "Akima"</tt><br /></p></td>

</tr><tr>

    
    <td style="text-align:left; border-right:1px solid black; border-left:1px solid black"><p>The resulting plot is shown below: </p></td>

</tr><tr>

    
    <td style="border-bottom-style:solid; border-bottom-width:1px; border-left:1px solid black; border-right:1px solid black; text-align:left; border-bottom-color:black"><p><center>
<img src="images/img-0185.png" alt="\includegraphics[width=\textwidth ]{examples/eps/ex_interpolation}" style="width:" /></center>  </p></td>

</tr>
</table>
</div></div>





<div class="navigation">
<table cellspacing="2" cellpadding="0" width="100%">
<tr>
<td><a href="sec-fit_command.html" title="Function Fitting"><img alt="Previous: Function Fitting" border="0" src="icons/previous.gif" width="32" height="32" /></a></td>

<td><a href="ch-numerics.html" title="Working with Data"><img alt="Up: Working with Data" border="0" src="icons/up.gif" width="32" height="32" /></a></td>

<td><a href="sect0028.html" title="Fourier Transforms"><img alt="Next: Fourier Transforms" border="0" src="icons/next.gif" width="32" height="32" /></a></td>

<td class="navtitle" align="center">PyXPlot Users' Guide</td>
<td><a href="index.html" title="Table of Contents"><img border="0" alt="" src="icons/contents.gif" width="32" height="32" /></a></td>

<td><a href="sect0255.html" title="Index"><img border="0" alt="" src="icons/index.gif" width="32" height="32" /></a></td>

<td><img border="0" alt="" src="icons/blank.gif" width="32" height="32" /></td>
</tr>
</table>
</div>

<script language="javascript" src="icons/imgadjust.js" type="text/javascript"></script>

</body>
</html>