Created
January 20, 2013 13:07
-
-
Save juhasch/4578525 to your computer and use it in GitHub Desktop.
Save scikit-rf objects using hdf5pickle
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"metadata": { | |
"name": "scikit-rf-hdf" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"import skrf as rf\n", | |
"import hdf5pickle, tables, datetime\n", | |
"import numpy as np" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"stream": "stdout", | |
"text": [ | |
"warning: data module didnt load. dont worry about it.\n" | |
] | |
} | |
], | |
"prompt_number": 1 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"a = rf.N(f=[1,2],s=[1+2j, 3+4j],z0=1)\n", | |
"b = rf.Network('hl_simulation_mit_trafo.s2p')" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [], | |
"prompt_number": 2 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"f = tables.openFile('test.hdf', 'w')\n", | |
"hdf5pickle.dump(a, f, '/network1')\n", | |
"hdf5pickle.dump(b, f, '/network2')\n", | |
"f.close()" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [], | |
"prompt_number": 3 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"f = tables.openFile('test.hdf', 'r')\n", | |
"new_a = hdf5pickle.load(f, '/network1')\n", | |
"new_b = hdf5pickle.load(f, '/network2')\n", | |
"f.close()" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [], | |
"prompt_number": 4 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"a, new_a" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"output_type": "pyout", | |
"prompt_number": 5, | |
"text": [ | |
"(1-Port Network: '', 1-2 GHz, 2 pts, z0=[ 1.+0.j],\n", | |
" 1-Port Network: '', 1-2 GHz, 2 pts, z0=[ 1.+0.j])" | |
] | |
} | |
], | |
"prompt_number": 5 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"b,new_b" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"output_type": "pyout", | |
"prompt_number": 6, | |
"text": [ | |
"(2-Port Network: 'hl_simulation_mit_trafo', 70-100 GHz, 1001 pts, z0=[ 50.+0.j 50.+0.j],\n", | |
" 2-Port Network: 'hl_simulation_mit_trafo', 70-100 GHz, 1001 pts, z0=[ 50.+0.j 50.+0.j])" | |
] | |
} | |
], | |
"prompt_number": 6 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [], | |
"prompt_number": 6 | |
} | |
], | |
"metadata": {} | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment