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 Distribution

necpp-1.8.2.tar.gz (195.6 kB view details)

Uploaded Source

Built Distributions

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

necpp-1.8.2-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (5.1 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

necpp-1.8.2-cp313-cp313-macosx_11_0_arm64.whl (244.1 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

necpp-1.8.2-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (5.1 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

necpp-1.8.2-cp312-cp312-macosx_11_0_arm64.whl (244.4 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

necpp-1.8.2-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (5.1 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

necpp-1.8.2-cp311-cp311-macosx_11_0_arm64.whl (244.4 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

necpp-1.8.2-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (5.1 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

necpp-1.8.2-cp310-cp310-macosx_11_0_arm64.whl (244.4 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

Details for the file necpp-1.8.2.tar.gz.

File metadata

  • Download URL: necpp-1.8.2.tar.gz
  • Upload date:
  • Size: 195.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for necpp-1.8.2.tar.gz
Algorithm Hash digest
SHA256 ed514f26e9dead9ff49bf17c979a9dae1594c506cee01bc9343f69839bdb1436
MD5 fdf8c8d6634d7d31024d4e8dd5cfb31d
BLAKE2b-256 9e8a23b4aaa5954c66a5cd3a11df0046482513ed4dbd194ac77a9362ff7b7395

See more details on using hashes here.

Provenance

The following attestation bundles were made for necpp-1.8.2.tar.gz:

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.8.2-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for necpp-1.8.2-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 3e9e32681a22f53ecd926c5396a8e39f0a52e9229b450cfcd77e25c18c83752e
MD5 9b178f98175825455e50eb1aa3156138
BLAKE2b-256 67d2bd4ae439cb7de4d4000351f0c00a59fe392a3f305daaa7b82e96bd602f36

See more details on using hashes here.

Provenance

The following attestation bundles were made for necpp-1.8.2-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_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.8.2-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for necpp-1.8.2-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 59bd295ac9a1ac33f5b027d38f4fddfadbbe4356819915d4d529a092d7926de7
MD5 59e920246b9d31876b6233c315f149a0
BLAKE2b-256 95cf5c695897dd531fe8eab683d836e8ef1b8ee34cdfd25f075176f7f6e15b18

See more details on using hashes here.

Provenance

The following attestation bundles were made for necpp-1.8.2-cp313-cp313-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.

File details

Details for the file necpp-1.8.2-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for necpp-1.8.2-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 4444f5caa37f73c4b6c358d2c169c29638e3312542288408fa322d0adcbed3a0
MD5 a07f207aa73934378e4a20be5fb36ed8
BLAKE2b-256 72273134a769d73efe3d86981709d9fe9d27f9d7e21b57b2702dff7f2aadd6ce

See more details on using hashes here.

Provenance

The following attestation bundles were made for necpp-1.8.2-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_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.8.2-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for necpp-1.8.2-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fa50939c21854b929fc1a36eacc9ac705cfc6a2aa2085fa9a3fed37f985e142c
MD5 6e4095d86bdecd4ee8102c8884cc0aa8
BLAKE2b-256 8aa3eab54cbd9cde408a93edda998812019cf1402651c92ad74d34a2446e8944

See more details on using hashes here.

Provenance

The following attestation bundles were made for necpp-1.8.2-cp312-cp312-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.

File details

Details for the file necpp-1.8.2-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for necpp-1.8.2-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7046742919f9ec8059dd8b479fd913625b656e78e81e0d4803e81a274392f8a2
MD5 08af7607a60b0a9a1f5543f1142b3b8e
BLAKE2b-256 ed4b2a73f5b8539a2956cc19bb21204f6667569463514888621dd390a3414607

See more details on using hashes here.

Provenance

The following attestation bundles were made for necpp-1.8.2-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_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.8.2-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for necpp-1.8.2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2a427f568b479082ee4c3d368384c63cea963be781033984fe98591ee3ace8a8
MD5 86cf5131a0a4126207852b6f4ed5f33e
BLAKE2b-256 5964047dae995539f41243bcb8f65fbc7cac114fc8758bfe956c8e1eef6eff7c

See more details on using hashes here.

Provenance

The following attestation bundles were made for necpp-1.8.2-cp311-cp311-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.

File details

Details for the file necpp-1.8.2-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for necpp-1.8.2-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ce5f8849d00c296d2a09d94ce51ee2725fc701c68c9e8f39e803e1c2992ed0c8
MD5 f4d5820a4c595ff1bb5ca2134455fc62
BLAKE2b-256 9d23a8bd49117dd25d4a5c977923c23c0ebfb972a5a9cee1a97d1bd8b2d7ee95

See more details on using hashes here.

Provenance

The following attestation bundles were made for necpp-1.8.2-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_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.8.2-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for necpp-1.8.2-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 14a60f675a8b136075f851b16d1fe8f2aac4eb9f4b8f752f45446cc4731a6824
MD5 13f79c887d1f9511dc72be4b2b32d1cd
BLAKE2b-256 300cf4161c8d15818aa114b12e386d4d1417bc1ba4a5bdb3ff28f06e3868ec0c

See more details on using hashes here.

Provenance

The following attestation bundles were made for necpp-1.8.2-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