skrf.network.Network.interpolate
- Network.interpolate(freq_or_n, basis='s', coords='cart', f_kwargs=None, return_array=False, kind=None, **kwargs)[source]
Interpolate a Network along frequency axis.
The input ‘freq_or_n` can be either a new
Frequency
or an int, or a new frequency vector (in Hz).This interpolates a given basis, ie s, z, y, etc, in the coordinate system defined by coord like polar or cartesian. Different interpolation types (‘linear’, ‘quadratic’) can be used by passing appropriate **kwargs. This function returns an interpolated Network. Alternatively
interpolate_self()
will interpolate self.- Parameters:
freq_or_n (
Frequency
or int or list-like) –The new frequency over which to interpolate. this arg may be one of the following:
basis (['s','z','y','a'], etc) – The network parameter to interpolate
coords (string) – Coordinate system to use for interpolation: ‘cart’ or ‘polar’: ‘cart’ is cartesian is Re/Im. ‘polar’ is unwrapped phase/mag
return_array (bool) – return the interpolated array instead of re-assigning it to a given attribute
**kwargs (keyword arguments) –
passed to interpolate method. freq_cropped kwarg controls whether to use pre-cropped frequency points for interpolation. Defaults to True.
passed to
scipy.interpolate.interp1d()
initializer. kind controls interpolation type.kind = rational uses interpolation by rational polynomials.
d kwarg controls the degree of rational polynomials when kind`=`rational. Defaults to 4.
f_kwargs (dict | None)
kind (Literal['linear', 'cubic', 'nearest', 'zero', 'slinear', 'quadratic', 'rational'] | None)
- Returns:
result – an interpolated Network, or array
- Return type:
Note
Frequency cropping is only supported with methods from scipy.interpolate.interpolate.interp1d. The ‘rational’ method does not support frequency cropping.
The interpolation coordinate system (coords) makes a big difference for large amounts of interpolation. polar works well for duts with slowly changing magnitude. try them all.
See
scipy.interpolate.interpolate.interp1d()
for useful kwargs. For example:- kindstring or int
Specifies the kind of interpolation as a string (‘linear’, ‘nearest’, ‘zero’, ‘slinear’, ‘quadratic, ‘cubic’) or as an integer specifying the order of the spline interpolator to use.
See also
resample
,interpolate_self
,interpolate_from_f
Examples
In [1]: n = rf.data.ring_slot In [2]: n Out[2]: 2-Port Network: 'ring slot', 75.0-110.0 GHz, 201 pts, z0=[50.+0.j 50.+0.j] In [3]: new_freq = rf.Frequency(75,110,501,'ghz') In [4]: n.interpolate(new_freq, kind = 'cubic') Out[4]: 2-Port Network: 'ring slot', 75.0-110.0 GHz, 501 pts, z0=[50.+0.j 50.+0.j]