Skip to content

Commit 632efed

Browse files
committed
Merge branch 'main' of https://github.com/G1OJS/NECBOL
2 parents e741c66 + 6c481dc commit 632efed

2 files changed

Lines changed: 44 additions & 9 deletions

File tree

docs/outline.html

Lines changed: 43 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,11 @@
190190
'E_theta_mag', 'E_theta_phase_deg', 'E_phi_mag', 'E_phi_phase_deg'
191191
]
192192

193+
n_theta, n_phi, theta_step, phi_step = _extract_pattern_grid_info(pattern)
194+
print(n_theta, n_phi, theta_step, phi_step )
195+
193196
with open(file_path, "w") as f:
197+
f.write(f" ***** DATA CARD NO. 5 RP 0 {n_theta} {n_phi} 1003 0 0 {theta_step:.1f} {phi_step:.1f} 0.0 0.0\n\n")
194198
f.write(" - - - RADIATION PATTERNS - - -\n")
195199
f.write("\n")
196200
f.write(" - - ANGLES - - - POWER GAINS - - - - POLARIZATION - - - - - - E(THETA) - - - - - - E(PHI) - - -\n")
@@ -208,7 +212,7 @@
208212
line += f"{val:{fmt}}"
209213
f.write(line.rstrip() + "\n")
210214

211-
215+
f.write("\n RUN TIME = 0\n")
212216

213217

214218
</pre>
@@ -297,7 +301,7 @@
297301

298302
# Total field magnitude squared
299303
total_power = abs(E_theta)**2 + abs(E_phi)**2
300-
total_gain_dBi = 10 * math.log10(total_power) if total_power &gt; 0 else -math.inf
304+
total_gain_dBi = 10 * math.log10(total_power) if total_power &gt; 0 else -999
301305

302306
# RHCP and LHCP components
303307
E_rhcp = (E_theta - 1j * E_phi) / math.sqrt(2)
@@ -306,19 +310,19 @@
306310
rhcp_power = abs(E_rhcp)**2
307311
lhcp_power = abs(E_lhcp)**2
308312

309-
rhcp_gain_dBi = 10 * math.log10(rhcp_power) if rhcp_power &gt; 0 else -math.inf
310-
lhcp_gain_dBi = 10 * math.log10(lhcp_power) if lhcp_power &gt; 0 else -math.inf
313+
rhcp_gain_dBi = 10 * math.log10(rhcp_power) if rhcp_power &gt; 0 else -999
314+
lhcp_gain_dBi = 10 * math.log10(lhcp_power) if lhcp_power &gt; 0 else -999
311315

312316
# Axial ratio in dB
313317
max_pol_power = max(rhcp_power, lhcp_power)
314318
min_pol_power = min(rhcp_power, lhcp_power)
315319
if min_pol_power == 0:
316-
axial_ratio_dB = float(&#x27;inf&#x27;)
320+
axial_ratio_dB = 999
317321
else:
318322
axial_ratio_dB = 10 * math.log10(max_pol_power / min_pol_power)
319323

320324
# Polarization sense
321-
if axial_ratio_dB == float(&#x27;inf&#x27;):
325+
if axial_ratio_dB == 999:
322326
polarization_sense = &quot;Linear&quot;
323327
elif rhcp_power &gt; lhcp_power:
324328
polarization_sense = &quot;RHCP&quot;
@@ -344,8 +348,8 @@
344348
vert_power = abs(E_theta)**2
345349
horiz_power = abs(E_phi)**2
346350

347-
vert_gain_dBi = 10 * math.log10(vert_power) if vert_power &gt; 0 else -math.inf
348-
horiz_gain_dBi = 10 * math.log10(horiz_power) if horiz_power &gt; 0 else -math.inf
351+
vert_gain_dBi = 10 * math.log10(vert_power) if vert_power &gt; 0 else -999
352+
horiz_gain_dBi = 10 * math.log10(horiz_power) if horiz_power &gt; 0 else -999
349353

350354
return {
351355
&#x27;vert_gain_dBi&#x27;: vert_gain_dBi,
@@ -363,6 +367,36 @@
363367
}
364368

365369

370+
</pre>
371+
</details>
372+
<details><summary><span class ='def signature'> def _extract_pattern_grid_info(pattern):</span></summary>
373+
<pre class ='def content'> # Compute theta and phi for each entry
374+
for entry in pattern:
375+
entry[&#x27;theta_deg&#x27;] = 90.0 - entry[&#x27;elevation_deg&#x27;]
376+
entry[&#x27;phi_deg&#x27;] = entry[&#x27;azimuth_deg&#x27;]
377+
378+
# Extract sorted unique theta and phi values
379+
theta_vals = sorted(set(round(e[&#x27;theta_deg&#x27;], 5) for e in pattern))
380+
phi_vals = sorted(set(round(e[&#x27;phi_deg&#x27;], 5) for e in pattern))
381+
382+
# Determine steps (assuming uniform grid)
383+
if len(theta_vals) &gt; 1:
384+
theta_step = round(theta_vals[1] - theta_vals[0], 5)
385+
else:
386+
theta_step = 0.0
387+
388+
if len(phi_vals) &gt; 1:
389+
phi_step = round(phi_vals[1] - phi_vals[0], 5)
390+
else:
391+
phi_step = 0.0
392+
393+
n_theta = len(theta_vals)
394+
n_phi = len(phi_vals)
395+
396+
return n_theta, n_phi, theta_step, phi_step
397+
398+
399+
366400
</pre>
367401
</details>
368402
<details><summary><span class ='def signature'> def _get_available_results(model):</span></summary>
@@ -629,7 +663,7 @@
629663
LDTAG = LD[&#x27;iTag&#x27;]
630664
R_Ohms, L_uH , C_pF = LD[&#x27;RoLuCp&#x27;]
631665
# these strings are set programatically so shouldn&#x27;t need an error trap
632-
f.write(f&quot;LD {LDTYP} {LDTAG} 0 0 {R_Ohms} {L_uH * 1e-6} {C_pF * 1e-12}\n&quot;)
666+
f.write(f&quot;LD {LDTYP} {LDTAG} 0 0 {R_Ohms:8.4e} {L_uH * 1e-6:8.4e} {C_pF * 1e-12:8.4e}\n&quot;)
633667

634668
# Feed
635669
f.write(f&quot;EX 0 {self.EX_tag} 1 0 1 0\n&quot;)

docs/text_list.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ def _add_wire(self, iTag, nS, x1, y1, z1, x2, y2, z2, wr):
1111
def _compute_full_farfield_metrics(E_theta, E_phi):
1212
def _cos_sin(self,angle_deg):
1313
def _cosine_series(s, terms):
14+
def _extract_pattern_grid_info(pattern):
1415
def _fast_perpendicular(v, threshold=100):
1516
def _format_params(self, params):
1617
def _from_suffixed_dimensions(self, params: dict, whitelist=[]) -> dict:

0 commit comments

Comments
 (0)