diff --git a/.gitignore b/.gitignore index e78ea17..e5fd729 100644 --- a/.gitignore +++ b/.gitignore @@ -21,9 +21,11 @@ parts/ sdist/ var/ wheels/ +share/python-wheels/ *.egg-info/ .installed.cfg *.egg +MANIFEST # PyInstaller # Usually these files are written by a python script from a template @@ -38,6 +40,7 @@ pip-delete-this-directory.txt # Unit test / coverage reports htmlcov/ .tox/ +.nox/ .coverage .coverage.* .cache @@ -46,6 +49,7 @@ coverage.xml *.cover .hypothesis/ .pytest_cache/ +cover/ # Translations *.mo @@ -66,11 +70,16 @@ instance/ docs/_build/ # PyBuilder +.pybuilder/ target/ # Jupyter Notebook .ipynb_checkpoints +# IPython +profile_default/ +ipython_config.py + # pyenv .python-version @@ -87,6 +96,11 @@ celerybeat-schedule .venv venv/ ENV/ +.env +env/ +ENV/ +env.bak/ +venv.bak # Spyder project settings .spyderproject @@ -100,4 +114,31 @@ ENV/ # mypy .mypy_cache/ -alabaster \ No newline at end of file +.dmypy.json +dmypy.json +alabaster + +# VSCode +.vscode/ + +# local ignores +DARC.py +DARC2.py +DARC3.py +DARC4.py +DARC5.py +limit_line_0.9_angle_0.csv +limit_line_0.9_angle_5.csv +limit_line_10.0_angle_0.csv +limit_line_10.0_angle_5.csv +limit_line_14.9_angle_0.csv +limit_line_14.9_angle_5.csv +limit_line_38.2_angle_0.csv +limit_line_38.2_angle_5.csv +limit_line_100.0_angle_0.csv +limit_line_100.0_angle_5.csv +limit_line_128.4_angle_0.csv +limit_line_128.4_angle_5.csv +limitation_line_angle_0.csv +limitation_line_angle_5.csv +test.py diff --git a/.vscode/settings.json b/.vscode/settings.json index d76ba6d..bd177d7 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,7 +1,8 @@ -{ - "python.pythonPath": "C:\\Users\\SCYT\\Anaconda3\\envs\\py36\\python.exe", - "deepcode.review.results.hideInformationIssues": false, - "python.linting.pylintEnabled": true, - "python.linting.pycodestyleEnabled": false, - "python.linting.enabled": true +{ + "python.pythonPath": "/home/wboxx1/miniconda3/envs/datascience/bin/python", + "python.linting.pylintEnabled": true, + "python.linting.pycodestyleEnabled": false, + "python.linting.enabled": true, + "python.formatting.provider": "black", + "deepcode.uploadApproved": true } \ No newline at end of file diff --git a/Makefile b/Makefile index af98961..e7c9bbb 100644 --- a/Makefile +++ b/Makefile @@ -1,92 +1,92 @@ -.PHONY: clean clean-test clean-pyc clean-build docs help -.DEFAULT_GOAL := help - -define BROWSER_PYSCRIPT -import os, webbrowser, sys - -try: - from urllib import pathname2url -except: - from urllib.request import pathname2url - -webbrowser.open("file://" + pathname2url(os.path.abspath(sys.argv[1]))) -endef -export BROWSER_PYSCRIPT - -define PRINT_HELP_PYSCRIPT -import re, sys - -for line in sys.stdin: - match = re.match(r'^([a-zA-Z_-]+):.*?## (.*)$$', line) - if match: - target, help = match.groups() - print("%-20s %s" % (target, help)) -endef -export PRINT_HELP_PYSCRIPT - -BROWSER := python -c "$$BROWSER_PYSCRIPT" - -help: - @python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST) - -clean: clean-build clean-pyc clean-test ## remove all build, test, coverage and Python artifacts - -clean-build: ## remove build artifacts - rm -fr build/ - rm -fr dist/ - rm -fr .eggs/ - find . -name '*.egg-info' -exec rm -fr {} + - find . -name '*.egg' -exec rm -f {} + - -clean-pyc: ## remove Python file artifacts - find . -name '*.pyc' -exec rm -f {} + - find . -name '*.pyo' -exec rm -f {} + - find . -name '*~' -exec rm -f {} + - find . -name '__pycache__' -exec rm -fr {} + - -clean-test: ## remove test and coverage artifacts - rm -fr .tox/ - rm -f .coverage - rm -fr htmlcov/ - rm -fr .pytest_cache - -lint: ## check style with flake8 - flake8 antenna_intensity_modeler tests - -test: ## run tests quickly with the default Python - poetry run pytest --cov=src/antenna_intensity_modeler tests/ - -test-all: ## run tests on every Python version with tox - poetry run tox - -coverage: ## check code coverage quickly with the default Python - poetry run coverage run --source src/antenna_intensity_modeler -m pytest - poetry run coverage report -m - poetry run coverage html - poetry run $(BROWSER) htmlcov/index.html - -docs: ## generate Sphinx HTML documentation, including API docs - rm -f docs/antenna_intensity_modeler.rst - rm -f docs/modules.rst - sphinx-apidoc -o docs/ src/antenna_intensity_modeler - $(MAKE) -C docs clean - $(MAKE) -C docs html - $(BROWSER) docs/_build/html/index.html - -servedocs: docs ## compile the docs watching for changes - watchmedo shell-command -p '*.rst' -c '$(MAKE) -C docs html' -R -D . - -release: dist ## package and upload a release - poetry publish - -dist: clean ## builds source and wheel package - poetry build - -install: clean ## install the package to the active Python's site-packages - poetry install - -version-major: - bump2version major - -version-minor: - bump2version minor +.PHONY: clean clean-test clean-pyc clean-build docs help +.DEFAULT_GOAL := help + +define BROWSER_PYSCRIPT +import os, webbrowser, sys + +try: + from urllib import pathname2url +except: + from urllib.request import pathname2url + +webbrowser.open(pathname2url(sys.argv[1])) +endef +export BROWSER_PYSCRIPT + +define PRINT_HELP_PYSCRIPT +import re, sys + +for line in sys.stdin: + match = re.match(r'^([a-zA-Z_-]+):.*?## (.*)$$', line) + if match: + target, help = match.groups() + print("%-20s %s" % (target, help)) +endef +export PRINT_HELP_PYSCRIPT + +BROWSER := python -c "$$BROWSER_PYSCRIPT" + +help: + @python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST) + +clean: clean-build clean-pyc clean-test ## remove all build, test, coverage and Python artifacts + +clean-build: ## remove build artifacts + rm -fr build/ + rm -fr dist/ + rm -fr .eggs/ + find . -name '*.egg-info' -exec rm -fr {} + + find . -name '*.egg' -exec rm -f {} + + +clean-pyc: ## remove Python file artifacts + find . -name '*.pyc' -exec rm -f {} + + find . -name '*.pyo' -exec rm -f {} + + find . -name '*~' -exec rm -f {} + + find . -name '__pycache__' -exec rm -fr {} + + +clean-test: ## remove test and coverage artifacts + rm -fr .tox/ + rm -f .coverage + rm -fr htmlcov/ + rm -fr .pytest_cache + +lint: ## check style with flake8 + flake8 antenna_intensity_modeler tests + +test: ## run tests quickly with the default Python + poetry run pytest + +test-all: ## run tests on every Python version with tox + poetry run tox + +coverage: ## check code coverage quickly with the default Python + poetry run coverage run --source src/antenna_intensity_modeler -m pytest + poetry run coverage report -m + poetry run coverage html + poetry run $(BROWSER) htmlcov/index.html + +docs: ## generate Sphinx HTML documentation, including API docs + rm -f docs/antenna_intensity_modeler.rst + rm -f docs/modules.rst + sphinx-apidoc -M -o docs/ src/antenna_intensity_modeler + $(MAKE) -C docs clean + $(MAKE) -C docs html + $(BROWSER) docs/_build/html/index.html + +servedocs: docs ## compile the docs watching for changes + watchmedo shell-command -p '*.rst' -c '$(MAKE) -C docs html' -R -D . + +release: dist ## package and upload a release + poetry publish + +dist: clean ## builds source and wheel package + poetry build + +install: clean ## install the package to the active Python's site-packages + poetry install + +version-major: + bump2version major + +version-minor: + bump2version minor diff --git a/appveyor.yml b/appveyor.yml index 012cbc0..645373d 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -50,7 +50,7 @@ install: - sh: "pip install -U tox" - sh: "pip install -U poetry" -build: false # Not a C# project, build stuff at the test step instead. +build: off # Not a C# project, build stuff at the test step instead. test_script: - cmd: "%PYTHON%/Scripts/tox -e %TOX_ENV%" diff --git a/docs/_build/html/.buildinfo b/docs/_build/html/.buildinfo index 4a3bb87..85ef9cf 100644 --- a/docs/_build/html/.buildinfo +++ b/docs/_build/html/.buildinfo @@ -1,4 +1,4 @@ -# Sphinx build info version 1 -# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. -config: 556abe7c721910f6245712bea2d89b0a -tags: 645f666f9bcd5a90fca523b33c5a78b7 +# Sphinx build info version 1 +# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. +config: 9d5b790a11b3c00311d9ff23704107f6 +tags: 645f666f9bcd5a90fca523b33c5a78b7 diff --git a/docs/_build/html/_modules/antenna_intensity_modeler/parabolic.html b/docs/_build/html/_modules/antenna_intensity_modeler/parabolic.html index 4043d1f..acf638c 100644 --- a/docs/_build/html/_modules/antenna_intensity_modeler/parabolic.html +++ b/docs/_build/html/_modules/antenna_intensity_modeler/parabolic.html @@ -1,321 +1,938 @@ - - - - - - - antenna_intensity_modeler.parabolic — antenna-intensity-modeler 0.1.1 documentation - - - - - - - - - - - - -
-
-
-
- -

Source code for antenna_intensity_modeler.parabolic

-# -*- coding: utf-8 -*-
-
-"""Main module."""
-
-import numpy as np
-import scipy as sp
-import scipy.integrate
-import scipy.special
-import matplotlib.pyplot as plt
-import pandas as pd
-
-# Units
-m = 1.0
-pi = np.pi
-rad = 1.0
-s = 1.0
-
-
-
[docs]def parameters(radius_meters, freq_mhz, power_watts, efficiency, side_lobe_ratio): - """Parameters for parabolic dish - - Receives user input parameters for parabolic dish and - computes and returns all needed parameters for parabolic - functions. - - :param radius_meters: antenna radius in meters. - :param freq_mhz: frequency in megahertz. - :param power_watts: output power of radio in watts. - :param efficiency: efficiency of antenna. - :param side_lobe_ratio: side lobe ratio of antenna. - :type radius_meters: float - :type freq_mhz: float - :type power_watts: float - :type efficiency: float - :type side_lobe_ratio: float - :returns: parameters needed for parabolic functions. - :rtype: tuple(float) - :Example: - - >>> from antenna_intensity_modeler import parabolic - >>> params = parabolic.parameters(2.4, 8400., 400.0, 0.62, 20.0) - >>> params - (2.4, 8400., 400, 0.62, 20, 0.4872, 1290.24, 2.1134, 175.929) - """ - - """Constants""" - C = 3e8 * m / s - - # Sidelobe Ratios (illummination) - # n = 0: slr = 17.57 - # n = 1: slr = 25 - # n = 2: slr = 30 - # n = 3: slr = 35 - # n = 4: slr = 40 - # n = 5: slr = 45 - HDICT = { - 17.57: 0, - 20: 0.4872, - 25: 0.8899, - 30: 1.1977, - 35: 1.4708, - 40: 1.7254, - 45: 1.9681, - 50: 2.2026 - } - freq_hz = freq_mhz*1e6 - DIAM = 2 * radius_meters - LAMDA = C / freq_hz - GAIN = 10 * np.log10(efficiency * (pi * DIAM / LAMDA)**2) - EIRP = power_watts * 10**(0.1 * GAIN) - - """Properties""" - H = HDICT[side_lobe_ratio] - ffmin = 2 * DIAM**2 / LAMDA - ffpwrden = EIRP / (4 * pi * ffmin**2) - k = 2 * pi / LAMDA - - return radius_meters, freq_mhz, power_watts, efficiency, side_lobe_ratio, H, ffmin, ffpwrden, k
- - -
[docs]def near_field_corrections(parameters, xbar): - """Near field corrections for parabolic dish. - - Receives user input parameters and normalized off axis distance - for parabolic dish computes and returns plot of near field correction - factors. - - :param parameters: parameters tuple created with parameters function - :param xbar: normalized off-axis distance - :type parameters: tuple(float) - :type xbar: float - :returns: dataframe - :rtype: pandas dataframe - :Example: - - >>> from antenna_intensity_modeler import parabolic - >>> import matplotlib.pyplot as plt - >>> params = parabolic.parameters(2.4, 8.4e9, 400.0, 0.62, 20.0) - >>> xbar = 1.0 - >>> table = parabolic.near_field_corrections(params, xbar) - >>> fig, ax = plt.subplots() - >>> ax.semilogx(table.delta, table.Pcorr) - >>> ax.set_xlim([0.01, 1.0]) - >>> ax.grid(True, which="both") - >>> ax.minorticks_on() - >>> side_lobe_ratio = params[4] - >>> ax.set_title("Near Field Corrections xbar: %s , slr: %s" % (xbar, side_lobe_ratio)) - >>> ax.set_xlabel("Normalized On Axis Distance") - >>> ax.set_ylabel("Normalized On Axis Power Density") - >>> fig.show() - - .. image:: _static/nfcImage.png - """ - radius, freq_mhz, power_watts, efficiency, side_lobe_ratio, H, ffmin, ffpwrden, k = parameters - - # delta = np.linspace(0.01, 1.0, 1000) # Normalized farfield distances - delta = np.logspace(-2, 0, 1000) - Ep = np.zeros(1000) - count = 0 - xbarR = xbar * radius - - for d in delta: - theta = np.arctan(xbarR / (d * ffmin)) - u = k * radius * np.sin(theta) - - def fun1(x): return (scipy.special.iv(0, pi * H * (1 - x**2)) - * scipy.special.jv(0, u * x) - * np.cos(pi * x**2 / 8 / d) - * x) - Ep1 = scipy.integrate.romberg(fun1, 0, 1) - - def fun2(x): return (scipy.special.iv(0, pi * H * (1 - x**2)) - * scipy.special.jv(0, u * x) - * np.sin(pi * x**2 / 8 / d) - * x) - Ep2 = scipy.integrate.romberg(fun2, 0, 1) - Ep[count] = (1 + np.cos(theta)) / d * abs(Ep1 - 1j * Ep2) - count += 1 - - Pcorr = (Ep**2 / Ep[-1]**2) * ffpwrden - - #fig, ax = plt.subplots() - #ax.semilogx(delta, Pcorr) - #ax.set_xlim([0.01, 1.0]) - #ax.grid(True, which="both") - # ax.minorticks_on() - #ax.set_title("Near Field Corrections xbar: %s , slr: %s" % (xbar, side_lobe_ratio)) - #ax.set_xlabel("Normalized On Axis Distance") - #ax.set_ylabel("Normalized On Axis Power Density") - # return fig, ax - return pd.DataFrame(dict(delta=delta, Pcorr=Pcorr))
- - -
[docs]def hazard_plot(parameters, limit, density=1000, xbar_max=1, gain_boost=None): - """Hazard plot for parabolic dish. - - Receives user input parameters and hazard limit - for parabolic dish. Computes and returns hazard distance - plot. - - :param parameters: parameters tuple created with parameters function - :param limit: power density limit - :param density: (optional) number of points for plot, if none density=1000 - :param xbar_max: (optional) maximum value for xbar, if none is given xbar_max=1 - :param gain_boost: (optional) additional numerical gain to add - :type parameters: tuple(float) - :type limit: float - :type xbar_max: int - :type gain_boost: float - :returns: figure and axes for hazard plot - :rtype: (figure, axes) - :Example: - - >>> from antenna_intensity_modeler import parabolic - >>> params = parabolic.parameters(2.4, 8.4e9, 400.0, 0.62, 20.0) - >>> fig, ax = hazard_plot(params, 10.0) - """ - radius_meters, freq_mhz, power_watts, efficiency, side_lobe_ratio, H, ffmin, ffpwrden, k = parameters - n = density - delta = np.linspace(1.0, 0.01, n) # Normalized farfield distances - xbarArray = np.ones(n) - Ep = np.zeros(n) - - # xbars = np.linspace(0, 1, 10) - xbars = np.arange(0, xbar_max + 0.1, 0.1) - - if gain_boost is not None: - ffpwrden = gain_boost*ffpwrden - - last = 999 - count = 0 - for d in delta: - for xbar in xbars: - xbarR = xbar * radius_meters - theta = np.arctan(xbarR / (d * ffmin)) - u = k * radius_meters * np.sin(theta) - - def fun1(x): return (sp.special.iv(0, pi * H * (1 - x**2)) - * sp.special.jv(0, u * x) - * np.cos(pi * x**2 / 8 / d) - * x) - Ep1 = sp.integrate.romberg(fun1, 0, 1) - - def fun2(x): return (sp.special.iv(0, pi * H * (1 - x**2)) - * sp.special.jv(0, u * x) - * np.sin(pi * x**2 / 8 / d) - * x) - Ep2 = sp.integrate.romberg(fun2, 0, 1) - Ep[count] = (1 + np.cos(theta)) / d * abs(Ep1 - 1j * Ep2) - power = ffpwrden * (Ep[count]**2 / Ep[0]**2) - if power - limit < 0: - if abs(power - limit) < last: - xbarArray[count] = xbar - last = power - limit - last = 999 - count += 1 - - fig, ax = plt.subplots() - ax.plot(delta[::-1] * ffmin, xbarArray[::-1] * radius_meters, - delta[::-1] * ffmin, xbarArray[::-1] * -radius_meters) - ax.grid(True, which='both') - ax.minorticks_on() - ax.set_title('Hazard Plot with limit: %s w/m^2' % limit) - ax.set_xlabel('Distance From Antenna(m)') - ax.set_ylabel('Off Axis Distance (m)') - return fig, ax
- - - -
- -
-
-
- -
-
- - - + + + + + + + + + + + antenna_intensity_modeler.parabolic — Antenna Intensity Modeler 0.1.1 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + + + +
+ +
+ + + + + + + + + + + + + + + + + +
+ +
    + +
  • Docs »
  • + +
  • Module code »
  • + +
  • antenna_intensity_modeler.parabolic
  • + + +
  • + +
  • + +
