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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

necpp-2.2.2-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.2-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.2.tar.gz.

File metadata

  • Download URL: necpp-2.2.2.tar.gz
  • Upload date:
  • Size: 194.5 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.2.tar.gz
Algorithm Hash digest
SHA256 28c1f00f2a7a3dd90cac3cad3ecd981d8664cacff8fd660d30be97b87bc54c8b
MD5 e8d1bbbbc4c6e55953614e014680e5d3
BLAKE2b-256 22973792fc780aa0e3611cdbddb7f203b485a011f2a2270f879d9d28fe887c19

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for necpp-2.2.2-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 174a9525be70309913c192a0f38ca4cb1b4ef58b8f8194b1cde91325a6c4be0a
MD5 2fd828d3ef8151aac219983ae33832aa
BLAKE2b-256 31e963d267928fadf9a59c3810a9b00055311c1768b96da4ea78a80d89cd7104

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for necpp-2.2.2-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2c7daa5e133593a38eee1417e9e61d8a6a1415bfb01f16dfbe0aa24d22052311
MD5 1593fc9acfeb50e9f1f3a7f0572f4a64
BLAKE2b-256 ad6c46e6ab2ba57458a7c15dccf87536e074950ca82f6136abb3e8f819624dac

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for necpp-2.2.2-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a3b6215322d56bc23dbe27876835c633ebc7e6c693d11a1e1d6b1658fdf60f6d
MD5 11701b19485399f379c2de6c8aedeec5
BLAKE2b-256 4e3de1eda4422de0d27c2b86a76c80b6f557d731e4bbe89e9ffa17a818c48b25

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for necpp-2.2.2-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5b98cf090060ad3635b2d0c5d5112390ab56227186e3dde89930bc50ae627099
MD5 89b0f51cdef1e5091790fc56941576f8
BLAKE2b-256 9e663e420eef8bea387d3ed0f37dac5511624878b542e28eefd8c97068509007

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for necpp-2.2.2-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e586053b22c779454b99f1b788d10e7dc482a30380f791992bbb51690af6fba0
MD5 74ce6a84c879dc45be9a0e64c11fc843
BLAKE2b-256 e5c7dda4bdd3d68590d7c5e7a3f964eb73903e8cdb9172c53a220820901e04f5

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for necpp-2.2.2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5bbe6e3d735d505168ceb7c536cb64334525f2a2d3087a058bf3f254002ea99b
MD5 7be59aef17ee8c97fc450035f09829d3
BLAKE2b-256 905e02f05af7ea3938cdde2665592a6676811c1ae722c1600c6b14e3faefa543

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for necpp-2.2.2-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 bf41b2bb653f6f743da541f9417b72b1c1a07f2473808d4038192da64d6db734
MD5 45f12e2a38e85ac3d9148872a35ce6e5
BLAKE2b-256 f857a048b3d3ae01e4e62501db9a4750197540f04c387eebc7c4ac73b534dcb5

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for necpp-2.2.2-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0d33dcf3a5e42270edaecbb9ba415eb9fdbd6ae11ade423e2c63fe150d507d45
MD5 2143fcf1df1a60e0f714fb20400ab86f
BLAKE2b-256 bca89b25518d5847aa9d233b776d9daecd7d879149204a4d35b0c65def73d63d

See more details on using hashes here.

Provenance

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

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

This release

2.2.2 This release

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