PyNEC 1.7.3.6__tar.gz → 1.7.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. pynec-1.7.4/PKG-INFO +118 -0
  2. pynec-1.7.4/PyNEC.egg-info/PKG-INFO +118 -0
  3. pynec-1.7.4/PyNEC.egg-info/SOURCES.txt +78 -0
  4. pynec-1.7.4/PyNEC.egg-info/requires.txt +1 -0
  5. pynec-1.7.4/PyNEC.py +612 -0
  6. pynec-1.7.4/PyNEC_wrap.cxx +12892 -0
  7. {PyNEC-1.7.3.6 → pynec-1.7.4}/README.md +3 -5
  8. {PyNEC-1.7.3.6 → pynec-1.7.4}/example/antenna_util.py +7 -2
  9. {PyNEC-1.7.3.6 → pynec-1.7.4}/example/context_clean.py +4 -2
  10. pynec-1.7.4/necpp_src/config.h +76 -0
  11. pynec-1.7.4/necpp_src/src/AntennaInput.h +117 -0
  12. pynec-1.7.4/necpp_src/src/BaseInput.h +110 -0
  13. pynec-1.7.4/necpp_src/src/CurrentInput.h +112 -0
  14. pynec-1.7.4/necpp_src/src/PowerBudget.h +123 -0
  15. pynec-1.7.4/necpp_src/src/RadiationInput.h +135 -0
  16. pynec-1.7.4/necpp_src/src/XGetopt.cpp +195 -0
  17. pynec-1.7.4/necpp_src/src/XGetopt.h +23 -0
  18. pynec-1.7.4/necpp_src/src/atlas_check.cpp +613 -0
  19. pynec-1.7.4/necpp_src/src/c_evlcom.cpp +843 -0
  20. pynec-1.7.4/necpp_src/src/c_evlcom.h +66 -0
  21. pynec-1.7.4/necpp_src/src/c_geometry.cpp +3257 -0
  22. pynec-1.7.4/necpp_src/src/c_geometry.h +221 -0
  23. pynec-1.7.4/necpp_src/src/c_ggrid.cpp +467 -0
  24. pynec-1.7.4/necpp_src/src/c_ggrid.h +77 -0
  25. pynec-1.7.4/necpp_src/src/c_plot_card.cpp +240 -0
  26. pynec-1.7.4/necpp_src/src/c_plot_card.h +94 -0
  27. pynec-1.7.4/necpp_src/src/common.h +80 -0
  28. pynec-1.7.4/necpp_src/src/electromag.cpp +48 -0
  29. pynec-1.7.4/necpp_src/src/electromag.h +67 -0
  30. pynec-1.7.4/necpp_src/src/libNEC.cpp +274 -0
  31. pynec-1.7.4/necpp_src/src/libnecpp.h +607 -0
  32. pynec-1.7.4/necpp_src/src/math_util.h +345 -0
  33. pynec-1.7.4/necpp_src/src/matrix_algebra.cpp +849 -0
  34. pynec-1.7.4/necpp_src/src/matrix_algebra.h +66 -0
  35. pynec-1.7.4/necpp_src/src/misc.cpp +122 -0
  36. pynec-1.7.4/necpp_src/src/misc.h +33 -0
  37. pynec-1.7.4/necpp_src/src/nec2cpp.h +14 -0
  38. pynec-1.7.4/necpp_src/src/nec_context.cpp +6966 -0
  39. pynec-1.7.4/necpp_src/src/nec_context.h +1000 -0
  40. pynec-1.7.4/necpp_src/src/nec_debug.h +44 -0
  41. pynec-1.7.4/necpp_src/src/nec_exception.cpp +108 -0
  42. pynec-1.7.4/necpp_src/src/nec_exception.h +83 -0
  43. pynec-1.7.4/necpp_src/src/nec_ground.cpp +264 -0
  44. pynec-1.7.4/necpp_src/src/nec_ground.h +283 -0
  45. pynec-1.7.4/necpp_src/src/nec_output.cpp +227 -0
  46. pynec-1.7.4/necpp_src/src/nec_output.h +120 -0
  47. pynec-1.7.4/necpp_src/src/nec_radiation_pattern.cpp +533 -0
  48. pynec-1.7.4/necpp_src/src/nec_radiation_pattern.h +467 -0
  49. pynec-1.7.4/necpp_src/src/nec_results.cpp +55 -0
  50. pynec-1.7.4/necpp_src/src/nec_results.h +849 -0
  51. pynec-1.7.4/necpp_src/src/nec_structure_currents.cpp +414 -0
  52. pynec-1.7.4/necpp_src/src/nec_structure_currents.h +249 -0
  53. pynec-1.7.4/necpp_src/src/nec_wire.h +262 -0
  54. pynec-1.7.4/necpp_src/src/safe_array.h +339 -0
  55. pynec-1.7.4/necpp_src/src/typesafe_stdint.h +60 -0
  56. pynec-1.7.4/pyproject.toml +32 -0
  57. pynec-1.7.4/setup.py +67 -0
  58. pynec-1.7.4/tests/test_examples.py +197 -0
  59. pynec-1.7.4/tests/test_get_gain.py +57 -0
  60. PyNEC-1.7.3.6/PKG-INFO +0 -118
  61. PyNEC-1.7.3.6/PyNEC.egg-info/PKG-INFO +0 -118
  62. PyNEC-1.7.3.6/PyNEC.egg-info/SOURCES.txt +0 -26
  63. PyNEC-1.7.3.6/setup.py +0 -73
  64. {PyNEC-1.7.3.6 → pynec-1.7.4}/LICENCE.txt +0 -0
  65. {PyNEC-1.7.3.6 → pynec-1.7.4}/MANIFEST.in +0 -0
  66. {PyNEC-1.7.3.6 → pynec-1.7.4}/PyNEC.egg-info/dependency_links.txt +0 -0
  67. {PyNEC-1.7.3.6 → pynec-1.7.4}/PyNEC.egg-info/top_level.txt +0 -0
  68. {PyNEC-1.7.3.6 → pynec-1.7.4}/example/dipole.py +0 -0
  69. {PyNEC-1.7.3.6 → pynec-1.7.4}/example/impedance_plot.py +0 -0
  70. {PyNEC-1.7.3.6 → pynec-1.7.4}/example/logperiodic_opt.py +0 -0
  71. {PyNEC-1.7.3.6 → pynec-1.7.4}/example/monopole.py +0 -0
  72. {PyNEC-1.7.3.6 → pynec-1.7.4}/example/monopole_realistic_ground_plane.py +0 -0
  73. {PyNEC-1.7.3.6 → pynec-1.7.4}/example/optimized.py +0 -0
  74. {PyNEC-1.7.3.6 → pynec-1.7.4}/example/radiation_pattern.py +0 -0
  75. {PyNEC-1.7.3.6 → pynec-1.7.4}/example/test_ai.py +0 -0
  76. {PyNEC-1.7.3.6 → pynec-1.7.4}/example/test_charge_densities.py +0 -0
  77. {PyNEC-1.7.3.6 → pynec-1.7.4}/example/test_ne_nh.py +0 -0
  78. {PyNEC-1.7.3.6 → pynec-1.7.4}/example/test_nrp.py +0 -0
  79. {PyNEC-1.7.3.6 → pynec-1.7.4}/example/test_rp.py +0 -0
  80. {PyNEC-1.7.3.6 → pynec-1.7.4}/example/test_rp2.py +0 -0
  81. {PyNEC-1.7.3.6 → pynec-1.7.4}/example/test_se.py +0 -0
  82. {PyNEC-1.7.3.6 → pynec-1.7.4}/example/test_structure_currents.py +0 -0
  83. {PyNEC-1.7.3.6 → pynec-1.7.4}/example/test_surface_patch_currents.py +0 -0
  84. {PyNEC-1.7.3.6 → pynec-1.7.4}/setup.cfg +0 -0