+ + +
+
+
+
+ +

Source code for antenna_intensity_modeler.parabolic

+# -*- coding: utf-8 -*-
+
+"""Main module for parabolic reflector antennas."""
+
+import numpy as np
+import scipy as sp
+from scipy import integrate
+import scipy.special
+import matplotlib.pyplot as plt
+import pandas as pd
+
+# Units
+m = 1.0
+pi = np.pi
+cos = np.cos
+sin = np.sin
+rad = 1.0
+s = 1.0
+
+
+
[docs]def parameters( + radius_meters: float, + freq_mhz: float, + power_watts: float, + efficiency: float, + side_lobe_ratio: float, +) -> dict: + """Parameters for parabolic dish + + Receives user input parameters for parabolic dish and + computes and returns all needed parameters for parabolic + functions. + + Args: + radius_meters (float): antenna radius in meters. + freq_mhz (float): frequency in megahertz. + power_watts (float): output power of radio in watts. + efficiency (float): efficiency of antenna. + side_lobe_ratio (float): side lobe ratio of antenna. + + Returns: + dict: parameter dictionary needed for parabolic functions. + + Example: + >>> from antenna_intensity_modeler import parabolic + >>> params = parabolic.parameters(2.4, 8400., 400.0, 0.62, 20.0) + >>> params + {'radius_meters': 2.4, 'freq_mhz': 8400.0, 'power_watts': 400.0, 'efficiency': 0.62, + 'side_lobe_ratio':20.0, 'H': 0.4872, 'ffmin': 1290.24, 'ffpwrden': 2.1134, 'k': 175.929} + """ + + """Constants""" + C = 3e8 * m / s + + # Sidelobe Ratios (illummination) + # n = 0: slr = 17.57 + # n = 1: slr = 25 + # n = 2: slr = 30 + # n = 3: slr = 35 + # n = 4: slr = 40 + # n = 5: slr = 45 + HDICT = { + 17.57: 0, + 20: 0.4872, + 25: 0.8899, + 30: 1.1977, + 35: 1.4708, + 40: 1.7254, + 45: 1.9681, + 50: 2.2026, + } + freq_hz = freq_mhz * 1e6 + DIAM = 2 * radius_meters + LAMDA = C / freq_hz + GAIN = 10 * np.log10(efficiency * (pi * DIAM / LAMDA) ** 2) + EIRP = power_watts * 10 ** (0.1 * GAIN) + + """Properties""" + H = HDICT[side_lobe_ratio] + ffmin = 2 * DIAM ** 2 / LAMDA + ffpwrden = EIRP / (4 * pi * ffmin ** 2) + k = 2 * pi / LAMDA + + return_dict = { + "radius_meters": radius_meters, + "freq_mhz": freq_mhz, + "power_watts": power_watts, + "efficiency": efficiency, + "side_lobe_ratio": side_lobe_ratio, + "H": H, + "ffmin": ffmin, + "ffpwrden": ffpwrden, + "k": k, + } + return return_dict
+ # return radius_meters, freq_mhz, power_watts, efficiency, side_lobe_ratio, H, ffmin, ffpwrden, k + + +
[docs]def near_field_corrections(parameters: dict, xbar: float) -> pd.DataFrame: + """Near field corrections for parabolic dish. + + Receives user input parameters and normalized off axis distance + for parabolic dish. Computes and returns plot of near field correction + factors. + + Args: + parameters (dict): parameters tuple created with parameters function + xbar (float): normalized off-axis distance + + Returns: + pandas.DataFrame: A dataframe with "delta" and "Pcorr" columns + + Example: + >>> from antenna_intensity_modeler import parabolic + >>> import matplotlib.pyplot as plt + >>> params = parabolic.parameters(2.4, 8.4e9, 400.0, 0.62, 20.0) + >>> xbar = 1.0 + >>> table = parabolic.near_field_corrections(params, xbar) + >>> fig, ax = plt.subplots() + >>> ax.semilogx(table.delta, table.Pcorr) + >>> ax.set_xlim([0.01, 1.0]) + >>> ax.grid(True, which="both") + >>> ax.minorticks_on() + >>> slr = params.get('side_lobe_ratio') + >>> ax.set_title("Near Field Corrections xbar: %s , slr: %s" % (xbar, slr)) + >>> ax.set_xlabel("Normalized On Axis Distance") + >>> ax.set_ylabel("Normalized On Axis Power Density") + >>> fig.show() + + .. image:: _static/near_field_plot.png + """ + # radius, freq_mhz, power_watts, efficiency, side_lobe_ratio, H, ffmin, ffpwrden, k = tuple(parameters) + radius = parameters.get("radius_meters") + freq_mhz = parameters.get("freq_mhz") + power_watts = parameters.get("power_watts") + efficiency = parameters.get("efficiency") + side_lobe_ratio = parameters.get("side_lobe_ratio") + H = parameters.get("H") + ffmin = parameters.get("ffmin") + ffpwrden = parameters.get("ffpwrden") + k = parameters.get("k") + + # delta = np.linspace(0.01, 1.0, 1000) # Normalized farfield distances + delta = np.logspace(-2, 0, 1000) + Ep = np.zeros(1000) + count = 0 + xbarR = xbar * radius + + for d in delta: + theta = np.arctan(xbarR / (d * ffmin)) + u = k * radius * np.sin(theta) + + def fun1(x): + return ( + 1 + * scipy.special.iv(0, pi * H * (1 - x ** 2)) # **(1 / 2)) + # * (1 - x**2) + * scipy.special.jv(0, u * x) + * np.cos(pi * x ** 2 / 8 / d) + * x + ) + + Ep1 = scipy.integrate.romberg(fun1, 0, 1) + # Ep1 = sum(fun1(np.linspace(0, 1, 1000))) + + def fun2(x): + return ( + 1 + * scipy.special.iv(0, pi * H * (1 - x ** 2)) # **(1 / 2)) + # * (1 - x**2) + * scipy.special.jv(0, u * x) + * np.sin(pi * x ** 2 / 8 / d) + * x + ) + + Ep2 = scipy.integrate.romberg(fun2, 0, 1) + # Ep2 = sum(fun2(np.linspace(0, 1, 1000))) + Ep[count] = (1 + np.cos(theta)) / d * abs(Ep1 - 1j * Ep2) + count += 1 + + Pcorr = (Ep ** 2 / Ep[-1] ** 2) * ffpwrden + + # fig, ax = plt.subplots() + # ax.semilogx(delta, Pcorr) + # ax.set_xlim([0.01, 1.0]) + # ax.grid(True, which="both") + # ax.minorticks_on() + # ax.set_title("Near Field Corrections xbar: %s , slr: %s" % (xbar, side_lobe_ratio)) + # ax.set_xlabel("Normalized On Axis Distance") + # ax.set_ylabel("Normalized On Axis Power Density") + # return fig, ax + return pd.DataFrame(dict(delta=delta, Pcorr=Pcorr))
+ + +
[docs]def test_method(parameters, xbar): + ( + radius, + freq_mhz, + power_watts, + efficiency, + side_lobe_ratio, + H, + ffmin, + ffpwrden, + k, + ) = parameters + + # delta = np.linspace(0.01, 1.0, 1000) # Normalized farfield distances + # delta = np.logspace(-2, 0, 100) + delta = range(70) + Ep = np.zeros(len(delta)) + count = 0 + xbarR = xbar * radius + C = 3e8 + lamda = C / (freq_mhz * 1e6) + # theta = np.arctan(xbarR / (delta * ffmin)) + # sintheta = np.sin(theta) + # x = np.linspace(-7.5, 7.5, 1000) + # u = k * radius * np.sin(theta) + # Ep = np.fft.fft( + # 1 + # # * scipy.special.iv(0, pi * H * (1 - x**2)) + # # * scipy.special.jv(0, u * x) + # * np.exp(1j * k * (x**2 / 2 / xbarR)) + # ) + # Ep = np.fft.fftshift(Ep) + # Ep = Ep * np.exp(-1j * k * 7.5**2 * u**2 / 2 / xbarR) + + # Pcorr = abs(Ep) + # for d in delta: + + ###########################3 + # FSA method without dropping phi + + # delta = np.logspace(-2, 0, 1000) + # Ep = np.zeros(len(delta)) + # for d in delta: + # theta = np.arctan(xbarR / (d * ffmin)) + # u = k * radius * np.sin(theta) + + # def fun1(x,y): return( + # 1 + # # * scipy.special.iv(0, pi * H * (1 - x**2)) + # * np.exp(-1j * k * x**2 / 2 / d) + # * np.exp(1j * k * x * sin(theta) * cos((pi / 8) - y) * x) + # ) + # Ep1 = integrate.dblquad(fun1, 0, radius, lambda x: 0, lambda x: 2 * pi) + + # # def fun2(x,y): return( + # # 1 + # # # * scipy.special.iv(0, pi * H * (1 - x**2)) + # # * sin(k * x**2 / 2 / d) + # # * sin(k * x * sin(theta) * cos((pi / 8) - y) * x) + # # ) + # # Ep2 = integrate.dblquad(fun1, 0, radius, lambda x: 0, lambda x: 2 * pi) + + # # Ep[count] = (1 + cos(theta)) / 4 / pi / d * abs(Ep1[0] - 1j * Ep2[0]) + # Ep[count] = (1 + cos(theta)) / 4 / pi / d * abs(Ep1[0]) + # count += 1 + ########################## + + ########################## + # Hansen implementation + d = 0.075 * ffmin + for deg in delta: + # theta = np.arctan(xbarR / (d * ffmin)) + # u = np.sin(theta) + theta = deg * pi / 180 + phi = 0 + # R = (xbar**2 + d**2)**(1/2) + R = d / cos(theta) # / ffmin + nabla = 120 * pi + + # u = k * radius * np.sin(theta) + + ####################### + # o = k * xbar**2 / d + + # def fun1(x): return( + # 1 + # * np.exp(1j * k * x**2 / 2 / d) + # * np.exp(-1j * k * x * u) + # ) + # def fun1(x): return ( + # 1 + # * scipy.special.iv(0, pi * H * (1 - x**2)) + # # * scipy.special.jv(0, u * x) + # * np.cos(k * (o / 2) * x**2 * (1 - u**2)) + # * np.cos(k * u * x) + # )j + # Ep[count] = 13.14 * (1 - np.cos(np.pi / 8 / d)) + ####################### + + ############################## + # def R(x,y): return( + # ((xbarR - (x * cos(y)))**2 + (-x * sin(y))**2 + d**2)**1/2 + # ) + + # def fun1(x,y): return( + # 1 + # * scipy.special.iv(0, pi * H * (1 - x**2)) + # * (1 / R(x,y)) + # * cos(k * R(x,y)) + # ) + # Ep1 = integrate.dblquad(fun1, 0, radius, lambda x: 0, lambda x: 2 * pi) + + # def fun2(x,y): return( + # 1 + # * scipy.special.iv(0, pi * H * (1 - x**2)) + # * (1 / R(x,y)) + # * sin(k * R(x,y)) + # ) + # Ep2 = integrate.dblquad(fun2, 0, radius, lambda x: 0, lambda x: 2 * pi) + + # Ep[count] = (1 / lamda) * abs(Ep1[0] - 1j * Ep2[0])**2 + ############################ + + ####################### + summation = 0 + even = 0 + odd = 0 + # print(k) + # print(radius) + # print(H) + + # print("{} of {}".format(count, len(delta)), end="\r") + for N in range(50): + + def fun_b1(x): + return ( + 1 + # * scipy.special.iv(0, pi * H * (1 - x**2)**(1 / 2)) + * scipy.special.spherical_jn(N, x) + * x + ) + + B1 = scipy.integrate.romberg(fun_b1, 0, k * radius, divmax=20) + + def fun_b2(x): + return ( + 1 + # * scipy.special.iv(0, pi * H * (1 - x**2)**(1 / 2)) + * scipy.special.spherical_jn(N, x) + ) + + # B2 = scipy.integrate.romberg(fun_b2, 0, 1, divmax=20) + B2 = scipy.integrate.romberg(fun_b2, 0, k * radius, divmax=20) + + if N % 2 == 0: + + def fun_a1(x): + return scipy.special.gegenbauer(N, 0)(sin(theta) * cos(x)) + + def fun_a2(x): + return scipy.special.gegenbauer(N - 1, 1)(sin(theta) * cos(x)) + + def fun_a5(x): + return ( + scipy.special.gegenbauer(N - 2, 2)(sin(theta) * cos(x)) + * cos(x) ** 2 + ) + + if N == 0: + A1 = 0 + A2 = 0 + A5 = 0 + pass + elif N == 2: + A1 = scipy.integrate.romberg(fun_a1, 0, pi / 2, divmax=20) + A2 = scipy.integrate.romberg(fun_a2, 0, pi / 2, divmax=20) + A5 = 0 + else: + A1 = scipy.integrate.romberg(fun_a1, 0, pi / 2, divmax=20) + A2 = scipy.integrate.romberg(fun_a2, 0, pi / 2, divmax=20) + A5 = scipy.integrate.romberg(fun_a5, 0, pi / 2, divmax=20) + + even += ( + (2 * N + 1) + # * scipy.special.spherical_yn(N, k * R) + * scipy.special.hankel2(N, k * R) + * ( + -A1 * B1 + + ((1 / k / R) * A2 * B2) + - ((1 / k ** 2 / R ** 2) * A5 * B1) + ) + ) + else: + + def fun_a4(x): + return scipy.special.gegenbauer(N - 2, 2)( + sin(theta) * cos(x) + ) * cos(x) + + if N == 1: + A4 = 0 + else: + A4 = scipy.integrate.romberg(fun_a4, 0, pi / 2, divmax=20) + + odd += ( + (2 * N + 1) + # * scipy.special.spherical_yn(N, k * R) + * scipy.special.hankel2(N, k * R) + * A4 + * B2 + ) + even = nabla * cos(theta) * cos(phi) / pi * even + odd = nabla * sin(theta) * cos(theta) * cos(phi) / pi / k / R * odd + # print(even) + # print(odd) + Ep[count] = abs( + np.real(even) + np.real(odd) + 1j * (np.imag(even) + np.imag(odd)) + ) + # print(Ep[count]) + + # def fun2(x): return ( + # 1 + # * scipy.special.iv(0, pi * H * (1 - x**2)) + # # * scipy.special.jv(0, u * x) + # * np.sin(k * (o / 2) * x**2 * (1 - u**2)) + # * np.sin(k * u * x) + # ) + # Ep2 = 2 * scipy.integrate.romberg(fun2, 0, 1) + # Ep2 = sum(fun2(np.linspace(0, 1, 1000))) + # Ep[count] = abs(Ep1 - 1j * Ep2) + # Ep2 = np.exp(-1j * k * radius**2 * u**2 / 2 / d) + + count += 1 + + Pcorr = Ep ** 2 / max(Ep) ** 2 # * ffpwrden + + # Pcorr = (Ep**2 / Ep[-1]**2) * ffpwrden + # Pcorr = Ep + + # fig, ax = plt.subplots() + # ax.semilogx(delta, Pcorr) + # ax.set_xlim([0.01, 1.0]) + # ax.grid(True, which="both") + # ax.minorticks_on() + # ax.set_title("Near Field Corrections xbar: %s , slr: %s" % (xbar, side_lobe_ratio)) + # ax.set_xlabel("Normalized On Axis Distance") + # ax.set_ylabel("Normalized On Axis Power Density") + # return fig, ax + return pd.DataFrame(dict(delta=delta, Pcorr=Pcorr))
+ + +
[docs]def hazard_plot( + parameters: dict, + limit: float, + density: int = 1000, + xbar_max: float = 1.0, + gain_boost_db: int = 0, +): + """Hazard plot for parabolic dish. + + Receives user input parameters and hazard limit + for parabolic dish. Computes and returns hazard distance + plot. + + Args: + parameters (dict): parameters dict created with parameters function + limit (float): power density limit + density (int): (optional) number of points for plot, if none density=1000 + xbar_max (float): (optional) maximum value for xbar, if none is given xbar_max=1 + gain_boost (int): (optional) additional gain in dB to add to output power + + Returns: + pandas.DataFrame: dataframe containing a range column, a positive values column, and a negative values column + + Example: + >>> from antenna_intensity_modeler import parabolic + >>> import matplotlib.pyplot as plt + >>> + >>> params = parabolic.parameters(2.4, 8.4e9, 400.0, 0.62, 20.0) + >>> limit = 10.0 + >>> df = parabolic.hazard_plot(params, limit) + >>> rng = df.range.values + >>> positives = df.positives.values + >>> negatives = df.negatives.values + >>> + >>> fig, ax = plt.subplots() + >>> ax.plot(range, positives, range, negatives) + >>> ax.grid(True, which='both') + >>> ax.minorticks_on() + >>> ax.set_title('Hazard Plot with limit: %s w/m^2' % limit) + >>> ax.set_xlabel('Distance From Antenna(m)') + >>> ax.set_ylabel('Off Axis Distance (m)') + + .. image:: _static/hazard_plot.png + """ + + radius_meters = parameters.get("radius_meters") + freq_mhz = parameters.get("freq_mhz") + power_watts = parameters.get("power_watts") + efficiency = parameters.get("efficiency") + side_lobe_ratio = parameters.get("side_lobe_ratio") + H = parameters.get("H") + ffmin = parameters.get("ffmin") + ffpwrden = parameters.get("ffpwrden") + k = parameters.get("k") + + n = density + delta = np.linspace(1.0, 0.001, n) # Normalized farfield distances + # delta = np.logspace(-2, 0, n) + # delta = delta[::-1] + xbarArray = np.zeros(n) # np.ones(n) + Ep = np.zeros(n) + + # xbars = np.linspace(0, 1, 10) + step = 0.01 + xbars = np.arange(0, xbar_max + step, step) + + gain_boost = 10 ** (gain_boost_db / 10.0) + ffpwrden = gain_boost * ffpwrden + + last = 1e-9 + count = 0 + ff_reference = 0 + for d in delta: + for xbar in xbars: + xbarR = xbar * radius_meters + theta = np.arctan(xbarR / (d * ffmin)) + u = k * radius_meters * np.sin(theta) + + def fun1(x): + return ( + 1 + # * sp.special.iv(0, pi * H * (1 - x**2)**(1 / 2)) + * sp.special.jv(0, u * x) + * np.cos(pi * x ** 2 / 8 / d) + * x + ) + + # Ep1 = sp.integrate.romberg(fun1, 0, 1) + Ep1 = sum(fun1(np.linspace(0, 1, 1000))) + + def fun2(x): + return ( + 1 + # * sp.special.iv(0, pi * H * (1 - x**2)**(1 / 2)) + * sp.special.jv(0, u * x) + * np.sin(pi * x ** 2 / 8 / d) + * x + ) + + # Ep2 = sp.integrate.romberg(fun2, 0, 1) + Ep2 = sum(fun2(np.linspace(0, 1, 1000))) + + if d == 1.0 and xbar == 0.0: + ff_reference = (1 + np.cos(theta)) / d * abs(Ep1 - 1j * Ep2) + Ep = ff_reference + else: + Ep = (1 + np.cos(theta)) / d * abs(Ep1 - 1j * Ep2) + + power = ffpwrden * (Ep ** 2 / ff_reference ** 2) + if (power - limit) > 0: + # if power - limit > last: + xbarArray[count] = xbar + # last = power - limit + last = 1e-9 + count += 1 + + # fig, ax = plt.subplots() + # # ax.plot(delta[::-1] * ffmin, xbarArray[::-1] * radius_meters, + # # delta[::-1] * ffmin, xbarArray[::-1] * -radius_meters) + # _x = delta[::-1] * ffmin + # _y = xbarArray[::-1] * radius_meters + # _y_neg = -1 * _y + # degree = 0 + # rotate = [ + # [np.cos(degree * np.pi / 180), np.sin(degree * np.pi / 180)], + # [-np.sin(degree * np.pi / 180), np.cos(degree * np.pi / 180)] + # ] + # top = np.dot(np.column_stack((_x, _y)), rotate) + # bottom = np.dot(np.column_stack((_x, _y_neg)), rotate) + # ax.plot(top[:, 0], top[:, 1], bottom[:, 0], bottom[:, 1]) + # ax.grid(True, which='both') + # ax.minorticks_on() + # ax.set_title('Hazard Plot with limit: %s w/m^2' % limit) + # ax.set_xlabel('Distance From Antenna(m)') + # ax.set_ylabel('Off Axis Distance (m)') + # return fig, ax + return pd.DataFrame( + dict( + range=delta[::-1] * ffmin, + positives=xbarArray[::-1] * radius_meters, + negatives=xbarArray[::-1] * -radius_meters, + ) + )
+ + +
[docs]def combined_hazard_plot(parameters, limit, density=1000): + """Hazard plot for parabolic dish. + + Receives user input parameters and hazard limit + for parabolic dish. Computes and returns hazard distance + plot. + + :param parameters: parameters tuple created with parameters function + :param limit: power density limit + :param density: (optional) number of points for plot, if none density=1000 + :param xbar_max: (optional) maximum value for xbar, if none is given xbar_max=1 + :param gain_boost: (optional) additional numerical gain to add + :type parameters: tuple(float) + :type limit: float + :type xbar_max: int + :type gain_boost: float + :returns: figure and axes for hazard plot + :rtype: (figure, axes) + :Example: + + >>> from antenna_intensity_modeler import parabolic + >>> params = parabolic.parameters(2.4, 8.4e9, 400.0, 0.62, 20.0) + >>> fig, ax = hazard_plot(params, 10.0) + """ + radius_meters = parameters.get("radius_meters") + freq_mhz = parameters.get("freq_mhz") + power_watts = parameters.get("power_watts") + efficiency = parameters.get("efficiency") + side_lobe_ratio = parameters.get("side_lobe_ratio") + H = parameters.get("H") + ffmin = parameters.get("ffmin") + ffpwrden = parameters.get("ffpwrden") + k = parameters.get("k") + + n = density + delta = np.linspace(1.0, 0.01, n) # Normalized farfield distances + # x = np.logspace(-5, 0, 100) # Normalized farfield distances + x = np.linspace(0, 1, 1000) # Normalized to farfield distance + y = np.arange(0, 16.1, 0.1) # Normalized to radius + X, Y = np.meshgrid(x, y) + + txr_coord = [ + [-30 / ffmin, 2], + [-45 / ffmin, 6], + [-15 / ffmin, 6], + [-30 / ffmin, 10], + [-45 / ffmin, 14], + [-15 / ffmin, 14], + ] + + pd_field = np.zeros(X.shape) + eps = 1e-12 + + # Determine farfield power density + d = 1.0 + theta = 0.0 + u = 0.0 + + def fun1(x): + return ( + 1 + # * scipy.special.iv(0, pi * H * (1 - x**2)) + * scipy.special.jv(0, u * x) + * np.cos(pi * x ** 2 / 8 / d) + * x + ) + + Ep1 = scipy.integrate.romberg(fun1, 0, 1, divmax=20) + # Ep1 = sum(fun1(np.linspace(0, 1, 1000))) + + def fun2(x): + return ( + 1 + # * scipy.special.iv(0, pi * H * (1 - x**2)) + * scipy.special.jv(0, u * x) + * np.sin(pi * x ** 2 / 8 / d) + * x + ) + + Ep2 = scipy.integrate.romberg(fun2, 0, 1, divmax=20) + # Ep2 = sum(fun2(np.linspace(0, 1, 1000))) + + ff_reference = (1 + np.cos(theta)) / d * abs(Ep1 - 1j * Ep2) + + for i in range(len(y)): + for j in range(len(x)): + for coord in txr_coord: + _x = coord[0] + _y = coord[1] + diff_x = np.abs(X[i, j] - _x) * ffmin + diff_y = np.abs(Y[i, j] - _y) * radius_meters + theta = np.arctan(diff_y / (diff_x + eps)) + u = k * radius_meters * np.sin(theta) + + def fun1(x): + return ( + 1 + # * scipy.special.iv(0, pi * H * (1 - x**2)) + * scipy.special.jv(0, u * x) + * np.cos(pi * x ** 2 / 8 / abs(X[i, j] - _x)) + * x + ) + + Ep1 = scipy.integrate.romberg(fun1, 0, 1, divmax=20) + # Ep1 = sum(fun1(np.linspace(0, 1, 1000))) + + def fun2(x): + return ( + 1 + # * scipy.special.iv(0, pi * H * (1 - x**2)) + * scipy.special.jv(0, u * x) + * np.sin(pi * x ** 2 / 8 / abs(X[i, j] - _x)) + * x + ) + + Ep2 = scipy.integrate.romberg(fun2, 0, 1, divmax=20) + # Ep2 = sum(fun2(np.linspace(0, 1, 1000))) + + Ep = (1 + np.cos(theta)) / abs(X[i, j] - _x) * abs(Ep1 - 1j * Ep2) + pd_field[i, j] = ( + pd_field[i, j] + (Ep ** 2 / ff_reference ** 2) * ffpwrden + ) + + # Pcorr = (Ep**2 / Ep[-1]**2) * ffpwrden + + return X, Y, pd_field
+ + + +
+ +
+ +
+ + +
+
+ +
+ +
+ + + + + + + + + + + \ No newline at end of file diff --git a/docs/_build/html/_modules/index.html b/docs/_build/html/_modules/index.html index f56a9c0..4e82456 100644 --- a/docs/_build/html/_modules/index.html +++ b/docs/_build/html/_modules/index.html @@ -1,76 +1,196 @@ - - - - - - - Overview: module code — antenna-intensity-modeler 0.1.1 documentation - - - - - - - - - - - - -
-
-
-
- -

