Skip to content

Commit 41f538a

Browse files
committed
Revert "Update outline files"
This reverts commit 794295f.
1 parent 1682d18 commit 41f538a

2 files changed

Lines changed: 70 additions & 48 deletions

File tree

docs/outline.html

Lines changed: 65 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -47,51 +47,92 @@
4747

4848
</pre>
4949
</details>
50-
<details><summary><span class ='def signature'> def plot_pattern_gains(model, azimuth_deg = None, elevation_deg = None, components = ['vert_gain_dBi', 'horiz_gain_dBi'], gain_scale_range_dB = 30):</span></summary>
51-
<pre class ='def content'> import matplotlib.pyplot as plt
50+
<details><summary><span class ='def signature'>🧾 def plot_total_gain(model):</span></summary>
51+
<pre class ='def content'></pre>
52+
<details><summary><span class ='docstring signature'> docstring</span></summary>
53+
<pre class ='docstring content'> This is a very basic plot routine providing polar and rectangular plots
54+
with gain range covering 40 dB max to min.
55+
Later versions of necbol will include more customisable plot functions
56+
and the ability to save output data in a suitable format for onward analysis
57+
</pre>
58+
</details>
59+
<details><summary><span class ='body signature'> body</span></summary>
60+
<pre class ='body content'> import matplotlib.pyplot as plt
5261
import numpy as np
5362

