Skip to main content

Python Antenna Simulation Module (nec2++) C-style interface

Project description

python-necpp: Antenna simulation in python

This module allows you to do antenna simulations in Python using the nec2++ antenna simulation package.

This is a wrapper using SWIG of the C interface, so the syntax is quite simple. Have a look at the file necpp_src/example/test.py, for an example of how this library can be used.

Tim Molteno. tim@physics.otago.ac.nz

NEWS

  • Version 1.7.3 Includes Python3 support. Also some bug fixes and updating nec++ to the latest version.
  • Version 1.7.0.3 includes nec_medium_parameters(). You could simulate an antenna in seawater!
  • Version 1.7.0 includes support for getting elements of radiation patterns. At the moment this is just through the function nec_get_gain().

Install

As of version 1.6.1.2 swig is no longer required for installation. Simply use PIP as follows:

pip install necpp

To build from source with uv:

uv build
uv pip install .

Documentation

Try help(necpp) to list the available functions. The functions available are documented in the C-style API of nec2++. This is available here

Using

The following code calculates the impedance of a simple vertical monopole antenna over a perfect ground.

import necpp

def handle_nec(result):
  if (result != 0):
    print necpp.nec_error_message()

def impedance(frequency, z0, height):
  
  nec = necpp.nec_create()
  handle_nec(necpp.nec_wire(nec, 1, 17, 0, 0, z0, 0, 0, z0+height, 0.1, 1, 1))
  handle_nec(necpp.nec_geometry_complete(nec, 1, 0))
  handle_nec(necpp.nec_gn_card(nec, 1, 0, 0, 0, 0, 0, 0, 0))
  handle_nec(necpp.nec_fr_card(nec, 0, 1, frequency, 0))
  handle_nec(necpp.nec_ex_card(nec, 0, 0, 1, 0, 1.0, 0, 0, 0, 0, 0)) 
  handle_nec(necpp.nec_rp_card(nec, 0, 90, 1, 0,5,0,0, 0, 90, 1, 0, 0, 0))
  result_index = 0
  
  z = complex(necpp.nec_impedance_real(nec,result_index), 
              necpp.nec_impedance_imag(nec,result_index))
  
  necpp.nec_delete(nec)
  return z

if (__name__ == 'main'):
  z = impedance(frequency = 34.5, z0 = 0.5, height = 4.0)
  print "Impedance \t(%6.1f,%+6.1fI) Ohms" % (z.real, z.imag)

More Information

Have a look at [http://github.com/tmolteno/necpp] for more information on using nec2++.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

necpp-1.7.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.9 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

necpp-1.7.4-cp310-cp310-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl (1.7 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.12+ i686manylinux: glibc 2.17+ i686

necpp-1.7.4-cp310-cp310-macosx_11_0_arm64.whl (205.6 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

Details for the file necpp-1.7.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for necpp-1.7.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d359a8183d368e076b7df6bcb62178af61ff58fd425040d89c5106723214312d
MD5 1100f18d1fadaacbcb2cd63b0322743b
BLAKE2b-256 4e924236d16204c473a179cfb4ba51155545e0b0664b07394ba0f2955e4fd825

See more details on using hashes here.

Provenance

The following attestation bundles were made for necpp-1.7.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: build-necpp-wheels.yml on tmolteno/python-necpp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file necpp-1.7.4-cp310-cp310-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for necpp-1.7.4-cp310-cp310-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 ab0740e30c5977e7eb9aef891607136ad1b92a343497364c1ac7ceb6436ca6e9
MD5 5a39ac5d575367cb1f4ae920dc2defcb
BLAKE2b-256 f5e5e6c0abaf58104b338c72adc67db29da368255ec7998750f402e19b4add30

See more details on using hashes here.

Provenance

The following attestation bundles were made for necpp-1.7.4-cp310-cp310-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl:

Publisher: build-necpp-wheels.yml on tmolteno/python-necpp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file necpp-1.7.4-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for necpp-1.7.4-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 78a5362065a9de96df199e3613d86541603c18caa2e4e188907e711aa60c5ced
MD5 4077f44a781dac3e3592a12fbe073462
BLAKE2b-256 be313345f7f4190d87a408503dac18eff943035448b142379382f4a3878beafc

See more details on using hashes here.

Provenance

The following attestation bundles were made for necpp-1.7.4-cp310-cp310-macosx_11_0_arm64.whl:

Publisher: build-necpp-wheels.yml on tmolteno/python-necpp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page