pynec-1.7.4/PKG-INFO ADDED
@@ -0,0 +1,118 @@
1
+ Metadata-Version: 2.4
2
+ Name: PyNEC
3
+ Version: 1.7.4
4
+ Summary: Python Antenna Simulation Module (nec2++) object-oriented interface
5
+ Author-email: Tim Molteno <tim@physics.otago.ac.nz>
6
+ License: GPLv3
7
+ Project-URL: Homepage, http://github.com/tmolteno/python-necpp
8
+ Project-URL: Repository, http://github.com/tmolteno/python-necpp
9
+ Keywords: nec2,nec2++,antenna,electromagnetism,radio
10
+ Classifier: Development Status :: 5 - Production/Stable
11
+ Classifier: Topic :: Scientific/Engineering
12
+ Classifier: Topic :: Communications :: Ham Radio
13
+ Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Intended Audience :: Science/Research
16
+ Requires-Python: >=3.9
17
+ Description-Content-Type: text/markdown
18
+ License-File: LICENCE.txt
19
+ Requires-Dist: numpy
20
+ Dynamic: license-file
21
+
22
+ # Python NEC2++ Module
23
+
24
+ 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+.
25
+
26
+
27
+ ## Usage
28
+
29
+ Here is an example that plots a radiation pattern.
30
+
31
+ from PyNEC import *
32
+ import numpy as np
33
+
34
+ #creation of a nec context
35
+ context=nec_context()
36
+
37
+ #get the associated geometry
38
+ geo = context.get_geometry()
39
+
40
+ #add wires to the geometry
41
+ geo.wire(0, 36, 0, 0, 0, -0.042, 0.008, 0.017, 0.001, 1.0, 1.0)
42
+ context.geometry_complete(0)
43
+
44
+ context.gn_card(-1, 0, 0, 0, 0, 0, 0, 0)
45
+
46
+ #add a "ex" card to specify an excitation
47
+ context.ex_card(1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0)
48
+
49
+ #add a "fr" card to specify the frequency
50
+ context.fr_card(0, 2, 2400.0e6, 100.0e6)
51
+
52
+ #add a "rp" card to specify radiation pattern sampling parameters and to cause program execution
53
+ context.rp_card(0, 91, 1, 0, 5, 0, 0, 0.0, 45.0, 4.0, 2.0, 1.0, 0.0)
54
+
55
+ #get the radiation_pattern
56
+ rp = context.get_radiation_pattern(0)
57
+
58
+ # Gains are in decibels
59
+ gains_db = rp.get_gain()
60
+ gains = 10.0**(gains_db / 10.0)
61
+ thetas = rp.get_theta_angles() * 3.1415 / 180.0
62
+ phis = rp.get_phi_angles() * 3.1415 / 180.0
63
+
64
+
65
+ # Plot stuff
66
+ import matplotlib.pyplot as plt
67
+
68
+ ax = plt.subplot(111, polar=True)
69
+ ax.plot(thetas, gains[:,0], color='r', linewidth=3)
70
+ ax.grid(True)
71
+
72
+ ax.set_title("Gain at an elevation of 45 degrees", va='bottom')
73
+ plt.savefig('RadiationPattern.png')
74
+ plt.show()
75
+
76
+ ## Manual Build & install
77
+
78
+ Requirements
79
+
80
+ * [Swig](http://www.swig.org/download.html)
81
+ * For Windows: [C/C++ compilers](https://wiki.python.org/moin/WindowsCompilers).
82
+ * Git bash (for running build.sh script)
83
+ * [uv](https://github.com/astral-sh/uv) (recommended) or pip + setuptools + numpy + wheel
84
+
85
+ *Note: Download and extract swigwin.zip and add the path to swig.exe to environment.*
86
+
87
+ Then do following:
88
+
89
+ $ git clone --recursive https://github.com/tmolteno/python-necpp.git
90
+ $ cd python-necpp
91
+ $ cd PyNEC
92
+ $ ./build.sh
93
+ $ uv build # Modern, fast build
94
+ $ uv pip install . # Or: pip install .
95
+
96
+ *Note: 'sudo' is not required in windows.*
97
+
98
+ ## Install from PyPI
99
+
100
+ $ sudo pip install pynec
101
+
102
+ *Note: 'sudo' is not required in windows.*
103
+
104
+ ## Testing
105
+
106
+ Requirements
107
+
108
+ * python package: matplotlib
109
+
110
+ $ python example/test_rp.py
111
+
112
+ The example directory contains the following additional examples (that are inspired by excercises from a course on antennas):
113
+
114
+ * 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.
115
+ * 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.
116
+ * 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.
117
+
118
+
@@ -0,0 +1,118 @@
1
+ Metadata-Version: 2.4
2
+ Name: PyNEC
3
+ Version: 1.7.4
4
+ Summary: Python Antenna Simulation Module (nec2++) object-oriented interface
5
+ Author-email: Tim Molteno <tim@physics.otago.ac.nz>
6
+ License: GPLv3
7
+ Project-URL: Homepage, http://github.com/tmolteno/python-necpp
8
+ Project-URL: Repository, http://github.com/tmolteno/python-necpp
9
+ Keywords: nec2,nec2++,antenna,electromagnetism,radio
10
+ Classifier: Development Status :: 5 - Production/Stable
11
+ Classifier: Topic :: Scientific/Engineering
12
+ Classifier: Topic :: Communications :: Ham Radio
13
+ Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Intended Audience :: Science/Research
16
+ Requires-Python: >=3.9
17
+ Description-Content-Type: text/markdown
18
+ License-File: LICENCE.txt
19
+ Requires-Dist: numpy
20
+ Dynamic: license-file
21
+
22
+ # Python NEC2++ Module
23
+
24
+ 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+.
25
+
26
+
27
+ ## Usage
28
+
29
+ Here is an example that plots a radiation pattern.
30
+
31
+ from PyNEC import *
32
+ import numpy as np
33
+
34
+ #creation of a nec context
35
+ context=nec_context()
36
+
37
+ #get the associated geometry
38
+ geo = context.get_geometry()
39
+
40
+ #add wires to the geometry
41
+ geo.wire(0, 36, 0, 0, 0, -0.042, 0.008, 0.017, 0.001, 1.0, 1.0)
42
+ context.geometry_complete(0)
43
+
44
+ context.gn_card(-1, 0, 0, 0, 0, 0, 0, 0)
45
+
46
+ #add a "ex" card to specify an excitation
47
+ context.ex_card(1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0)
48
+
49
+ #add a "fr" card to specify the frequency
50
+ context.fr_card(0, 2, 2400.0e6, 100.0e6)
51
+
52
+ #add a "rp" card to specify radiation pattern sampling parameters and to cause program execution
53
+ context.rp_card(0, 91, 1, 0, 5, 0, 0, 0.0, 45.0, 4.0, 2.0, 1.0, 0.0)
54
+
55
+ #get the radiation_pattern
56
+ rp = context.get_radiation_pattern(0)
57
+
58
+ # Gains are in decibels
59
+ gains_db = rp.get_gain()
60
+ gains = 10.0**(gains_db / 10.0)
61
+ thetas = rp.get_theta_angles() * 3.1415 / 180.0
62
+ phis = rp.get_phi_angles() * 3.1415 / 180.0
63
+
64
+
65
+ # Plot stuff
66
+ import matplotlib.pyplot as plt
67
+
68
+ ax = plt.subplot(111, polar=True)
69
+ ax.plot(thetas, gains[:,0], color='r', linewidth=3)
70
+ ax.grid(True)
71
+
72
+ ax.set_title("Gain at an elevation of 45 degrees", va='bottom')
73
+ plt.savefig('RadiationPattern.png')
74
+ plt.show()
75
+
76
+ ## Manual Build & install
77
+
78
+ Requirements
79
+
80
+ * [Swig](http://www.swig.org/download.html)
81
+ * For Windows: [C/C++ compilers](https://wiki.python.org/moin/WindowsCompilers).
82
+ * Git bash (for running build.sh script)
83
+ * [uv](https://github.com/astral-sh/uv) (recommended) or pip + setuptools + numpy + wheel
84
+
85
+ *Note: Download and extract swigwin.zip and add the path to swig.exe to environment.*
86
+
87
+ Then do following:
88
+
89
+ $ git clone --recursive https://github.com/tmolteno/python-necpp.git
90
+ $ cd python-necpp
91
+ $ cd PyNEC
92
+ $ ./build.sh
93
+ $ uv build # Modern, fast build
94
+ $ uv pip install . # Or: pip install .
95
+
96
+ *Note: 'sudo' is not required in windows.*
97
+
98
+ ## Install from PyPI
99
+
100
+ $ sudo pip install pynec
101
+
102
+ *Note: 'sudo' is not required in windows.*
103
+
104
+ ## Testing
105
+
106
+ Requirements
107
+
108
+ * python package: matplotlib
109
+
110
+ $ python example/test_rp.py
111
+
112
+ The example directory contains the following additional examples (that are inspired by excercises from a course on antennas):
113
+
114
+ * 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.
115
+ * 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.
116
+ * 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.
117
+
118
+
@@ -0,0 +1,78 @@
1
+ LICENCE.txt
2
+ MANIFEST.in
3
+ PyNEC.py
4
+ PyNEC_wrap.cxx
5
+ README.md
6
+ pyproject.toml
7
+ setup.py
8
+ PyNEC.egg-info/PKG-INFO
9
+ PyNEC.egg-info/SOURCES.txt
10
+ PyNEC.egg-info/dependency_links.txt
11
+ PyNEC.egg-info/requires.txt
12
+ PyNEC.egg-info/top_level.txt
13
+ example/antenna_util.py
14
+ example/context_clean.py
15
+ example/dipole.py
16
+ example/impedance_plot.py
17
+ example/logperiodic_opt.py
18
+ example/monopole.py
19
+ example/monopole_realistic_ground_plane.py
20
+ example/optimized.py
21
+ example/radiation_pattern.py
22
+ example/test_ai.py
23
+ example/test_charge_densities.py
24
+ example/test_ne_nh.py
25
+ example/test_nrp.py
26
+ example/test_rp.py
27
+ example/test_rp2.py
28
+ example/test_se.py
29
+ example/test_structure_currents.py
30
+ example/test_surface_patch_currents.py
31
+ necpp_src/config.h
32
+ necpp_src/src/AntennaInput.h
33
+ necpp_src/src/BaseInput.h
34
+ necpp_src/src/CurrentInput.h
35
+ necpp_src/src/PowerBudget.h
36
+ necpp_src/src/RadiationInput.h
37
+ necpp_src/src/XGetopt.cpp
38
+ necpp_src/src/XGetopt.h
39
+ necpp_src/src/atlas_check.cpp
40
+ necpp_src/src/c_evlcom.cpp
41
+ necpp_src/src/c_evlcom.h
42
+ necpp_src/src/c_geometry.cpp
43
+ necpp_src/src/c_geometry.h
44
+ necpp_src/src/c_ggrid.cpp
45
+ necpp_src/src/c_ggrid.h
46
+ necpp_src/src/c_plot_card.cpp
47
+ necpp_src/src/c_plot_card.h
48
+ necpp_src/src/common.h
49
+ necpp_src/src/electromag.cpp
50
+ necpp_src/src/electromag.h
51
+ necpp_src/src/libNEC.cpp
52
+ necpp_src/src/libnecpp.h
53
+ necpp_src/src/math_util.h
54
+ necpp_src/src/matrix_algebra.cpp
55
+ necpp_src/src/matrix_algebra.h
56
+ necpp_src/src/misc.cpp
57
+ necpp_src/src/misc.h
58
+ necpp_src/src/nec2cpp.h
59
+ necpp_src/src/nec_context.cpp
60
+ necpp_src/src/nec_context.h
61
+ necpp_src/src/nec_debug.h
62
+ necpp_src/src/nec_exception.cpp
63
+ necpp_src/src/nec_exception.h
64
+ necpp_src/src/nec_ground.cpp
65
+ necpp_src/src/nec_ground.h
66
+ necpp_src/src/nec_output.cpp
67
+ necpp_src/src/nec_output.h
68
+ necpp_src/src/nec_radiation_pattern.cpp
69
+ necpp_src/src/nec_radiation_pattern.h
70
+ necpp_src/src/nec_results.cpp
71
+ necpp_src/src/nec_results.h
72
+ necpp_src/src/nec_structure_currents.cpp
73
+ necpp_src/src/nec_structure_currents.h
74
+ necpp_src/src/nec_wire.h
75
+ necpp_src/src/safe_array.h
76
+ necpp_src/src/typesafe_stdint.h
77
+ tests/test_examples.py
78
+ tests/test_get_gain.py
@@ -0,0 +1 @@
1
+ numpy