Write skrf object[s] to a file
This uses the pickle module 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 Network objects or Calibration objects. This will write out a single file. If you would like to write out a seperate file for each object, use write_all().
Parameters : | file : file or string
obj : an object, or list/dict of objects
overwrite : Boolean
|
---|
See also
Notes
If file is a str, but doesnt contain a suffix, one is chosen automatically. Here are the extensions
skrf object | extension |
---|---|
Frequency | ‘.freq’ |
Network | ‘.ntwk’ |
NetworkSet | ‘.ns’ |
Calibration | ‘.cal’ |
Media | ‘.med’ |
other | ‘.p’ |
To make file written by this method cross-platform, the pickling protocol 2 is used. See pickle for more info.
Examples
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')