Skip to main content

PyNEC accelerated fork (OpenBLAS + OpenMP) — nec2++ object-oriented interface

Project description

Python NEC2++ Module

This module wraps the C++ API for antenna simulation of nec2++. It is easier to work with, and more powerful than the C-style API wrapper. Works with Python 2.7 and 3+.

Usage

Here is an example that plots a radiation pattern.

from PyNEC import *
import numpy as np

#creation of a nec context
context=nec_context()

#get the associated geometry
geo = context.get_geometry()

#add wires to the geometry
geo.wire(0, 36, 0, 0, 0, -0.042, 0.008, 0.017, 0.001, 1.0, 1.0)
context.geometry_complete(0)

context.gn_card(-1, 0, 0, 0, 0, 0, 0, 0)

#add a "ex" card to specify an excitation
context.ex_card(1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0)

#add a "fr" card to specify the frequency 
context.fr_card(0, 2, 2400.0e6, 100.0e6)

#add a "rp" card to specify radiation pattern sampling parameters and to cause program execution
context.rp_card(0, 91, 1, 0, 5, 0, 0, 0.0, 45.0, 4.0, 2.0, 1.0, 0.0)

#get the radiation_pattern
rp = context.get_radiation_pattern(0)

# Gains are in decibels
gains_db = rp.get_gain()
gains = 10.0**(gains_db / 10.0)
thetas = rp.get_theta_angles() * 3.1415 / 180.0
phis = rp.get_phi_angles() * 3.1415 / 180.0


# Plot stuff
import matplotlib.pyplot as plt

ax = plt.subplot(111, polar=True)
ax.plot(thetas, gains[:,0], color='r', linewidth=3)
ax.grid(True)

ax.set_title("Gain at an elevation of 45 degrees", va='bottom')
plt.savefig('RadiationPattern.png')
plt.show()

Manual Build & install

Requirements

  • Pandoc
  • Swig
  • For Windows: C/C++ compilers.
  • Git bash (for running build.sh script)
  • Latest python packages: pip, setuptools, numpy, wheel, numpy. Run: $ pip install --upgrade pip setuptools wheel numpy

Note: Download and extract swigwin.zip and add the path to swig.exe to environment.

Then do following:

    $ git clone --recursive https://github.com/tmolteno/python-necpp.git
    $ cd python-necpp
    $ cd PyNEC
    $ ./build.sh
	$ python setup.py bdist_wheel (For generating wheel, requires wheel package)
    $ sudo python setup.py install

Note: 'sudo' is not required in windows.

Install from PyPI

$ sudo pip install pynec

Note: 'sudo' is not required in windows.

Testing

Requirements

  • python package: matplotlib

    $ python example/test_rp.py

The example directory contains the following additional examples (that are inspired by excercises from a course on antennas):

  • logperiodic_opt.py is an example on how to combine PyNECPP with scipy.optimize to use a genetic algorithm to optimize an antenna for multiple frequency bands at the same time (which I thin is not possible in 4nec2). The resulting gains and VSWR are plotted over the frequency range of interest. This requires scipy >= 0.15.0 due to the usage of scipy.optimize.differential_evolution.
  • monopole_realistic_ground_plane.py plots the vertical gain pattern of a monopole antenna. Its dimensions are optimized with a local search, and the path through the search space is visualized with a heat map.
  • dipole.py does a very simple optimization of a dipole, and plots the VSWR over a given frequency range for different system impedances to file.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

pynec_accel-1.7.4.post2-cp314-cp314-win_amd64.whl (7.3 MB view details)

Uploaded CPython 3.14Windows x86-64

