Skip to main content

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++.

Download files

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

Source Distribution

necpp-2.2.1.tar.gz (194.0 kB view details)

Uploaded Source

Built Distributions

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

necpp-2.2.1-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (4.7 MB view details)

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

necpp-2.2.1-cp313-cp313-macosx_11_0_arm64.whl (244.2 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

necpp-2.2.1-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (4.7 MB view details)

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

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

Uploaded CPython 3.12macOS 11.0+ ARM64

necpp-2.2.1-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (4.7 MB view details)

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

necpp-2.2.1-cp311-cp311-macosx_11_0_arm64.whl (244.3 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

necpp-2.2.1-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (4.7 MB view details)

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

necpp-2.2.1-cp310-cp310-macosx_11_0_arm64.whl (244.3 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

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

File metadata

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

File hashes

Hashes for necpp-2.2.1.tar.gz
Algorithm Hash digest
SHA256 4299ab144d92bdf3412a0bf1698cec64256cce6796629385c273e27f5f06f39b
MD5 431c695d92a0eb5d7c1609e8b8cec993
BLAKE2b-256 0182498e69a071aa3356333c07f14bb7decb029a10e8c9723ee5b61c40645586

See more details on using hashes here.

Provenance

The following attestation bundles were made for necpp-2.2.1.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-2.2.1-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for necpp-2.2.1-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b8e335c77fc4248b058b84dcffbd68fa17b04811b7047af59315e15e2e83c6b2
MD5 c6ca0daf8a78d3081d0919bb6ada50ce
BLAKE2b-256 37c8dcef54c6fa219f2a547223e6eab23a9b45871ad1a767d201ca41abac9c32

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for necpp-2.2.1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4d059d8171220dd2e700f8af73d5af253ea8bac4c601ecfd64764a446d6092ab
MD5 c55ac2e69de90fadf06f61c57e47e5bd
BLAKE2b-256 0e74beb0bb2f471e36189fd76c3945aa8ea88463e5b39a59b29b7ce578f68ab8

See more details on using hashes here.

Provenance

The following attestation bundles were made for necpp-2.2.1-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-2.2.1-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for necpp-2.2.1-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 54ca3b4241959ac29a6b991c72e8b7d7a6ce0cf8d711adb34e27c72e47261b23
MD5 7c6b96ee79a52b77ef12eb282db6141b
BLAKE2b-256 77776d70add20d0aa8cdbfb9e6f8853a38250b004528e4c767d7c3e32790cfe4

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for necpp-2.2.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a23e358333a145828234ea6e662e0e3548d3cc8b48ba9f605a636523e9fcbeee
MD5 0ef4a55de406c891ca32fc8b294f52e5
BLAKE2b-256 0b658e63af446c5286d95e666bf31464f12c15261a1c3abc75258d71e7a653c0

See more details on using hashes here.

Provenance

The following attestation bundles were made for necpp-2.2.1-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-2.2.1-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for necpp-2.2.1-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2a216ca2a340d9e658eb4a0d6e90d1ba372a31ff68c5c817c12e18455ac4d12f
MD5 1a3f93fd270590a8856f806d3e67d0b0
BLAKE2b-256 d697d0bb39b25a5a34ba73bcf643b02f5157ee1c9cd8fdbcfebb0c8247bc62c0

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for necpp-2.2.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6e44be31e987c0a522e408c29f996186f45b49e89527e51eb57cf08b25b35a2f
MD5 20c8c973e668b76b7824ee3d6a15b2a6
BLAKE2b-256 2b2d2cf195373697c80dbadd51d5a7996b25e17d55913a1cfdb63959a624b0b0

See more details on using hashes here.

Provenance

The following attestation bundles were made for necpp-2.2.1-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-2.2.1-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for necpp-2.2.1-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 761f9d873bd1ac8d42f48508ffc9ad272a3b99682a65c4b739ef0cd5b439baf4
MD5 b0eb926b5f0362c9b09bed7e12e61ab7
BLAKE2b-256 8d00f5ec4b596b7e9f49a3b5f2a1adce013a516f46a40b48c5f988959d3be429

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for necpp-2.2.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f4ddad0bca1d92b0cd59096088abb960a8c54dde69a18064c9133b0545826920
MD5 538df8c2f795cb1af19e3de10c4cfbc2
BLAKE2b-256 91d45076c9c4c281b3231f7a9343b248ca62af15448393be2c3ce091e54c0e7f

See more details on using hashes here.

Provenance

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

Release history Release notifications | RSS feed

2.3.4

9 files

2.3.2

9 files

2.2.6

9 files

2.2.5

9 files

2.2.4

9 files

2.2.3

9 files

2.2.2

9 files

This release

2.2.1 This release

9 files

1.8.2

9 files

1.8.1

10 files

1.7.4

3 files

1.7.3.5

1 file

1.7.3.2

1 file

1.7.3.1

1 file

1.7.3

1 file

1.7.0.3

1 file

1.7.0.2

1 file

1.6.1.4

1 file

1.6.1.3

1 file

1.6.1.2

1 file

1.6.1.1

1 file

1.6.1

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page