你已经派生过 gprMax
镜像自地址
https://gitee.com/sunhf/gprMax.git
已同步 2025-08-07 15:10:13 +08:00
Merge pull request #360 from Sai-Suraj-27/update_pre-commit
Updated the `.pre-commit-config.yaml` file.
这个提交包含在:
@@ -1,14 +1,19 @@
|
||||
# See https://pre-commit.com for more information
|
||||
repos:
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v2.0.0
|
||||
rev: v3.3.0
|
||||
hooks:
|
||||
- id: trailing-whitespace
|
||||
- id: end-of-file-fixer
|
||||
- id: check-yaml
|
||||
- id: check-added-large-files
|
||||
- repo: https://github.com/psf/black
|
||||
rev: 23.3.0
|
||||
rev: 23.7.0
|
||||
hooks:
|
||||
- id: black
|
||||
args: ["--line-length", "120"] # Adjust the max line length value as needed.
|
||||
- repo: https://github.com/pycqa/isort
|
||||
rev: 5.12.0
|
||||
hooks:
|
||||
- id: isort
|
||||
args: ["--line-length", "120", "--profile", "black"]
|
||||
|
@@ -10,6 +10,7 @@ source is used with a waveform shaped as the first derivative of a gaussian.
|
||||
"""
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
import gprMax
|
||||
from gprMax.materials import calculate_water_properties
|
||||
|
||||
|
@@ -18,10 +18,11 @@
|
||||
|
||||
import logging
|
||||
|
||||
import gprMax.config as config
|
||||
import numpy as np
|
||||
from scipy.spatial.transform import Rotation as R
|
||||
|
||||
import gprMax.config as config
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
|
@@ -18,9 +18,10 @@
|
||||
|
||||
import logging
|
||||
|
||||
import gprMax.config as config
|
||||
import numpy as np
|
||||
|
||||
import gprMax.config as config
|
||||
|
||||
from ..cython.geometry_primitives import build_voxels_from_array, build_voxels_from_array_mask
|
||||
from .cmds_geometry import UserObjectGeometry
|
||||
|
||||
|
@@ -19,9 +19,10 @@
|
||||
import logging
|
||||
from pathlib import Path
|
||||
|
||||
import gprMax.config as config
|
||||
import h5py
|
||||
|
||||
import gprMax.config as config
|
||||
|
||||
from ..cython.geometry_primitives import build_voxels_from_array
|
||||
from ..hash_cmds_file import get_user_objects
|
||||
from ..utilities.utilities import round_value
|
||||
|
@@ -20,10 +20,11 @@ import inspect
|
||||
import logging
|
||||
from pathlib import Path
|
||||
|
||||
import gprMax.config as config
|
||||
import numpy as np
|
||||
from scipy import interpolate
|
||||
|
||||
import gprMax.config as config
|
||||
|
||||
from .pml import PML
|
||||
from .utilities.host_info import set_omp_threads
|
||||
from .waveforms import Waveform
|
||||
|
@@ -17,8 +17,8 @@
|
||||
# along with gprMax. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import numpy as np
|
||||
cimport numpy as np
|
||||
|
||||
cimport numpy as np
|
||||
|
||||
ctypedef fused float_or_double:
|
||||
float
|
||||
|
@@ -223,7 +223,7 @@ update_electric_dispersive_A = {
|
||||
// component arrays.
|
||||
|
||||
$CUDA_IDX
|
||||
|
||||
|
||||
// Convert the linear index to subscripts for 3D field arrays
|
||||
int x = i / ($NY_FIELDS * $NZ_FIELDS);
|
||||
int y = (i % ($NY_FIELDS * $NZ_FIELDS)) / $NZ_FIELDS;
|
||||
@@ -335,7 +335,7 @@ update_electric_dispersive_B = {
|
||||
// component arrays.
|
||||
|
||||
$CUDA_IDX
|
||||
|
||||
|
||||
// Convert the linear index to subscripts for 3D field arrays
|
||||
int x = i / ($NY_FIELDS * $NZ_FIELDS);
|
||||
int y = (i % ($NY_FIELDS * $NZ_FIELDS)) / $NZ_FIELDS;
|
||||
|
@@ -18,7 +18,6 @@
|
||||
|
||||
from string import Template
|
||||
|
||||
|
||||
store_snapshot = {
|
||||
"args_cuda": Template(
|
||||
"""
|
||||
|
@@ -18,7 +18,6 @@
|
||||
|
||||
from string import Template
|
||||
|
||||
|
||||
store_outputs = {
|
||||
"args_cuda": Template(
|
||||
"""
|
||||
|
@@ -17,20 +17,25 @@
|
||||
# along with gprMax. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import numpy as np
|
||||
|
||||
cimport numpy as np
|
||||
|
||||
np.seterr(divide='raise')
|
||||
from cython.parallel import prange
|
||||
|
||||
from gprMax.cython.yee_cell_setget_rigid cimport set_rigid_Ex
|
||||
from gprMax.cython.yee_cell_setget_rigid cimport set_rigid_Ey
|
||||
from gprMax.cython.yee_cell_setget_rigid cimport set_rigid_Ez
|
||||
from gprMax.cython.yee_cell_setget_rigid cimport set_rigid_Hx
|
||||
from gprMax.cython.yee_cell_setget_rigid cimport set_rigid_Hy
|
||||
from gprMax.cython.yee_cell_setget_rigid cimport set_rigid_Hz
|
||||
from gprMax.cython.yee_cell_setget_rigid cimport set_rigid_E
|
||||
from gprMax.cython.yee_cell_setget_rigid cimport unset_rigid_E
|
||||
from gprMax.cython.yee_cell_setget_rigid cimport set_rigid_H
|
||||
from gprMax.cython.yee_cell_setget_rigid cimport unset_rigid_H
|
||||
from gprMax.cython.yee_cell_setget_rigid cimport (
|
||||
set_rigid_E,
|
||||
set_rigid_Ex,
|
||||
set_rigid_Ey,
|
||||
set_rigid_Ez,
|
||||
set_rigid_H,
|
||||
set_rigid_Hx,
|
||||
set_rigid_Hy,
|
||||
set_rigid_Hz,
|
||||
unset_rigid_E,
|
||||
unset_rigid_H,
|
||||
)
|
||||
|
||||
from gprMax.utilities.utilities import round_value
|
||||
|
||||
|
||||
|
@@ -17,14 +17,18 @@
|
||||
# along with gprMax. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import numpy as np
|
||||
|
||||
cimport numpy as np
|
||||
|
||||
from gprMax.cython.yee_cell_setget_rigid cimport get_rigid_Ex
|
||||
from gprMax.cython.yee_cell_setget_rigid cimport get_rigid_Ey
|
||||
from gprMax.cython.yee_cell_setget_rigid cimport get_rigid_Ez
|
||||
from gprMax.cython.yee_cell_setget_rigid cimport get_rigid_Hx
|
||||
from gprMax.cython.yee_cell_setget_rigid cimport get_rigid_Hy
|
||||
from gprMax.cython.yee_cell_setget_rigid cimport get_rigid_Hz
|
||||
from gprMax.cython.yee_cell_setget_rigid cimport (
|
||||
get_rigid_Ex,
|
||||
get_rigid_Ey,
|
||||
get_rigid_Ez,
|
||||
get_rigid_Hx,
|
||||
get_rigid_Hy,
|
||||
get_rigid_Hz,
|
||||
)
|
||||
|
||||
from gprMax.materials import Material
|
||||
|
||||
|
||||
|
@@ -16,13 +16,12 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with gprMax. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import numpy as np
|
||||
import logging
|
||||
|
||||
import numpy as np
|
||||
|
||||
import gprMax.config as config
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
|
@@ -16,9 +16,10 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with gprMax. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import gprMax.config as config
|
||||
import numpy as np
|
||||
|
||||
import gprMax.config as config
|
||||
|
||||
|
||||
class Rx:
|
||||
"""Receiver output points."""
|
||||
|
@@ -17,8 +17,8 @@
|
||||
# along with gprMax. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import logging
|
||||
from pathlib import Path
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
import h5py
|
||||
import numpy as np
|
||||
|
@@ -18,9 +18,10 @@
|
||||
|
||||
from copy import deepcopy
|
||||
|
||||
import gprMax.config as config
|
||||
import numpy as np
|
||||
|
||||
import gprMax.config as config
|
||||
|
||||
from .fields_outputs import Ix, Iy, Iz
|
||||
from .utilities.utilities import round_value
|
||||
|
||||
|
@@ -17,6 +17,7 @@
|
||||
# along with gprMax. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import logging
|
||||
|
||||
import numpy as np
|
||||
from scipy import interpolate
|
||||
|
||||
|
@@ -18,9 +18,10 @@
|
||||
|
||||
import logging
|
||||
|
||||
import gprMax.config as config
|
||||
import numpy as np
|
||||
|
||||
import gprMax.config as config
|
||||
|
||||
from .subgrids.grid import SubGridBaseGrid
|
||||
from .utilities.utilities import round_value
|
||||
|
||||
|
@@ -17,6 +17,7 @@
|
||||
# along with gprMax. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import logging
|
||||
|
||||
import numpy as np
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
1
setup.py
1
setup.py
@@ -29,7 +29,6 @@ from Cython.Build import cythonize
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
from setuptools import Extension, find_packages, setup
|
||||
|
||||
|
||||
# Check Python version
|
||||
MIN_PYTHON_VERSION = (3, 7)
|
||||
if sys.version_info[:2] < MIN_PYTHON_VERSION:
|
||||
|
@@ -24,7 +24,7 @@ from gprMax.waveforms import Waveform
|
||||
|
||||
def hertzian_dipole_fs(iterations, dt, dxdydz, rx):
|
||||
"""Analytical solution of a z-directed Hertzian dipole in free space with a
|
||||
current waveform of the form of the first derivative of a Gaussian
|
||||
current waveform of the form of the first derivative of a Gaussian
|
||||
(http://dx.doi.org/10.1016/0021-9991(83)90103-1).
|
||||
|
||||
Args:
|
||||
|
@@ -4,10 +4,10 @@
|
||||
"""
|
||||
|
||||
|
||||
from pathlib import Path
|
||||
import gprMax
|
||||
|
||||
import itertools
|
||||
from pathlib import Path
|
||||
|
||||
import gprMax
|
||||
|
||||
# File path for output
|
||||
fn = Path(__file__)
|
||||
|
@@ -1,8 +1,9 @@
|
||||
from pathlib import Path
|
||||
|
||||
import gprMax
|
||||
import numpy as np
|
||||
|
||||
import gprMax
|
||||
|
||||
# File path for output
|
||||
fn = Path(__file__)
|
||||
parts = fn.parts
|
||||
|
@@ -1,8 +1,9 @@
|
||||
from pathlib import Path
|
||||
|
||||
import gprMax
|
||||
import numpy as np
|
||||
|
||||
import gprMax
|
||||
|
||||
# File path for output
|
||||
fn = Path(__file__)
|
||||
parts = fn.parts
|
||||
|
@@ -20,11 +20,11 @@ import logging
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
import gprMax
|
||||
import h5py
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
|
||||
import gprMax
|
||||
from testing.analytical_solutions import hertzian_dipole_fs
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
@@ -9,11 +9,12 @@ import argparse
|
||||
import logging
|
||||
import os
|
||||
|
||||
import gprMax.config as config
|
||||
import h5py
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
|
||||
import gprMax.config as config
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
|
@@ -9,10 +9,11 @@ import argparse
|
||||
import logging
|
||||
import os
|
||||
|
||||
import gprMax.config as config
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
|
||||
import gprMax.config as config
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
|
@@ -14,7 +14,6 @@ import matplotlib.gridspec as gridspec
|
||||
import numpy as np
|
||||
import scipy.interpolate
|
||||
from matplotlib import pylab as plt
|
||||
|
||||
from optimization import DA_DLS, DE_DLS, PSO_DLS
|
||||
|
||||
|
||||
|
@@ -2,7 +2,8 @@
|
||||
# "Incorporating dispersive electrical properties in FDTD GPR models
|
||||
# using a general Cole-Cole dispersion function,"
|
||||
# 2012 14th International Conference on Ground Penetrating Radar (GPR), 2012, pp. 232-236
|
||||
import os, sys
|
||||
import os
|
||||
import sys
|
||||
|
||||
sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
|
||||
from Debye_Fit import HavriliakNegami
|
||||
|
@@ -24,6 +24,7 @@ import h5py
|
||||
import matplotlib.gridspec as gridspec
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
|
||||
from gprMax.receivers import Rx
|
||||
from gprMax.utilities.utilities import fft_power
|
||||
|
||||
|
@@ -22,6 +22,7 @@ from pathlib import Path
|
||||
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
|
||||
from gprMax.utilities.utilities import fft_power, round_value
|
||||
from gprMax.waveforms import Waveform
|
||||
|
||||
|
@@ -7,12 +7,12 @@ from . import slice
|
||||
def convert_meshes(meshes, discretization, parallel=True):
|
||||
scale, shift, shape = slice.calculate_scale_shift(meshes, discretization)
|
||||
vol = np.zeros(shape[::-1], dtype=np.int8)
|
||||
vol.fill(-1) # Fill array with -1 to indicate background in gprMax
|
||||
vol.fill(-1) # Fill array with -1 to indicate background in gprMax
|
||||
|
||||
for mesh_ind, org_mesh in enumerate(meshes):
|
||||
slice.scale_and_shift_mesh(org_mesh, scale, shift)
|
||||
cur_vol = slice.mesh_to_plane(org_mesh, shape, parallel)
|
||||
vol[cur_vol] = mesh_ind # Removed plus 1 to work with gprMax material indexing
|
||||
vol[cur_vol] = mesh_ind # Removed plus 1 to work with gprMax material indexing
|
||||
|
||||
return vol, scale, shift
|
||||
|
||||
|
@@ -3,9 +3,10 @@ import multiprocessing as mp
|
||||
import sys
|
||||
|
||||
import numpy as np
|
||||
from gprMax.utilities.utilities import get_terminal_width
|
||||
from tqdm import tqdm
|
||||
|
||||
from gprMax.utilities.utilities import get_terminal_width
|
||||
|
||||
from . import perimeter
|
||||
|
||||
|
||||
|
@@ -16,10 +16,10 @@ if __name__ == "__main__":
|
||||
description="Allows the user to convert a STL files to voxelized mesh.",
|
||||
usage="cd gprMax; python -m toolboxes.STLtoVoxel.stltovoxel stlfilename -matindex -dxdydz",
|
||||
)
|
||||
parser.add_argument("stlfiles", help="can be the filename of a single STL file, or the path to folder containing multiple STL files")
|
||||
parser.add_argument(
|
||||
"-dxdydz", type=float, required=True, help="discretisation to use in voxelisation process"
|
||||
"stlfiles", help="can be the filename of a single STL file, or the path to folder containing multiple STL files"
|
||||
)
|
||||
parser.add_argument("-dxdydz", type=float, required=True, help="discretisation to use in voxelisation process")
|
||||
args = parser.parse_args()
|
||||
|
||||
if os.path.isdir(args.stlfiles):
|
||||
@@ -52,4 +52,4 @@ if __name__ == "__main__":
|
||||
# for i, file in enumerate(files):
|
||||
# name = os.path.splitext(os.path.basename(file))[0]
|
||||
# f.write(f"#material: {i + 1} 0 1 0 {name}" + "\n")
|
||||
# logger.info(f"Written materials file: {filename_mats}")
|
||||
# logger.info(f"Written materials file: {filename_mats}")
|
||||
|
在新工单中引用
屏蔽一个用户