pyarts3.math

Contains interfaces to the ARTS interpolation routines.

This exists mostly to test internal ARTS methods from Python, and is not intended to be high-performance code.

pyarts3.math.interp(y, *args)[source]

Interpolate to a single point

Note that this is not an efficient interpolation routine and you should use other methods if you are interested in speed. This is high level wrapper to the C++ routine, with no effort to optimize the python loops.

This method exists so that the interpolation routine inside ARTS can be tested from python.

import pyarts3 as pyarts
import numpy as np
import matplotlib.pyplot as plt

x = [0.1, 0.4, 0.6, 0.9]
y = np.arcsin(x)

xn = 0.5
yn = pyarts.math.interp(y, pyarts.arts.interp.LagrangeCyclic(x, xn, 1))

plt.plot(x, y, '-x')
plt.plot([xn], [yn], '*')

(Source code, svg, pdf)

_images/pyarts3-math-1.svg
Parameters:
Returns:

value – The interpolated value.

Return type:

ndarray

pyarts3.math.reinterp(y, *args)[source]

Reinterpolate to new grids

Note that this is not an efficient interpolation routine and you should use other methods if you are interested in speed. This is high level wrapper to the C++ routine, with no effort to optimize the python loops.

This method exists so that the interpolation routine inside ARTS can be tested from python.

import pyarts3 as pyarts
import numpy as np
import matplotlib.pyplot as plt

x = np.linspace(0.1, 0.9)
y = np.arcsin(x)

xn = np.linspace(0, 1)
yn = pyarts.math.reinterp(y, pyarts.arts.interp.ArrayOfLagrange(x, xn, 1))

plt.plot(x, y, '-x')
plt.plot(xn, yn)

(Source code, svg, pdf)

_images/pyarts3-math-2.svg
Parameters:
Returns:

value – The interpolated value.

Return type:

ndarray