Measurements in network data

Skip to first unread message


Feb 22, 2021, 7:03:39 AMFeb 22
to scikit-rf

I've never used scikit-rf so far but I am about to implement some automatic measurements to analyze mag loop antenna and at the moment I try to get a little bit familiar with scikit-rf doc to collect the bits and pieces I will need.

My automation script would run like this:
Sweeping through the tuning cap range and for each position take a NanoVNA measurement of s11 data, construct a Network object with this s11 data and determine some extreme points in this s11 data, e.g.  frequency of minimum reflection.

I haven't found any tools in scikit-rf so far to apply on a set of s-data to find minimum, maximum, stuff like bandwidth, etc.
You know, the typical "Measurements" you have on a VNA machine (Find Minimum, FindMaximum, FindNext,...)

I can't believe that there is no such toolbox in scikit-rf and ask you for some hint.

If there isn't such a set of functions, how to proceed? Crank up some numpy stuff to do the work?
Would be work I'd like to avoid.

Thanks a lot and 73

Julien Hillairet

Feb 22, 2021, 1:49:23 PMFeb 22
Dear Oli,

Sweeping through the cap values and saving s-param is definitely doable with scikit-rf. I suggest you to have a look into the NetworkSet objects:
which can be used for example for statistics/error determination, but also to interpolate a set of Networks that depend on one or a few external parameters:

Finding the minimum of s11 can be accomplished with Numpy:

import skrf as rf
import numpy as np
rs =  # 2port example
f_match = rs.f[np.argmin(rs.s_mag[:,0,0])]  # frequency for min(|S11|)

You are right that such a function doesn't exist yet in scikit-rf. I suppose the main reason is that while things are simple when there is a single match point, it can get more complicated when multiple resonances occur. Like, should such a function return all the frequencies below a certain threshold? Or only the local extrema? How to define a bandwidth with multiple resonances? etc. So potentially many various situations.

However, being open-source, this is never too late to add such a feature :)

Googling a bit how to find local extrema[1], here is a possibility (but I didn't test on network with multiple peaks):

from scipy.ndimage import rank_filter
def find_local_minima(x):
   x_erode = rank_filter(x, -0, size=3)
   return x_erode == x

Best regards,


You received this message because you are subscribed to the Google Groups "scikit-rf" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit

alexander arsenovic

Feb 22, 2021, 2:19:35 PMFeb 22
there are some peak finding methods in  which might be helpful . i am not sure why isnt in the API of the docs. 

Denz Choe

Jun 29, 2021, 9:56:41 PMJun 29
to scikit-rf
This thread should be promoted. Especially for someone who are not common to the language of numpy but understands how to use the VNA

#find max
#find min
#find maximum
#find minimum
#returns frequency

Julien Hillairet

Jun 30, 2021, 2:19:32 AMJun 30
You are right that documentation often assumes that the reader knows how to use Python and Numpy arrays, which is probably not the case in many situations. I will add something in the first tutorial about that.


Denz Choe

Jun 30, 2021, 2:25:49 AMJun 30
Thanks for making it part of the tutorial!
Wasn't expecting a reply.
I just wanted to add the hash tags for easy searching for other users. :) 


Reply all
Reply to author
0 new messages