- skrf.io.general.write(file, obj, overwrite=True)¶
Write skrf object[s] to a file.
This uses the
picklemodule to write skrf objects to a file. Note that you can write any pickl-able python object. For example, you can write a list or dictionary of
Calibrationobjects. This will write out a single file. If you would like to write out a separate file for each object, use
file (file or string) – File or filename to which the data is saved. If file is a file-object, then the filename is unchanged. If file is a string, an appropriate extension will be appended to the file name if it does not already have an extension.
obj (an object, or list/dict of objects) – object or list/dict of objects to write to disk
overwrite (Boolean) – if file exists, should it be overwritten?
If file is a string, but doesnt contain a suffix, one is chosen automatically. Here are the extensions:
To make the file written by this method cross-platform, the pickling protocol 2 is used. See
picklefor more info.
Convert a touchstone file to a pickled Network,
>>> n = rf.Network('my_ntwk.s2p') >>> rf.write('my_ntwk',n) >>> n_red = rf.read('my_ntwk.ntwk')
Writing a list of different objects
>>> n = rf.Network('my_ntwk.s2p') >>> ns = rf.NetworkSet([n,n,n]) >>> rf.write('out',[n,ns]) >>> n_red = rf.read('out.p')