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 2.2.x Latest releases including Eigen-based matrix solver and modern Python packaging (pyproject.toml, uv support).

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

Metadata

Release files for necpp 2.4.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for necpp 2.4.1
File Size Uploaded Provenance Actions
necpp-2.4.1.tar.gz 1.5 MB With provenance Details for necpp-2.4.1.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for necpp 2.4.1
File Actions
necpp-2.4.1-cp311-abi3-win_amd64.whl CPython 3.11 abi3 Windows x86-64 Details for necpp-2.4.1-cp311-abi3-win_amd64.whl
necpp-2.4.1-cp311-abi3-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl CPython 3.11 abi3 Linux glibc 2.28+ x86-64, Linux glibc 2.24+ x86-64 Details for necpp-2.4.1-cp311-abi3-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
necpp-2.4.1-cp311-abi3-macosx_11_0_arm64.whl CPython 3.11 abi3 macOS 11.0+ ARM64 Details for necpp-2.4.1-cp311-abi3-macosx_11_0_arm64.whl
necpp-2.4.1-cp311-abi3-macosx_10_9_x86_64.whl CPython 3.11 abi3 macOS 10.9+ x86-64 Details for necpp-2.4.1-cp311-abi3-macosx_10_9_x86_64.whl

Total release size: 7.2 MB

Release files / necpp-2.4.1.tar.gz

Download URL necpp-2.4.1.tar.gz
Size 1.5 MB
Tags Source
SHA-256 checksum
How to use checksums
ec49cdaf80186779e5fc54a21ad5010cf1129d47bbe2aa2dbfe43e85e6a55772
BLAKE2b-256 checksum
How to use checksums
9cbfb0cb7309ce866b528d002462f5b580d85d91079a0cb177afaf378414c6b0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.

Transparency log

Release files / necpp-2.4.1-cp311-abi3-win_amd64.whl

Download URL necpp-2.4.1-cp311-abi3-win_amd64.whl
Size 423.3 kB
Tags CPython 3.11 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
177f37a42fde5298edf729e19cb69c00c8c164177eff9276b84d1430e1b721df
BLAKE2b-256 checksum
How to use checksums
b1a848c872ddb6c1733629fa663aa0b2c15b103e7febb4d65fb28450229ef65a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.

Transparency log

Release files / necpp-2.4.1-cp311-abi3-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL necpp-2.4.1-cp311-abi3-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Size 4.8 MB
Tags CPython 3.11 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
9927dcad8cfd7fb133947c9539ca52e3c1e334e3dcddc9ba1433e86487491e77
BLAKE2b-256 checksum
How to use checksums
bc831aa2d51f1fbf42fbe46d8e204abb9e2402099b855056cdf5359b9f1e0deb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.

Transparency log

Release files / necpp-2.4.1-cp311-abi3-macosx_11_0_arm64.whl

Download URL necpp-2.4.1-cp311-abi3-macosx_11_0_arm64.whl
Size 258.8 kB
Tags CPython 3.11 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
376c19f7db410aa61dc0226b1aecf49e49e6c7a411aabb5b569b24c086c758d9
BLAKE2b-256 checksum
How to use checksums
d19ae2c6f0b0d93322fda7128837a870ea1855dfa28471d194f9d6a362851f42
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.

Transparency log

Release files / necpp-2.4.1-cp311-abi3-macosx_10_9_x86_64.whl

Download URL necpp-2.4.1-cp311-abi3-macosx_10_9_x86_64.whl
Size 281.8 kB
Tags CPython 3.11 abi3 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
a77853f06d85468fefacbb7bc7d680eba489b34c3055b9ed555cd2da99b6a565
BLAKE2b-256 checksum
How to use checksums
a3912545e233ddc8f7e9621d69e0fdc5d7303604be206d6a4533b520a5361979
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.

Transparency log

Security for necpp 2.4.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 5 files in this release have been uploaded with provenance metadata.

Select from 5 files

Attestation for necpp-2.4.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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