skrf.io.general.read_all
- skrf.io.general.read_all(dir='.', sort=True, contains=None, f_unit=None, obj_type=None, files=None, recursive=False)[source]
Read all skrf objects in a directory.
Attempts to load all files in dir, using
read(). Any file that is not readable by skrf is skipped. Optionally, simple filtering can be achieved through the use of contains argument.- Parameters:
dir (str or Path, optional) – the directory to load from, default ‘.’
sort (boolean, default is True) – filenames sorted by https://docs.python.org/3/library/stdtypes.html#list.sort without arguments
contains (str, optional) – if not None, only files containing this substring will be loaded
f_unit (['hz','khz','mhz','ghz','thz']) – for all
Networkobjects, set their frequencies’sf_unitobj_type (str) – Name of skrf object types to read (ie ‘Network’)
files (list, optional) – list of files to load, bypasses dir parameter.
recursive (bool, optional) – If True, search in the specified directory and all other nested directories
- Returns:
out – dictionary containing all loaded skrf objects. keys are the filenames without extensions, and the values are the objects
- Return type:
dictionary
Examples
>>> rf.read_all('skrf/data/') {'delay_short': 1-Port Network: 'delay_short', 75-110 GHz, 201 pts, z0=[ 50.+0.j], 'line': 2-Port Network: 'line', 75-110 GHz, 201 pts, z0=[ 50.+0.j 50.+0.j], 'ntwk1': 2-Port Network: 'ntwk1', 1-10 GHz, 91 pts, z0=[ 50.+0.j 50.+0.j], 'one_port': one port Calibration: 'one_port', 500-750 GHz, 201 pts, 4-ideals/4-measured, ...
>>> rf.read_all('skrf/data/', obj_type = 'Network') {'delay_short': 1-Port Network: 'delay_short', 75-110 GHz, 201 pts, z0=[ 50.+0.j], 'line': 2-Port Network: 'line', 75-110 GHz, 201 pts, z0=[ 50.+0.j 50.+0.j], 'ntwk1': 2-Port Network: 'ntwk1', 1-10 GHz, 91 pts, z0=[ 50.+0.j 50.+0.j],
>>> rf.read_all(files = ['skrf/data/delay_short.s1p', 'skrf/data/line.s2p'], obj_type = 'Network') {'delay_short': 1-Port Network: 'delay_short', 75-110 GHz, 201 pts, z0=[ 50.+0.j], 'line': 2-Port Network: 'line', 75-110 GHz, 201 pts, z0=[ 50.+0.j 50.+0.j]}