All modules for which code is available

- - -
-
-
- -
-
- - - + + + + + + + + + + + Overview: module code — Antenna Intensity Modeler 0.1.1 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + + + +
+ +
+ + + + + + + + + + + + + + + + + +
+ +
    + +
  • Docs »
  • + +
  • Overview: module code
  • + + +
  • + +
  • + +
+ + +
+
+
+
+ +

All modules for which code is available

+ + +
+ +
+ + +
+
+ +
+ +
+ + + + + + + + + + + \ No newline at end of file diff --git a/docs/_build/html/_sources/antenna_intensity_modeler.rst.txt b/docs/_build/html/_sources/antenna_intensity_modeler.rst.txt index 21b9e21..a88b5cd 100644 --- a/docs/_build/html/_sources/antenna_intensity_modeler.rst.txt +++ b/docs/_build/html/_sources/antenna_intensity_modeler.rst.txt @@ -1,30 +1,57 @@ -antenna\_intensity\_modeler package -=================================== - -Submodules ----------- - -antenna\_intensity\_modeler.cli module --------------------------------------- - -.. automodule:: antenna_intensity_modeler.cli - :members: - :undoc-members: - :show-inheritance: - -antenna\_intensity\_modeler.parabolic module --------------------------------------------- - -.. automodule:: antenna_intensity_modeler.parabolic - :members: - :undoc-members: - :show-inheritance: - - -Module contents ---------------- - -.. automodule:: antenna_intensity_modeler - :members: - :undoc-members: - :show-inheritance: + +Submodules +---------- + +antenna\_intensity\_modeler.cli module +-------------------------------------- + +.. automodule:: antenna_intensity_modeler.cli + :members: + :undoc-members: + :show-inheritance: + +antenna\_intensity\_modeler.parabolic module +-------------------------------------------- + +.. automodule:: antenna_intensity_modeler.parabolic + :members: + :undoc-members: + :show-inheritance: + + +Module contents +--------------- + +.. automodule:: antenna_intensity_modeler + :members: + :undoc-members: + :show-inheritance: +======= +antenna\_intensity\_modeler package +=================================== + +.. automodule:: antenna_intensity_modeler + :members: + :undoc-members: + :show-inheritance: + +Submodules +---------- + +antenna\_intensity\_modeler.cli module +-------------------------------------- + +.. automodule:: antenna_intensity_modeler.cli + :members: + :undoc-members: + :show-inheritance: + +antenna\_intensity\_modeler.parabolic module +-------------------------------------------- + +.. automodule:: antenna_intensity_modeler.parabolic + :members: + :undoc-members: + :show-inheritance: + + diff --git a/docs/_build/html/_sources/index.rst.txt b/docs/_build/html/_sources/index.rst.txt index 2593765..8425b0f 100644 --- a/docs/_build/html/_sources/index.rst.txt +++ b/docs/_build/html/_sources/index.rst.txt @@ -1,5 +1,6 @@ -Welcome to antenna-intensity-modeler's documentation! -====================================== +======= +Welcome to the Antenna Intensity Modeler documentation! +======================================================= .. toctree:: :maxdepth: 2 diff --git a/docs/_build/html/_static/nature.css b/docs/_build/html/_static/nature.css deleted file mode 100644 index 1572f54..0000000 --- a/docs/_build/html/_static/nature.css +++ /dev/null @@ -1,252 +0,0 @@ -/* - * nature.css_t - * ~~~~~~~~~~~~ - * - * Sphinx stylesheet -- nature theme. - * - * :copyright: Copyright 2007-2019 by the Sphinx team, see AUTHORS. - * :license: BSD, see LICENSE for details. - * - */ - -@import url("basic.css"); - -/* -- page layout ----------------------------------------------------------- */ - -body { - font-family: Arial, sans-serif; - font-size: 100%; - background-color: #fff; - color: #555; - margin: 0; - padding: 0; -} - -div.documentwrapper { - float: left; - width: 100%; -} - -div.bodywrapper { - margin: 0 0 0 230px; -} - -hr { - border: 1px solid #B1B4B6; -} - -div.document { - background-color: #eee; -} - -div.body { - background-color: #ffffff; - color: #3E4349; - padding: 0 30px 30px 30px; - font-size: 0.9em; -} - -div.footer { - color: #555; - width: 100%; - padding: 13px 0; - text-align: center; - font-size: 75%; -} - -div.footer a { - color: #444; - text-decoration: underline; -} - -div.related { - background-color: #6BA81E; - line-height: 32px; - color: #fff; - text-shadow: 0px 1px 0 #444; - font-size: 0.9em; -} - -div.related a { - color: #E2F3CC; -} - -div.sphinxsidebar { - font-size: 0.75em; - line-height: 1.5em; -} - -div.sphinxsidebarwrapper{ - padding: 20px 0; -} - -div.sphinxsidebar h3, -div.sphinxsidebar h4 { - font-family: Arial, sans-serif; - color: #222; - font-size: 1.2em; - font-weight: normal; - margin: 0; - padding: 5px 10px; - background-color: #ddd; - text-shadow: 1px 1px 0 white -} - -div.sphinxsidebar h4{ - font-size: 1.1em; -} - -div.sphinxsidebar h3 a { - color: #444; -} - - -div.sphinxsidebar p { - color: #888; - padding: 5px 20px; -} - -div.sphinxsidebar p.topless { -} - -div.sphinxsidebar ul { - margin: 10px 20px; - padding: 0; - color: #000; -} - -div.sphinxsidebar a { - color: #444; -} - -div.sphinxsidebar input { - border: 1px solid #ccc; - font-family: sans-serif; - font-size: 1em; -} - -div.sphinxsidebar .searchformwrapper { - margin-left: 20px; - margin-right: 20px; -} - -/* -- body styles ----------------------------------------------------------- */ - -a { - color: #005B81; - text-decoration: none; -} - -a:hover { - color: #E32E00; - text-decoration: underline; -} - -div.body h1, -div.body h2, -div.body h3, -div.body h4, -div.body h5, -div.body h6 { - font-family: Arial, sans-serif; - background-color: #BED4EB; - font-weight: normal; - color: #212224; - margin: 30px 0px 10px 0px; - padding: 5px 0 5px 10px; - text-shadow: 0px 1px 0 white -} - -div.body h1 { border-top: 20px solid white; margin-top: 0; font-size: 200%; } -div.body h2 { font-size: 150%; background-color: #C8D5E3; } -div.body h3 { font-size: 120%; background-color: #D8DEE3; } -div.body h4 { font-size: 110%; background-color: #D8DEE3; } -div.body h5 { font-size: 100%; background-color: #D8DEE3; } -div.body h6 { font-size: 100%; background-color: #D8DEE3; } - -a.headerlink { - color: #c60f0f; - font-size: 0.8em; - padding: 0 4px 0 4px; - text-decoration: none; -} - -a.headerlink:hover { - background-color: #c60f0f; - color: white; -} - -div.body p, div.body dd, div.body li { - line-height: 1.5em; -} - -div.admonition p.admonition-title + p { - display: inline; -} - -div.highlight{ - background-color: white; -} - -div.note { - background-color: #eee; - border: 1px solid #ccc; -} - -div.seealso { - background-color: #ffc; - border: 1px solid #ff6; -} - -div.topic { - background-color: #eee; -} - -div.warning { - background-color: #ffe4e4; - border: 1px solid #f66; -} - -p.admonition-title { - display: inline; -} - -p.admonition-title:after { - content: ":"; -} - -pre { - padding: 10px; - background-color: White; - color: #222; - line-height: 1.2em; - border: 1px solid #C6C9CB; - font-size: 1.1em; - margin: 1.5em 0 1.5em 0; - -webkit-box-shadow: 1px 1px 1px #d8d8d8; - -moz-box-shadow: 1px 1px 1px #d8d8d8; -} - -code { - background-color: #ecf0f3; - color: #222; - /* padding: 1px 2px; */ - font-size: 1.1em; - font-family: monospace; -} - -.viewcode-back { - font-family: Arial, sans-serif; -} - -div.viewcode-block:target { - background-color: #f4debf; - border-top: 1px solid #ac9; - border-bottom: 1px solid #ac9; -} - -div.code-block-caption { - background-color: #ddd; - color: #222; - border: 1px solid #C6C9CB; -} \ No newline at end of file diff --git a/docs/_build/html/antenna_intensity_modeler.html b/docs/_build/html/antenna_intensity_modeler.html index d330c1b..e28f5ca 100644 --- a/docs/_build/html/antenna_intensity_modeler.html +++ b/docs/_build/html/antenna_intensity_modeler.html @@ -1,253 +1,427 @@ - - - - - - - antenna_intensity_modeler package — antenna-intensity-modeler 0.1.1 documentation - - - - - - - - - - - - - - -
-
-
-
- -
-

