Debian Codegraph @

doc/source/examples/metrology/One Port Tiered Calibration.ipynb

raw
1 {
2 "cells": [
3 {
4 "cell_type": "markdown",
5 "metadata": {},
6 "source": [
7 "# One Port Tiered Calibration"
8 ]
9 },
10 {
11 "cell_type": "markdown",
12 "metadata": {},
13 "source": [
14 "## Intro"
15 ]
16 },
17 {
18 "cell_type": "markdown",
19 "metadata": {},
20 "source": [
21 "A one-port network analyzer can be used to measure a two-port device, provided that the device is reciprocal. This is accomplished by performing two calibrations, which is why its called a *tiered* calibration. \n",
22 "\n",
23 "First, the VNA is calibrated at the test-port like normal. This is called the *first tier*. Next, the device is connected to the test-port, and a calibration is performed at the far end of the device, the *second tier*. A diagram is shown below,\n",
24 "\n",
25 "![box diagram](oneport_tiered_calibration/images/boxDiagram.svg)"
26 ]
27 },
28 {
29 "cell_type": "markdown",
30 "metadata": {},
31 "source": [
32 "This notebook will demonstrate how to use [skrf](http://scikit-rf.org) to do a two-tiered one-port calibration. We'll use data that was taken to characterize a waveguide-to-CPW probe. So, for this specific example the diagram above looks like:\n",
33 "\n",
34 "![probe diagram](oneport_tiered_calibration/images/probe.svg)"
35 ]
36 },
37 {
38 "cell_type": "markdown",
39 "metadata": {},
40 "source": [
41 "## Some Data "
42 ]
43 },
44 {
45 "cell_type": "markdown",
46 "metadata": {},
47 "source": [
48 "The data available is the folders `'tier1/'` and `'tier2/'`. "
49 ]
50 },
51 {
52 "cell_type": "code",
53 "execution_count": null,
54 "metadata": {},
55 "outputs": [],
56 "source": [
57 "!ls {\"oneport_tiered_calibration/\"}"
58 ]
59 },
60 {
61 "cell_type": "markdown",
62 "metadata": {},
63 "source": [
64 "(if you dont have the git repo for these examples, the data for this notebook can be found [here](https://github.com/scikit-rf/scikit-rf/tree/master/doc/source/examples/metrology/oneport_tiered_calibration))\n",
65 "\n",
66 "In each folder you will find the two sub-folders, called `'ideals/' ` and `'measured/'`. These contain touchstone files of the calibration standards ideal and measured responses, respectively. "
67 ]
68 },
69 {
70 "cell_type": "code",
71 "execution_count": null,
72 "metadata": {},
73 "outputs": [],
74 "source": [
75 "!ls {\"oneport_tiered_calibration/tier1/\"}"
76 ]
77 },
78 {
79 "cell_type": "markdown",
80 "metadata": {},
81 "source": [
82 "The first tier is at waveguide interface, and consisted of the following set of standards\n",
83 "\n",
84 "* short \n",
85 "* delay short\n",
86 "* load\n",
87 "* radiating open (literally an open waveguide)"
88 ]
89 },
90 {
91 "cell_type": "code",
92 "execution_count": null,
93 "metadata": {},
94 "outputs": [],
95 "source": [
96 "!ls {\"oneport_tiered_calibration/tier1/measured/\"}"
97 ]
98 },
99 {
100 "cell_type": "markdown",
101 "metadata": {},
102 "source": [
103 "## Creating Calibrations"
104 ]
105 },
106 {
107 "cell_type": "markdown",
108 "metadata": {},
109 "source": [
110 "### Tier 1"
111 ]
112 },
113 {
114 "cell_type": "markdown",
115 "metadata": {},
116 "source": [
117 "First defining the calibration for *Tier 1*"
118 ]
119 },
120 {
121 "cell_type": "code",
122 "execution_count": null,
123 "metadata": {},
124 "outputs": [],
125 "source": [
126 "import matplotlib.pyplot as plt\n",
127 "\n",
128 "import skrf as rf\n",
129 "from skrf.calibration import OnePort\n",
130 "\n",
131 "%matplotlib inline\n",
132 "\n",
133 "rf.stylely()\n",
134 "\n",
135 "\n",
136 "tier1_ideals = rf.read_all_networks('oneport_tiered_calibration/tier1/ideals/')\n",
137 "tier1_measured = rf.read_all_networks('oneport_tiered_calibration/tier1/measured/')\n",
138 "\n",
139 "\n",
140 "tier1 = OnePort(measured = tier1_measured,\n",
141 " ideals = tier1_ideals,\n",
142 " name = 'tier1',\n",
143 " sloppy_input=True)\n",
144 "tier1"
145 ]
146 },
147 {
148 "cell_type": "markdown",
149 "metadata": {},
150 "source": [
151 "Because we saved corresponding *ideal* and *measured* standards with identical names, the Calibration will automatically align our standards upon initialization. (More info on creating Calibration objects this can be found in [the docs](../../tutorials/Calibration.ipynb).)\n",
152 "\n",
153 "Similarly for the second tier 2,"
154 ]
155 },
156 {
157 "cell_type": "markdown",
158 "metadata": {},
159 "source": [
160 "### Tier 2"
161 ]
162 },
163 {
164 "cell_type": "code",
165 "execution_count": null,
166 "metadata": {},
167 "outputs": [],
168 "source": [
169 "tier2_ideals = rf.read_all_networks('oneport_tiered_calibration/tier2/ideals/')\n",
170 "tier2_measured = rf.read_all_networks('oneport_tiered_calibration/tier2/measured/')\n",
171 "\n",
172 "\n",
173 "tier2 = OnePort(measured = tier2_measured,\n",
174 " ideals = tier2_ideals,\n",
175 " name = 'tier2',\n",
176 " sloppy_input=True)\n",
177 "tier2"
178 ]
179 },
180 {
181 "cell_type": "markdown",
182 "metadata": {},
183 "source": [
184 "## Error Networks"
185 ]
186 },
187 {
188 "cell_type": "markdown",
189 "metadata": {},
190 "source": [
191 "Each one-port Calibration contains a two-port error network, that is determined from the calculated error coefficients. The error network for *tier1* models the VNA, while the error network for *tier2* represents the VNA **and** the DUT. These can be visualized through the parameter `'error_ntwk'`.\n",
192 "\n",
193 "\n",
194 "For tier 1, "
195 ]
196 },
197 {
198 "cell_type": "code",
199 "execution_count": null,
200 "metadata": {},
201 "outputs": [],
202 "source": [
203 "tier1.error_ntwk.plot_s_db()\n",
204 "plt.title('Tier 1 Error Network')"
205 ]
206 },
207 {
208 "cell_type": "markdown",
209 "metadata": {},
210 "source": [
211 "Similarly for tier 2, "
212 ]
213 },
214 {
215 "cell_type": "code",
216 "execution_count": null,
217 "metadata": {},
218 "outputs": [],
219 "source": [
220 "tier2.error_ntwk.plot_s_db()\n",
221 "plt.title('Tier 2 Error Network')"
222 ]
223 },
224 {
225 "cell_type": "markdown",
226 "metadata": {},
227 "source": [
228 "## De-embedding the DUT"
229 ]
230 },
231 {
232 "cell_type": "markdown",
233 "metadata": {},
234 "source": [
235 "As previously stated, the error network for *tier1* models the VNA, and the error network for *tier2* represents the VNA+DUT. So to determine the DUT's response, we cascade the inverse S-parameters of the VNA with the VNA+DUT. \n",
236 "\n",
237 "$$ DUT = VNA^{-1}\\cdot (VNA \\cdot DUT)$$\n",
238 "\n",
239 "In skrf, this is done as follows"
240 ]
241 },
242 {
243 "cell_type": "code",
244 "execution_count": null,
245 "metadata": {},
246 "outputs": [],
247 "source": [
248 "dut = tier1.error_ntwk.inv ** tier2.error_ntwk\n",
249 "dut.name = 'probe'\n",
250 "dut.plot_s_db()\n",
251 "plt.title('Probe S-parameters')\n",
252 "plt.ylim(-60,10)"
253 ]
254 },
255 {
256 "cell_type": "markdown",
257 "metadata": {},
258 "source": [
259 "You may want to save this to disk, for future use, \n",
260 "\n",
261 " dut.write_touchstone()"
262 ]
263 },
264 {
265 "cell_type": "code",
266 "execution_count": null,
267 "metadata": {},
268 "outputs": [],
269 "source": [
270 "!ls {\"probe*\"}"
271 ]
272 },
273 {
274 "cell_type": "code",
275 "execution_count": null,
276 "metadata": {},
277 "outputs": [],
278 "source": []
279 }
280 ],
281 "metadata": {
282 "anaconda-cloud": {},
283 "kernelspec": {
284 "display_name": "Python 3",
285 "language": "python",
286 "name": "python3"
287 },
288 "language_info": {
289 "codemirror_mode": {
290 "name": "ipython",
291 "version": 3
292 },
293 "file_extension": ".py",
294 "mimetype": "text/x-python",
295 "name": "python",
296 "nbconvert_exporter": "python",
297 "pygments_lexer": "ipython3",
298 "version": "3.7.5"
299 }
300 },
301 "nbformat": 4,
302 "nbformat_minor": 1
303 }