Skip to main content

Python Antenna Simulation Module (nec2++) C-style interface

Project description

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

Project details


Download files

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

Source Distribution

necpp-1.8.1.tar.gz (195.6 kB view details)

Uploaded Source

Built Distributions

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

necpp-1.8.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.9 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

necpp-1.8.1-cp312-cp312-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl (4.7 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.12+ i686manylinux: glibc 2.17+ i686

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

Uploaded CPython 3.12macOS 11.0+ ARM64

necpp-1.8.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.9 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

necpp-1.8.1-cp311-cp311-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl (4.7 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.12+ i686manylinux: glibc 2.17+ i686

necpp-1.8.1-cp311-cp311-macosx_11_0_arm64.whl (244.4 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

necpp-1.8.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.9 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

necpp-1.8.1-cp310-cp310-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl (4.7 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.12+ i686manylinux: glibc 2.17+ i686

necpp-1.8.1-cp310-cp310-macosx_11_0_arm64.whl (244.4 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

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

File metadata

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

File hashes

Hashes for necpp-1.8.1.tar.gz
Algorithm Hash digest
SHA256 ad98652892f1fbcaf32309426564a5c4eb94545abba5f1688269399782f2c74a
MD5 75188b8f4be1171d9896ee5a373ffcc3
BLAKE2b-256 0ff3c9fff749233cb5691d0ea2e41e87ba39cda04dbf914c9d8e1ab70767e14b

See more details on using hashes here.

Provenance

The following attestation bundles were made for necpp-1.8.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-1.8.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for necpp-1.8.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f49fca774cab3ee7282b2386158da86b41b45ca2bb1b5b308f4ea3d86577dd39
MD5 598af780461dfd0ad1e20144805a9ac6
BLAKE2b-256 c2fa9d6bcfe5a1a08970f5ca2c2e936b16c2013146f4c5c9afbc5829058b5b1c

See more details on using hashes here.

Provenance

The following attestation bundles were made for necpp-1.8.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_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-1.8.1-cp312-cp312-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for necpp-1.8.1-cp312-cp312-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 8becaa6caf89a4b13428479960fc469d87d2a9ab782ef8efafa13fcb344c46ce
MD5 825cc9187a4c9f04055b8f7a9465757c
BLAKE2b-256 151803b054c4665b07301b3bea83ea899f769afa1b87362389d986077e890f55

See more details on using hashes here.

Provenance

The following attestation bundles were made for necpp-1.8.1-cp312-cp312-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.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-1.8.1-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for necpp-1.8.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c9480a1139771cefc6b84d52211415e50358ba2e9d2652a521561de20ad605e5
MD5 78e542a685804f27b3e02b7bf5f1aec0
BLAKE2b-256 94585393696838d996bf226b6472e7d33a2e4595207380317ddaf7959954c096

See more details on using hashes here.

Provenance

The following attestation bundles were made for necpp-1.8.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-1.8.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for necpp-1.8.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c1920083599cbae3f2e967f422ecd91da0c45c8ee99f3ce2358708b16b24ebcb
MD5 aac7696bc421ab14408b8cd7d8fe9990
BLAKE2b-256 aa506b24c6e382d838e17eccc138a1c2ff0d498717c78fd53b4c536acad4e0c5

See more details on using hashes here.

Provenance

The following attestation bundles were made for necpp-1.8.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_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-1.8.1-cp311-cp311-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for necpp-1.8.1-cp311-cp311-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 831dca878c905a3f71219724019a0f808806aea88527420877809e7e051a92f8
MD5 0388a09d9af15d3c53b42667aa00bb80
BLAKE2b-256 ddf9130a875e5a930d1584557b29135675c797f64ee43269a3f3a235c1bc0a4f

See more details on using hashes here.

Provenance

The following attestation bundles were made for necpp-1.8.1-cp311-cp311-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.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-1.8.1-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for necpp-1.8.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 dd251955b328ec805bf2f4ab82dcc4984736e49482cf0f7eed49475ff471af7c
MD5 3bbf1ecbb5cbf76e8de86f46226dc0c6
BLAKE2b-256 e8be1343a6c201a1f6c9d939442651c5cdfa21a84bb50bbb908e263a71d22936

See more details on using hashes here.

Provenance

The following attestation bundles were made for necpp-1.8.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-1.8.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for necpp-1.8.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 050a349969210c48049a81672a86d612b82e351602c3af43de360f79b54eed4d
MD5 df31b67aae23bab43861bc715368151a
BLAKE2b-256 4048cb41938711388222e4527df600d697cbd84faef09f034f177a0a77252584

See more details on using hashes here.

Provenance

The following attestation bundles were made for necpp-1.8.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_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-1.8.1-cp310-cp310-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for necpp-1.8.1-cp310-cp310-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 b24670188c4031d75afa092bee8201542919febb1f3e5509c7ff6f3d178b659f
MD5 0eb2301406f8f553ab0a63588f8ff83e
BLAKE2b-256 43be8c6b37a25b02fef7891fe8d44c0b782a80f11fb6c624e68267d8ca0c2dc2

See more details on using hashes here.

Provenance

The following attestation bundles were made for necpp-1.8.1-cp310-cp310-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.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-1.8.1-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for necpp-1.8.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3266b7b5762557f80a7b8edf86f6742c292e344a3c1143530774c06f35d10571
MD5 90ab6d71590f5461843378161e3c503d
BLAKE2b-256 2e8c6d86a1a46e8bc33a5e6b4db153bf7934d9d73020221dc5fefba428c61910

See more details on using hashes here.

Provenance

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

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page