你已经派生过 gprMax
镜像自地址
https://gitee.com/sunhf/gprMax.git
已同步 2025-08-07 15:10:13 +08:00
just some newline, trying to be consistent...
这个提交包含在:
@@ -32,6 +32,7 @@ Coordinate(x=0.1, y=0.2, z=0.3)
|
|||||||
0.1 0.2 0.3
|
0.1 0.2 0.3
|
||||||
"""
|
"""
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
Coordinate_tuple = namedtuple('Coordinate', ['x', 'y', 'z'])
|
Coordinate_tuple = namedtuple('Coordinate', ['x', 'y', 'z'])
|
||||||
|
|
||||||
@@ -40,6 +41,7 @@ class Coordinate(Coordinate_tuple):
|
|||||||
def __str__(self):
|
def __str__(self):
|
||||||
return '{:g} {:g} {:g}'.format(self.x, self.y, self.z)
|
return '{:g} {:g} {:g}'.format(self.x, self.y, self.z)
|
||||||
|
|
||||||
|
|
||||||
def command(cmd, *parameters):
|
def command(cmd, *parameters):
|
||||||
"""Helper function. Prints the gprMax #<cmd>: <parameters>. None is ignored in the output.
|
"""Helper function. Prints the gprMax #<cmd>: <parameters>. None is ignored in the output.
|
||||||
|
|
||||||
@@ -78,7 +80,6 @@ def domain(x, y, z):
|
|||||||
Returns:
|
Returns:
|
||||||
domain (Coordinate): Namedtuple of the extent of the domain.
|
domain (Coordinate): Namedtuple of the extent of the domain.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
domain = Coordinate(x, y, z)
|
domain = Coordinate(x, y, z)
|
||||||
command('domain', domain)
|
command('domain', domain)
|
||||||
|
|
||||||
@@ -94,7 +95,6 @@ def dx_dy_dz(x, y, z):
|
|||||||
Returns:
|
Returns:
|
||||||
dx_dy_dz (float): Tuple of the spatial resolutions.
|
dx_dy_dz (float): Tuple of the spatial resolutions.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
dx_dy_dz = Coordinate(x, y, z)
|
dx_dy_dz = Coordinate(x, y, z)
|
||||||
command('dx_dy_dz', dx_dy_dz)
|
command('dx_dy_dz', dx_dy_dz)
|
||||||
|
|
||||||
@@ -110,7 +110,6 @@ def time_window(time_window):
|
|||||||
Returns:
|
Returns:
|
||||||
time_window (float): Duration of simulation.
|
time_window (float): Duration of simulation.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
command('time_window', time_window)
|
command('time_window', time_window)
|
||||||
|
|
||||||
return time_window
|
return time_window
|
||||||
@@ -126,7 +125,6 @@ def material(permittivity, conductivity, permeability, magconductivity, name):
|
|||||||
magconductivity (float): Magnetic loss of the material.
|
magconductivity (float): Magnetic loss of the material.
|
||||||
name (str): Material identifier.
|
name (str): Material identifier.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
command('material', permittivity, conductivity, permeability, magconductivity, name)
|
command('material', permittivity, conductivity, permeability, magconductivity, name)
|
||||||
|
|
||||||
|
|
||||||
@@ -170,8 +168,10 @@ def snapshot(xs, ys, zs, xf, yf, zf, dx, dy, dz, time, filename):
|
|||||||
time = '{:d}'.format(int(time))
|
time = '{:d}'.format(int(time))
|
||||||
|
|
||||||
command('snapshot', *s, *f, *d, time, filename)
|
command('snapshot', *s, *f, *d, time, filename)
|
||||||
|
|
||||||
return s, f, d
|
return s, f, d
|
||||||
|
|
||||||
|
|
||||||
def edge(xs, ys, zs, xf, yf, zf, material):
|
def edge(xs, ys, zs, xf, yf, zf, material):
|
||||||
"""Prints the gprMax #edge command.
|
"""Prints the gprMax #edge command.
|
||||||
|
|
||||||
@@ -183,8 +183,8 @@ def edge(xs, ys, zs, xf, yf, zf, material):
|
|||||||
"""
|
"""
|
||||||
s = Coordinate(xs, ys, zs)
|
s = Coordinate(xs, ys, zs)
|
||||||
f = Coordinate(xf, yf, zf)
|
f = Coordinate(xf, yf, zf)
|
||||||
|
|
||||||
command('edge', *s, *f, material)
|
command('edge', *s, *f, material)
|
||||||
|
|
||||||
return s, f
|
return s, f
|
||||||
|
|
||||||
|
|
||||||
@@ -199,10 +199,11 @@ def plate(xs, ys, zs, xf, yf, zf, material):
|
|||||||
"""
|
"""
|
||||||
s = Coordinate(xs, ys, zs)
|
s = Coordinate(xs, ys, zs)
|
||||||
f = Coordinate(xf, yf, zf)
|
f = Coordinate(xf, yf, zf)
|
||||||
|
|
||||||
command('plate', *s, *f, material)
|
command('plate', *s, *f, material)
|
||||||
|
|
||||||
return s, f
|
return s, f
|
||||||
|
|
||||||
|
|
||||||
def triangle(x1, y1, z1, x2, y2, z2, x3, y3, z3, thickness, material):
|
def triangle(x1, y1, z1, x2, y2, z2, x3, y3, z3, thickness, material):
|
||||||
"""Prints the gprMax #triangle command.
|
"""Prints the gprMax #triangle command.
|
||||||
|
|
||||||
@@ -216,8 +217,8 @@ def triangle(x1, y1, z1, x2, y2, z2, x3, y3, z3, thickness, material):
|
|||||||
v1 = Coordinate(x1, y1, z1)
|
v1 = Coordinate(x1, y1, z1)
|
||||||
v2 = Coordinate(x2, y2, z2)
|
v2 = Coordinate(x2, y2, z2)
|
||||||
v3 = Coordinate(x3, y3, z3)
|
v3 = Coordinate(x3, y3, z3)
|
||||||
|
|
||||||
command('triangle', *v1, *v2, *v3, thickness, material)
|
command('triangle', *v1, *v2, *v3, thickness, material)
|
||||||
|
|
||||||
return v1, v2, v3
|
return v1, v2, v3
|
||||||
|
|
||||||
|
|
||||||
@@ -232,11 +233,10 @@ def box(xs, ys, zs, xf, yf, zf, material, averaging=''):
|
|||||||
Returns:
|
Returns:
|
||||||
s, f (tuple): 2 namedtuple Coordinate for the start and finish coordinates
|
s, f (tuple): 2 namedtuple Coordinate for the start and finish coordinates
|
||||||
"""
|
"""
|
||||||
|
|
||||||
s = Coordinate(xs, ys, zs)
|
s = Coordinate(xs, ys, zs)
|
||||||
f = Coordinate(xf, yf, zf)
|
f = Coordinate(xf, yf, zf)
|
||||||
|
|
||||||
command('box', *s, *f, material, averaging)
|
command('box', *s, *f, material, averaging)
|
||||||
|
|
||||||
return s, f
|
return s, f
|
||||||
|
|
||||||
|
|
||||||
@@ -253,8 +253,8 @@ def sphere(x, y, z, radius, material, averaging=''):
|
|||||||
c (tuple): namedtuple Coordinate for the center of the sphere
|
c (tuple): namedtuple Coordinate for the center of the sphere
|
||||||
"""
|
"""
|
||||||
c = Coordinate(x, y, z)
|
c = Coordinate(x, y, z)
|
||||||
|
|
||||||
command('sphere', *c, radius, material, averaging)
|
command('sphere', *c, radius, material, averaging)
|
||||||
|
|
||||||
return c
|
return c
|
||||||
|
|
||||||
|
|
||||||
@@ -272,8 +272,8 @@ def cylinder(x1, y1, z1, x2, y2, z2, radius, material, averaging=''):
|
|||||||
"""
|
"""
|
||||||
c1 = Coordinate(x1, y1, z1)
|
c1 = Coordinate(x1, y1, z1)
|
||||||
c2 = Coordinate(x2, y2, z2)
|
c2 = Coordinate(x2, y2, z2)
|
||||||
|
|
||||||
command('cylinder', *c1, *c2, radius, material, averaging)
|
command('cylinder', *c1, *c2, radius, material, averaging)
|
||||||
|
|
||||||
return c1, c2
|
return c1, c2
|
||||||
|
|
||||||
|
|
||||||
@@ -290,7 +290,6 @@ def cylindrical_sector(axis, ctr1, ctr2, t1, t2, radius, startingangle, sweptang
|
|||||||
material (str): Material identifier(s).
|
material (str): Material identifier(s).
|
||||||
averaging (str): Turn averaging on or off.
|
averaging (str): Turn averaging on or off.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
command('cylindrical_sector', axis, ctr1, ctr2, t1, t2, radius, startingangle, sweptangle, material, averaging)
|
command('cylindrical_sector', axis, ctr1, ctr2, t1, t2, radius, startingangle, sweptangle, material, averaging)
|
||||||
|
|
||||||
|
|
||||||
@@ -303,8 +302,10 @@ def excitation_file(file1):
|
|||||||
file1 (str): filename
|
file1 (str): filename
|
||||||
"""
|
"""
|
||||||
command('excitation_file', file1)
|
command('excitation_file', file1)
|
||||||
|
|
||||||
return file1
|
return file1
|
||||||
|
|
||||||
|
|
||||||
def waveform(shape, amplitude, frequency, identifier):
|
def waveform(shape, amplitude, frequency, identifier):
|
||||||
"""Prints the #waveform: shape amplitude frequency identifier
|
"""Prints the #waveform: shape amplitude frequency identifier
|
||||||
|
|
||||||
@@ -317,8 +318,10 @@ def waveform(shape, amplitude, frequency, identifier):
|
|||||||
identifier (str): is an identifier for the waveform used to assign it to a source.
|
identifier (str): is an identifier for the waveform used to assign it to a source.
|
||||||
"""
|
"""
|
||||||
command('waveform', shape, amplitude, frequency, identifier)
|
command('waveform', shape, amplitude, frequency, identifier)
|
||||||
|
|
||||||
return identifier
|
return identifier
|
||||||
|
|
||||||
|
|
||||||
def hertzian_dipole(polarization, f1, f2, f3, identifier, t0=None, t_remove=None):
|
def hertzian_dipole(polarization, f1, f2, f3, identifier, t0=None, t_remove=None):
|
||||||
"""Prints the #hertzian_dipole: polarization, f1, f2, f3, identifier, [t0, t_remove]
|
"""Prints the #hertzian_dipole: polarization, f1, f2, f3, identifier, [t0, t_remove]
|
||||||
|
|
||||||
@@ -331,12 +334,13 @@ def hertzian_dipole(polarization, f1, f2, f3, identifier, t0=None, t_remove=None
|
|||||||
Returns:
|
Returns:
|
||||||
coordinates (tuple): namedtuple Coordinate of the source location
|
coordinates (tuple): namedtuple Coordinate of the source location
|
||||||
"""
|
"""
|
||||||
|
|
||||||
c = Coordinate(f1, f2, f3)
|
c = Coordinate(f1, f2, f3)
|
||||||
# since command ignores None, this is safe:
|
# since command ignores None, this is safe:
|
||||||
command('hertzian_dipole', polarization, str(c), identifier, t0, t_remove)
|
command('hertzian_dipole', polarization, str(c), identifier, t0, t_remove)
|
||||||
|
|
||||||
return c
|
return c
|
||||||
|
|
||||||
|
|
||||||
def rx(x, y, z, identifier=None, to_save=None):
|
def rx(x, y, z, identifier=None, to_save=None):
|
||||||
"""Prints the #rx: x, y, z, [identifier, to_save] command.
|
"""Prints the #rx: x, y, z, [identifier, to_save] command.
|
||||||
|
|
||||||
@@ -347,11 +351,12 @@ def rx(x, y, z, identifier=None, to_save=None):
|
|||||||
Returns:
|
Returns:
|
||||||
coordinates (tuple): namedtuple Coordinate of the receiver location
|
coordinates (tuple): namedtuple Coordinate of the receiver location
|
||||||
"""
|
"""
|
||||||
|
|
||||||
c = Coordinate(x, y, z)
|
c = Coordinate(x, y, z)
|
||||||
command('rx', str(c), identifier, to_save)
|
command('rx', str(c), identifier, to_save)
|
||||||
|
|
||||||
return c
|
return c
|
||||||
|
|
||||||
|
|
||||||
def src_steps(dx=0, dy=0, dz=0):
|
def src_steps(dx=0, dy=0, dz=0):
|
||||||
"""Prints the #src_steps: dx, dy, dz command.
|
"""Prints the #src_steps: dx, dy, dz command.
|
||||||
|
|
||||||
@@ -363,8 +368,10 @@ def src_steps(dx=0, dy=0, dz=0):
|
|||||||
|
|
||||||
c = Coordinate(dx, dy, dz)
|
c = Coordinate(dx, dy, dz)
|
||||||
command('src_steps', str(c))
|
command('src_steps', str(c))
|
||||||
|
|
||||||
return c
|
return c
|
||||||
|
|
||||||
|
|
||||||
def rx_steps(dx=0, dy=0, dz=0):
|
def rx_steps(dx=0, dy=0, dz=0):
|
||||||
"""Prints the #rx_steps: dx, dy, dz command.
|
"""Prints the #rx_steps: dx, dy, dz command.
|
||||||
|
|
||||||
@@ -377,3 +384,5 @@ def rx_steps(dx=0, dy=0, dz=0):
|
|||||||
c = Coordinate(dx, dy, dz)
|
c = Coordinate(dx, dy, dz)
|
||||||
command('rx_steps', str(c))
|
command('rx_steps', str(c))
|
||||||
return c
|
return c
|
||||||
|
|
||||||
|
|
||||||
|
在新工单中引用
屏蔽一个用户