small refinement to physical line example
"metadata": {},
"outputs": [],
"source": [
+ "Z0 = 51.5 # Guessed for time being\n",
+ "\n",
+ "half = m.line(L/2, 'm', embed=True, z0=Z0)\n",
+ "\n",
"coefs = cal.coefs\n",
"r = np.sqrt(coefs['forward reflection tracking'])\n",
"s1 = np.array([[coefs['forward directivity'],r],\n",
"conn = TL100.copy()\n",
"conn.name = 'Connector'\n",
"conn.s = s1\n",
+ "conn = conn ** half.inv\n",
"\n",
"# delay estimation\n",
- "phi_conn = np.unwrap(np.angle(conn.s[:,1,0]))\n",
- "z = np.polyfit(f, phi_conn, 1)\n",
+ "phi_conn = np.unwrap(np.angle(conn.s[:500,1,0]))\n",
+ "z = np.polyfit(f[:500], phi_conn, 1)\n",
"p = np.poly1d(z)\n",
"delay = -z[0]/(2*np.pi)/2\n",
"print('Connector delay: {:.0f} ps'.format(delay * 1e12))\n",
"\n",
"# connector model\n",
- "mf = rf.media.PhysicalLine(m.frequency, z0=50, ep_r=1, mu_r=1, tand=0.1,\n",
+ "mf = rf.media.PhysicalLine(m.frequency, z0=50, ep_r=1, mu_r=1, tand=0.02, A=0, f_A=1e9,\n",
" f_low=1e3, f_high=1e12, f_epr_tand=1e9, diel='djordjevicsvensson')\n",
- "left = mf.line(0.02, 'ns', embed=True, z0=58)\n",
+ "left = mf.line(delay * 1e9, 'ns', embed=True, z0=58)\n",
"right = left.flipped()\n",
"check = left ** right\n",
"\n",
"plt.figure()\n",
"plt.suptitle('Connector effects')\n",
"plt.subplot(2,1,1)\n",
- "plt.plot(f_ghz, phi_conn, label='measured')\n",
- "plt.plot(f * 1e-9, np.unwrap(np.angle(check.s[:,1,0])), label='model')\n",
+ "plt.plot(f_ghz[:500], phi_conn, label='measured')\n",
+ "plt.plot(f_ghz, np.unwrap(np.angle(check.s[:,1,0])), label='model')\n",
"plt.ylabel('phase (rad)')\n",
"plt.legend()\n",
"\n",
"plt.subplot(2,1,2)\n",
"conn.plot_s_db(1, 0, label='Measured')\n",
- "plt.plot(f * 1e-9, 20*np.log10(np.absolute(check.s[:,1,0])), label='model')\n",
+ "plt.plot(f_ghz, 20*np.log10(np.absolute(check.s[:,1,0])), label='model')\n",
"plt.xlabel('Frequency (GHz)')\n",
"plt.ylabel('Insertion Loss (dB)')\n",
"plt.legend()\n",
