Network.interpolate(freq_or_n, basis='s', coords='cart', f_kwargs=None, return_array=False, **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.

  • freq_or_n (Frequency or int or list-like) –

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

    • a new Frequency object

    • an int: the current frequency span is resampled linearly.

    • a list-like: create a new frequency using from_f()

  • 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 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)


result – an interpolated Network, or array

Return type:



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


In [1]: n =

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]