antenna_intensity_modeler package

-
-

Submodules

-
-
-

antenna_intensity_modeler.cli module

-
-
-

antenna_intensity_modeler.parabolic module

-

Main module.

-
-
-antenna_intensity_modeler.parabolic.hazard_plot(parameters, limit, density=1000, xbar_max=1, gain_boost=None)[source]
-

Hazard plot for parabolic dish.

-

Receives user input parameters and hazard limit -for parabolic dish. Computes and returns hazard distance -plot.

-
-
Parameters
-
    -
  • parameters (tuple(float)) – parameters tuple created with parameters function

  • -
  • limit (float) – power density limit

  • -
  • density – (optional) number of points for plot, if none density=1000

  • -
  • xbar_max (int) – (optional) maximum value for xbar, if none is given xbar_max=1

  • -
  • gain_boost (float) – (optional) additional numerical gain to add

  • -
-
-
Returns
-

figure and axes for hazard plot

-
-
Return type
-

(figure, axes)

-
-
Example
-

-
-
>>> from antenna_intensity_modeler import parabolic
->>> params = parabolic.parameters(2.4, 8.4e9, 400.0, 0.62, 20.0)
->>> fig, ax = hazard_plot(params, 10.0)
-
-
-
- -
-
-antenna_intensity_modeler.parabolic.near_field_corrections(parameters, xbar)[source]
-

Near field corrections for parabolic dish.

-

Receives user input parameters and normalized off axis distance -for parabolic dish computes and returns plot of near field correction -factors.

-
-
Parameters
-
    -
  • parameters (tuple(float)) – parameters tuple created with parameters function

  • -
  • xbar (float) – normalized off-axis distance

  • -
-
-
Returns
-

dataframe

-
-
Return type
-

pandas dataframe

-
-
Example
-

-
-
>>> from antenna_intensity_modeler import parabolic
->>> import matplotlib.pyplot as plt
->>> params = parabolic.parameters(2.4, 8.4e9, 400.0, 0.62, 20.0)
->>> xbar = 1.0
->>> table = parabolic.near_field_corrections(params, xbar)
->>> fig, ax = plt.subplots()
->>> ax.semilogx(table.delta, table.Pcorr)
->>> ax.set_xlim([0.01, 1.0])
->>> ax.grid(True, which="both")
->>> ax.minorticks_on()
->>> side_lobe_ratio = params[4]
->>> ax.set_title("Near Field Corrections xbar: %s , slr: %s" % (xbar, side_lobe_ratio))
->>> ax.set_xlabel("Normalized On Axis Distance")
->>> ax.set_ylabel("Normalized On Axis Power Density")
->>> fig.show()
-
-
-_images/nfcImage.png -
- -
-
-antenna_intensity_modeler.parabolic.parameters(radius_meters, freq_mhz, power_watts, efficiency, side_lobe_ratio)[source]
-

Parameters for parabolic dish

-

Receives user input parameters for parabolic dish and -computes and returns all needed parameters for parabolic -functions.

-
-
Parameters
-
    -
  • radius_meters (float) – antenna radius in meters.

  • -
  • freq_mhz (float) – frequency in megahertz.

  • -
  • power_watts (float) – output power of radio in watts.

  • -
  • efficiency (float) – efficiency of antenna.

  • -
  • side_lobe_ratio (float) – side lobe ratio of antenna.

  • -
-
-
Returns
-

parameters needed for parabolic functions.

-
-
Return type
-

tuple(float)

-
-
Example
-

-
-
>>> from antenna_intensity_modeler import parabolic
->>> params = parabolic.parameters(2.4, 8400., 400.0, 0.62, 20.0)
->>> params
-(2.4, 8400., 400, 0.62, 20, 0.4872, 1290.24, 2.1134, 175.929)
-
-
-
- -
-
-antenna_intensity_modeler.parabolic.print_parameters(parameters)[source]
-

Prints formated parameter list.

-
-
Args:

parameters(tuple): parameters tuple created with parameters function

-
-
Returns:

none

-
-
-
- -
-
-

Module contents

-

Top-level package for antenna-intensity-modeler.

-
-
- - -
-
-
- -
-
- - - + + + + + + + + + + + antenna_intensity_modeler package — Antenna Intensity Modeler 0.1.1 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + + + +
+ +
+ + + + + + + + + + + + + + + + + +
+ + + + +
+
+
+
+ +
+

antenna_intensity_modeler package

+

Top-level package for antenna-intensity-modeler.

+
+

Submodules

+
+
+

antenna_intensity_modeler.cli module

+

Console script for antenna_intensity_modeler.

+
+
+

antenna_intensity_modeler.parabolic module

+

Main module for parabolic reflector antennas.

+
+
+antenna_intensity_modeler.parabolic.combined_hazard_plot(parameters, limit, density=1000)[source]
+

Hazard plot for parabolic dish.

+

Receives user input parameters and hazard limit +for parabolic dish. Computes and returns hazard distance +plot.

+ +++ + + + + + + + + + +
Parameters:
    +
  • parameters (tuple(float)) – parameters tuple created with parameters function
  • +
  • limit (float) – power density limit
  • +
  • density – (optional) number of points for plot, if none density=1000
  • +
  • xbar_max (int) – (optional) maximum value for xbar, if none is given xbar_max=1
  • +
  • gain_boost (float) – (optional) additional numerical gain to add
  • +
+
Returns:

figure and axes for hazard plot

+
Return type:

(figure, axes)

+
Example:
+
>>> from antenna_intensity_modeler import parabolic
+>>> params = parabolic.parameters(2.4, 8.4e9, 400.0, 0.62, 20.0)
+>>> fig, ax = hazard_plot(params, 10.0)
+
+
+
+ +
+
+antenna_intensity_modeler.parabolic.hazard_plot(parameters: dict, limit: float, density: int = 1000, xbar_max: float = 1.0, gain_boost_db: int = 0)[source]
+

Hazard plot for parabolic dish.

+

Receives user input parameters and hazard limit +for parabolic dish. Computes and returns hazard distance +plot.

+ +++ + + + + + + + +
Parameters:
    +
  • parameters (dict) – parameters dict created with parameters function
  • +
  • limit (float) – power density limit
  • +
  • density (int) – (optional) number of points for plot, if none density=1000
  • +
  • xbar_max (float) – (optional) maximum value for xbar, if none is given xbar_max=1
  • +
  • gain_boost (int) – (optional) additional gain in dB to add to output power
  • +
+
Returns:

dataframe containing a range column, a positive values column, and a negative values column

+
Return type:

pandas.DataFrame

+
+

Example

+
>>> from antenna_intensity_modeler import parabolic
+>>> import matplotlib.pyplot as plt
+>>>
+>>> params = parabolic.parameters(2.4, 8.4e9, 400.0, 0.62, 20.0)
+>>> limit = 10.0
+>>> df = parabolic.hazard_plot(params, limit)
+>>> rng = df.range.values
+>>> positives = df.positives.values
+>>> negatives = df.negatives.values
+>>>
+>>> fig, ax = plt.subplots()
+>>> ax.plot(range, positives, range, negatives)
+>>> ax.grid(True, which='both')
+>>> ax.minorticks_on()
+>>> ax.set_title('Hazard Plot with limit: %s w/m^2' % limit)
+>>> ax.set_xlabel('Distance From Antenna(m)')
+>>> ax.set_ylabel('Off Axis Distance (m)')
+
+
+_images/hazard_plot.png +
+ +
+
+antenna_intensity_modeler.parabolic.near_field_corrections(parameters: dict, xbar: float) → pandas.core.frame.DataFrame[source]
+

Near field corrections for parabolic dish.

+

Receives user input parameters and normalized off axis distance +for parabolic dish. Computes and returns plot of near field correction +factors.

+ +++ + + + + + + + +
Parameters:
    +
  • parameters (dict) – parameters tuple created with parameters function
  • +
  • xbar (float) – normalized off-axis distance
  • +
+
Returns:

A dataframe with “delta” and “Pcorr” columns

+
Return type:

pandas.DataFrame

+
+

Example

+
>>> from antenna_intensity_modeler import parabolic
+>>> import matplotlib.pyplot as plt
+>>> params = parabolic.parameters(2.4, 8.4e9, 400.0, 0.62, 20.0)
+>>> xbar = 1.0
+>>> table = parabolic.near_field_corrections(params, xbar)
+>>> fig, ax = plt.subplots()
+>>> ax.semilogx(table.delta, table.Pcorr)
+>>> ax.set_xlim([0.01, 1.0])
+>>> ax.grid(True, which="both")
+>>> ax.minorticks_on()
+>>> slr = params.get('side_lobe_ratio')
+>>> ax.set_title("Near Field Corrections xbar: %s , slr: %s" % (xbar, slr))
+>>> ax.set_xlabel("Normalized On Axis Distance")
+>>> ax.set_ylabel("Normalized On Axis Power Density")
+>>> fig.show()
+
+
+_images/near_field_plot.png +
+ +
+
+antenna_intensity_modeler.parabolic.parameters(radius_meters: float, freq_mhz: float, power_watts: float, efficiency: float, side_lobe_ratio: float) → dict[source]
+

Parameters for parabolic dish

+

Receives user input parameters for parabolic dish and +computes and returns all needed parameters for parabolic +functions.

+ +++ + + + + + + + +
Parameters:
    +
  • radius_meters (float) – antenna radius in meters.
  • +
  • freq_mhz (float) – frequency in megahertz.
  • +
  • power_watts (float) – output power of radio in watts.
  • +
  • efficiency (float) – efficiency of antenna.
  • +
  • side_lobe_ratio (float) – side lobe ratio of antenna.
  • +
+
Returns:

parameter dictionary needed for parabolic functions.

+
Return type:

dict

+
+

Example

+
>>> from antenna_intensity_modeler import parabolic
+>>> params = parabolic.parameters(2.4, 8400., 400.0, 0.62, 20.0)
+>>> params
+{'radius_meters': 2.4, 'freq_mhz': 8400.0, 'power_watts': 400.0, 'efficiency': 0.62,
+'side_lobe_ratio':20.0, 'H': 0.4872, 'ffmin': 1290.24, 'ffpwrden': 2.1134, 'k': 175.929}
+
+
+
+ +
+
+antenna_intensity_modeler.parabolic.print_parameters(parameters: dict)[source]
+

Prints formated parameter list.

+ +++ + + + + + +
Parameters:parameters (dict) – parameters tuple created with parameters function
Returns:none
+
+ +
+
+antenna_intensity_modeler.parabolic.test_method(parameters, xbar)[source]
+
+ +
+
+ + +
+ +
+ + +
+
+ +
+ +
+ + + + + + + + + + + \ No newline at end of file diff --git a/docs/_build/html/authors.html b/docs/_build/html/authors.html index a68f9bc..ab29dc3 100644 --- a/docs/_build/html/authors.html +++ b/docs/_build/html/authors.html @@ -1,123 +1,226 @@ - - - - - - - Credits — antenna-intensity-modeler 0.1.1 documentation - - - - - - - - - - - - - - -
-
-
-
- -
-

Credits

-
-

Development Lead

- -
-
-

Contributors

-

None yet. Why not be the first?

-
-
- - -
-
-
- -
-
- - - + + + + + + + + + + + Credits — Antenna Intensity Modeler 0.1.1 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + + + +
+ +
+ + + + + + + + + + + + + + + + + +
+ + + + +
+
+
+
+ +
+

Credits

+
+

Development Lead

+ +
+
+

Contributors

+

None yet. Why not be the first?

+
+
+ + +
+ +
+ + +
+
+ +
+ +
+ + + + + + + + + + + \ No newline at end of file diff --git a/docs/_build/html/contributing.html b/docs/_build/html/contributing.html index 242011d..096d20e 100644 --- a/docs/_build/html/contributing.html +++ b/docs/_build/html/contributing.html @@ -1,240 +1,345 @@ - - - - - - - Contributing — antenna-intensity-modeler 0.1.1 documentation - - - - - - - - - - - - - - -
-
-
-
- -
-

Contributing

-

Contributions are welcome, and they are greatly appreciated! Every little bit -helps, and credit will always be given.

-

You can contribute in many ways:

-
-

Types of Contributions

-
-

Report Bugs

-

Report bugs at https://github.com/wboxx1/antenna_intensity_modeler/issues.

-

If you are reporting a bug, please include:

-
    -
  • Your operating system name and version.

  • -
  • Any details about your local setup that might be helpful in troubleshooting.

  • -
  • Detailed steps to reproduce the bug.

  • -
-
-
-

Fix Bugs

-

Look through the GitHub issues for bugs. Anything tagged with “bug” and “help -wanted” is open to whoever wants to implement it.

-
-
-

Implement Features

-

Look through the GitHub issues for features. Anything tagged with “enhancement” -and “help wanted” is open to whoever wants to implement it.

-
-
-

Write Documentation

-

antenna-intensity-modeler could always use more documentation, whether as part of the -official antenna-intensity-modeler docs, in docstrings, or even on the web in blog posts, -articles, and such.

-
-
-

Submit Feedback

-

The best way to send feedback is to file an issue at https://github.com/wboxx1/antenna_intensity_modeler/issues.

-

If you are proposing a feature:

-
    -
  • Explain in detail how it would work.

  • -
  • Keep the scope as narrow as possible, to make it easier to implement.

  • -
  • Remember that this is a volunteer-driven project, and that contributions -are welcome :)

  • -
-
-
-
-

Get Started!

-

Ready to contribute? Here’s how to set up antenna-intensity-modeler for local development.

-
    -
  1. Fork the antenna-intensity-modeler repo on GitHub.

  2. -
  3. Clone your fork locally:

    -
    $ git clone git@github.com:your_name_here/antenna-intensity-modeler.git
    -
    -
    -
  4. -
  5. Install your local copy into a virtualenv using poetry. Assuming you have poetry installed, this is how you set up your fork for local development:

    -
    $ cd antenna_intensity_modeler/
    -$ poetry install
    -$ poetry shell
    -
    -
    -
  6. -
  7. Create a branch for local development:

    -
    $ git checkout -b name-of-your-bugfix-or-feature
    -
    -
    -

    Now you can make your changes locally.

    -
  8. -
  9. When you’re done making changes, check that your changes pass flake8 and the -tests, including testing other Python versions with tox:

    -
    $ flake8 src/antenna_intensity_modeler tests
    -$ tox
    -
    -
    -

    To get flake8 and tox, just pip install them into your virtualenv.

    -
  10. -
  11. Commit your changes and push your branch to GitHub:

    -
    $ git add .
    -$ git commit -m "Your detailed description of your changes."
    -$ git push origin name-of-your-bugfix-or-feature
    -
    -
    -
  12. -
  13. Submit a pull request through the GitHub website.

  14. -
-
-
-

Pull Request Guidelines

-

Before you submit a pull request, check that it meets these guidelines:

-
    -
  1. The pull request should include tests.

  2. -
  3. If the pull request adds functionality, the docs should be updated. Put -your new functionality into a function with a docstring, and add the -feature to the list in README.rst.

  4. -
  5. The pull request should work for Python 2.7, 3.4, 3.5 and 3.6, and for PyPy. Check -https://travis-ci.org/wboxx1/antenna_intensity_modeler/pull_requests -https://ci.appveyor.com/project/wboxx1/antenna_intensity_modeler -and make sure that the tests pass for all supported Python versions.

  6. -
-
-
-

Tips

-

To run a subset of tests:

-
$ poetry run pytest tests/
-
-
-
-
-

Deploying

-

A reminder for the maintainers on how to deploy. -Make sure all your changes are committed (including an entry in HISTORY.rst). -Then run:

-
$ bump2version patch # possible: major / minor / patch
-$ git push
-$ git push --tags
-
-
-

Travis will then deploy to PyPI if tests pass.

-
-
- - -
-
-
- -
-
- - - + + + + + + + + + + + Contributing — Antenna Intensity Modeler 0.1.1 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + + + +
+ +
+ + + + + + + + + + + + + + + + + +
+ + + + +
+
+
+
+ +
+

Contributing

+

Contributions are welcome, and they are greatly appreciated! Every little bit +helps, and credit will always be given.

+

You can contribute in many ways:

+
+

Types of Contributions

+
+

Report Bugs

+

Report bugs at https://github.com/wboxx1/antenna_intensity_modeler/issues.

+

If you are reporting a bug, please include:

+
    +
  • Your operating system name and version.
  • +
  • Any details about your local setup that might be helpful in troubleshooting.
  • +
  • Detailed steps to reproduce the bug.
  • +
+
+
+

Fix Bugs

+

Look through the GitHub issues for bugs. Anything tagged with “bug” and “help +wanted” is open to whoever wants to implement it.

+
+
+

Implement Features

+

Look through the GitHub issues for features. Anything tagged with “enhancement” +and “help wanted” is open to whoever wants to implement it.

+
+
+

Write Documentation

+

antenna-intensity-modeler could always use more documentation, whether as part of the +official antenna-intensity-modeler docs, in docstrings, or even on the web in blog posts, +articles, and such.

+
+
+

Submit Feedback

+

The best way to send feedback is to file an issue at https://github.com/wboxx1/antenna_intensity_modeler/issues.

+

If you are proposing a feature:

+
    +
  • Explain in detail how it would work.
  • +
  • Keep the scope as narrow as possible, to make it easier to implement.
  • +
  • Remember that this is a volunteer-driven project, and that contributions +are welcome :)
  • +
+
+
+
+

Get Started!

+

Ready to contribute? Here’s how to set up antenna-intensity-modeler for local development.

+
    +
  1. Fork the antenna-intensity-modeler repo on GitHub.

    +
  2. +
  3. Clone your fork locally:

    +
    $ git clone git@github.com:your_name_here/antenna-intensity-modeler.git
    +
    +
    +
  4. +
  5. Install your local copy into a virtualenv using poetry. Assuming you have poetry installed, this is how you set up your fork for local development:

    +
    $ cd antenna_intensity_modeler/
    +$ poetry install
    +$ poetry shell
    +
    +
    +
  6. +
  7. Create a branch for local development:

    +
    $ git checkout -b name-of-your-bugfix-or-feature
    +
    +
    +

    Now you can make your changes locally.

    +
  8. +
  9. When you’re done making changes, check that your changes pass flake8 and the +tests, including testing other Python versions with tox:

    +
    $ flake8 src/antenna_intensity_modeler tests
    +$ tox
    +
    +
    +

    To get flake8 and tox, just pip install them into your virtualenv.

    +
  10. +
  11. Commit your changes and push your branch to GitHub:

    +
    $ git add .
    +$ git commit -m "Your detailed description of your changes."
    +$ git push origin name-of-your-bugfix-or-feature
    +
    +
    +
  12. +
  13. Submit a pull request through the GitHub website.

    +
  14. +
+
+
+

Pull Request Guidelines

+

Before you submit a pull request, check that it meets these guidelines:

+
    +
  1. The pull request should include tests.
  2. +
  3. If the pull request adds functionality, the docs should be updated. Put +your new functionality into a function with a docstring, and add the +feature to the list in README.rst.
  4. +
  5. The pull request should work for Python 2.7, 3.4, 3.5 and 3.6, and for PyPy. Check +https://travis-ci.org/wboxx1/antenna_intensity_modeler/pull_requests +https://ci.appveyor.com/project/wboxx1/antenna_intensity_modeler +and make sure that the tests pass for all supported Python versions.
  6. +
+
+
+

Tips

+

To run a subset of tests:

+
$ poetry run pytest tests/
+
+
+
+
+

Deploying

+

A reminder for the maintainers on how to deploy. +Make sure all your changes are committed (including an entry in HISTORY.rst). +Then run:

+
$ bump2version patch # possible: major / minor / patch
+$ git push
+$ git push --tags
+
+
+

Travis will then deploy to PyPI if tests pass.

+
+
+ + +
+ +
+ + +
+
+ +
+ +
+ + + + + + + + + + + \ No newline at end of file diff --git a/docs/_build/html/genindex.html b/docs/_build/html/genindex.html index e16e60e..5e46ab6 100644 --- a/docs/_build/html/genindex.html +++ b/docs/_build/html/genindex.html @@ -1,125 +1,267 @@ - - - - - - - - Index — antenna-intensity-modeler 0.1.1 documentation - - - - - - - - - - - - -
-
- -
- -
-
- - - + + + + + + + + + + + + Index — Antenna Intensity Modeler 0.1.1 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + + + +
+ +
+ + + + + + + + + + + + + + + + + +
+ +
    + +
  • Docs »
  • + +
  • Index
  • + + +
  • + + + +
  • + +
+ + +
+
+ + + +
+
+ +
+ +
+ + + + + + + + + + + \ No newline at end of file diff --git a/docs/_build/html/history.html b/docs/_build/html/history.html index 6726e4d..ef256b0 100644 --- a/docs/_build/html/history.html +++ b/docs/_build/html/history.html @@ -1,108 +1,218 @@ - - - - - - - History — antenna-intensity-modeler 0.1.1 documentation - - - - - - - - - - - - - -
-
-
-
- -
-

History

-
-

0.1.0 (2018-12-15)

-
    -
  • First release on PyPI.

  • -
-
-
- - -
-
-
- -
-
- - - + + + + + + + + + + + History — Antenna Intensity Modeler 0.1.1 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + + + +
+ +
+ + + + + + + + + + + + + + + + + +
+ + + + +
+
+
+
+ +
+

History

+
+

0.1.0 (2018-12-15)

+
    +
  • First release on PyPI.
  • +
+
+
+ + +
+ +
+ + +
+
+ +
+ +
+ + + + + + + + + + + \ No newline at end of file diff --git a/docs/_build/html/index.html b/docs/_build/html/index.html index e0d3053..9cda766 100644 --- a/docs/_build/html/index.html +++ b/docs/_build/html/index.html @@ -1,146 +1,255 @@ - - - - - - - Welcome to antenna-intensity-modeler’s documentation! — antenna-intensity-modeler 0.1.1 documentation - - - - - - - - - - - - - -
-
- -
- -
-
- - - + + + + + + + + + + + Welcome to the Antenna Intensity Modeler documentation! — Antenna Intensity Modeler 0.1.1 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + + + +
+ +
+ + + + + + + + + + + + + + + + + +
+ +
    + +
  • Docs »
  • + +
  • Welcome to the Antenna Intensity Modeler documentation!
  • + + +
  • + + + View page source + + +
  • + +
+ + +
+
+ + + +
+
+ +
+ +
+ + + + + + + + + + + \ No newline at end of file diff --git a/docs/_build/html/installation.html b/docs/_build/html/installation.html index 278d743..a891663 100644 --- a/docs/_build/html/installation.html +++ b/docs/_build/html/installation.html @@ -1,139 +1,242 @@ - - - - - - - Installation — antenna-intensity-modeler 0.1.1 documentation - - - - - - - - - - - - - - -
-
-
-
- -
-

Installation

-
-

Stable release

-

To install antenna-intensity-modeler, run this command in your terminal:

-
$ pip install antenna-intensity-modeler
-
-
-

This is the preferred method to install antenna-intensity-modeler, as it will always install the most recent stable release.

-

If you don’t have pip installed, this Python installation guide can guide -you through the process.

-
-
-

From sources

-

The sources for antenna-intensity-modeler can be downloaded from the Github repo.

-

You can either clone the public repository:

-
$ git clone git://github.com/wboxx1/antenna-intensity-modeler
-
-
-

Or download the tarball:

-
$ curl  -OL https://github.com/wboxx1/antenna-intensity-modeler/tarball/master
-
-
-

Once you have a copy of the source, you can install into poetry virtual environment with:

-
$ poetry install
-
-
-
-
- - -
-
-
- -
-
- - - + + + + + + + + + + + Installation — Antenna Intensity Modeler 0.1.1 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + + + +
+ +
+ + + + + + + + + + + + + + + + + +
+ + + + +
+
+
+
+ +
+

Installation

+
+

Stable release

+

To install antenna-intensity-modeler, run this command in your terminal:

+
$ pip install antenna-intensity-modeler
+
+
+

This is the preferred method to install antenna-intensity-modeler, as it will always install the most recent stable release.

+

If you don’t have pip installed, this Python installation guide can guide +you through the process.

+
+
+

From sources

+

The sources for antenna-intensity-modeler can be downloaded from the Github repo.

+

You can either clone the public repository:

+
$ git clone git://github.com/wboxx1/antenna-intensity-modeler
+
+
+

Or download the tarball:

+
$ curl  -OL https://github.com/wboxx1/antenna-intensity-modeler/tarball/master
+
+
+

Once you have a copy of the source, you can install into poetry virtual environment with:

+
$ poetry install
+
+
+
+
+ + +
+ +
+ + +
+
+ +
+ +
+ + + + + + + + + + + \ No newline at end of file diff --git a/docs/_build/html/modules.html b/docs/_build/html/modules.html index fe67b55..8b2c3ad 100644 --- a/docs/_build/html/modules.html +++ b/docs/_build/html/modules.html @@ -1,115 +1,225 @@ - - - - - - - antenna_intensity_modeler — antenna-intensity-modeler 0.1.1 documentation - - - - - - - - - - - - - - -
-
- -
- -
-
- - - + + + + + + + + + + + antenna_intensity_modeler — Antenna Intensity Modeler 0.1.1 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + + + +
+ +
+ + + + + + + + + + + + + + + + + +
+ + + + +
+
+ + + +
+
+ +
+ +
+ + + + + + + + + + + \ No newline at end of file diff --git a/docs/_build/html/py-modindex.html b/docs/_build/html/py-modindex.html index 33b4ea6..b42476d 100644 --- a/docs/_build/html/py-modindex.html +++ b/docs/_build/html/py-modindex.html @@ -1,100 +1,225 @@ - - - - - - - Python Module Index — antenna-intensity-modeler 0.1.1 documentation - - - - - - - - - - - - - - - -
-
-
-
- - -

Python Module Index

- -
- a -
- - - - - - - - - - -
 
- a
- antenna_intensity_modeler -
    - antenna_intensity_modeler.parabolic -
- - -
-
-
- -
-
- - - + + + + + + + + + + + Python Module Index — Antenna Intensity Modeler 0.1.1 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + + + +
+ +
+ + + + + + + + + + + + + + + + + +
+ +
    + +
  • Docs »
  • + +
  • Python Module Index
  • + + +
  • + +
  • + +
+ + +
+
+
+
+ + +

Python Module Index

+ +
+ a +
+ + + + + + + + + + + + + +
 
+ a
+ antenna_intensity_modeler +
    + antenna_intensity_modeler.cli +
    + antenna_intensity_modeler.parabolic +
+ + +
+ +
+ + +
+
+ +
+ +
+ + + + + + + + + + + \ No newline at end of file diff --git a/docs/_build/html/readme.html b/docs/_build/html/readme.html index 9f2e626..478f40c 100644 --- a/docs/_build/html/readme.html +++ b/docs/_build/html/readme.html @@ -1,139 +1,242 @@ - - - - - - - antenna-intensity-modeler — antenna-intensity-modeler 0.1.1 documentation - - - - - - - - - - - - - - -
-
-
-
- -
-

antenna-intensity-modeler

-https://img.shields.io/pypi/v/antenna_intensity_modeler.svg -Build status on travis-ci -Build status on Appveyor -Updates -

Create near-field plots of parabolic dish antennas.

- -
-

Installation:

-
$ pip install antenna-intensity-modeler
-
-
-
-
-

Features

-
    -
  • TODO

  • -
-
-
-

Credits

-

This package was created with Cookiecutter and the wboxx1/cookiecutter-pypackage project template.

-
-
- - -
-
-
- -
-
- - - + + + + + + + + + + + antenna-intensity-modeler — Antenna Intensity Modeler 0.1.1 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + + + +
+ +
+ + + + + + + + + + + + + + + + + +
+ + + + +
+
+
+
+ +
+

antenna-intensity-modeler

+https://img.shields.io/pypi/v/antenna_intensity_modeler.svg +Build status on Azure DevOps +Updates +

Create near-field plots of parabolic dish antennas.

+ +
+

Installation:

+
$ pip install antenna-intensity-modeler
+
+
+
+
+

Features

+
    +
  • TODO
  • +
+
+
+

Credits

+

This package was created with Cookiecutter and the wboxx1/cookiecutter-pypackage project template.

+

[ ~ Dependencies scanned by PyUp.io ~ ]

+
+
+ + +
+ +
+ + +
+
+ +
+ +
+ + + + + + + + + + + \ No newline at end of file diff --git a/docs/_build/html/search.html b/docs/_build/html/search.html index 11225bf..f6c47e7 100644 --- a/docs/_build/html/search.html +++ b/docs/_build/html/search.html @@ -1,91 +1,216 @@ - - - - - - - Search — antenna-intensity-modeler 0.1.1 documentation - - - - - - - - - - - - - - - - - -
-
-
-
- -

Search

-
- -

- Please activate JavaScript to enable the search - functionality. -

-
-

- From here you can search these documents. Enter your search - words into the box below and click "search". Note that the search - function will automatically search for all of the words. Pages - containing fewer words won't appear in the result list. -

-
- - - -
- -
- -
- -
-
-
- -
-
- - - + + + + + + + + + + + Search — Antenna Intensity Modeler 0.1.1 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + + + +
+ +
+ + + + + + + + + + + + + + + + + +
+ +
    + +
  • Docs »
  • + +
  • Search
  • + + +
  • + + + +
  • + +
