Added a pre-commit config file and reformatted all the files accordingly by using it.

这个提交包含在:
Sai-Suraj-27
2023-06-26 16:09:39 +05:30
父节点 c71e87e34f
当前提交 f9dd7f2420
共有 155 个文件被更改,包括 11383 次插入8802 次删除

查看文件

@@ -8,7 +8,7 @@ The most computationally intensive parts of gprMax, which are the FDTD solver lo
1. `OpenMP <http://openmp.org>`_ which supports multi-platform shared memory multiprocessing.
2. `NVIDIA CUDA <https://developer.nvidia.com/cuda-toolkit>`_ for NVIDIA GPUs.
3. `OpenCL <https://www.khronos.org/api/opencl>`_ for a wider range of CPU and GPU hardware.
3. `OpenCL <https://www.khronos.org/api/opencl>`_ for a wider range of CPU and GPU hardware.
Additionally, the Message Passing Interface (MPI) can be utilised to implement a simple task farm that can be used to distribute a series of models as independent tasks. This can be useful in many GPR simulations where a B-scan (composed of multiple A-scans) is required. Each A-scan can be task-farmed as an independent model, and within each model, OpenMP or CUDA can still be used for parallelism. This creates mixed mode OpenMP/MPI or CUDA/MPI environments.
@@ -74,7 +74,7 @@ Run one of the test models:
.. note::
* If you want to select a specific GPU card on your system, you can specify an integer after the ``-gpu`` flag. The integer should be the NVIDIA CUDA device ID for a specific GPU card. If it is not specified it defaults to device ID 0.
* If you want to select a specific GPU card on your system, you can specify an integer after the ``-gpu`` flag. The integer should be the NVIDIA CUDA device ID for a specific GPU card. If it is not specified it defaults to device ID 0.
* You can use the ``get_host_spec.py`` module (in ``toolboxes/Utilities``) to help you understand what hardware (CPU/GPU) you have and how gprMax can use it.
@@ -108,7 +108,7 @@ Run one of the test models:
CUDA/MPI
========
Message Passing Interface (MPI) has been utilised to implement a simple task farm that can be used to distribute a series of models as independent tasks. This is described in more detail in the :ref:`HPC <hpc>` section. MPI can be combined with the GPU functionality to allow a series of models to be distributed to multiple GPUs on the same machine (node).
Message Passing Interface (MPI) has been utilised to implement a simple task farm that can be used to distribute a series of models as independent tasks. This is described in more detail in the :ref:`HPC <hpc>` section. MPI can be combined with the GPU functionality to allow a series of models to be distributed to multiple GPUs on the same machine (node).
Example
-------

查看文件

@@ -50,4 +50,3 @@ Results
Input impedance (resistive and reactive) of a bowtie antenna in free space using FDTD (gprMax) and MoM (MATLAB) models.
The results from the FDTD and MoM modelling techniques are in very good agreement. The biggest mismatch occurs in the resistive part of the input impedance at frequencies above 3GHz.

查看文件

@@ -9,30 +9,26 @@
import re
import time
project = 'gprMax'
project = "gprMax"
copyright = f'2015-{time.strftime("%Y")}, The University of Edinburgh, United Kingdom. Authors: Craig Warren, Antonis Giannopoulos, and John Hartley'
author = 'Craig Warren, Antonis Giannopoulos, and John Hartley'
with open('../../gprMax/_version.py', 'r') as fd:
version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]',
fd.read(), re.MULTILINE).group(1)
author = "Craig Warren, Antonis Giannopoulos, and John Hartley"
with open("../../gprMax/_version.py", "r") as fd:
version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1)
# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
extensions = ['sphinx.ext.mathjax',
'sphinx.ext.autodoc',
'sphinx.ext.napoleon']
extensions = ["sphinx.ext.mathjax", "sphinx.ext.autodoc", "sphinx.ext.napoleon"]
# Figure numbering
numfig = True
templates_path = ['_templates']
templates_path = ["_templates"]
exclude_patterns = []
# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
html_theme = 'sphinx_rtd_theme'
html_static_path = ['_static']
html_theme = "sphinx_rtd_theme"
html_static_path = ["_static"]

查看文件

