skrf.io.general.read

skrf.io.general.read(file, *args, **kwargs)[source]

Read skrf object[s] from a pickle file.

Reads a skrf object that is written with write(), which uses the pickle module.

Parameters:
  • file (str, Path, or file-object) – name of file, or a file-object

  • *args (arguments and keyword arguments) – passed through to pickle.load

  • **kwargs (arguments and keyword arguments) – passed through to pickle.load

Note

If file is a:

  • a file-object, it is left open

  • a filename, then a file-object is opened and closed.

  • a file-object and reading fails, then the position is reset back to 0 using seek if possible.

Examples

>>> n = rf.Network(f=[1,2,3],s=[1,1,1],z0=50)
>>> n.write('my_ntwk.ntwk')
>>> n_2 = rf.read('my_ntwk.ntwk')

See also

read

read a skrf object

write

write skrf object[s]

read_all

read all skrf objects in a directory

write_all

write dictionary of skrf objects to a directory