skrf.networkSet.NetworkSet.sel
- NetworkSet.sel(indexers=None)[source]
Select Network(s) in the NetworkSet from a given value of a parameter.
- Parameters:
indexers (dict, optional) – A dict with keys matching dimensions and values given by scalars, or arrays of parameters. Default is None, which returns the entire NetworkSet
- Returns:
ns – NetworkSet containing the selected Networks or empty NetworkSet if no match found
- Return type:
Example
Creating a dummy example:
>>> params = [ {'a':0, 'X':10, 'c':'A'}, {'a':1, 'X':10, 'c':'A'}, {'a':2, 'X':10, 'c':'A'}, {'a':1, 'X':20, 'c':'A'}, {'a':0, 'X':20, 'c':'A'}, ] >>> freq1 = rf.Frequency(75, 110, 101, 'ghz') >>> ntwks_params = [rf.Network(frequency=freq1, s=np.random.rand(len(freq1),2,2), name=f'ntwk_{m}', comment=f'ntwk_{m}', params=params) for (m, params) in enumerate(params) ] >>> ns = rf.NetworkSet(ntwks_params)
Selecting the sub-NetworkSet matching scalar parameters:
>>> ns.sel({'a': 1}) # len == 2 >>> ns.sel({'a': 0, 'X': 10}) # len == 1
Selectong the sub-NetworkSet matching a range of parameters:
>>> ns.sel({'a': 0, 'X': [10,20]}) # len == 2 >>> ns.sel({'a': [0,1], 'X': [10,20]}) # len == 4
If using a parameter name of value that does not exist, returns empty NetworkSet:
>>> ns.sel({'a': -1}) # len == 0 >>> ns.sel({'duh': 0}) # len == 0