PyNEC 1.7.3.4__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 (87) 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.3.4 → pynec-1.7.4}/PyNEC.egg-info/SOURCES.txt +5 -1
  4. pynec-1.7.4/PyNEC.egg-info/requires.txt +1 -0
  5. {PyNEC-1.7.3.4 → pynec-1.7.4}/PyNEC.py +126 -157
  6. {PyNEC-1.7.3.4 → pynec-1.7.4}/PyNEC_wrap.cxx +2937 -2321
  7. {PyNEC-1.7.3.4 → pynec-1.7.4}/README.md +33 -12
  8. {PyNEC-1.7.3.4 → pynec-1.7.4}/example/antenna_util.py +7 -2
  9. {PyNEC-1.7.3.4 → pynec-1.7.4}/example/context_clean.py +7 -5
  10. {PyNEC-1.7.3.4 → pynec-1.7.4}/example/dipole.py +7 -7
  11. {PyNEC-1.7.3.4 → pynec-1.7.4}/example/logperiodic_opt.py +11 -11
  12. pynec-1.7.4/example/monopole.py +48 -0
  13. {PyNEC-1.7.3.4 → pynec-1.7.4}/example/monopole_realistic_ground_plane.py +9 -9
  14. pynec-1.7.4/example/optimized.py +61 -0
  15. {PyNEC-1.7.3.4 → pynec-1.7.4}/example/radiation_pattern.py +4 -4
  16. {PyNEC-1.7.3.4 → pynec-1.7.4}/example/test_ne_nh.py +1 -1
  17. {PyNEC-1.7.3.4 → pynec-1.7.4}/necpp_src/config.h +10 -11
  18. pynec-1.7.4/necpp_src/src/c_ggrid.cpp +467 -0
  19. {PyNEC-1.7.3.4 → pynec-1.7.4}/necpp_src/src/common.h +1 -1
  20. {PyNEC-1.7.3.4 → pynec-1.7.4}/necpp_src/src/math_util.h +13 -2
  21. pynec-1.7.4/necpp_src/src/matrix_algebra.cpp +849 -0
  22. {PyNEC-1.7.3.4 → pynec-1.7.4}/necpp_src/src/misc.cpp +1 -1
  23. {PyNEC-1.7.3.4 → pynec-1.7.4}/necpp_src/src/nec_radiation_pattern.cpp +4 -3
  24. pynec-1.7.4/pyproject.toml +32 -0
  25. pynec-1.7.4/setup.py +67 -0
  26. pynec-1.7.4/tests/test_examples.py +197 -0
  27. pynec-1.7.4/tests/test_get_gain.py +57 -0
  28. PyNEC-1.7.3.4/PKG-INFO +0 -94
  29. PyNEC-1.7.3.4/PyNEC.egg-info/PKG-INFO +0 -94
  30. PyNEC-1.7.3.4/example/monopole.py +0 -48
  31. PyNEC-1.7.3.4/example/optimized.py +0 -31
  32. PyNEC-1.7.3.4/necpp_src/src/c_ggrid.cpp +0 -471
  33. PyNEC-1.7.3.4/necpp_src/src/matrix_algebra.cpp +0 -850
  34. PyNEC-1.7.3.4/setup.py +0 -74
  35. {PyNEC-1.7.3.4 → pynec-1.7.4}/LICENCE.txt +0 -0
  36. {PyNEC-1.7.3.4 → pynec-1.7.4}/MANIFEST.in +0 -0
  37. {PyNEC-1.7.3.4 → pynec-1.7.4}/PyNEC.egg-info/dependency_links.txt +0 -0
  38. {PyNEC-1.7.3.4 → pynec-1.7.4}/PyNEC.egg-info/top_level.txt +0 -0
  39. {PyNEC-1.7.3.4 → pynec-1.7.4}/example/impedance_plot.py +0 -0
  40. {PyNEC-1.7.3.4 → pynec-1.7.4}/example/test_ai.py +0 -0
  41. {PyNEC-1.7.3.4 → pynec-1.7.4}/example/test_charge_densities.py +0 -0
  42. {PyNEC-1.7.3.4 → pynec-1.7.4}/example/test_nrp.py +0 -0
  43. {PyNEC-1.7.3.4 → pynec-1.7.4}/example/test_rp.py +0 -0
  44. {PyNEC-1.7.3.4 → pynec-1.7.4}/example/test_rp2.py +0 -0
  45. {PyNEC-1.7.3.4 → pynec-1.7.4}/example/test_se.py +0 -0
  46. {PyNEC-1.7.3.4 → pynec-1.7.4}/example/test_structure_currents.py +0 -0
  47. {PyNEC-1.7.3.4 → pynec-1.7.4}/example/test_surface_patch_currents.py +0 -0
  48. {PyNEC-1.7.3.4 → pynec-1.7.4}/necpp_src/src/AntennaInput.h +0 -0
  49. {PyNEC-1.7.3.4 → pynec-1.7.4}/necpp_src/src/BaseInput.h +0 -0
  50. {PyNEC-1.7.3.4 → pynec-1.7.4}/necpp_src/src/CurrentInput.h +0 -0
  51. {PyNEC-1.7.3.4 → pynec-1.7.4}/necpp_src/src/PowerBudget.h +0 -0
  52. {PyNEC-1.7.3.4 → pynec-1.7.4}/necpp_src/src/RadiationInput.h +0 -0
  53. {PyNEC-1.7.3.4 → pynec-1.7.4}/necpp_src/src/XGetopt.cpp +0 -0
  54. {PyNEC-1.7.3.4 → pynec-1.7.4}/necpp_src/src/XGetopt.h +0 -0
  55. {PyNEC-1.7.3.4 → pynec-1.7.4}/necpp_src/src/atlas_check.cpp +0 -0
  56. {PyNEC-1.7.3.4 → pynec-1.7.4}/necpp_src/src/c_evlcom.cpp +0 -0
  57. {PyNEC-1.7.3.4 → pynec-1.7.4}/necpp_src/src/c_evlcom.h +0 -0
  58. {PyNEC-1.7.3.4 → pynec-1.7.4}/necpp_src/src/c_geometry.cpp +0 -0
  59. {PyNEC-1.7.3.4 → pynec-1.7.4}/necpp_src/src/c_geometry.h +0 -0
  60. {PyNEC-1.7.3.4 → pynec-1.7.4}/necpp_src/src/c_ggrid.h +0 -0
  61. {PyNEC-1.7.3.4 → pynec-1.7.4}/necpp_src/src/c_plot_card.cpp +0 -0
  62. {PyNEC-1.7.3.4 → pynec-1.7.4}/necpp_src/src/c_plot_card.h +0 -0
  63. {PyNEC-1.7.3.4 → pynec-1.7.4}/necpp_src/src/electromag.cpp +0 -0
  64. {PyNEC-1.7.3.4 → pynec-1.7.4}/necpp_src/src/electromag.h +0 -0
  65. {PyNEC-1.7.3.4 → pynec-1.7.4}/necpp_src/src/libNEC.cpp +0 -0
  66. {PyNEC-1.7.3.4 → pynec-1.7.4}/necpp_src/src/libnecpp.h +0 -0
  67. {PyNEC-1.7.3.4 → pynec-1.7.4}/necpp_src/src/matrix_algebra.h +0 -0
  68. {PyNEC-1.7.3.4 → pynec-1.7.4}/necpp_src/src/misc.h +0 -0
  69. {PyNEC-1.7.3.4 → pynec-1.7.4}/necpp_src/src/nec2cpp.h +0 -0
  70. {PyNEC-1.7.3.4 → pynec-1.7.4}/necpp_src/src/nec_context.cpp +0 -0
  71. {PyNEC-1.7.3.4 → pynec-1.7.4}/necpp_src/src/nec_context.h +0 -0
  72. {PyNEC-1.7.3.4 → pynec-1.7.4}/necpp_src/src/nec_debug.h +0 -0
  73. {PyNEC-1.7.3.4 → pynec-1.7.4}/necpp_src/src/nec_exception.cpp +0 -0
  74. {PyNEC-1.7.3.4 → pynec-1.7.4}/necpp_src/src/nec_exception.h +0 -0
  75. {PyNEC-1.7.3.4 → pynec-1.7.4}/necpp_src/src/nec_ground.cpp +0 -0
  76. {PyNEC-1.7.3.4 → pynec-1.7.4}/necpp_src/src/nec_ground.h +0 -0
  77. {PyNEC-1.7.3.4 → pynec-1.7.4}/necpp_src/src/nec_output.cpp +0 -0
  78. {PyNEC-1.7.3.4 → pynec-1.7.4}/necpp_src/src/nec_output.h +0 -0
  79. {PyNEC-1.7.3.4 → pynec-1.7.4}/necpp_src/src/nec_radiation_pattern.h +0 -0
  80. {PyNEC-1.7.3.4 → pynec-1.7.4}/necpp_src/src/nec_results.cpp +0 -0
  81. {PyNEC-1.7.3.4 → pynec-1.7.4}/necpp_src/src/nec_results.h +0 -0
  82. {PyNEC-1.7.3.4 → pynec-1.7.4}/necpp_src/src/nec_structure_currents.cpp +0 -0
  83. {PyNEC-1.7.3.4 → pynec-1.7.4}/necpp_src/src/nec_structure_currents.h +0 -0
  84. {PyNEC-1.7.3.4 → pynec-1.7.4}/necpp_src/src/nec_wire.h +0 -0
  85. {PyNEC-1.7.3.4 → pynec-1.7.4}/necpp_src/src/safe_array.h +0 -0
  86. {PyNEC-1.7.3.4 → pynec-1.7.4}/necpp_src/src/typesafe_stdint.h +0 -0
  87. {PyNEC-1.7.3.4 → 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
+
@@ -3,10 +3,12 @@ MANIFEST.in
3
3
  PyNEC.py
4
4
  PyNEC_wrap.cxx
5
5
  README.md
6
+ pyproject.toml
6
7
  setup.py
7
8
  PyNEC.egg-info/PKG-INFO
8
9
  PyNEC.egg-info/SOURCES.txt
9
10
  PyNEC.egg-info/dependency_links.txt
11
+ PyNEC.egg-info/requires.txt
10
12
  PyNEC.egg-info/top_level.txt
11
13
  example/antenna_util.py
12
14
  example/context_clean.py
@@ -71,4 +73,6 @@ necpp_src/src/nec_structure_currents.cpp
71
73
  necpp_src/src/nec_structure_currents.h
72
74
  necpp_src/src/nec_wire.h
73
75
  necpp_src/src/safe_array.h
74
- necpp_src/src/typesafe_stdint.h
76
+ necpp_src/src/typesafe_stdint.h
77
+ tests/test_examples.py
78
+ tests/test_get_gain.py
@@ -0,0 +1 @@
1
+ numpy
@@ -1,119 +1,119 @@
1
- # This file was automatically generated by SWIG (http://www.swig.org).
2
- # Version 3.0.12
1
+ # This file was automatically generated by SWIG (https://www.swig.org).
2
+ # Version 4.2.0
3
3
  #
4
- # Do not make changes to this file unless you know what you are doing--modify
4
+ # Do not make changes to this file unless you know what you are doing - modify
5
5
  # the SWIG interface file instead.
6
6
 
7
7
  from sys import version_info as _swig_python_version_info
8
- if _swig_python_version_info >= (2, 7, 0):
9
- def swig_import_helper():
10
- import importlib
11
- pkg = __name__.rpartition('.')[0]
12
- mname = '.'.join((pkg, '_PyNEC')).lstrip('.')
13
- try:
14
- return importlib.import_module(mname)
15
- except ImportError:
16
- return importlib.import_module('_PyNEC')
17
- _PyNEC = swig_import_helper()
18
- del swig_import_helper
19
- elif _swig_python_version_info >= (2, 6, 0):
20
- def swig_import_helper():
21
- from os.path import dirname
22
- import imp
23
- fp = None
24
- try:
25
- fp, pathname, description = imp.find_module('_PyNEC', [dirname(__file__)])
26
- except ImportError:
27
- import _PyNEC
28
- return _PyNEC
29
- try:
30
- _mod = imp.load_module('_PyNEC', fp, pathname, description)
31
- finally:
32
- if fp is not None:
33
- fp.close()
34
- return _mod
35
- _PyNEC = swig_import_helper()
36
- del swig_import_helper
8
+ # Import the low-level C/C++ module
9
+ if __package__ or "." in __name__:
10
+ from . import _PyNEC
37
11
  else:
38
12
  import _PyNEC
39
- del _swig_python_version_info
40
-
41
- try:
42
- _swig_property = property
43
- except NameError:
44
- pass # Python < 2.2 doesn't have 'property'.
45
13
 
46
14
  try:
47
15
  import builtins as __builtin__
48
16
  except ImportError:
49
17
  import __builtin__
50
18
 
51
- def _swig_setattr_nondynamic(self, class_type, name, value, static=1):
52
- if (name == "thisown"):
53
- return self.this.own(value)
54
- if (name == "this"):
55
- if type(value).__name__ == 'SwigPyObject':
56
- self.__dict__[name] = value
57
- return
58
- method = class_type.__swig_setmethods__.get(name, None)
59
- if method:
60
- return method(self, value)
61
- if (not static):
62
- if _newclass:
63
- object.__setattr__(self, name, value)
19
+ def _swig_repr(self):
20
+ try:
21
+ strthis = "proxy of " + self.this.__repr__()
22
+ except __builtin__.Exception:
23
+ strthis = ""
24
+ return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
25
+
26
+
27
+ def _swig_setattr_nondynamic_instance_variable(set):
28
+ def set_instance_attr(self, name, value):
29
+ if name == "this":
30
+ set(self, name, value)
31
+ elif name == "thisown":
32
+ self.this.own(value)
33
+ elif hasattr(self, name) and isinstance(getattr(type(self), name), property):
34
+ set(self, name, value)
64
35
  else:
65
- self.__dict__[name] = value
66
- else:
67
- raise AttributeError("You cannot add attributes to %s" % self)
36
+ raise AttributeError("You cannot add instance attributes to %s" % self)
37
+ return set_instance_attr
68
38
 
69
39
 
70
- def _swig_setattr(self, class_type, name, value):
71
- return _swig_setattr_nondynamic(self, class_type, name, value, 0)
40
+ def _swig_setattr_nondynamic_class_variable(set):
41
+ def set_class_attr(cls, name, value):
42
+ if hasattr(cls, name) and not isinstance(getattr(cls, name), property):
43
+ set(cls, name, value)
44
+ else:
45
+ raise AttributeError("You cannot add class attributes to %s" % cls)
46
+ return set_class_attr
72
47
 
73
48
 
74
- def _swig_getattr(self, class_type, name):
75
- if (name == "thisown"):
76
- return self.this.own()
77
- method = class_type.__swig_getmethods__.get(name, None)
78
- if method:
79
- return method(self)
80
- raise AttributeError("'%s' object has no attribute '%s'" % (class_type.__name__, name))
49
+ def _swig_add_metaclass(metaclass):
50
+ """Class decorator for adding a metaclass to a SWIG wrapped class - a slimmed down version of six.add_metaclass"""
51
+ def wrapper(cls):
52
+ return metaclass(cls.__name__, cls.__bases__, cls.__dict__.copy())
53
+ return wrapper
81
54
 
82
55
 
83
- def _swig_repr(self):
84
- try:
85
- strthis = "proxy of " + self.this.__repr__()
86
- except __builtin__.Exception:
87
- strthis = ""
88
- return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
56
+ class _SwigNonDynamicMeta(type):
57
+ """Meta class to enforce nondynamic attributes (no new attributes) for a class"""
58
+ __setattr__ = _swig_setattr_nondynamic_class_variable(type.__setattr__)
89
59
 
90
- try:
91
- _object = object
92
- _newclass = 1
93
- except __builtin__.Exception:
94
- class _object:
95
- pass
96
- _newclass = 0
97
-
98
- class nec_context(_object):
99
- __swig_setmethods__ = {}
100
- __setattr__ = lambda self, name, value: _swig_setattr(self, nec_context, name, value)
101
- __swig_getmethods__ = {}
102
- __getattr__ = lambda self, name: _swig_getattr(self, nec_context, name)
60
+
61
+ class nec_context(object):
62
+ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
103
63
  __repr__ = _swig_repr
104
64
 
105
65
  def __init__(self):
106
- this = _PyNEC.new_nec_context()
107
- try:
108
- self.this.append(this)
109
- except __builtin__.Exception:
110
- self.this = this
66
+ _PyNEC.nec_context_swiginit(self, _PyNEC.new_nec_context())
111
67
  __swig_destroy__ = _PyNEC.delete_nec_context
112
- __del__ = lambda self: None
113
68
 
114
69
  def get_geometry(self):
115
70
  return _PyNEC.nec_context_get_geometry(self)
116
71
 
72
+ def get_gain(self, freq_index, theta_index, phi_index):
73
+ return _PyNEC.nec_context_get_gain(self, freq_index, theta_index, phi_index)
74
+
75
+ def get_gain_max(self, freq_index):
76
+ return _PyNEC.nec_context_get_gain_max(self, freq_index)
77
+
78
+ def get_gain_min(self, freq_index):
79
+ return _PyNEC.nec_context_get_gain_min(self, freq_index)
80
+
81
+ def get_gain_mean(self, freq_index):
82
+ return _PyNEC.nec_context_get_gain_mean(self, freq_index)
83
+
84
+ def get_gain_sd(self, freq_index):
85
+ return _PyNEC.nec_context_get_gain_sd(self, freq_index)
86
+
87
+ def get_gain_rhcp_max(self, freq_index):
88
+ return _PyNEC.nec_context_get_gain_rhcp_max(self, freq_index)
89
+
90
+ def get_gain_rhcp_min(self, freq_index):
91
+ return _PyNEC.nec_context_get_gain_rhcp_min(self, freq_index)
92
+
93
+ def get_gain_rhcp_mean(self, freq_index):
94
+ return _PyNEC.nec_context_get_gain_rhcp_mean(self, freq_index)
95
+
96
+ def get_gain_rhcp_sd(self, freq_index):
97
+ return _PyNEC.nec_context_get_gain_rhcp_sd(self, freq_index)
98
+
99
+ def get_gain_lhcp_max(self, freq_index):
100
+ return _PyNEC.nec_context_get_gain_lhcp_max(self, freq_index)
101
+
102
+ def get_gain_lhcp_min(self, freq_index):
103
+ return _PyNEC.nec_context_get_gain_lhcp_min(self, freq_index)
104
+
105
+ def get_gain_lhcp_mean(self, freq_index):
106
+ return _PyNEC.nec_context_get_gain_lhcp_mean(self, freq_index)
107
+
108
+ def get_gain_lhcp_sd(self, freq_index):
109
+ return _PyNEC.nec_context_get_gain_lhcp_sd(self, freq_index)
110
+
111
+ def get_impedance_real(self, freq_index):
112
+ return _PyNEC.nec_context_get_impedance_real(self, freq_index)
113
+
114
+ def get_impedance_imag(self, freq_index):
115
+ return _PyNEC.nec_context_get_impedance_imag(self, freq_index)
116
+
117
117
  def get_input_parameters(self, index):
118
118
  return _PyNEC.nec_context_get_input_parameters(self, index)
119
119
 
@@ -185,14 +185,11 @@ class nec_context(_object):
185
185
 
186
186
  def pl_card(self, ploutput_filename, itmp1, itmp2, itmp3, itmp4):
187
187
  return _PyNEC.nec_context_pl_card(self, ploutput_filename, itmp1, itmp2, itmp3, itmp4)
188
- nec_context_swigregister = _PyNEC.nec_context_swigregister
189
- nec_context_swigregister(nec_context)
190
-
191
- class c_geometry(_object):
192
- __swig_setmethods__ = {}
193
- __setattr__ = lambda self, name, value: _swig_setattr(self, c_geometry, name, value)
194
- __swig_getmethods__ = {}
195
- __getattr__ = lambda self, name: _swig_getattr(self, c_geometry, name)
188
+
189
+ # Register nec_context in _PyNEC:
190
+ _PyNEC.nec_context_swigregister(nec_context)
191
+ class c_geometry(object):
192
+ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
196
193
  __repr__ = _swig_repr
197
194
 
198
195
  def wire(self, tag_id, segment_count, xw1, yw1, zw1, xw2, yw2, zw2, rad, rdel, rrad):
@@ -234,25 +231,17 @@ class c_geometry(_object):
234
231
  def quadrilateral_patch(self, ax1, ay1, az1, ax2, ay2, az2, ax3, ay3, az3, ax4, ay4, az4):
235
232
  return _PyNEC.c_geometry_quadrilateral_patch(self, ax1, ay1, az1, ax2, ay2, az2, ax3, ay3, az3, ax4, ay4, az4)
236
233
 
237
- def multiple_patch(self, nx, ny, ax1, ay1, az1, ax2, ay2, az2, ax3, ay3, az3, ax4, ay4, az4):
238
- return _PyNEC.c_geometry_multiple_patch(self, nx, ny, ax1, ay1, az1, ax2, ay2, az2, ax3, ay3, az3, ax4, ay4, az4)
234
+ def multiple_patch(self, nx, ny, ax1, ay1, az1, ax2, ay2, az2, ax3, ay3, az3):
235
+ return _PyNEC.c_geometry_multiple_patch(self, nx, ny, ax1, ay1, az1, ax2, ay2, az2, ax3, ay3, az3)
239
236
 
240
237
  def __init__(self):
241
- this = _PyNEC.new_c_geometry()
242
- try:
243
- self.this.append(this)
244
- except __builtin__.Exception:
245
- self.this = this
238
+ _PyNEC.c_geometry_swiginit(self, _PyNEC.new_c_geometry())
246
239
  __swig_destroy__ = _PyNEC.delete_c_geometry
247
- __del__ = lambda self: None
248
- c_geometry_swigregister = _PyNEC.c_geometry_swigregister
249
- c_geometry_swigregister(c_geometry)
250
240
 
251
- class nec_radiation_pattern(_object):
252
- __swig_setmethods__ = {}
253
- __setattr__ = lambda self, name, value: _swig_setattr(self, nec_radiation_pattern, name, value)
254
- __swig_getmethods__ = {}
255
- __getattr__ = lambda self, name: _swig_getattr(self, nec_radiation_pattern, name)
241
+ # Register c_geometry in _PyNEC:
242
+ _PyNEC.c_geometry_swigregister(c_geometry)
243
+ class nec_radiation_pattern(object):
244
+ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
256
245
 
257
246
  def __init__(self, *args, **kwargs):
258
247
  raise AttributeError("No constructor defined")
@@ -344,14 +333,11 @@ class nec_radiation_pattern(_object):
344
333
 
345
334
  def get_rp_ipd(self):
346
335
  return _PyNEC.nec_radiation_pattern_get_rp_ipd(self)
347
- nec_radiation_pattern_swigregister = _PyNEC.nec_radiation_pattern_swigregister
348
- nec_radiation_pattern_swigregister(nec_radiation_pattern)
349
336
 
350
- class nec_norm_rx_pattern(_object):
351
- __swig_setmethods__ = {}
352
- __setattr__ = lambda self, name, value: _swig_setattr(self, nec_norm_rx_pattern, name, value)
353
- __swig_getmethods__ = {}
354
- __getattr__ = lambda self, name: _swig_getattr(self, nec_norm_rx_pattern, name)
337
+ # Register nec_radiation_pattern in _PyNEC:
338
+ _PyNEC.nec_radiation_pattern_swigregister(nec_radiation_pattern)
339
+ class nec_norm_rx_pattern(object):
340
+ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
355
341
 
356
342
  def __init__(self, *args, **kwargs):
357
343
  raise AttributeError("No constructor defined")
@@ -395,14 +381,11 @@ class nec_norm_rx_pattern(_object):
395
381
 
396
382
  def get_mag(self):
397
383
  return _PyNEC.nec_norm_rx_pattern_get_mag(self)
398
- nec_norm_rx_pattern_swigregister = _PyNEC.nec_norm_rx_pattern_swigregister
399
- nec_norm_rx_pattern_swigregister(nec_norm_rx_pattern)
400
384
 
401
- class nec_structure_excitation(_object):
402
- __swig_setmethods__ = {}
403
- __setattr__ = lambda self, name, value: _swig_setattr(self, nec_structure_excitation, name, value)
404
- __swig_getmethods__ = {}
405
- __getattr__ = lambda self, name: _swig_getattr(self, nec_structure_excitation, name)
385
+ # Register nec_norm_rx_pattern in _PyNEC:
386
+ _PyNEC.nec_norm_rx_pattern_swigregister(nec_norm_rx_pattern)
387
+ class nec_structure_excitation(object):
388
+ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
406
389
 
407
390
  def __init__(self, *args, **kwargs):
408
391
  raise AttributeError("No constructor defined")
@@ -425,14 +408,11 @@ class nec_structure_excitation(_object):
425
408
 
426
409
  def get_power(self):
427
410
  return _PyNEC.nec_structure_excitation_get_power(self)
428
- nec_structure_excitation_swigregister = _PyNEC.nec_structure_excitation_swigregister
429
- nec_structure_excitation_swigregister(nec_structure_excitation)
430
411
 
431
- class nec_antenna_input(_object):
432
- __swig_setmethods__ = {}
433
- __setattr__ = lambda self, name, value: _swig_setattr(self, nec_antenna_input, name, value)
434
- __swig_getmethods__ = {}
435
- __getattr__ = lambda self, name: _swig_getattr(self, nec_antenna_input, name)
412
+ # Register nec_structure_excitation in _PyNEC:
413
+ _PyNEC.nec_structure_excitation_swigregister(nec_structure_excitation)
414
+ class nec_antenna_input(object):
415
+ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
436
416
 
437
417
  def __init__(self, *args, **kwargs):
438
418
  raise AttributeError("No constructor defined")
@@ -458,14 +438,11 @@ class nec_antenna_input(_object):
458
438
 
459
439
  def get_impedance(self):
460
440
  return _PyNEC.nec_antenna_input_get_impedance(self)
461
- nec_antenna_input_swigregister = _PyNEC.nec_antenna_input_swigregister
462
- nec_antenna_input_swigregister(nec_antenna_input)
463
441
 
464
- class nec_near_field_pattern(_object):
465
- __swig_setmethods__ = {}
466
- __setattr__ = lambda self, name, value: _swig_setattr(self, nec_near_field_pattern, name, value)
467
- __swig_getmethods__ = {}
468
- __getattr__ = lambda self, name: _swig_getattr(self, nec_near_field_pattern, name)
442
+ # Register nec_antenna_input in _PyNEC:
443
+ _PyNEC.nec_antenna_input_swigregister(nec_antenna_input)
444
+ class nec_near_field_pattern(object):
445
+ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
469
446
 
470
447
  def __init__(self, *args, **kwargs):
471
448
  raise AttributeError("No constructor defined")
@@ -494,14 +471,11 @@ class nec_near_field_pattern(_object):
494
471
 
495
472
  def get_field_z(self):
496
473
  return _PyNEC.nec_near_field_pattern_get_field_z(self)
497
- nec_near_field_pattern_swigregister = _PyNEC.nec_near_field_pattern_swigregister
498
- nec_near_field_pattern_swigregister(nec_near_field_pattern)
499
474
 
500
- class nec_structure_currents(_object):
501
- __swig_setmethods__ = {}
502
- __setattr__ = lambda self, name, value: _swig_setattr(self, nec_structure_currents, name, value)
503
- __swig_getmethods__ = {}
504
- __getattr__ = lambda self, name: _swig_getattr(self, nec_structure_currents, name)
475
+ # Register nec_near_field_pattern in _PyNEC:
476
+ _PyNEC.nec_near_field_pattern_swigregister(nec_near_field_pattern)
477
+ class nec_structure_currents(object):
478
+ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
505
479
 
506
480
  def __init__(self, *args, **kwargs):
507
481
  raise AttributeError("No constructor defined")
@@ -596,14 +570,11 @@ class nec_structure_currents(_object):
596
570
 
597
571
  def get_patch_e_z(self):
598
572
  return _PyNEC.nec_structure_currents_get_patch_e_z(self)
599
- nec_structure_currents_swigregister = _PyNEC.nec_structure_currents_swigregister
600
- nec_structure_currents_swigregister(nec_structure_currents)
601
573
 
602
- class nec_ground(_object):
603
- __swig_setmethods__ = {}
604
- __setattr__ = lambda self, name, value: _swig_setattr(self, nec_ground, name, value)
605
- __swig_getmethods__ = {}
606
- __getattr__ = lambda self, name: _swig_getattr(self, nec_ground, name)
574
+ # Register nec_structure_currents in _PyNEC:
575
+ _PyNEC.nec_structure_currents_swigregister(nec_structure_currents)
576
+ class nec_ground(object):
577
+ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
607
578
 
608
579
  def __init__(self, *args, **kwargs):
609
580
  raise AttributeError("No constructor defined")
@@ -635,9 +606,7 @@ class nec_ground(_object):
635
606
 
636
607
  def get_conductivity2(self):
637
608
  return _PyNEC.nec_ground_get_conductivity2(self)
638
- nec_ground_swigregister = _PyNEC.nec_ground_swigregister
639
- nec_ground_swigregister(nec_ground)
640
-
641
- # This file is compatible with both classic and new-style classes.
642
609
 
610
+ # Register nec_ground in _PyNEC:
611
+ _PyNEC.nec_ground_swigregister(nec_ground)
643
612