MCPcopy Create free account
hub / github.com/NanoComp/meep / plot_radiation_pattern_polar

Function plot_radiation_pattern_polar

python/examples/disc_radiation_pattern.py:34–61  ·  view source on GitHub ↗

Plots the radiation pattern in polar coordinates. The angles increase clockwise with zero at the top (+z direction). Args: radial_flux: radial flux of the far fields in polar coordinates.

(radial_flux: np.ndarray)

Source from the content-addressed store, hash-verified

32
33
34def plot_radiation_pattern_polar(radial_flux: np.ndarray):
35 """Plots the radiation pattern in polar coordinates.
36
37 The angles increase clockwise with zero at the top (+z direction).
38
39 Args:
40 radial_flux: radial flux of the far fields in polar coordinates.
41 """
42 fig, ax = plt.subplots(subplot_kw={"projection": "polar"}, figsize=(6, 6))
43 ax.plot(
44 polar_rad,
45 radial_flux,
46 "b-",
47 )
48 ax.set_theta_direction(-1)
49 ax.set_theta_offset(0.5 * math.pi)
50 ax.set_thetalim(0, 0.5 * math.pi)
51 ax.grid(True)
52 ax.set_rlabel_position(22)
53 ax.set_ylabel("radial flux (a.u.)")
54 ax.set_title("radiation pattern in polar coordinates")
55
56 if mp.am_master():
57 fig.savefig(
58 "disc_radiation_pattern_polar.png",
59 dpi=150,
60 bbox_inches="tight",
61 )
62
63
64def plot_radiation_pattern_3d(radial_flux: np.ndarray):

Callers 1

disc_radiated_fluxFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected