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.3.tar.gz (194.4 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.3-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.3-cp313-cp313-macosx_11_0_arm64.whl (244.1 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

necpp-2.2.3-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.3-cp312-cp312-macosx_11_0_arm64.whl (244.3 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

necpp-2.2.3-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.3-cp311-cp311-macosx_11_0_arm64.whl (244.2 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

necpp-2.2.3-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.3-cp310-cp310-macosx_11_0_arm64.whl (244.2 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: necpp-2.2.3.tar.gz
  • Upload date:
  • Size: 194.4 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.3.tar.gz
Algorithm Hash digest
SHA256 f147bf0d13aee330e95e0ed36da0a7cdb27dd73142db51b0e9cc809ecae50bc3
MD5 d2fe8c44f258ba6724777b73daf25675
BLAKE2b-256 02c4b4b1a153339c21d1341b84071d417a4b439acb9fb1cb0118757126bf56dc

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for necpp-2.2.3-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 6986306df96979f934826c7b2626e18b40e4ce0369a558d14972210cd94db3be
MD5 c84fa32f3a6a790f34f8346e5c90fbf2
BLAKE2b-256 66b963b219f3fdb7b54395b1b0103249e15ce86f598d7eba91b81c29cf561483

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for necpp-2.2.3-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 688efd2d7937bdbbb0b7757ceb5861d0a4796259e8f6330d07ac62fcabfc4b4b
MD5 aac8e225e2e20e26b47b2bc73cc113c7
BLAKE2b-256 99a0bfabe4930e839b1a64bb413d4df00ba1458af5146cc1d8ef3d5070a65ac6

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for necpp-2.2.3-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ce5581de6e2483dcfe65a8c3cc58d26e4b8b8337110b3f1350be4ec3e4bd7b1b
MD5 4d18b5273944a25186e51500f47a3c4a
BLAKE2b-256 aae85b4760bf76ec5c9c2ae5bd532f82f53a51407362f2ee36aaeb323bd6c979

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for necpp-2.2.3-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a7a88d3a08d81306f47df36a2e42831601b98f977e79fc3b5f5e4f32021dca8b
MD5 b0b668e6a43a7f235543579c92742e4e
BLAKE2b-256 df1dd58450f99bd3706da6c7b859ccfae8aa808f8368f39ae02cd1970b288f25

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for necpp-2.2.3-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 40628a09e53d3cad45fc41e41a18f14408ca0d7745a08982d640ca2ea54e0bd5
MD5 4dc36c606a6e897399a22543a698207a
BLAKE2b-256 d58aba0a0f091e73230c3e03d3f443dd0bc90ae925fd825f6db3c2a9926268e9

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for necpp-2.2.3-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8b5edc3dfdf04e24965d4c8cf47e91cf9ae0b747a08ec64304c73389fc25aa9f
MD5 4eea78080c9ee8e79d772238c5e2619c
BLAKE2b-256 4dd0fc03d801858956a9e6165d4a1623940700db97c79dcfb2335d814f103bb2

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for necpp-2.2.3-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ac306258d08a0fce9c6cd525b1d26801ba11632e2cd9c7405d62938da9688fda
MD5 50e4079bb8db32a6b86eb322e63c04cd
BLAKE2b-256 2feb35281637765a8ff1d76b4d30cd87cb11c16ea34bade27ff519b5bde3a712

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for necpp-2.2.3-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 790e0e27d54d581694aff68b528e7cecfa84c020ff195bea7d9212fc0cb8482d
MD5 14ac9bd9aee78afb39c2342be4ac36f6
BLAKE2b-256 58b9bb1dd777535d90bdf989537cf34676b8d860cbfdf88efeb24846cdfe594d

See more details on using hashes here.

Provenance

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

This release

2.2.3 This release

9 files

2.2.2

9 files

2.2.1

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