@@ -63,9 +63,9 @@ This example is a basic demonstration of how to use subgrids. The geometry is 3D
:language: python
:linenos:
Much of the functionality demonstrated in this example is standard use of our :ref:`Python API <input-api>`, so mainly the parts that relate to the subgrid will be described here. Lines 20-25 specify the spatial discretisation of the course main grid (5mm) and fine subgrid (1mm). Lines 56-60 specify the centres and radius of the cylinder and coordinates of a bounding box which will be used to set the domain of the subgrid.
Much of the functionality demonstrated in this example is standard use of our :ref:`Python API <input-api>`, so mainly the parts that relate to the subgrid will be described here. Lines 20-25 specify the spatial discretisation of the course main grid (5mm) and fine subgrid (1mm). Lines 56-60 specify the centres and radius of the cylinder and coordinates of a bounding box which will be used to set the domain of the subgrid.
The subgrid object is created on line 63 (providing its extent, the ratio of the spatial resolution, and a string identifier) and then added to the main scene on line 64. Any objects that are to be placed within the subgrid can be added to the subgrid scene (through the variable ``subgrid``) in the same way as the main grid/scene.
The subgrid object is created on line 63 (providing its extent, the ratio of the spatial resolution, and a string identifier) and then added to the main scene on line 64. Any objects that are to be placed within the subgrid can be added to the subgrid scene (through the variable ``subgrid``) in the same way as the main grid/scene.
In lines 67-71 the material used to represent water is created and added to the subgrid. The function ``calculate_water_properties()`` is used to help define the properties of water which is represented as a dispersive material using a single pole Debye model.
@@ -122,14 +122,4 @@ The performance of each PML can be compared with a reference solution using the
:language: python
:linenos:
In lines 43-122 a dictionary with different PML formulations and parameters is created.
In lines 43-122 a dictionary with different PML formulations and parameters is created.

查看文件

@@ -9,7 +9,7 @@ This section highlights some of the key features of gprMax that are useful for G
Python API
==========
There is now a **Python API**, which includes all the functionality of the input file (hash) commands as well as several more advanced features. It allows users to access to gprMax functions directly from Python by importing the gprMax module. This method is recommended for those who prefer to use Python or need access to specific API-only advanced features, and is described in the :ref:`Python API <input-api>` section. There are several advantages to using the Python API:
There is now a **Python API**, which includes all the functionality of the input file (hash) commands as well as several more advanced features. It allows users to access to gprMax functions directly from Python by importing the gprMax module. This method is recommended for those who prefer to use Python or need access to specific API-only advanced features, and is described in the :ref:`Python API <input-api>` section. There are several advantages to using the Python API:
1. Users can take advantage of the Python language - for instance, the structural elements of Python can be utilised more easily.
2. gprMax objects can be used directly within functions, classes, modules and packages. In this way, collections of components can be defined, reused, and modified. For example, complex targets can be imported from a separate module and combined with an antenna from another module.

查看文件

@@ -52,4 +52,4 @@ Here is an example of a job script for running models, e.g. A-scans to make a B-
The ``-t`` tells Grid Engine that we are using a job array followed by a range of integers which will be the IDs for each individual task (model). Task IDs must start from 1, and the total number of tasks in the range should correspond to the number of models you want to run, i.e. the integer with the ``-n`` flag passed to gprMax. The ``-i`` flag is passed to gprMax along with the specific number of the task (model) with the environment variable ``$SGE_TASK_ID``.
A job array means that exactly the same submit script is going to be run multiple times, the only difference between each run is the environment variable ``$SGE_TASK_ID``.
A job array means that exactly the same submit script is going to be run multiple times, the only difference between each run is the environment variable ``$SGE_TASK_ID``.

查看文件

@@ -1 +1 @@
.. include:: ../../toolboxes/AntennaPatterns/README.rst
.. include:: ../../toolboxes/AntennaPatterns/README.rst

查看文件

@@ -1 +1 @@
.. include:: ../../toolboxes/AustinManWoman/README.rst
.. include:: ../../toolboxes/AustinManWoman/README.rst

查看文件

@@ -1 +1 @@
.. include:: ../../toolboxes/DebyeFit/README.rst
.. include:: ../../toolboxes/DebyeFit/README.rst

查看文件

@@ -1 +1 @@
.. include:: ../../toolboxes/GPRAntennaModels/README.rst
.. include:: ../../toolboxes/GPRAntennaModels/README.rst

查看文件

@@ -1 +1 @@
.. include:: ../../toolboxes/LandmineModels/README.rst
.. include:: ../../toolboxes/LandmineModels/README.rst

查看文件

@@ -1 +1 @@
.. include:: ../../toolboxes/Materials/README.rst
.. include:: ../../toolboxes/Materials/README.rst

查看文件

@@ -1 +1 @@
.. include:: ../../toolboxes/Plotting/README.rst
.. include:: ../../toolboxes/Plotting/README.rst

