The following example is available as int_save.py in the examples directory. We will produce a Data object which aproximates a sine curve.
First we produce an interpolation table.
We wish to identify 0
and
with the ends of the curve.
That is, with the first and eighth values in the table.
So the values
from the input lie in the interval minval
maxval.
step represents the gap (in the input range) between entries in the table.
By default values of
outside the table argument range (minval, maxval) will
be pushed back into the range, ie. if
minval the value minval will be used to
evaluate the table. Similarly, for values
maxval the value maxval is used.
Now we produce our new Data object.
Any values which interpolate to larger than toobig will raise an exception. You can
switch on boundary checking by adding ''check_boundaries=True`` the argument list.
Now for a 2D example. We will interpolate a surface such that the bottom edge is the sine curve described above. The amplitude of the curve decreases as we move towards the top edge.
Our interpolation table will have three rows.
The use of numpy and multiplication here is just to save typing.
In the 2D case, the parameters for the x1 direction (min=0, step=0.55) come first followed by the x0 data object and its parameters. By default, if a point is specified which is outside the boundary, then interpolateTable will operate as if the point was on the boundary. Passing check_boundaries=True will interpolateTable to reject any points outside the boundaries.