NEC Utilities

Utilities related to representing an indiviudal antenna radiation pattern from a NEC4 output file.

class nec.AntennaPattern(name=None)

Object to store the antenna gain pattern for a single frequency from a NEC4 output file. If no file is given, then an isotropic gain pattern will be generated.

Note

The NEC4 file must contain an EXCITATION section and be at 1 degree resolution.

plot_pattern(dB=False)

Function to plot the normalized antenna gain pattern.

nec.fit_antenna_response(freqs, p1, t1, p2, t2, lmax=None)

Fit the gain response of an antenna as a polynomial in frequency.

Parameters:
  • freqs: List or array of frequencies in MHz

  • p1: List or array containing the names of NEC4 outputs for polarization 1 parallel response

  • t1: List or array containing the names of NEC4 outputs for polarization 1 transverse response

  • p2: List or array containing the names of NEC4 outputs for polarization 2 parallel response

  • t2: List or array containing the names of NEC4 outputs for polarization 2 transverse response

  • lmax: Maximum degree of spherical harmonics to use for decomposition (None = No spherical harmonic decomposition)

Returns:
  • A .npz file containing the coefficients of the polynomial in frequency