你已经派生过 gprMax
镜像自地址
https://gitee.com/sunhf/gprMax.git
已同步 2025-08-07 15:10:13 +08:00
Reformatted some code in a few more files.
这个提交包含在:
@@ -46,7 +46,7 @@ class GeometryObjectsRead(UserObjectGeometry):
|
||||
geofile = self.kwargs['geofile']
|
||||
matfile = self.kwargs['matfile']
|
||||
except KeyError:
|
||||
logger.exception(self.__str__() + 'requires exactly five parameters')
|
||||
logger.exception(f'{self.__str__()} requires exactly five parameters')
|
||||
raise
|
||||
|
||||
# Discretise the point using uip object. This has different behaviour
|
||||
@@ -100,7 +100,7 @@ class GeometryObjectsRead(UserObjectGeometry):
|
||||
if round_value((dx_dy_dz[0] / grid.dx) != 1 or
|
||||
round_value(dx_dy_dz[1] / grid.dy) != 1 or
|
||||
round_value(dx_dy_dz[2] / grid.dz) != 1):
|
||||
logger.exception(self.__str__() + ' requires the spatial resolution ' +
|
||||
logger.exception(f'{self.__str__()} requires the spatial resolution ' +
|
||||
'of the geometry objects file to match the spatial ' +
|
||||
'resolution of the model')
|
||||
raise ValueError
|
||||
|
@@ -61,7 +61,7 @@ class Plate(UserObjectGeometry):
|
||||
p1 = self.kwargs['p1']
|
||||
p2 = self.kwargs['p2']
|
||||
except KeyError:
|
||||
logger.exception(self.__str__() + ' 2 points must be specified')
|
||||
logger.exception(f'{self.__str__()} 2 points must be specified')
|
||||
raise
|
||||
|
||||
# isotropic
|
||||
@@ -72,7 +72,7 @@ class Plate(UserObjectGeometry):
|
||||
try:
|
||||
materialsrequested = self.kwargs['material_ids']
|
||||
except KeyError:
|
||||
logger.exception(self.__str__() + ' No materials have been specified')
|
||||
logger.exception(f'{self.__str__()} No materials have been specified')
|
||||
raise
|
||||
|
||||
if self.do_rotate:
|
||||
@@ -86,23 +86,15 @@ class Plate(UserObjectGeometry):
|
||||
xf, yf, zf = p2
|
||||
|
||||
# Check for valid orientations
|
||||
if xs == xf:
|
||||
if ys == yf or zs == zf:
|
||||
logger.exception(self.__str__() + ' the plate is not specified correctly')
|
||||
raise ValueError
|
||||
|
||||
elif ys == yf:
|
||||
if xs == xf or zs == zf:
|
||||
logger.exception(self.__str__() + ' the plate is not specified correctly')
|
||||
raise ValueError
|
||||
|
||||
elif zs == zf:
|
||||
if xs == xf or ys == yf:
|
||||
logger.exception(self.__str__() + ' the plate is not specified correctly')
|
||||
raise ValueError
|
||||
|
||||
else:
|
||||
logger.exception(self.__str__() + ' the plate is not specified correctly')
|
||||
if (xs == xf
|
||||
and (ys == yf or zs == zf)
|
||||
or (xs != xf
|
||||
and ys == yf
|
||||
and zs == zf)
|
||||
or (xs != xf
|
||||
and ys != yf
|
||||
and zs != zf)):
|
||||
logger.exception(f'{self.__str__()} the plate is not specified correctly')
|
||||
raise ValueError
|
||||
|
||||
# Look up requested materials in existing list of material instances
|
||||
@@ -110,7 +102,7 @@ class Plate(UserObjectGeometry):
|
||||
|
||||
if len(materials) != len(materialsrequested):
|
||||
notfound = [x for x in materialsrequested if x not in materials]
|
||||
logger.exception(self.__str__() + f' material(s) {notfound} do not exist')
|
||||
logger.exception(f'{self.__str__()} material(s) {notfound} do not exist')
|
||||
raise ValueError
|
||||
|
||||
# yz-plane plate
|
||||
|
@@ -48,7 +48,7 @@ class Sphere(UserObjectGeometry):
|
||||
p1 = self.kwargs['p1']
|
||||
r = self.kwargs['r']
|
||||
except KeyError:
|
||||
logger.exception(self.__str__() + ' please specify a point and a radius.')
|
||||
logger.exception(f'{self.__str__()} please specify a point and a radius.')
|
||||
raise
|
||||
|
||||
# Check averaging
|
||||
@@ -68,7 +68,7 @@ class Sphere(UserObjectGeometry):
|
||||
try:
|
||||
materialsrequested = self.kwargs['material_ids']
|
||||
except KeyError:
|
||||
logger.exception(self.__str__() + ' no materials have been specified')
|
||||
logger.exception(f'{self.__str__()} no materials have been specified')
|
||||
raise
|
||||
|
||||
# Centre of sphere
|
||||
@@ -85,7 +85,7 @@ class Sphere(UserObjectGeometry):
|
||||
|
||||
if len(materials) != len(materialsrequested):
|
||||
notfound = [x for x in materialsrequested if x not in materials]
|
||||
logger.exception(self.__str__() + f' material(s) {notfound} do not exist')
|
||||
logger.exception(f'{self.__str__()} material(s) {notfound} do not exist')
|
||||
raise ValueError
|
||||
|
||||
# Isotropic case
|
||||
|
@@ -70,7 +70,7 @@ class Triangle(UserObjectGeometry):
|
||||
up3 = self.kwargs['p3']
|
||||
thickness = self.kwargs['thickness']
|
||||
except KeyError:
|
||||
logger.exception(self.__str__() + ' specify 3 points and a thickness')
|
||||
logger.exception(f'{self.__str__()} specify 3 points and a thickness')
|
||||
raise
|
||||
|
||||
if self.do_rotate:
|
||||
@@ -93,7 +93,7 @@ class Triangle(UserObjectGeometry):
|
||||
try:
|
||||
materialsrequested = self.kwargs['material_ids']
|
||||
except KeyError:
|
||||
logger.exception(self.__str__() + ' no materials have been specified')
|
||||
logger.exception(f'{self.__str__()} no materials have been specified')
|
||||
raise
|
||||
|
||||
p4 = uip.round_to_grid_static_point(up1)
|
||||
@@ -108,21 +108,21 @@ class Triangle(UserObjectGeometry):
|
||||
x3, y3, z3 = uip.round_to_grid(up3)
|
||||
|
||||
if thickness < 0:
|
||||
logger.exception(self.__str__() + ' requires a positive value for thickness')
|
||||
logger.exception(f'{self.__str__()} requires a positive value for thickness')
|
||||
raise ValueError
|
||||
|
||||
# Check for valid orientations
|
||||
# yz-plane triangle
|
||||
if x1 == x2 and x2 == x3:
|
||||
if x1 == x2 == x3:
|
||||
normal = 'x'
|
||||
# xz-plane triangle
|
||||
elif y1 == y2 and y2 == y3:
|
||||
elif y1 == y2 == y3:
|
||||
normal = 'y'
|
||||
# xy-plane triangle
|
||||
elif z1 == z2 and z2 == z3:
|
||||
elif z1 == z2 == z3:
|
||||
normal = 'z'
|
||||
else:
|
||||
logger.exception(self.__str__() + ' the triangle is not specified correctly')
|
||||
logger.exception(f'{self.__str__()} the triangle is not specified correctly')
|
||||
raise ValueError
|
||||
|
||||
# Look up requested materials in existing list of material instances
|
||||
@@ -130,7 +130,7 @@ class Triangle(UserObjectGeometry):
|
||||
|
||||
if len(materials) != len(materialsrequested):
|
||||
notfound = [x for x in materialsrequested if x not in materials]
|
||||
logger.exception(self.__str__() + f' material(s) {notfound} do not exist')
|
||||
logger.exception(f'{self.__str__()} material(s) {notfound} do not exist')
|
||||
raise ValueError
|
||||
|
||||
if thickness > 0:
|
||||
|
在新工单中引用
屏蔽一个用户