54-
if(elevation_deg is not None and azimuth_deg is not None):
55-
Print(&quot;Can&#x27;t plot a 3D pattern, please select azimuth or elevation only&quot;)
56-
return
63+
pattern_data = _read_radiation_pattern(model.nec_out, elevation_deg = model.el_datum_deg)
64+
elevation_deg = model.el_datum_deg
65+
component = &#x27;total_gain_dBi&#x27;
66+
67+
# Filter data for fixed elevation
68+
print(f&quot;Plotting gain for elevation = {elevation_deg}&quot;)
69+
az_cut = [d for d in pattern_data if abs(d[&#x27;elevation_deg&#x27;] - model.el_datum_deg) &lt; 0.1]
70+
71+
# Extract azimuth (phi) and gain
72+
az_deg = [d[&#x27;azimuth_deg&#x27;] for d in az_cut]
73+
gain_db = [d[component] for d in az_cut]
74+
max_gain = np.max(gain_db)
75+
76+
title = f&#x27;{component} at elevation = {elevation_deg}° for {model.model_name}&#x27;
77+
78+
az_rad = np.radians(az_deg)
79+
fig, ax = plt.subplots(subplot_kw={&#x27;projection&#x27;: &#x27;polar&#x27;})
80+
ax.plot(az_rad, gain_db, label=title)
81+
ax.set_title(title)
82+
ax.grid(True)
83+
ax.set_rmax(max_gain)
84+
ax.set_rmin(max_gain-40)
85+
ax.set_rlabel_position(90)
86+
87+
plt.show()
5788

58-
if (elevation_deg is None and azimuth_deg is None):
59-
elevation_deg = model.el_datum_deg
6089

61-
title = model.model_name
6290

91+
#==================================================================
92+
# Internal functions
93+
#==================================================================
94+
95+
import numpy as np
96+
import copy
97+
98+
</pre>
99+
</details>
100+
</details>
101+
<details><summary><span class ='def signature'> def _plot_pattern_gains(pattern_data, azimuth_deg = None, elevation_deg = None, components = ['gain_total_dBi']):</span></summary>
102+
<pre class ='def content'> import matplotlib.pyplot as plt
103+
import numpy as np
104+
63105
# Filter data for fixed elevation (theta)
64106
if(elevation_deg is not None):
65107
print(f&quot;Plotting gain for elevation = {elevation_deg}&quot;)
66-
pattern_data = _read_radiation_pattern(model.nec_out, azimuth_deg = azimuth_deg, elevation_deg = None)
67-
68108
cut = [d for d in pattern_data if abs(d[&#x27;elevation_deg&#x27;] - elevation_deg) &lt; 0.1]
69109
angle_deg = [d[&#x27;azimuth_deg&#x27;] for d in cut]
70-
title += f&#x27; elevation = {elevation_deg}°&#x27;
110+
title = f&#x27;elevation = {elevation_deg}°&#x27;
71111

72112
# Filter data for fixed azimuth (phi)
73113
if(azimuth_deg is not None):
74114
print(f&quot;Plotting gain for azimuth = {azimuth_deg}&quot;)
75-
pattern_data = _read_radiation_pattern(model.nec_out, azimuth_deg = None, elevation_deg = elevation_deg)
76115
cut = [d for d in pattern_data if abs(d[&#x27;azimuth_deg&#x27;] - azimuth_deg) &lt; 0.1]
77116
angle_deg = [d[&#x27;elevation_deg&#x27;] for d in cut]
78-
title += f&#x27; azimuth = {azimuth_deg}°&#x27;
117+
title = f&#x27;azimuth = {azimuth_deg}°&#x27;
79118

80119
fig, ax = plt.subplots(subplot_kw={&#x27;projection&#x27;: &#x27;polar&#x27;})
81-
82-
scl_max = -100
83-
for comp in components:
84-
gain = [d[comp] for d in cut]
85-
scl_max = max(scl_max,max(gain))
86-
angle_rad = np.radians(angle_deg)
87-
ax.plot(angle_rad, gain, label = comp)
88-
print(comp, f&quot; max gain: {max(gain)}&quot;)
89-
ax.legend()
120+
angle_rad = np.radians(angle_deg)
121+
v_gain_db = [d[&#x27;vert_gain_dBi&#x27;] for d in cut]
122+
h_gain_db = [d[&#x27;horiz_gain_dBi&#x27;] for d in cut]
123+
ax.plot(angle_rad, v_gain_db, label=title)
124+
ax.plot(angle_rad, h_gain_db, label=title)
90125
ax.set_title(title)
91126
ax.grid(True)
127+
128+
vmax = max(v_gain_db)
129+
hmax = max(h_gain_db)
92130

93-
ax.set_rmax(scl_max)
94-
ax.set_rmin(scl_max - gain_scale_range_dB )
131+
print(vmax,hmax)
132+
pmax = max(vmax,hmax)
133+
134+
ax.set_rmax(pmax)
135+
ax.set_rmin(pmax-40)
95136
ax.set_rlabel_position(90)
96137

97138
# Enable interactive mode for non-blocking plotting
@@ -102,16 +143,6 @@
102143

103144

104145

105-
106-
#==================================================================
107-
# Internal functions
108-
#==================================================================
109-
110-
import numpy as np
111-
import copy
112-
113-
114-
115146
</pre>
116147
</details>
117148
<details><summary><span class ='def signature'> def _get_complex_component(pat_data, component):</span></summary>

docs/user_functions.html

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,11 @@
66
Or another value if specified
77
</pre>
88
<hr><div><span class ='def signature'>&nbsp&nbsp&nbspget_gains_at_gain_point(model):</span></div>
9-
<hr><div><span class ='def signature'>&nbsp&nbsp&nbspplot_pattern_gains(model, azimuth_deg = None, elevation_deg = None, components = ['vert_gain_dBi', 'horiz_gain_dBi'], gain_scale_range_dB = 30):</span></div>
10-
<pre class ='docstring content'> Read the radiation pattern into a Python dictionary:
11-
&#x27;az_deg&#x27;: float,
12-
&#x27;el_deg&#x27;: float,
13-
&#x27;vert_gain_dBi&#x27;: float,
14-
&#x27;horiz_gain_dBi&#x27;: float,
15-
&#x27;total_gain_dBi&#x27;: float,
16-
&#x27;axial_ratio_dB&#x27;: float,
17-
&#x27;tilt_deg&#x27;: float,
18-
&#x27;sense&#x27;: string,
19-
&#x27;E_theta_mag&#x27;: float,
20-
&#x27;E_theta_phase_deg&#x27;: float,
21-
&#x27;E_phi_mag&#x27;: float,
22-
&#x27;E_phi_phase_deg&#x27;: float
9+
<hr><div><span class ='def signature'>&nbsp&nbsp&nbspplot_total_gain(model):</span></div>
10+
<pre class ='docstring content'> This is a very basic plot routine providing polar and rectangular plots
11+
with gain range covering 40 dB max to min.
12+
Later versions of necbol will include more customisable plot functions
13+
and the ability to save output data in a suitable format for onward analysis
2314
</pre>
2415
<br><div class = 'filename'>modeller.py</div><br><hr><div><span class ='class signature'>class NECModel:</span></div>
2516
<hr><div><span class ='def signature'>&nbsp&nbsp&nbspset_name(name):</span></div>

0 commit comments

Comments
 (0)