From d75ea4dc45315485f33e5b8ccac07501468851da Mon Sep 17 00:00:00 2001 From: Craig Warren Date: Mon, 18 Mar 2024 10:47:19 +0000 Subject: [PATCH 1/4] Fixed import of em constants --- toolboxes/AntennaPatterns/initial_save.py | 17 +++++++++++------ toolboxes/AntennaPatterns/plot_fields.py | 14 ++++++++++---- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/toolboxes/AntennaPatterns/initial_save.py b/toolboxes/AntennaPatterns/initial_save.py index 1c849ab4..7a7fe4cb 100644 --- a/toolboxes/AntennaPatterns/initial_save.py +++ b/toolboxes/AntennaPatterns/initial_save.py @@ -13,10 +13,15 @@ import h5py import matplotlib.pyplot as plt import numpy as np -import gprMax.config as config +from scipy.constants import c +from scipy.constants import epsilon_0 as e0 +from scipy.constants import mu_0 as m0 + logger = logging.getLogger(__name__) +# Impedance of free space (Ohms) +z0 = np.sqrt(m0 / e0) # Parse command line arguments parser = argparse.ArgumentParser( @@ -59,9 +64,9 @@ traceno = np.s_[:] # All traces # Critical angle and velocity if epsr: mr = 1 - z1 = np.sqrt(mr / epsr) * config.sim_config.em_consts["z0"] - v1 = config.sim_config.em_consts["c"] / np.sqrt(epsr) - thetac = np.round(np.arcsin(v1 / config.sim_config.em_consts["c"]) * (180 / np.pi)) + z1 = np.sqrt(mr / epsr) * z0 + v1 = c / np.sqrt(epsr) + thetac = np.round(np.arcsin(v1 / c * (180 / np.pi)) wavelength = v1 / f # Print some useful information @@ -189,8 +194,8 @@ for radius in range(0, len(radii)): Ethetasum[index] = np.sum(Etheta[:, index] ** 2) / z1 Hthetasum[index] = np.sum(Htheta[:, index] ** 2) / z1 else: - Ethetasum[index] = np.sum(Etheta[:, index] ** 2) / config.sim_config.em_consts["z0"] - Hthetasum[index] = np.sum(Htheta[:, index] ** 2) / config.sim_config.em_consts["z0"] + Ethetasum[index] = np.sum(Etheta[:, index] ** 2) / z0 + Hthetasum[index] = np.sum(Htheta[:, index] ** 2) / z0 index += 1 diff --git a/toolboxes/AntennaPatterns/plot_fields.py b/toolboxes/AntennaPatterns/plot_fields.py index d6f85e4b..b43160ed 100644 --- a/toolboxes/AntennaPatterns/plot_fields.py +++ b/toolboxes/AntennaPatterns/plot_fields.py @@ -12,11 +12,17 @@ import os import matplotlib.pyplot as plt import numpy as np -import gprMax.config as config +from scipy.constants import c +from scipy.constants import epsilon_0 as e0 +from scipy.constants import mu_0 as m0 + logger = logging.getLogger(__name__) +# Impedance of free space (Ohms) +z0 = np.sqrt(m0 / e0) + # Parse command line arguments parser = argparse.ArgumentParser( description="Plot field patterns from a simulation with receivers positioned in circles around an antenna. This module should be used after the field pattern data has been processed and stored using the initial_save.py module.", @@ -56,9 +62,9 @@ step = 12 # Critical angle and velocity if epsr: mr = 1 - z1 = np.sqrt(mr / epsr) * config.sim_config.em_consts["z0"] - v1 = config.sim_config.em_consts["c"] / np.sqrt(epsr) - thetac = np.round(np.rad2deg(np.arcsin(v1 / config.sim_config.em_consts["c"]))) + z1 = np.sqrt(mr / epsr) * z0 + v1 = c / np.sqrt(epsr) + thetac = np.round(np.rad2deg(np.arcsin(v1 / c))) wavelength = v1 / f # Print some useful information From af10677efbd437cf28708dc44883e7ccf1bc9bf0 Mon Sep 17 00:00:00 2001 From: Craig Warren Date: Tue, 19 Mar 2024 11:26:35 +0000 Subject: [PATCH 2/4] Add explicit encoding to parsing README.rst --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 743af3c6..409a97bd 100644 --- a/setup.py +++ b/setup.py @@ -253,7 +253,7 @@ else: ) # Parse long_description from README.rst file. - with open("README.rst", "r") as fd: + with open("README.rst", "r", encoding="utf-8") as fd: long_description = fd.read() setup( From 7f4ccc8b28b94aeafb51b0767dff9117ad96baa3 Mon Sep 17 00:00:00 2001 From: Craig Warren Date: Tue, 19 Mar 2024 11:41:27 +0000 Subject: [PATCH 3/4] Fix for specifying rx outputs --- gprMax/cmds_multiuse.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gprMax/cmds_multiuse.py b/gprMax/cmds_multiuse.py index b151cb9a..385f6f92 100644 --- a/gprMax/cmds_multiuse.py +++ b/gprMax/cmds_multiuse.py @@ -871,7 +871,7 @@ class Rx(UserObjectMulti): try: r.ID = self.kwargs["id"] - outputs = [self.kwargs["outputs"]] + outputs = list(self.kwargs["outputs"]) except KeyError: # If no ID or outputs are specified, use default r.ID = f"{r.__class__.__name__}({str(r.xcoord)},{str(r.ycoord)},{str(r.zcoord)})" From e5d093f87ea79da956f90e71754f40017d4744cd Mon Sep 17 00:00:00 2001 From: Craig Warren Date: Tue, 19 Mar 2024 14:07:15 +0000 Subject: [PATCH 4/4] Initial add --- requirements.txt | 131 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 131 insertions(+) create mode 100644 requirements.txt diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 00000000..4b467a35 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,131 @@ +aiofiles==23.2.1 +aiosqlite==0.20.0 +anyio==4.3.0 +appnope==0.1.4 +argon2-cffi==23.1.0 +argon2-cffi-bindings==21.2.0 +asttokens==2.4.1 +attrs==23.2.0 +Babel==2.14.0 +backcall==0.2.0 +beautifulsoup4==4.12.3 +bleach==6.1.0 +brotlipy==0.7.0 +certifi==2024.2.2 +cffi==1.16.0 +charset-normalizer==3.3.2 +click==8.1.7 +colorama==0.4.6 +comm==0.2.2 +contourpy==1.2.0 +cryptography==42.0.5 +cycler==0.12.1 +Cython==3.0.9 +debugpy==1.8.1 +decorator==5.1.1 +defusedxml==0.7.1 +entrypoints==0.4 +evtk==2.0.0 +executing==2.0.1 +fastjsonschema==2.19.1 +fonttools==4.50.0 +gprMax==4.0.0b0 +h5py==3.10.0 +humanize==4.9.0 +idna==3.6 +ipykernel==6.29.3 +ipython==8.22.2 +ipython-genutils==0.2.0 +ipywidgets==8.1.2 +jedi==0.19.1 +Jinja2==3.1.3 +json5==0.9.24 +jsonschema==4.21.1 +jupyter==1.0.0 +jupyter_client==8.6.1 +jupyter-console==6.6.3 +jupyter_core==5.7.2 +jupyter-events==0.10.0 +jupyter-server==2.13.0 +jupyter_server_fileid==0.9.1 +jupyter_server_ydoc==0.8.0 +jupyter-ydoc==2.0.1 +jupyterlab==4.1.5 +jupyterlab-pygments==0.3.0 +jupyterlab_server==2.25.4 +jupyterlab-widgets==3.0.10 +kiwisolver==1.4.5 +lxml==5.1.0 +MarkupSafe==2.1.5 +matplotlib==3.8.3 +matplotlib-inline==0.1.6 +mistune==3.0.2 +munkres==1.1.4 +nbclassic==1.0.0 +nbclient==0.10.0 +nbconvert==7.16.2 +nbformat==5.10.3 +nest-asyncio==1.6.0 +notebook==7.1.2 +notebook_shim==0.2.4 +numpy==1.26.4 +numpy-stl==3.1.1 +packaging==24.0 +pandocfilters==1.5.1 +parso==0.8.3 +pexpect==4.9.0 +pickleshare==0.7.5 +Pillow==10.2.0 +pip==24.0 +platformdirs==4.2.0 +ply==3.11 +prometheus-client==0.20.0 +prompt-toolkit==3.0.43 +psutil==5.9.8 +ptyprocess==0.7.0 +pur==7.3.1 +pure-eval==0.2.2 +pycparser==2.21 +Pygments==2.17.2 +pyopencl==2024.1 +pyOpenSSL==24.1.0 +pyparsing==3.1.2 +PyQt5-sip==12.13.0 +pyrsistent==0.20.0 +PySocks==1.7.1 +python-dateutil==2.9.0.post0 +python-json-logger==2.0.7 +python-utils==3.8.2 +pytools==2023.1.1 +pytz==2024.1 +PyYAML==6.0.1 +pyzmq==25.1.2 +qtconsole==5.5.1 +QtPy==2.4.1 +requests==2.31.0 +rfc3339-validator==0.1.4 +rfc3986-validator==0.1.1 +scipy==1.12.0 +Send2Trash==1.8.2 +setuptools==69.2.0 +sip==6.8.3 +six==1.16.0 +sniffio==1.3.1 +soupsieve==2.5 +stack-data==0.6.3 +terminado==0.18.1 +terminaltables==3.1.10 +tinycss2==1.2.1 +toml==0.10.2 +tornado==6.4 +tqdm==4.66.2 +traitlets==5.14.2 +typing_extensions==4.10.0 +urllib3==2.2.1 +wcwidth==0.2.13 +webencodings==0.5.1 +websocket-client==1.7.0 +wheel==0.43.0 +widgetsnbextension==4.0.10 +y-py==0.6.2 +ypy-websocket==0.12.4