查看文件

@@ -1 +1 @@
.. include:: ../../README.rst
.. include:: ../../README.rst

查看文件

@@ -1 +1 @@
.. include:: ../../toolboxes/STLtoVoxel/README.rst
.. include:: ../../toolboxes/STLtoVoxel/README.rst

查看文件

@@ -1 +1 @@
.. include:: ../../toolboxes/Utilities/README.rst
.. include:: ../../toolboxes/Utilities/README.rst

查看文件

@@ -12,7 +12,7 @@ gprMax has a choice of two methods for building a model to simulate:
1. A **text-based (ASCII) input file**, which can be created with any text editor, and uses a series of gprMax commands which begin with the hash character (``#``). This method is recommended for beginners and those not familiar with Python, and is described in the :ref:`input-hash-cmds` section.
2. A **Python API**, which includes all the functionality of method 1 as well as several more advanced features. This method is recommended for those who prefer to use Python or need access to specific API-only advanced features, and is described in this section of the documentation.
The Python API in gprMax allows users to access to gprMax functions directly from Python through importing the gprMax module. There are several advantages to using the API:
The Python API in gprMax allows users to access to gprMax functions directly from Python through importing the gprMax module. There are several advantages to using the API:
* Users can take advantage of the Python language - for instance, the structural elements of Python can be utilised more easily.
* gprMax objects can be used directly within functions, classes, modules and packages. In this way collections of components can be defined, reused and modified. For example, complex targets can be imported from a separate module and combined with an antenna from another module.
@@ -25,7 +25,7 @@ Example
:download:`antenna_wire_dipole_fs.py <../../examples/antenna_wire_dipole_fs.py>`
This example is used to give an introduction to the gprMax Python API.
This example is used to give an introduction to the gprMax Python API.
.. literalinclude:: ../../examples/antenna_wire_dipole_fs.py
:language: python
@@ -260,7 +260,7 @@ Allows you control of the specific parameters that are used to build each order
.. autoclass:: gprMax.cmds_multiuse.PMLCFS
The CFS values (which are internally specified) used for the default standard first order PML are:
The CFS values (which are internally specified) used for the default standard first order PML are:
* ``alphascalingprofile = 'constant'``
* ``alphascalingdirection = 'forward'``
* ``alphamin = 0``
@@ -275,7 +275,7 @@ The CFS values (which are internally specified) used for the default standard fi
* ``sigmamax = None``
.. note::
* The parameters will be applied to all slabs of the PML that are switched on.
* Using ``None`` for the maximum value of :math:`\sigma` forces gprMax to calculate it internally based on the relative permittivity and permeability of the underlying materials in the model.
* Using ``None`` for the maximum value of :math:`\sigma` forces gprMax to calculate it internally based on the relative permittivity and permeability of the underlying materials in the model.
* ``forward`` direction implies a minimum parameter value at the inner boundary of the PML and maximum parameter value at the edge of the computational domain, ``reverse`` is the opposite.

查看文件

@@ -585,7 +585,7 @@ Allows you to introduce an ellipsoid into the model. The syntax of the command i
#ellipsoid: f1 f2 f3 f4 f5 f6 str1 [c1]
* ``f1 f2 f3`` are the coordinates (x,y,z) of the centre of the ellipsoid.
* ``f1 f2 f3`` are the coordinates (x,y,z) of the centre of the ellipsoid.
* ``f4 f5 f6`` are the coordinates (x,y,z) of the semi-axes of the ellipsoid.
* ``str1`` is a material identifier that must correspond to material that has already been defined in the input file, or is one of the builtin materials.
* ``c1`` is an optional parameter which can be ``y`` or ``n``, used to switch on and off dielectric smoothing.
@@ -984,4 +984,4 @@ For example to use a PML with 20 cells (thicker than the default 10 cells) on on
.. code-block:: none
#pml_cells: 10 10 20 10 10 20
#pml_cells: 10 10 20 10 10 20

查看文件

@@ -115,8 +115,8 @@ Snapshot files contain a snapshot of the electromagnetic field values of a speci
import gprMax
for i in range(1, 31):
s = gprMax.Snapshot(p1=(0, 0, 0), p2=(x, y, z), dl=(dl, dl, dl),
time=(i/10) * 1e-9,
s = gprMax.Snapshot(p1=(0, 0, 0), p2=(x, y, z), dl=(dl, dl, dl),
time=(i/10) * 1e-9,
filename=fn.with_suffix('').parts[-1] + '_' + str(i))
scene.add(s)