你已经派生过 gprMax
镜像自地址
https://gitee.com/sunhf/gprMax.git
已同步 2025-08-07 15:10:13 +08:00
bugfix, the filter command removed the float/int 0. Added command call for material(), NOTE: may modify rounding as str(x) outputs more digits than {:g}
这个提交包含在:
@@ -51,17 +51,17 @@ def command(cmd, *parameters):
|
|||||||
s (str): the printed string
|
s (str): the printed string
|
||||||
"""
|
"""
|
||||||
# remove Nones
|
# remove Nones
|
||||||
parameters = filter(None, parameters)
|
filtered = filter(lambda x: x is not None, parameters)
|
||||||
# convert to str
|
# convert to str
|
||||||
parameters = map(str, parameters)
|
filtered_str = map(str, filtered)
|
||||||
# convert to list
|
# convert to list
|
||||||
parameters = list(parameters)
|
filtered_list = list(filtered_str)
|
||||||
try:
|
try:
|
||||||
s = '#{}: {}'.format(cmd, " ".join(parameters))
|
s = '#{}: {}'.format(cmd, " ".join(filtered_list))
|
||||||
except TypeError as e:
|
except TypeError as e:
|
||||||
# append info about cmd and parameters to the exception:
|
# append info about cmd and parameters to the exception:
|
||||||
if not e.args: e.args=('', )
|
if not e.args: e.args=('', )
|
||||||
additional_info = "Creating cmd = #{} with parameters {} failed".format(cmd, parameters)
|
additional_info = "Creating cmd = #{} with parameters {} -> {} failed".format(cmd, parameters, filtered_list)
|
||||||
e.args = e.args + (additional_info,)
|
e.args = e.args + (additional_info,)
|
||||||
raise e
|
raise e
|
||||||
# and now we can print it:
|
# and now we can print it:
|
||||||
@@ -127,7 +127,7 @@ def material(permittivity, conductivity, permeability, magconductivity, name):
|
|||||||
name (str): Material identifier.
|
name (str): Material identifier.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
print('#material: {:g} {:g} {:g} {:g} {}'.format(permittivity, conductivity, permeability, magconductivity, name))
|
command('material', permittivity, conductivity, permeability, magconductivity, name)
|
||||||
|
|
||||||
|
|
||||||
def geometry_view(xs, ys, zs, xf, yf, zf, dx, dy, dz, filename, type='n'):
|
def geometry_view(xs, ys, zs, xf, yf, zf, dx, dy, dz, filename, type='n'):
|
||||||
|
在新工单中引用
屏蔽一个用户