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

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.0
File Size Uploaded Provenance Actions
necpp-2.4.0.tar.gz 1.5 MB With provenance Details for necpp-2.4.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for necpp 2.4.0
File Actions
necpp-2.4.0-cp311-abi3-win_amd64.whl CPython 3.11 abi3 Windows x86-64 Details for necpp-2.4.0-cp311-abi3-win_amd64.whl
necpp-2.4.0-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.0-cp311-abi3-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
necpp-2.4.0-cp311-abi3-macosx_11_0_arm64.whl CPython 3.11 abi3 macOS 11.0+ ARM64 Details for necpp-2.4.0-cp311-abi3-macosx_11_0_arm64.whl
necpp-2.4.0-cp311-abi3-macosx_10_9_x86_64.whl CPython 3.11 abi3 macOS 10.9+ x86-64 Details for necpp-2.4.0-cp311-abi3-macosx_10_9_x86_64.whl

Total release size: 7.2 MB

Release files / necpp-2.4.0.tar.gz

Download URL necpp-2.4.0.tar.gz
Size 1.5 MB
Tags Source
SHA-256 checksum
How to use checksums
f4086f331e6829a0dbc335e68107a9d3f193f29f95f671038323271fc6a1e90c
BLAKE2b-256 checksum
How to use checksums
cb28f12a60e2ae807e54799d36c63de6be8fb970185f76d4877a62ab5ee83fc9
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 9, 2026.

Transparency log

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

Download URL necpp-2.4.0-cp311-abi3-win_amd64.whl
Size 424.0 kB
Tags CPython 3.11 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
429d570cad9bf39ecd45b8cb0f37e9d2ef3ef63d68f777aabda5f576772be2bd
BLAKE2b-256 checksum
How to use checksums
0c0c085afcd6aa2bd3e9e05c0f090d6eed270ddc8b914b15ffcd1c0350a647de
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 9, 2026.

Transparency log

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

Download URL necpp-2.4.0-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
5c51652c82a88f0ad46860b73faf54d8bb2ae09289a21b25529be15f9af32613
BLAKE2b-256 checksum
How to use checksums
8225396a0f89b0ffeaf272ba984ed429b52e36f5bb3bf9542351cba606ec5bce
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 9, 2026.

Transparency log

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

Download URL necpp-2.4.0-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
de26a51cd3d5fc4648e42a7d4a730441a8fd78753c8b5d527298ab4868dc8363
BLAKE2b-256 checksum
How to use checksums
c489afd57ee593474e15fb84f173dade5022179d30370e8e8bb41c94667e5cb9
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 9, 2026.

Transparency log

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

Download URL necpp-2.4.0-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
a4b941fdd7d8845aecf8812e748a4aaea4c2dac53d2ed7bf184e6524644e5c6a
BLAKE2b-256 checksum
How to use checksums
7ce749a0d68aa78b50b52742ce441d5b3bc025514d054f24daf501bb651469fe
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 9, 2026.

Transparency log

Security for necpp 2.4.0

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.0.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 9, 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