skrf.network.Network.interpolate

Network.interpolate(freq_or_n, basis='s', coords='cart', f_kwargs={}, return_array=False, **kwargs)[source]

Interpolate a Network allong 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 listlike) –

    The new frequency over which to interpolate. this arg may be one of the following

    • a new Frequency object
    • if an int, the current frequency span is resampled linearly.
    • if a listlike, then create its used to create a new frequency object using Frequency.from_f
  • basis (['s','z','y','a'],etc) – The network parameter to interpolate
  • coords (['cart','polar']) –
    coordinate system to use for interpolation.
    • ’cart’ is cartesian is Re/Im
    • ’polar’ is unwrapped phase/mag
  • return_array (bool) – return the interpolated array instead of re-asigning it to a given attribute
  • **kwargs (keyword arguments) –

    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.

Returns:

result – an interpolated Network, or array

Return type:

Network

Notes

The interpolation cordinate system (coords) makes a big difference for large ammounts of inerpolation. polar works well for duts with slowly changing magnitude. try them all.

See scipy.interpolate.interpolate.interp1d() for useful kwargs. For example

kind : str 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.

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]