114 """Plot radial profile
117 Er (array of Er): Field to plot.
118 r (array, optional): Radial positions. If None, it is take from data mesh.
119 m (int): Angular mode param.
120 R (float): Fiber radius.
126 fig, (ax1, ax2) = plt.subplots(2, 1, sharex=
True)
128 ax.axvline(-R, color=
'k', ls=
'--', lw=0.5)
129 ax.axvline(+R, color=
'k', ls=
'--', lw=0.5)
130 ax1.plot((np.nan,), (np.nan,), color=
'k', ls=
'-', label=
"$E_r$")
131 ax1.plot((np.nan,), (np.nan,), color=
'k', ls=
'-', alpha=0.35, label=
r"$E_\varphi$")
132 ax1.plot((np.nan,), (np.nan,), color=
'k', ls=
'--', label=
"$E_z$")
133 ax2.set_xlabel(
"$r$ (µm)")
134 leg1 = ax1.legend(loc=
'best', prop={
'size': 6})
135 try: leg1.set_draggable(
True)
136 except AttributeError:
pass
137 fig.set_tight_layout({
'pad': 0.1})
140 ax1.plot(r, Er[:,1], color=f
'C{c}', ls=
'-')
141 ax1.plot(r, Er[:,0], color=f
'C{c}', ls=
'-', alpha=0.5)
142 ax1.plot(r, Er[:,2], color=f
'C{c}', ls=
'--')
143 ax2.plot(r, np.sum(np.real(Er * np.conj(Er)), 1), color=f
'C{c}', label=f
"{c}: {neff.real:.4f}" if neff
is not None else None)
144 leg2 = ax2.legend(loc=
'best', prop={
'size': 6})
145 try: leg2.set_draggable(
True)
146 except AttributeError:
pass
154 Er (array of Er): Field to plot.
155 r (array, optional): Radial positions. If None, it is take from data mesh.
156 m (int): Angular mode param.
157 R (float): Fiber radius.
161 Er = Er.array[:,0,:2]
163 p = np.linspace(0., 2*np.pi, 37)
164 rr, pp = np.meshgrid(r, p)
165 phi = np.linspace(0., 2*np.pi, 1001)
168 E = np.repeat(E, len(p), 0)
170 mer = np.max(np.abs(E.ravel().real))
171 mei = np.max(np.abs(E.ravel().imag))
172 if mer >= mei: E = E.real / mer
173 else: E = E.imag / mei
176 E[:,:,0] *= np.sin(m * pp)
177 E[:,:,1] *= np.cos(m * pp)
179 F = np.sum((E * E.conj()).real, 2)
181 fs = plt.rcParams[
'figure.figsize'][0]
182 fig, ax = plt.subplots(subplot_kw=dict(projection=
'polar'), figsize=(fs,fs))
183 ax.tick_params(
'y', colors=
'w')
184 ax.tick_params(axis=
'x', left=
'off', top=
'off', right=
'off', bottom=
'off', labelleft=
'off', labeltop=
'off', labelright=
'off', labelbottom=
'off')
185 ax.tick_params(axis=
'y', left=
'off', top=
'off', right=
'off', bottom=
'off', labelleft=
'off', labeltop=
'off', labelright=
'off', labelbottom=
'off')
186 ax.set_xticklabels([])
187 ax.set_yticklabels([])
190 plt.contourf(pp, rr, F, 64)
192 Ex = E[:,:,1] * np.cos(pp) - E[:,:,0] * np.sin(pp)
193 Ey = E[:,:,1] * np.sin(pp) + E[:,:,0] * np.cos(pp)
194 plt.quiver(pp, rr, Ex, Ey, pivot=
'mid', scale=30, color=
'w')
196 plt.plot(phi, (R,)*len(phi),
'w', lw=0.5)