pynec_accel-1.7.4.post2-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (11.0 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

pynec_accel-1.7.4.post2-cp314-cp314-macosx_14_0_arm64.whl (6.8 MB view details)

Uploaded CPython 3.14macOS 14.0+ ARM64

pynec_accel-1.7.4.post2-cp313-cp313-win_amd64.whl (7.2 MB view details)

Uploaded CPython 3.13Windows x86-64

pynec_accel-1.7.4.post2-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (11.0 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

pynec_accel-1.7.4.post2-cp313-cp313-macosx_14_0_arm64.whl (6.8 MB view details)

Uploaded CPython 3.13macOS 14.0+ ARM64

pynec_accel-1.7.4.post2-cp312-cp312-win_amd64.whl (7.2 MB view details)

Uploaded CPython 3.12Windows x86-64

pynec_accel-1.7.4.post2-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (11.0 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

pynec_accel-1.7.4.post2-cp312-cp312-macosx_14_0_arm64.whl (6.8 MB view details)

Uploaded CPython 3.12macOS 14.0+ ARM64

pynec_accel-1.7.4.post2-cp311-cp311-win_amd64.whl (7.2 MB view details)

Uploaded CPython 3.11Windows x86-64

pynec_accel-1.7.4.post2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (11.0 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

pynec_accel-1.7.4.post2-cp311-cp311-macosx_14_0_arm64.whl (6.8 MB view details)

Uploaded CPython 3.11macOS 14.0+ ARM64

pynec_accel-1.7.4.post2-cp310-cp310-win_amd64.whl (7.2 MB view details)

Uploaded CPython 3.10Windows x86-64

pynec_accel-1.7.4.post2-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (11.0 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

pynec_accel-1.7.4.post2-cp310-cp310-macosx_14_0_arm64.whl (6.8 MB view details)

Uploaded CPython 3.10macOS 14.0+ ARM64

File details

Details for the file pynec_accel-1.7.4.post2-cp314-cp314-win_amd64.whl.

File metadata

File hashes

Hashes for pynec_accel-1.7.4.post2-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 10ae4b73b99521028646470b5975d1f4e242389cf03a5b2cf55dff5ce092207a
MD5 eba322ec78923db941209f54aa2629fa
BLAKE2b-256 7ef7d73a2a9060a4af90388479f462c67428c9094d39bccd9f284cd7a3f1e6d5

See more details on using hashes here.

Provenance

The following attestation bundles were made for pynec_accel-1.7.4.post2-cp314-cp314-win_amd64.whl:

Publisher: wheels.yml on stevenmburns/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 pynec_accel-1.7.4.post2-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pynec_accel-1.7.4.post2-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 d531bbe1af1fd08d428bb577483d9d34db4e1d298037444fd14022b1086ec37e
MD5 34eb7c7d6259ddc66ed6888692f32c37
BLAKE2b-256 dd5c01ca719eced537782ffab41630d9e43c10cd2cc6b037e152488a13e893c6

See more details on using hashes here.

Provenance

The following attestation bundles were made for pynec_accel-1.7.4.post2-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: wheels.yml on stevenmburns/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 pynec_accel-1.7.4.post2-cp314-cp314-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for pynec_accel-1.7.4.post2-cp314-cp314-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 6a782db2381be23b4fa03e8922bc20fe96d7eaf1e83da1611db7915fa1f88b19
MD5 769778e29c6e2502c79608c32535bee0
BLAKE2b-256 ae6c32369cae031fe010689e3891b9e8e04725a549601850544e939dc07690fe

See more details on using hashes here.

Provenance

The following attestation bundles were made for pynec_accel-1.7.4.post2-cp314-cp314-macosx_14_0_arm64.whl:

Publisher: wheels.yml on stevenmburns/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 pynec_accel-1.7.4.post2-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pynec_accel-1.7.4.post2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 b2bddafff59a4297d2ac2efb37f6db10c7d84072f5bb552ed6473329ba82ecfa
MD5 eedb6ee3ec7d883e11eee3aa1aed09d8
BLAKE2b-256 851869e72c3e7b2e98e6f5f47aa09e6c6687332ff11be1489503643a11e6dea5

See more details on using hashes here.

Provenance

The following attestation bundles were made for pynec_accel-1.7.4.post2-cp313-cp313-win_amd64.whl:

Publisher: wheels.yml on stevenmburns/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 pynec_accel-1.7.4.post2-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pynec_accel-1.7.4.post2-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 1d9e13d735837a6d1e3263cf9f8fc01f59ebb5485917054d0eacb1c9e7652a31
MD5 61904bec53f29b145965804e9674f662
BLAKE2b-256 896b1ac95d62d31ebc0ac378a607d19865306d8c43d01c1b3d1e738fa0e793ab

See more details on using hashes here.

Provenance

The following attestation bundles were made for pynec_accel-1.7.4.post2-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: wheels.yml on stevenmburns/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 pynec_accel-1.7.4.post2-cp313-cp313-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for pynec_accel-1.7.4.post2-cp313-cp313-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 330dbbb4754a959a4e9f28c22799c7126e14704e4efc4946abd60e51152ef19c
MD5 4387c16263d7f36cff76b04e237f925e
BLAKE2b-256 7f4976d60e71c9c22f259de5d506bcbbc9c93bfd83a1b34783897c350fdc59d4

See more details on using hashes here.

Provenance

The following attestation bundles were made for pynec_accel-1.7.4.post2-cp313-cp313-macosx_14_0_arm64.whl:

Publisher: wheels.yml on stevenmburns/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 pynec_accel-1.7.4.post2-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pynec_accel-1.7.4.post2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 340488994343c6e2aa2af8c24f2b997d7d92e11039f2c6c9585c7345bd285a9e
MD5 9eb400ee0efa4b840d9c6c79b6ce64a2
BLAKE2b-256 af69d6ef84bb8ee266d18b945534bb7806c919bba4416024a133ec3fad6f7b29

See more details on using hashes here.

Provenance

The following attestation bundles were made for pynec_accel-1.7.4.post2-cp312-cp312-win_amd64.whl:

Publisher: wheels.yml on stevenmburns/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 pynec_accel-1.7.4.post2-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pynec_accel-1.7.4.post2-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 32c5a4dc8e98fc1f86a14756d5502b1000d23a9ea8c2fdb6d50a106ed4fd2add
MD5 032115f8018ba80ef7431ec26a0c7fd2
BLAKE2b-256 e6beec7b89c54c9b202eb391ed2102fd77e0d52540cfe8ca5c808151e4cf8445

See more details on using hashes here.

Provenance

The following attestation bundles were made for pynec_accel-1.7.4.post2-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: wheels.yml on stevenmburns/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 pynec_accel-1.7.4.post2-cp312-cp312-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for pynec_accel-1.7.4.post2-cp312-cp312-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 2cc0f5695d7ac93e3c6a851e91963475e36c56e097db7e685932650371023c56
MD5 f94252bfc3830d7c0f66168317ca5554
BLAKE2b-256 b0f542098346a0e12f5911239724c51f131b3f115e157f068d9eeec0fa2b583a

See more details on using hashes here.

Provenance

The following attestation bundles were made for pynec_accel-1.7.4.post2-cp312-cp312-macosx_14_0_arm64.whl:

Publisher: wheels.yml on stevenmburns/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 pynec_accel-1.7.4.post2-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pynec_accel-1.7.4.post2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 35b59c3aa4f2160949a34a6e0ce5ce0763270d0fd64a7eb9bef99464337ef19d
MD5 083679d23f9b671fb49764861b04e404
BLAKE2b-256 03d95212a3ffff25449dd0d5fb1dbb2f173c3e4f851ffd57fc9dfe17c29e0d74

See more details on using hashes here.

Provenance

The following attestation bundles were made for pynec_accel-1.7.4.post2-cp311-cp311-win_amd64.whl:

Publisher: wheels.yml on stevenmburns/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 pynec_accel-1.7.4.post2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pynec_accel-1.7.4.post2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f9745f3fff59514d9976b2945f6b84b6ad312cd611d856f2571ab3ada052a076
MD5 76baa9a3ef522cff2b88a1ee0eb66c44
BLAKE2b-256 36229019aaf2336d394bfaafa8c75674c85d74f8dca3960b917c47c38fb4e8d1

See more details on using hashes here.

Provenance

The following attestation bundles were made for pynec_accel-1.7.4.post2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: wheels.yml on stevenmburns/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 pynec_accel-1.7.4.post2-cp311-cp311-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for pynec_accel-1.7.4.post2-cp311-cp311-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 e617e1180cbf0234e7e8e20f87fdd842e4f56244f81f780a03378da7514bfa2b
MD5 04e4498d27abced386de89ff92ea1a59
BLAKE2b-256 0c9d491731cb507cf388f3e70f7d7b2c6c67be08ea48e07ffea70c89b6c097b8

See more details on using hashes here.

Provenance

The following attestation bundles were made for pynec_accel-1.7.4.post2-cp311-cp311-macosx_14_0_arm64.whl:

Publisher: wheels.yml on stevenmburns/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 pynec_accel-1.7.4.post2-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pynec_accel-1.7.4.post2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 3c8be732a997025fdd3588b7aee941bd08cd34c95b201bfd28dbd44a2bfab260
MD5 3d7351d6eb096470ae3e629f88e252d2
BLAKE2b-256 6b04a4a89f034c13b54fab90e797e2dc153080e4df409daf19da2c30e85514b3

See more details on using hashes here.

Provenance

The following attestation bundles were made for pynec_accel-1.7.4.post2-cp310-cp310-win_amd64.whl:

Publisher: wheels.yml on stevenmburns/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 pynec_accel-1.7.4.post2-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pynec_accel-1.7.4.post2-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 95eb2e078ef1a6765678fb479cf1f5bff4d1a1d28ac31722db70bfdd9db8c3e9
MD5 5d1292182d8824a1c339ca2ec4388760
BLAKE2b-256 2a29cc3057741aa09df087f7aed120e4fb3853a753dc4f66e059c358ff87b401

See more details on using hashes here.

Provenance

The following attestation bundles were made for pynec_accel-1.7.4.post2-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: wheels.yml on stevenmburns/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 pynec_accel-1.7.4.post2-cp310-cp310-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for pynec_accel-1.7.4.post2-cp310-cp310-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 9ae02195ad0b13772aa168a06b2a903a905eb3949bc5b924e87b75f70606e070
MD5 cc41558434d7eac7cfa13dc29e980304
BLAKE2b-256 a16461469f16e3780f55013e88f0c7098e87cf8277cf6cd823a12d671379f6aa

See more details on using hashes here.

Provenance

The following attestation bundles were made for pynec_accel-1.7.4.post2-cp310-cp310-macosx_14_0_arm64.whl:

Publisher: wheels.yml on stevenmburns/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