+ + +
+
+
+
+ + + + +
+ +
+ +
+ +
+ + +
+
+ +
+ +
+ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/_build/html/searchindex.js b/docs/_build/html/searchindex.js index 9c8467e..c962490 100644 --- a/docs/_build/html/searchindex.js +++ b/docs/_build/html/searchindex.js @@ -1 +1,434 @@ -Search.setIndex({docnames:["antenna_intensity_modeler","authors","contributing","history","index","installation","modules","readme","usage"],envversion:{"sphinx.domains.c":1,"sphinx.domains.changeset":1,"sphinx.domains.citation":1,"sphinx.domains.cpp":1,"sphinx.domains.javascript":1,"sphinx.domains.math":2,"sphinx.domains.python":1,"sphinx.domains.rst":1,"sphinx.domains.std":1,"sphinx.ext.viewcode":1,sphinx:56},filenames:["antenna_intensity_modeler.rst","authors.rst","contributing.rst","history.rst","index.rst","installation.rst","modules.rst","readme.rst","usage.rst"],objects:{"":{antenna_intensity_modeler:[0,0,0,"-"]},"antenna_intensity_modeler.parabolic":{hazard_plot:[0,1,1,""],near_field_corrections:[0,1,1,""],parameters:[0,1,1,""],print_parameters:[0,1,1,""]},antenna_intensity_modeler:{parabolic:[0,0,0,"-"]}},objnames:{"0":["py","module","Python module"],"1":["py","function","Python function"]},objtypes:{"0":"py:module","1":"py:function"},terms:{"4e9":0,"float":0,"function":[0,2],"import":[0,8],"int":0,"new":2,"public":[5,7],"return":0,"true":0,Near:0,The:[2,5],Then:2,Will:1,about:2,add:[0,2],addit:0,all:[0,2],alwai:[2,5],ani:2,antenna:[0,2,5,8],antenna_intensity_model:[2,4,8],anyth:2,appreci:2,appveyor:2,arg:0,articl:2,assum:2,axes:0,axi:0,befor:2,best:2,bit:2,blog:2,both:0,boxx:1,branch:2,bugfix:2,bump2vers:2,can:[2,5],chang:2,check:2,checkout:2,cli:6,clone:[2,5],com:[1,2,5],command:5,commit:2,comput:0,content:[4,6],contribut:4,contributor:4,cookiecutt:7,copi:[2,5],correct:0,could:2,creat:[0,2,7],credit:[2,4],curl:5,datafram:0,delta:0,densiti:0,deploi:4,descript:2,detail:2,develop:[2,4],dish:[0,7],distanc:0,doc:2,docstr:2,document:7,don:5,done:2,download:5,driven:2,easier:2,effici:0,either:5,enhanc:2,entri:2,environ:5,even:2,everi:2,exampl:0,explain:2,factor:0,featur:4,field:[0,7],fig:0,figur:0,file:2,first:[1,3],flake8:2,fork:2,format:0,free:7,freq_mhz:0,frequenc:0,from:[0,4],gain:0,gain_boost:0,gener:7,get:4,git:[2,5],github:[2,5,7],given:[0,2],gmail:1,gnu:7,greatli:2,grid:0,guid:5,guidelin:4,have:[2,5],hazard:0,hazard_plot:0,help:2,here:2,histori:[2,4],how:2,http:[2,5,7],includ:2,index:4,input:0,instal:[2,4],intens:[0,2,5,8],issu:2,just:2,keep:2,lead:4,level:0,licens:7,limit:0,list:[0,2],littl:2,lobe:0,local:2,look:2,main:0,maintain:2,major:2,make:2,mani:2,master:5,matplotlib:0,maximum:0,meet:2,megahertz:0,meter:0,method:5,might:2,minor:2,minorticks_on:0,model:[0,2,5,8],modul:[4,6],more:2,most:5,name:2,narrow:2,near_field_correct:0,need:0,none:[0,1],normal:0,now:2,number:0,numer:0,off:0,offici:2,onc:5,open:2,oper:2,option:0,org:2,origin:2,other:2,output:0,packag:[4,6,7],page:4,panda:0,parabol:[6,7],param:0,paramet:0,part:2,pass:2,patch:2,pcorr:0,pip:[2,5,7],pleas:2,plot:[0,7],plt:0,poetri:[2,5],point:0,possibl:2,post:2,power:0,power_watt:0,prefer:5,print:0,print_paramet:0,process:5,project:[2,7,8],propos:2,pull:4,pull_request:2,push:2,put:2,pypackag:7,pypi:[2,3],pyplot:0,pytest:2,python:[2,5],radio:0,radiu:0,radius_met:0,ratio:0,readi:2,readm:2,receiv:0,recent:5,releas:[3,4],rememb:2,remind:2,repo:[2,5],repositori:5,reproduc:2,request:4,rst:2,run:[2,5],scope:2,search:4,semilogx:0,send:2,set:2,set_titl:0,set_xlabel:0,set_xlim:0,set_ylabel:0,setup:2,shell:2,should:2,show:0,side:0,side_lobe_ratio:0,slr:0,softwar:7,sourc:[0,4],src:2,stabl:4,start:4,step:2,submodul:6,subplot:0,subset:2,support:2,sure:2,system:2,tabl:0,tag:2,tarbal:5,templat:7,termin:5,test:2,thei:2,them:2,thi:[2,5,7],through:[2,5],tip:4,todo:7,top:0,tox:2,travi:2,troubleshoot:2,tupl:0,type:[0,4],updat:2,usag:4,use:[2,8],user:0,using:2,valu:0,version:2,virtual:5,virtualenv:2,volunt:2,wai:2,want:2,watt:0,wboxx1:[1,2,5,7],web:2,websit:2,welcom:2,when:2,whether:2,which:0,whoever:2,why:1,work:2,would:2,xbar:0,xbar_max:0,yet:1,you:[2,5],your:[2,5],your_name_her:2},titles:["antenna_intensity_modeler package","Credits","Contributing","History","Welcome to antenna-intensity-modeler\u2019s documentation!","Installation","antenna_intensity_modeler","antenna-intensity-modeler","Usage"],titleterms:{antenna:[4,7],antenna_intensity_model:[0,6],bug:2,cli:0,content:0,contribut:2,contributor:1,credit:[1,7],deploi:2,develop:1,document:[2,4],featur:[2,7],feedback:2,fix:2,from:5,get:2,guidelin:2,histori:3,implement:2,indic:4,instal:[5,7],intens:[4,7],lead:1,model:[4,7],modul:0,packag:0,parabol:0,pull:2,releas:5,report:2,request:2,sourc:5,stabl:5,start:2,submit:2,submodul:0,tabl:4,tip:2,type:2,usag:8,welcom:4,write:2}}) \ No newline at end of file +Search.setIndex({ + docnames: [ + 'antenna_intensity_modeler', + 'authors', + 'contributing', + 'history', + 'index', + 'installation', + 'modules', + 'readme', + 'usage', + ], + envversion: { + 'sphinx.domains.c': 1, + 'sphinx.domains.changeset': 1, + 'sphinx.domains.cpp': 1, + 'sphinx.domains.javascript': 1, + 'sphinx.domains.math': 2, + 'sphinx.domains.python': 1, + 'sphinx.domains.rst': 1, + 'sphinx.domains.std': 1, + 'sphinx.ext.viewcode': 1, + sphinx: 55, + }, + filenames: [ + 'antenna_intensity_modeler.rst', + 'authors.rst', + 'contributing.rst', + 'history.rst', + 'index.rst', + 'installation.rst', + 'modules.rst', + 'readme.rst', + 'usage.rst', + ], + objects: { + '': { antenna_intensity_modeler: [ 0, 0, 0, '-' ] }, + 'antenna_intensity_modeler.parabolic': { + combined_hazard_plot: [ 0, 1, 1, '' ], + hazard_plot: [ 0, 1, 1, '' ], + near_field_corrections: [ 0, 1, 1, '' ], + parameters: [ 0, 1, 1, '' ], + print_parameters: [ 0, 1, 1, '' ], + test_method: [ 0, 1, 1, '' ], + }, + antenna_intensity_modeler: { + cli: [ 0, 0, 0, '-' ], + parabolic: [ 0, 0, 0, '-' ], + }, + }, + objnames: { + '0': [ 'py', 'module', 'Python module' ], + '1': [ 'py', 'function', 'Python function' ], + }, + objtypes: { '0': 'py:module', '1': 'py:function' }, + terms: { + '4e9': 0, + float: 0, + function: [ 0, 2 ], + import: [ 0, 8 ], + int: 0, + new: 2, + public: [ 5, 7 ], + return: 0, + true: 0, + Near: 0, + The: [ 2, 5 ], + Then: 2, + Will: 1, + about: 2, + add: [ 0, 2 ], + addit: 0, + all: [ 0, 2 ], + alwai: [ 2, 5 ], + ani: 2, + antenna: [ 0, 2, 5, 8 ], + antenna_intensity_model: [ 2, 4, 8 ], + anyth: 2, + appreci: 2, + appveyor: 2, + articl: 2, + assum: 2, + axes: 0, + axi: 0, + befor: 2, + best: 2, + bit: 2, + blog: 2, + both: 0, + boxx: 1, + branch: 2, + bugfix: 2, + bump2vers: 2, + can: [ 2, 5 ], + chang: 2, + check: 2, + checkout: 2, + cli: 6, + clone: [ 2, 5 ], + column: 0, + com: [ 1, 2, 5 ], + combined_hazard_plot: 0, + command: 5, + commit: 2, + comput: 0, + consol: 0, + contain: 0, + content: 4, + contribut: 4, + contributor: 4, + cookiecutt: 7, + copi: [ 2, 5 ], + core: 0, + correct: 0, + could: 2, + creat: [ 0, 2, 7 ], + credit: [ 2, 4 ], + curl: 5, + datafram: 0, + delta: 0, + densiti: 0, + depend: 7, + deploi: 4, + descript: 2, + detail: 2, + develop: [ 2, 4 ], + dict: 0, + dictionari: 0, + dish: [ 0, 7 ], + distanc: 0, + doc: 2, + docstr: 2, + document: 7, + don: 5, + done: 2, + download: 5, + driven: 2, + easier: 2, + effici: 0, + either: 5, + enhanc: 2, + entri: 2, + environ: 5, + even: 2, + everi: 2, + exampl: 0, + explain: 2, + factor: 0, + featur: 4, + ffmin: 0, + ffpwrden: 0, + field: [ 0, 7 ], + fig: 0, + figur: 0, + file: 2, + first: [ 1, 3 ], + flake8: 2, + fork: 2, + format: 0, + frame: 0, + free: 7, + freq_mhz: 0, + frequenc: 0, + from: [ 0, 4 ], + gain: 0, + gain_boost: 0, + gain_boost_db: 0, + gener: 7, + get: [ 0, 4 ], + git: [ 2, 5 ], + github: [ 2, 5, 7 ], + given: [ 0, 2 ], + gmail: 1, + gnu: 7, + greatli: 2, + grid: 0, + guid: 5, + guidelin: 4, + have: [ 2, 5 ], + hazard: 0, + hazard_plot: 0, + help: 2, + here: 2, + histori: [ 2, 4 ], + how: 2, + http: [ 2, 5, 7 ], + includ: 2, + index: 4, + input: 0, + instal: [ 2, 4 ], + intens: [ 0, 2, 5, 8 ], + issu: 2, + just: 2, + keep: 2, + lead: 4, + level: 0, + licens: 7, + limit: 0, + list: [ 0, 2 ], + littl: 2, + lobe: 0, + local: 2, + look: 2, + main: 0, + maintain: 2, + major: 2, + make: 2, + mani: 2, + master: 5, + matplotlib: 0, + maximum: 0, + meet: 2, + megahertz: 0, + meter: 0, + method: 5, + might: 2, + minor: 2, + minorticks_on: 0, + model: [ 0, 2, 5, 8 ], + modul: [ 4, 6 ], + more: 2, + most: 5, + name: 2, + narrow: 2, + near_field_correct: 0, + need: 0, + neg: 0, + none: [ 0, 1 ], + normal: 0, + now: 2, + number: 0, + numer: 0, + off: 0, + offici: 2, + onc: 5, + open: 2, + oper: 2, + option: 0, + org: 2, + origin: 2, + other: 2, + output: 0, + packag: [ 4, 6, 7 ], + page: 4, + panda: 0, + parabol: [ 6, 7 ], + param: 0, + paramet: 0, + part: 2, + pass: 2, + patch: 2, + pcorr: 0, + pip: [ 2, 5, 7 ], + pleas: 2, + plot: [ 0, 7 ], + plt: 0, + poetri: [ 2, 5 ], + point: 0, + posit: 0, + possibl: 2, + post: 2, + power: 0, + power_watt: 0, + prefer: 5, + print: 0, + print_paramet: 0, + process: 5, + project: [ 2, 7, 8 ], + propos: 2, + pull: 4, + pull_request: 2, + push: 2, + put: 2, + pypackag: 7, + pypi: [ 2, 3 ], + pyplot: 0, + pytest: 2, + python: [ 2, 5 ], + pyup: 7, + radio: 0, + radiu: 0, + radius_met: 0, + rang: 0, + ratio: 0, + readi: 2, + readm: 2, + receiv: 0, + recent: 5, + reflector: 0, + releas: [ 3, 4 ], + rememb: 2, + remind: 2, + repo: [ 2, 5 ], + repositori: 5, + reproduc: 2, + request: 4, + rng: 0, + rst: 2, + run: [ 2, 5 ], + scan: 7, + scope: 2, + script: 0, + search: 4, + semilogx: 0, + send: 2, + set: 2, + set_titl: 0, + set_xlabel: 0, + set_xlim: 0, + set_ylabel: 0, + setup: 2, + shell: 2, + should: 2, + show: 0, + side: 0, + side_lobe_ratio: 0, + slr: 0, + softwar: 7, + sourc: [ 0, 4 ], + src: 2, + stabl: 4, + start: 4, + step: 2, + submodul: 6, + subplot: 0, + subset: 2, + support: 2, + sure: 2, + system: 2, + tabl: 0, + tag: 2, + tarbal: 5, + templat: 7, + termin: 5, + test: 2, + test_method: 0, + thei: 2, + them: 2, + thi: [ 2, 5, 7 ], + through: [ 2, 5 ], + tip: 4, + todo: 7, + top: 0, + tox: 2, + travi: 2, + troubleshoot: 2, + tupl: 0, + type: [ 0, 4 ], + updat: 2, + usag: 4, + use: [ 2, 8 ], + user: 0, + using: 2, + valu: 0, + version: 2, + virtual: 5, + virtualenv: 2, + volunt: 2, + wai: 2, + want: 2, + watt: 0, + wboxx1: [ 1, 2, 5, 7 ], + web: 2, + websit: 2, + welcom: 2, + when: 2, + whether: 2, + which: 0, + whoever: 2, + why: 1, + work: 2, + would: 2, + xbar: 0, + xbar_max: 0, + yet: 1, + you: [ 2, 5 ], + your: [ 2, 5 ], + your_name_her: 2, + }, + titles: [ + 'antenna_intensity_modeler package', + 'Credits', + 'Contributing', + 'History', + 'Welcome to the Antenna Intensity Modeler documentation!', + 'Installation', + 'antenna_intensity_modeler', + 'antenna-intensity-modeler', + 'Usage', + ], + titleterms: { + antenna: [ 4, 7 ], + antenna_intensity_model: [ 0, 6 ], + bug: 2, + cli: 0, + contribut: 2, + contributor: 1, + credit: [ 1, 7 ], + deploi: 2, + develop: 1, + document: [ 2, 4 ], + featur: [ 2, 7 ], + feedback: 2, + fix: 2, + from: 5, + get: 2, + guidelin: 2, + histori: 3, + implement: 2, + indic: 4, + instal: [ 5, 7 ], + intens: [ 4, 7 ], + lead: 1, + model: [ 4, 7 ], + modul: 0, + packag: 0, + parabol: 0, + pull: 2, + releas: 5, + report: 2, + request: 2, + sourc: 5, + stabl: 5, + start: 2, + submit: 2, + submodul: 0, + tabl: 4, + tip: 2, + type: 2, + usag: 8, + welcom: 4, + write: 2, + }, +}); diff --git a/docs/_build/html/usage.html b/docs/_build/html/usage.html index 222bb9b..c5b3406 100644 --- a/docs/_build/html/usage.html +++ b/docs/_build/html/usage.html @@ -1,108 +1,216 @@ - - - - - - - Usage — antenna-intensity-modeler 0.1.1 documentation - - - - - - - - - - - - - - -
-
-
-
- -
-

Usage

-

To use antenna-intensity-modeler in a project:

-
import antenna_intensity_modeler
-
-
-
- - -
-
-
- -
-
- - - + + + + + + + + + + + Usage — Antenna Intensity Modeler 0.1.1 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + + + +
+ +
+ + + + + + + + + + + + + + + + + +
+ + + + +
+
+
+
+ +
+

Usage

+

To use antenna-intensity-modeler in a project:

+
import antenna_intensity_modeler
+
+
+
+ + +
+ +
+ + +
+
+ +
+ +
+ + + + + + + + + + + \ No newline at end of file diff --git a/docs/_static/nfcImage.png b/docs/_static/nfcImage.png index d33493e..3c00d7a 100644 Binary files a/docs/_static/nfcImage.png and b/docs/_static/nfcImage.png differ diff --git a/docs/_static/nfcImage1.png b/docs/_static/nfcImage1.png new file mode 100644 index 0000000..d33493e Binary files /dev/null and b/docs/_static/nfcImage1.png differ diff --git a/docs/antenna_intensity_modeler.rst b/docs/antenna_intensity_modeler.rst index 21b9e21..a88b5cd 100644 --- a/docs/antenna_intensity_modeler.rst +++ b/docs/antenna_intensity_modeler.rst @@ -1,30 +1,57 @@ -antenna\_intensity\_modeler package -=================================== - -Submodules ----------- - -antenna\_intensity\_modeler.cli module --------------------------------------- - -.. automodule:: antenna_intensity_modeler.cli - :members: - :undoc-members: - :show-inheritance: - -antenna\_intensity\_modeler.parabolic module --------------------------------------------- - -.. automodule:: antenna_intensity_modeler.parabolic - :members: - :undoc-members: - :show-inheritance: - - -Module contents ---------------- - -.. automodule:: antenna_intensity_modeler - :members: - :undoc-members: - :show-inheritance: + +Submodules +---------- + +antenna\_intensity\_modeler.cli module +-------------------------------------- + +.. automodule:: antenna_intensity_modeler.cli + :members: + :undoc-members: + :show-inheritance: + +antenna\_intensity\_modeler.parabolic module +-------------------------------------------- + +.. automodule:: antenna_intensity_modeler.parabolic + :members: + :undoc-members: + :show-inheritance: + + +Module contents +--------------- + +.. automodule:: antenna_intensity_modeler + :members: + :undoc-members: + :show-inheritance: +======= +antenna\_intensity\_modeler package +=================================== + +.. automodule:: antenna_intensity_modeler + :members: + :undoc-members: + :show-inheritance: + +Submodules +---------- + +antenna\_intensity\_modeler.cli module +-------------------------------------- + +.. automodule:: antenna_intensity_modeler.cli + :members: + :undoc-members: + :show-inheritance: + +antenna\_intensity\_modeler.parabolic module +-------------------------------------------- + +.. automodule:: antenna_intensity_modeler.parabolic + :members: + :undoc-members: + :show-inheritance: + + diff --git a/docs/conf.py b/docs/conf.py index 2b28525..3cb6116 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -20,7 +20,8 @@ # import os import sys -sys.path.insert(0, os.path.abspath('../src/')) + +sys.path.insert(0, os.path.abspath("../src/")) import antenna_intensity_modeler @@ -32,22 +33,22 @@ # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. -extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode'] +extensions = ["sphinx.ext.autodoc", "sphinx.ext.viewcode", "sphinx.ext.napoleon"] # Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] +templates_path = ["_templates"] # The suffix(es) of source filenames. # You can specify multiple suffix as a list of string: # # source_suffix = ['.rst', '.md'] -source_suffix = '.rst' +source_suffix = ".rst" # The master toctree document. -master_doc = 'index' +master_doc = "index" # General information about the project. -project = u'antenna-intensity-modeler' +project = u"Antenna Intensity Modeler" copyright = u"2018, Will Boxx" author = u"Will Boxx" @@ -70,10 +71,10 @@ # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. # This patterns also effect to html_static_path and html_extra_path -exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] +exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] # The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'sphinx' +pygments_style = "sphinx" # If true, `todo` and `todoList` produce output, else they produce nothing. todo_include_todos = False @@ -84,7 +85,9 @@ # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. # -html_theme = 'nature' +# html_theme = "nature" +# html_theme = "bizstyle" +html_theme = "sphinx_rtd_theme" # Theme options are theme-specific and customize the look and feel of a # theme further. For a list of options available for each theme, see the @@ -95,13 +98,13 @@ # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] +html_static_path = ["_static"] # -- Options for HTMLHelp output --------------------------------------- # Output file base name for HTML help builder. -htmlhelp_basename = 'antenna_intensity_modelerdoc' +htmlhelp_basename = "antenna_intensity_modelerdoc" # -- Options for LaTeX output ------------------------------------------ @@ -110,15 +113,12 @@ # The paper size ('letterpaper' or 'a4paper'). # # 'papersize': 'letterpaper', - # The font size ('10pt', '11pt' or '12pt'). # # 'pointsize': '10pt', - # Additional stuff for the LaTeX preamble. # # 'preamble': '', - # Latex figure (float) alignment # # 'figure_align': 'htbp', @@ -128,9 +128,13 @@ # (source start file, target name, title, author, documentclass # [howto, manual, or own class]). latex_documents = [ - (master_doc, 'antenna_intensity_modeler.tex', - u'antenna-intensity-modeler Documentation', - u'Will Boxx', 'manual'), + ( + master_doc, + "antenna_intensity_modeler.tex", + u"antenna-intensity-modeler Documentation", + u"Will Boxx", + "manual", + ), ] @@ -139,9 +143,13 @@ # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ - (master_doc, 'antenna_intensity_modeler', - u'antenna-intensity-modeler Documentation', - [author], 1) + ( + master_doc, + "antenna_intensity_modeler", + u"antenna-intensity-modeler Documentation", + [author], + 1, + ) ] @@ -151,13 +159,13 @@ # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ - (master_doc, 'antenna_intensity_modeler', - u'antenna-intensity-modeler Documentation', - author, - 'antenna_intensity_modeler', - 'One line description of project.', - 'Miscellaneous'), + ( + master_doc, + "antenna_intensity_modeler", + u"antenna-intensity-modeler Documentation", + author, + "antenna_intensity_modeler", + "One line description of project.", + "Miscellaneous", + ), ] - - - diff --git a/docs/index.rst b/docs/index.rst index 2593765..8425b0f 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,5 +1,6 @@ -Welcome to antenna-intensity-modeler's documentation! -====================================== +======= +Welcome to the Antenna Intensity Modeler documentation! +======================================================= .. toctree:: :maxdepth: 2 diff --git a/src/antenna_intensity_modeler/helpers.py b/src/antenna_intensity_modeler/helpers.py new file mode 100644 index 0000000..da2eac0 --- /dev/null +++ b/src/antenna_intensity_modeler/helpers.py @@ -0,0 +1,167 @@ +from typing import TypeVar, Generic, Callable, NewType + +A = TypeVar("A") +B = TypeVar("B") +C = TypeVar("C") +T = TypeVar("T") + + +class Monad: + # pure :: a -> M a + @staticmethod + def pure(x): + raise Exception("pure method needs to be implemented") + + # flat_map :: # M a -> (a -> M b) -> M b + def flat_map(self, f): + raise Exception("flat_map method needs to be implemented") + + # map :: # M a -> (a -> b) -> M b + def map(self, f): + return self.flat_map(lambda x: self.pure(f(x))) + + +class Option(Monad): + # pure :: a -> Option a + @staticmethod + def pure(x): + return Some(x) + + # flat_map :: # Option a -> (a -> Option b) -> Option b + def flat_map(self, f): + if self.defined: + return f(self.value) + else: + return nil + + +class Some(Option): + def __init__(self, value): + self.value = value + self.defined = True + + +class Nil(Option): + def __init__(self): + self.value = None + self.defined = False + + +nil = Nil() + + +class Either(Monad): + # pure :: a -> Either a + @staticmethod + def pure(value): + return Right(value) + + # flat_map :: # Either a -> (a -> Either b) -> Either b + def flat_map(self, f): + if self.is_left: + return self + else: + return f(self.value) + + def left(self, f): + if self.is_left: + return self.flat_map(f) + else: + return self + + def right(self, f): + if self.is_left: + return self + else: + return self.flat_map(f) + + +class Left(Either): + def __init__(self, value): + self.value = value + self.is_left = True + + def __str__(self): + return f"Left({self.value})" + + +class Right(Either): + def __init__(self, value): + self.value = value + self.is_left = False + + def __str__(self): + return f"Right({self.value})" + + +from functools import reduce +import threading + + +class Future(Monad): + # __init__ :: ((Either err a -> void) -> void) -> Future (Either err a) + def __init__(self, f): + self.subscribers = [] + self.cache = nil + self.semaphore = threading.BoundedSemaphore(1) + f(self.callback) + + # pure :: a -> Future a + @staticmethod + def pure(value): + return Future(lambda cb: cb(Either.pure(value))) + + def exec(f, cb): + try: + data = f() + cb(Right(data)) + except Exception as err: + cb(Left(err)) + + def exec_on_thread(f, cb): + t = threading.Thread(target=Future.exec, args=[f, cb]) + t.start() + + def async(f): + return Future(lambda cb: Future.exec_on_thread(f, cb)) + + # flat_map :: (a -> Future b) -> Future b + def flat_map(self, f): + return Future( + lambda cb: self.subscribe( + lambda value: cb(value) + if (value.is_left) + else f(value.value).subscribe(cb) + ) + ) + + # traverse :: [a] -> (a -> Future b) -> Future [b] + def traverse(arr): + return lambda f: reduce( + lambda acc, elem: acc.flat_map( + lambda values: f(elem).map(lambda value: values + [value]) + ), + arr, + Future.pure([]), + ) + + # callback :: Either err a -> void + def callback(self, value): + self.semaphore.acquire() + self.cache = Some(value) + while len(self.subscribers) > 0: + sub = self.subscribers.pop(0) + t = threading.Thread(target=sub, args=[value]) + t.start() + self.semaphore.release() + + # subscribe :: (Either err a -> void) -> void + def subscribe(self, subscriber): + self.semaphore.acquire() + if self.cache.defined: + self.semaphore.release() + subscriber(self.cache.value) + else: + self.subscribers.append(subscriber) + self.semaphore.release() + diff --git a/src/antenna_intensity_modeler/parabolic.py b/src/antenna_intensity_modeler/parabolic.py index 9ec53db..9c4207f 100644 --- a/src/antenna_intensity_modeler/parabolic.py +++ b/src/antenna_intensity_modeler/parabolic.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- -"""Main module.""" + +"""Main module for parabolic reflector antennas.""" import numpy as np import scipy as sp @@ -9,6 +10,9 @@ import pandas as pd from functools import partial from multiprocessing import Pool +from typing import Union, Callable +from concurrent.futures import ProcessPoolExecutor +from .helpers import Either, Left, Right # Units m = 1.0 @@ -19,31 +23,35 @@ s = 1.0 -def parameters(radius_meters, freq_mhz, power_watts, efficiency, side_lobe_ratio): +def parameters( + radius_meters: float, + freq_mhz: float, + power_watts: float, + efficiency: float, + side_lobe_ratio: float, +) -> dict: """Parameters for parabolic dish Receives user input parameters for parabolic dish and computes and returns all needed parameters for parabolic functions. - :param radius_meters: antenna radius in meters. - :param freq_mhz: frequency in megahertz. - :param power_watts: output power of radio in watts. - :param efficiency: efficiency of antenna. - :param side_lobe_ratio: side lobe ratio of antenna. - :type radius_meters: float - :type freq_mhz: float - :type power_watts: float - :type efficiency: float - :type side_lobe_ratio: float - :returns: parameters needed for parabolic functions. - :rtype: tuple(float) - :Example: - - >>> from antenna_intensity_modeler import parabolic - >>> params = parabolic.parameters(2.4, 8400., 400.0, 0.62, 20.0) - >>> params - (2.4, 8400., 400, 0.62, 20, 0.4872, 1290.24, 2.1134, 175.929) + Args: + radius_meters (float): antenna radius in meters. + freq_mhz (float): frequency in megahertz. + power_watts (float): output power of radio in watts. + efficiency (float): efficiency of antenna. + side_lobe_ratio (float): side lobe ratio of antenna. + + Returns: + dict: parameter dictionary needed for parabolic functions. + + Example: + >>> from antenna_intensity_modeler import parabolic + >>> params = parabolic.parameters(2.4, 8400., 400.0, 0.62, 20.0) + >>> params + {'radius_meters': 2.4, 'freq_mhz': 8400.0, 'power_watts': 400.0, 'efficiency': 0.62, + 'side_lobe_ratio':20.0, 'H': 0.4872, 'ffmin': 1290.24, 'ffpwrden': 2.1134, 'k': 175.929} """ """Constants""" @@ -93,165 +101,119 @@ def parameters(radius_meters, freq_mhz, power_watts, efficiency, side_lobe_ratio # return radius_meters, freq_mhz, power_watts, efficiency, side_lobe_ratio, H, ffmin, ffpwrden, k -def __run_near_field_corrections(d: float, parameters: dict): - radius = parameters["radius_meters"] - freq_mhz = parameters["freq_mhz"] - power_watts = parameters["power_watts"] - efficiency = parameters["efficiency"] - side_lobe_ratio = parameters["side_lobe_ratio"] - H = parameters["H"] - ffmin = parameters["ffmin"] - ffpwrden = parameters["ffpwrden"] - k = parameters["k"] - xbar = parameters["xbar"] +def bessel_func( + x: float, f: Union[np.cos, np.sin], H: float, u: float, d: float +) -> Callable: + return ( + 1 + * scipy.special.iv(0, pi * H * (1 - x ** 2)) # **(1 / 2)) + # * (1 - x**2) + * scipy.special.jv(0, u * x) + * f(pi * x ** 2 / 8 / d) + * x + ) - xbarR = xbar * radius - theta = np.arctan(xbarR / (d * ffmin)) - u = k * radius * np.sin(theta) +def romberg_integration( + fun: Callable, lower: int = 0, upper: int = 1, divmax: int = 20 +) -> Either: + try: + return Right(scipy.integrate.romberg(fun, lower, upper, divmax=divmax)) + except Exception as err: + return Left(err) - def fun1(x): - return ( - 1 - * scipy.special.iv(0, pi * H * (1 - x ** 2)) # **(1 / 2)) - # * (1 - x**2) - * scipy.special.jv(0, u * x) - * np.cos(pi * x ** 2 / 8 / d) - * x - ) - Ep1 = scipy.integrate.romberg(fun1, 0, 1) +def run_near_field_corrections(d: float, parameters: dict, xbar: float) -> float: + # Get parameters + radius = parameters.get("radius_meters") + freq_mhz = parameters.get("freq_mhz") + power_watts = parameters.get("power_watts") + efficiency = parameters.get("efficiency") + side_lobe_ratio = parameters.get("side_lobe_ratio") + H = parameters.get("H") + ffmin = parameters.get("ffmin") + ffpwrden = parameters.get("ffpwrden") + k = parameters.get("k") - def fun2(x): - return ( - 1 - * scipy.special.iv(0, pi * H * (1 - x ** 2)) # **(1 / 2)) - # * (1 - x**2) - * scipy.special.jv(0, u * x) - * np.sin(pi * x ** 2 / 8 / d) - * x - ) + xbarR = xbar * radius + theta = np.arctan(xbarR / (d * ffmin)) + u = k * radius * np.sin(theta) + + # Get Bessel Functions + bessel_func_cos = partial(bessel_func, f=np.cos, H=H, u=u, d=d) + bessel_func_sin = partial(bessel_func, f=np.sin, H=H, u=u, d=d) - Ep2 = scipy.integrate.romberg(fun2, 0, 1) + # Calculate Powers + # Ep1 = romberg_integration(bessel_func_cos, 0, 1, divmax=20) + # Ep2 = romberg_integration(bessel_func_sin, 0, 1, divmax=20) + Ep1 = scipy.integrate.romberg(bessel_func_cos, 0, 1, divmax=20) + Ep2 = scipy.integrate.romberg(bessel_func_sin, 0, 1, divmax=20) return (1 + np.cos(theta)) / d * abs(Ep1 - 1j * Ep2) -def near_field_corrections(parameters, xbar): + +def near_field_corrections( + parameters: dict, xbar: float, resolution: int = 1000 +) -> np.array: """Near field corrections for parabolic dish. Receives user input parameters and normalized off axis distance - for parabolic dish computes and returns plot of near field correction + for parabolic dish. Computes and returns plot of near field correction factors. - :param parameters: parameters tuple created with parameters function - :param xbar: normalized off-axis distance - :type parameters: tuple(float) - :type xbar: float - :returns: dataframe - :rtype: pandas dataframe - :Example: + Args: + parameters (tuple): parameters tuple created with parameters function. + xbar (float) : normalized off-axis distance. + resolution (float): number of points used in array. - >>> from antenna_intensity_modeler import parabolic - >>> import matplotlib.pyplot as plt - >>> params = parabolic.parameters(2.4, 8.4e9, 400.0, 0.62, 20.0) - >>> xbar = 1.0 - >>> table = parabolic.near_field_corrections(params, xbar) - >>> fig, ax = plt.subplots() - >>> ax.semilogx(table.delta, table.Pcorr) - >>> ax.set_xlim([0.01, 1.0]) - >>> ax.grid(True, which="both") - >>> ax.minorticks_on() - >>> side_lobe_ratio = params[4] - >>> ax.set_title("Near Field Corrections xbar: %s , slr: %s" % (xbar, side_lobe_ratio)) - >>> ax.set_xlabel("Normalized On Axis Distance") - >>> ax.set_ylabel("Normalized On Axis Power Density") - >>> fig.show() + Returns: + pandas.DataFrame: A dataframe with "delta" and "Pcorr" columns + + Example: + >>> from antenna_intensity_modeler import parabolic + >>> import matplotlib.pyplot as plt + >>> import numpy as np + >>> params = parabolic.parameters(2.4, 8400, 400.0, 0.62, 20.0) + >>> xbar = 1.0 + >>> resolution = 1000 + >>> power_norm = parabolic.near_field_corrections(params, xbar, resolution) + >>> fig, ax = plt.subplots() + >>> delta = np.logspace(-2, 0, resolution) + >>> ax.semilogx(delta, power_norm) + >>> ax.set_xlim([0.01, 1.0]) + >>> ax.grid(True, which="both") + >>> ax.minorticks_on() + >>> slr = params.get('side_lobe_ratio') + >>> ax.set_title("Near Field Corrections xbar: {}, slr: {}".format(xbar, slr)) + >>> ax.set_xlabel("Normalized On Axis Distance") + >>> ax.set_ylabel("Normalized On Axis Power Density") + >>> plt.show() .. image:: _static/nfcImage.png """ - run_with_params = partial(__run_near_field_corrections, parameters={**parameters, "xbar": xbar}) - delta = np.logspace(-2, 0, 1000) - # Ep = np.array(map(lambda x: run_with_params(x) ** 2, delta)) - p = Pool(5) - Ep = np.array(list(p.map(run_with_params, delta))) - Pcorr = Ep ** 2 / Ep[-1] ** 2 * parameters["ffpwrden"] - - # # radius, freq_mhz, power_watts, efficiency, side_lobe_ratio, H, ffmin, ffpwrden, k = tuple(parameters) - # radius = parameters["radius_meters"] - # freq_mhz = parameters["freq_mhz"] - # power_watts = parameters["power_watts"] - # efficiency = parameters["efficiency"] - # side_lobe_ratio = parameters["side_lobe_ratio"] - # H = parameters["H"] - # ffmin = parameters["ffmin"] - # ffpwrden = parameters["ffpwrden"] - # k = parameters["k"] - - # # delta = np.linspace(0.01, 1.0, 1000) # Normalized farfield distances - # delta = np.logspace(-2, 0, 1000) - # Ep = np.zeros(1000) - # count = 0 - # xbarR = xbar * radius - - # for d in delta: - # theta = np.arctan(xbarR / (d * ffmin)) - # u = k * radius * np.sin(theta) - - # def fun1(x): - # return ( - # 1 - # * scipy.special.iv(0, pi * H * (1 - x ** 2)) # **(1 / 2)) - # # * (1 - x**2) - # * scipy.special.jv(0, u * x) - # * np.cos(pi * x ** 2 / 8 / d) - # * x - # ) - - # Ep1 = scipy.integrate.romberg(fun1, 0, 1) - # # Ep1 = sum(fun1(np.linspace(0, 1, 1000))) - - # def fun2(x): - # return ( - # 1 - # * scipy.special.iv(0, pi * H * (1 - x ** 2)) # **(1 / 2)) - # # * (1 - x**2) - # * scipy.special.jv(0, u * x) - # * np.sin(pi * x ** 2 / 8 / d) - # * x - # ) - - # Ep2 = scipy.integrate.romberg(fun2, 0, 1) - # # Ep2 = sum(fun2(np.linspace(0, 1, 1000))) - # Ep[count] = (1 + np.cos(theta)) / d * abs(Ep1 - 1j * Ep2) - # count += 1 + run_with_params = partial( + run_near_field_corrections, parameters=parameters, xbar=xbar + ) + delta = np.logspace(-2, 0, resolution) + with ProcessPoolExecutor() as p: + Ep = np.array(list(p.map(run_with_params, delta))) + power_norm = Ep ** 2 / Ep[-1] ** 2 # * parameters["ffpwrden"] - # Pcorr = (Ep ** 2 / Ep[-1] ** 2) * ffpwrden - - # # fig, ax = plt.subplots() - # # ax.semilogx(delta, Pcorr) - # # ax.set_xlim([0.01, 1.0]) - # # ax.grid(True, which="both") - # # ax.minorticks_on() - # # ax.set_title("Near Field Corrections xbar: %s , slr: %s" % (xbar, side_lobe_ratio)) - # # ax.set_xlabel("Normalized On Axis Distance") - # # ax.set_ylabel("Normalized On Axis Power Density") - # # return fig, ax - return pd.DataFrame(dict(delta=delta, Pcorr=Pcorr)) + # return pd.DataFrame(dict(delta=delta, Pcorr=Pcorr)) + return power_norm def test_method(parameters, xbar): - ( - radius, - freq_mhz, - power_watts, - efficiency, - side_lobe_ratio, - H, - ffmin, - ffpwrden, - k, - ) = parameters + radius = parameters.get("radius_meters") + freq_mhz = parameters.get("freq_mhz") + power_watts = parameters.get("power_watts") + efficiency = parameters.get("efficiency") + side_lobe_ratio = parameters.get("side_lobe_ratio") + H = parameters.get("H") + ffmin = parameters.get("ffmin") + ffpwrden = parameters.get("ffpwrden") + k = parameters.get("k") # delta = np.linspace(0.01, 1.0, 1000) # Normalized farfield distances # delta = np.logspace(-2, 0, 100) @@ -370,7 +332,8 @@ def test_method(parameters, xbar): # print(k) # print(radius) # print(H) - print("{} of {}".format(count, len(delta)), end="\r") + + # print("{} of {}".format(count, len(delta)), end="\r") for N in range(50): def fun_b1(x): @@ -490,41 +453,172 @@ def fun_a4(x): return pd.DataFrame(dict(delta=delta, Pcorr=Pcorr)) -def hazard_plot(parameters, limit, density=1000, xbar_max=1, gain_boost=None): +def delta_xbar_split(delta_xbar: tuple, parameters: dict): + (d, xbar) = delta_xbar[0], delta_xbar[1] + return run_near_field_corrections(d, parameters, xbar) + + +def get_normalized_power_tensor( + parameters: dict, density: int = 1000, xbar_max: float = 1.0 +) -> np.array: + n = density + delta = np.linspace(0.001, 1.0, num=n) # Normalized farfield distances + + # step = 0.01 + step = xbar_max / density * 10 + xbars = np.arange(0, xbar_max, step) + + delta_xbars = np.reshape(np.array(np.meshgrid(delta, xbars)).T, (-1, 2)) + + chunksize = 100 + run_corrections_with_params = partial(delta_xbar_split, parameters=parameters) + with ProcessPoolExecutor() as p: + # map each delta, xbars tuple to the run_with_params partial function + mtrx = np.array( + list(p.map(run_corrections_with_params, delta_xbars, chunksize=chunksize)) + ) + # Reshape the resulting flattened array into a 2-d tensor representing + # 2-d space from txr center to farfield and down to txr edge + mtrx_reshaped = np.reshape(mtrx, (len(xbars), len(delta)), order="F") + # Normalize each row of tensor to maximum level at far field + return mtrx_reshaped ** 2 / mtrx_reshaped[:, -1][:, np.newaxis] ** 2 + + +def test_hazard_plot( + parameters: dict, + limit: float, + density: int = 1000, + xbar_max: float = 1.0, + gain_boost_db: int = 0.0, +) -> pd.DataFrame: """Hazard plot for parabolic dish. Receives user input parameters and hazard limit for parabolic dish. Computes and returns hazard distance plot. - :param parameters: parameters tuple created with parameters function - :param limit: power density limit - :param density: (optional) number of points for plot, if none density=1000 - :param xbar_max: (optional) maximum value for xbar, if none is given xbar_max=1 - :param gain_boost: (optional) additional numerical gain to add - :type parameters: tuple(float) - :type limit: float - :type xbar_max: int - :type gain_boost: float - :returns: figure and axes for hazard plot - :rtype: (figure, axes) - :Example: + Args: + parameters (dict): parameters dict created with parameters function + limit (float): power density limit + density (int): (optional) number of points for plot, if none density=1000 + xbar_max (float): (optional) maximum value for xbar, if none is given xbar_max=1 + gain_boost (int): (optional) additional gain in dB to add to output power - >>> from antenna_intensity_modeler import parabolic - >>> params = parabolic.parameters(2.4, 8.4e9, 400.0, 0.62, 20.0) - >>> fig, ax = hazard_plot(params, 10.0) + Returns: + pandas.DataFrame: dataframe containing a range column, a positive values column, and a negative values column + + Example: + >>> from antenna_intensity_modeler import parabolic + >>> import matplotlib.pyplot as plt + >>> + >>> params = parabolic.parameters(2.4, 8400, 400.0, 0.62, 20.0) + >>> limit = 10.0 + >>> df = parabolic.hazard_plot(params, limit) + >>> rng = df.range.values + >>> positives = df.positives.values + >>> negatives = df.negatives.values + >>> + >>> fig, ax = plt.subplots() + >>> ax.plot(range, positives, range, negatives) + >>> ax.grid(True, which='both') + >>> ax.minorticks_on() + >>> ax.set_title('Hazard Plot with limit: %s w/m^2' % limit) + >>> ax.set_xlabel('Distance From Antenna(m)') + >>> ax.set_ylabel('Off Axis Distance (m)') + + .. image:: _static/hazard_plot.png """ - ( - radius_meters, - freq_mhz, - power_watts, - efficiency, - side_lobe_ratio, - H, - ffmin, - ffpwrden, - k, - ) = parameters + radius_meters = parameters.get("radius_meters") + ffpwrden = parameters.get("ffpwrden") + ffmin = parameters.get("ffmin") + + gain_boost = 10 ** (gain_boost_db / 10.0) + ffpwrden_boosted = gain_boost * ffpwrden + delta = np.linspace(0.001, 1.0, num=density) # Normalized farfield distances + xbar_density = (xbar_max + 0.01) / 0.01 + + # Get the normalized power tensor + mtrx_normalized = get_normalized_power_tensor( + parameters, density=density, xbar_max=xbar_max + ) + + # Subtract normalized limit from normalized power tensor + mtrx_limited = mtrx_normalized - limit / ffpwrden_boosted + + pause = True + # find the index of the largest values less than zero + # divide by xbar density to determine position + mtrx_arg_max = np.argmax( + np.where(mtrx_limited < 0, mtrx_limited, -np.inf), axis=0 + ) * (xbar_max / density * 10) + + # mtrx_reduced = np.maximum.reduce( + # mtrx_limited, initial=-np.inf, where=[mtrx_limited < 0] + # ) + return pd.DataFrame( + dict( + range=delta * ffmin, + positives=mtrx_arg_max * radius_meters, + negatives=mtrx_arg_max * -radius_meters, + ) + ) + + +def hazard_plot( + parameters: dict, + limit: float, + density: int = 1000, + xbar_max: float = 1.0, + gain_boost_db: int = 0, +): + """Hazard plot for parabolic dish. + + Receives user input parameters and hazard limit + for parabolic dish. Computes and returns hazard distance + plot. + + Args: + parameters (dict): parameters dict created with parameters function + limit (float): power density limit + density (int): (optional) number of points for plot, if none density=1000 + xbar_max (float): (optional) maximum value for xbar, if none is given xbar_max=1 + gain_boost (int): (optional) additional gain in dB to add to output power + + Returns: + pandas.DataFrame: dataframe containing a range column, a positive values column, and a negative values column + + Example: + >>> from antenna_intensity_modeler import parabolic + >>> import matplotlib.pyplot as plt + >>> + >>> params = parabolic.parameters(2.4, 8.4e9, 400.0, 0.62, 20.0) + >>> limit = 10.0 + >>> df = parabolic.hazard_plot(params, limit) + >>> rng = df.range.values + >>> positives = df.positives.values + >>> negatives = df.negatives.values + >>> + >>> fig, ax = plt.subplots() + >>> ax.plot(range, positives, range, negatives) + >>> ax.grid(True, which='both') + >>> ax.minorticks_on() + >>> ax.set_title('Hazard Plot with limit: %s w/m^2' % limit) + >>> ax.set_xlabel('Distance From Antenna(m)') + >>> ax.set_ylabel('Off Axis Distance (m)') + + .. image:: _static/hazard_plot.png + """ + + radius_meters = parameters.get("radius_meters") + freq_mhz = parameters.get("freq_mhz") + power_watts = parameters.get("power_watts") + efficiency = parameters.get("efficiency") + side_lobe_ratio = parameters.get("side_lobe_ratio") + H = parameters.get("H") + ffmin = parameters.get("ffmin") + ffpwrden = parameters.get("ffpwrden") + k = parameters.get("k") + n = density delta = np.linspace(1.0, 0.001, n) # Normalized farfield distances # delta = np.logspace(-2, 0, n) @@ -536,12 +630,13 @@ def hazard_plot(parameters, limit, density=1000, xbar_max=1, gain_boost=None): step = 0.01 xbars = np.arange(0, xbar_max + step, step) - if gain_boost is not None: - ffpwrden = gain_boost * ffpwrden + gain_boost = 10 ** (gain_boost_db / 10.0) + ffpwrden = gain_boost * ffpwrden last = 1e-9 count = 0 ff_reference = 0 + for d in delta: for xbar in xbars: xbarR = xbar * radius_meters @@ -639,17 +734,16 @@ def combined_hazard_plot(parameters, limit, density=1000): >>> params = parabolic.parameters(2.4, 8.4e9, 400.0, 0.62, 20.0) >>> fig, ax = hazard_plot(params, 10.0) """ - ( - radius_meters, - freq_mhz, - power_watts, - efficiency, - side_lobe_ratio, - H, - ffmin, - ffpwrden, - k, - ) = parameters + radius_meters = parameters.get("radius_meters") + freq_mhz = parameters.get("freq_mhz") + power_watts = parameters.get("power_watts") + efficiency = parameters.get("efficiency") + side_lobe_ratio = parameters.get("side_lobe_ratio") + H = parameters.get("H") + ffmin = parameters.get("ffmin") + ffpwrden = parameters.get("ffpwrden") + k = parameters.get("k") + n = density delta = np.linspace(1.0, 0.01, n) # Normalized farfield distances # x = np.logspace(-5, 0, 100) # Normalized farfield distances @@ -744,26 +838,23 @@ def fun2(x): return X, Y, pd_field -def print_parameters(parameters): +def print_parameters(parameters: dict): """Prints formated parameter list. Args: - parameters(tuple): parameters tuple created with parameters function - + parameters (dict): parameters tuple created with parameters function Returns: none """ - ( - radius_meters, - freq_mhz, - power_watts, - efficiency, - side_lobe_ratio, - H, - ffmin, - ffpwrden, - k, - ) = parameters + radius_meters = parameters.get("radius_meters") + freq_mhz = parameters.get("freq_mhz") + power_watts = parameters.get("power_watts") + efficiency = parameters.get("efficiency") + side_lobe_ratio = parameters.get("side_lobe_ratio") + H = parameters.get("H") + ffmin = parameters.get("ffmin") + ffpwrden = parameters.get("ffpwrden") + k = parameters.get("k") print("Aperture Radius: %.2f" % radius_meters) print("Output Power (w): %.2f" % power_watts) print("Antenna Efficiency: %.2f" % efficiency) diff --git a/src/test.py b/src/test.py deleted file mode 100644 index 9e04ae5..0000000 --- a/src/test.py +++ /dev/null @@ -1,16 +0,0 @@ -from antenna_intensity_modeler import parabolic -import matplotlib.pyplot as plt -params = parabolic.parameters(2.4, 8.4e9, 400.0, 0.62, 35) -params['ffpwrden'] = 1. -xbar = 0. -table = parabolic.near_field_corrections(params, xbar) -fig, ax = plt.subplots() -ax.semilogx(table.delta, table.Pcorr) -ax.set_xlim([0.01, 1.0]) -ax.grid(True, which="both") -ax.minorticks_on() -side_lobe_ratio = params['side_lobe_ratio'] -ax.set_title("Near Field Corrections xbar: %s , slr: %s" % (xbar, side_lobe_ratio)) -ax.set_xlabel("Normalized On Axis Distance") -ax.set_ylabel("Normalized On Axis Power Density") -plt.show() \ No newline at end of file diff --git a/src/test_run.py b/src/test_run.py new file mode 100644 index 0000000..c5e557c --- /dev/null +++ b/src/test_run.py @@ -0,0 +1,76 @@ +from antenna_intensity_modeler import parabolic +from antenna_intensity_modeler.helpers import Either, Option +import matplotlib.pyplot as plt +import time +import warnings +from functools import partial +from typing import Optional, Union +import numpy as np + + +def nfc_intermediary(xbar, params, res=1000): + return parabolic.near_field_corrections( + parameters=params, xbar=xbar, resolution=res + ) + + +def match(monad: Union[Either, Option], some_fun, no_fun): + if isinstance(monad, Some): + return monad.flat_map(some_fun) + elif isinstance(monad, Right): + return monad.flat_map(some_fun) + else: + return no_fun(monad.value) + + +def plotting_intermediary(nfc, delta, ax): + # _nfc = match(nfc, lambda x: x.pure, lambda x: []) + _nfc = nfc + return ax.semilogx(delta, _nfc) + + +# warnings.filterwarnings("ignore") +params = parabolic.parameters(2.4, 8400, 400.0, 0.62, 17.57) +xbar = np.arange(0, 1.1, 0.1) +# xbar = [1.1, 1.2, 1.5, 2.0] +resolution = 1000 +corrections_with_params = partial(nfc_intermediary, params=params, res=resolution) +nfc = list(map(corrections_with_params, xbar)) +delta = np.logspace(-2, 0, resolution) + +fig, ax = plt.subplots() +ax.set_xlim([0.01, 1.0]) +ax.grid(True, which="both") +ax.minorticks_on() +slr = params.get("side_lobe_ratio") +ax.set_title("Near Field Corrections xbar: {}, slr: {}".format(xbar, slr)) +ax.set_xlabel("Normalized On Axis Distance") +ax.set_ylabel("Normalized On Axis Power Density") + +partial_log_plot = partial(plotting_intermediary, delta=delta, ax=ax) +_ = list(map(partial_log_plot, nfc)) +plt.show() + +# limit = 10.0 +# print("Run 1...", end=" ", flush=True) +# t1 = time.clock() +# df = parabolic.test_hazard_plot(params, limit, xbar_max=2.0) +# t2 = time.clock() +# print("done in {:.2f} seconds".format(t2 - t1), flush=True) +# # print("Run 2...", end=" ", flush=True) +# # t3 = time.clock() +# # df2 = parabolic.hazard_plot(params, limit) +# # t4 = time.clock() +# # print("done in {:.2f} seconds".format(t4 - t3), flush=True) + +# rng = df.range.values +# positives = df.positives.values +# negatives = df.negatives.values +# fig, ax = plt.subplots() +# ax.plot(rng, positives, rng, negatives) +# ax.grid(True, which="both") +# ax.minorticks_on() +# ax.set_title("Hazard Plot with limit: %s w/m^2" % limit) +# ax.set_xlabel("Distance From Antenna(m)") +# ax.set_ylabel("Off Axis Distance (m)") +# plt.show()