From a87da89d9426017485ea0b0a2bca93893527e38b Mon Sep 17 00:00:00 2001 From: Sai-Suraj-27 Date: Fri, 4 Aug 2023 00:21:33 +0530 Subject: [PATCH] Removed un-necessary concatenations while using f-strings. --- gprMax/cmds_geometry/add_grass.py | 36 +++++------ gprMax/cmds_geometry/add_surface_roughness.py | 60 +++++++++---------- gprMax/cmds_geometry/add_surface_water.py | 18 +++--- gprMax/cmds_geometry/box.py | 6 +- gprMax/cmds_geometry/cone.py | 10 ++-- gprMax/cmds_geometry/cylinder.py | 6 +- gprMax/cmds_geometry/cylindrical_sector.py | 28 ++++----- gprMax/cmds_geometry/edge.py | 4 +- gprMax/cmds_geometry/ellipsoid.py | 10 ++-- gprMax/cmds_geometry/fractal_box.py | 42 +++++-------- gprMax/cmds_geometry/fractal_box_builder.py | 4 +- gprMax/cmds_geometry/geometry_objects_read.py | 16 ++--- gprMax/cmds_geometry/plate.py | 4 +- gprMax/cmds_geometry/sphere.py | 6 +- gprMax/cmds_geometry/triangle.py | 14 ++--- 15 files changed, 126 insertions(+), 138 deletions(-) diff --git a/gprMax/cmds_geometry/add_grass.py b/gprMax/cmds_geometry/add_grass.py index a76689b1..377fea97 100644 --- a/gprMax/cmds_geometry/add_grass.py +++ b/gprMax/cmds_geometry/add_grass.py @@ -98,11 +98,11 @@ class AddGrass(UserObjectGeometry): xf, yf, zf = p2 if frac_dim < 0: - logger.exception(f"{self.__str__()} requires a positive value for " + "the fractal dimension") + logger.exception(f"{self.__str__()} requires a positive value for the fractal dimension") raise ValueError if limits[0] < 0 or limits[1] < 0: logger.exception( - f"{self.__str__()} requires a positive value for " + "the minimum and maximum heights for grass blades" + f"{self.__str__()} requires a positive value for the minimum and maximum heights for grass blades" ) raise ValueError @@ -118,7 +118,7 @@ class AddGrass(UserObjectGeometry): # xminus surface if xs == volume.xs: logger.exception( - f"{self.__str__()} grass can only be specified " + "on surfaces in the positive axis direction" + f"{self.__str__()} grass can only be specified on surfaces in the positive axis direction" ) raise ValueError # xplus surface @@ -126,8 +126,8 @@ class AddGrass(UserObjectGeometry): if fractalrange[1] > grid.nx: logger.exception( f"{self.__str__()} cannot apply grass to " - + "fractal box as it would exceed the domain " - + "size in the x direction" + "fractal box as it would exceed the domain " + "size in the x direction" ) raise ValueError requestedsurface = "xplus" @@ -143,7 +143,7 @@ class AddGrass(UserObjectGeometry): # yminus surface if ys == volume.ys: logger.exception( - f"{self.__str__()} grass can only be specified " + "on surfaces in the positive axis direction" + f"{self.__str__()} grass can only be specified on surfaces in the positive axis direction" ) raise ValueError # yplus surface @@ -151,8 +151,8 @@ class AddGrass(UserObjectGeometry): if fractalrange[1] > grid.ny: logger.exception( f"{self.__str__()} cannot apply grass to " - + "fractal box as it would exceed the domain " - + "size in the y direction" + "fractal box as it would exceed the domain " + "size in the y direction" ) raise ValueError requestedsurface = "yplus" @@ -165,7 +165,7 @@ class AddGrass(UserObjectGeometry): # zminus surface if zs == volume.zs: logger.exception( - f"{self.__str__()} grass can only be specified " + "on surfaces in the positive axis direction" + f"{self.__str__()} grass can only be specified on surfaces in the positive axis direction" ) raise ValueError # zplus surface @@ -173,8 +173,8 @@ class AddGrass(UserObjectGeometry): if fractalrange[1] > grid.nz: logger.exception( f"{self.__str__()} cannot apply grass to " - + "fractal box as it would exceed the domain " - + "size in the z direction" + "fractal box as it would exceed the domain " + "size in the z direction" ) raise ValueError requestedsurface = "zplus" @@ -195,7 +195,7 @@ class AddGrass(UserObjectGeometry): if n_blades > surface.fractalsurface.shape[0] * surface.fractalsurface.shape[1]: logger.exception( f"{self.__str__()} the specified surface is not large " - + "enough for the number of grass blades/roots specified" + "enough for the number of grass blades/roots specified" ) raise ValueError @@ -244,7 +244,7 @@ class AddGrass(UserObjectGeometry): if testgrass: logger.exception( f"{self.__str__()} requires the time step for the " - + "model to be less than the relaxation time required to model grass." + "model to be less than the relaxation time required to model grass." ) raise ValueError @@ -252,9 +252,9 @@ class AddGrass(UserObjectGeometry): logger.info( f"{self.grid_name(grid)}{n_blades} blades of grass on surface from " - + f"{xs * grid.dx:g}m, {ys * grid.dy:g}m, {zs * grid.dz:g}m, " - + f"to {xf * grid.dx:g}m, {yf * grid.dy:g}m, {zf * grid.dz:g}m " - + f"with fractal dimension {surface.dimension:g}, fractal seeding " - + f"{surface.seed}, and range {limits[0]:g}m to {limits[1]:g}m, " - + f"added to {surface.operatingonID}." + f"{xs * grid.dx:g}m, {ys * grid.dy:g}m, {zs * grid.dz:g}m, " + f"to {xf * grid.dx:g}m, {yf * grid.dy:g}m, {zf * grid.dz:g}m " + f"with fractal dimension {surface.dimension:g}, fractal seeding " + f"{surface.seed}, and range {limits[0]:g}m to {limits[1]:g}m, " + f"added to {surface.operatingonID}." ) diff --git a/gprMax/cmds_geometry/add_surface_roughness.py b/gprMax/cmds_geometry/add_surface_roughness.py index a79898a5..a0755230 100644 --- a/gprMax/cmds_geometry/add_surface_roughness.py +++ b/gprMax/cmds_geometry/add_surface_roughness.py @@ -82,8 +82,8 @@ class AddSurfaceRoughness(UserObjectGeometry): except KeyError: logger.warning( f"{self.__str__()} no value for seed detected. This " - + "means you will get a different fractal distribution " - + "every time the model runs." + "means you will get a different fractal distribution " + "every time the model runs." ) seed = None @@ -108,13 +108,13 @@ class AddSurfaceRoughness(UserObjectGeometry): if weighting[0] < 0: logger.exception( f"{self.__str__()} requires a positive value for the " - + "fractal weighting in the first direction of the surface" + "fractal weighting in the first direction of the surface" ) raise ValueError if weighting[1] < 0: logger.exception( f"{self.__str__()} requires a positive value for the " - + "fractal weighting in the second direction of the surface" + "fractal weighting in the second direction of the surface" ) raise ValueError @@ -124,7 +124,7 @@ class AddSurfaceRoughness(UserObjectGeometry): logger.exception(f"{self.__str__()} dimensions are not specified correctly") raise ValueError if xs not in [volume.xs, volume.xf]: - logger.exception(f"{self.__str__()} can only be used on the external " + "surfaces of a fractal box") + logger.exception(f"{self.__str__()} can only be used on the external surfaces of a fractal box") raise ValueError fractalrange = (round_value(limits[0] / grid.dx), round_value(limits[1] / grid.dx)) # xminus surface @@ -132,9 +132,9 @@ class AddSurfaceRoughness(UserObjectGeometry): if fractalrange[0] < 0 or fractalrange[1] > volume.xf: logger.exception( f"{self.__str__()} cannot apply fractal surface " - + "to fractal box as it would exceed either the " - + "upper coordinates of the fractal box or the " - + "domain in the x direction" + "to fractal box as it would exceed either the " + "upper coordinates of the fractal box or the " + "domain in the x direction" ) raise ValueError requestedsurface = "xminus" @@ -143,9 +143,9 @@ class AddSurfaceRoughness(UserObjectGeometry): if fractalrange[0] < volume.xs or fractalrange[1] > grid.nx: logger.exception( f"{self.__str__()} cannot apply fractal surface " - + "to fractal box as it would exceed either the " - + "lower coordinates of the fractal box or the " - + "domain in the x direction" + "to fractal box as it would exceed either the " + "lower coordinates of the fractal box or the " + "domain in the x direction" ) raise ValueError requestedsurface = "xplus" @@ -163,9 +163,9 @@ class AddSurfaceRoughness(UserObjectGeometry): if fractalrange[0] < 0 or fractalrange[1] > volume.yf: logger.exception( f"{self.__str__()} cannot apply fractal surface " - + "to fractal box as it would exceed either the " - + "upper coordinates of the fractal box or the " - + "domain in the y direction" + "to fractal box as it would exceed either the " + "upper coordinates of the fractal box or the " + "domain in the y direction" ) raise ValueError requestedsurface = "yminus" @@ -174,9 +174,9 @@ class AddSurfaceRoughness(UserObjectGeometry): if fractalrange[0] < volume.ys or fractalrange[1] > grid.ny: logger.exception( f"{self.__str__()} cannot apply fractal surface " - + "to fractal box as it would exceed either the " - + "lower coordinates of the fractal box or the " - + "domain in the y direction" + "to fractal box as it would exceed either the " + "lower coordinates of the fractal box or the " + "domain in the y direction" ) raise ValueError requestedsurface = "yplus" @@ -191,9 +191,9 @@ class AddSurfaceRoughness(UserObjectGeometry): if fractalrange[0] < 0 or fractalrange[1] > volume.zf: logger.exception( f"{self.__str__()} cannot apply fractal surface " - + "to fractal box as it would exceed either the " - + "upper coordinates of the fractal box or the " - + "domain in the x direction" + "to fractal box as it would exceed either the " + "upper coordinates of the fractal box or the " + "domain in the x direction" ) raise ValueError requestedsurface = "zminus" @@ -202,9 +202,9 @@ class AddSurfaceRoughness(UserObjectGeometry): if fractalrange[0] < volume.zs or fractalrange[1] > grid.nz: logger.exception( f"{self.__str__()} cannot apply fractal surface " - + "to fractal box as it would exceed either the " - + "lower coordinates of the fractal box or the " - + "domain in the z direction" + "to fractal box as it would exceed either the " + "lower coordinates of the fractal box or the " + "domain in the z direction" ) raise ValueError requestedsurface = "zplus" @@ -226,7 +226,7 @@ class AddSurfaceRoughness(UserObjectGeometry): # List of existing surfaces IDs existingsurfaceIDs = [x.surfaceID for x in volume.fractalsurfaces] if surface.surfaceID in existingsurfaceIDs: - logger.exception(f"{self.__str__()} has already been used on the " + f"{surface.surfaceID} surface") + logger.exception(f"{self.__str__()} has already been used on the {surface.surfaceID} surface") raise ValueError surface.generate_fractal_surface() @@ -234,10 +234,10 @@ class AddSurfaceRoughness(UserObjectGeometry): logger.info( f"{self.grid_name(grid)}Fractal surface from {xs * grid.dx:g}m, " - + f"{ys * grid.dy:g}m, {zs * grid.dz:g}m, to {xf * grid.dx:g}m, " - + f"{yf * grid.dy:g}m, {zf * grid.dz:g}m with fractal dimension " - + f"{surface.dimension:g}, fractal weightings {surface.weighting[0]:g}, " - + f"{surface.weighting[1]:g}, fractal seeding {surface.seed}, " - + f"and range {limits[0]:g}m to {limits[1]:g}m, added to " - + f"{surface.operatingonID}." + f"{ys * grid.dy:g}m, {zs * grid.dz:g}m, to {xf * grid.dx:g}m, " + f"{yf * grid.dy:g}m, {zf * grid.dz:g}m with fractal dimension " + f"{surface.dimension:g}, fractal weightings {surface.weighting[0]:g}, " + f"{surface.weighting[1]:g}, fractal seeding {surface.seed}, " + f"and range {limits[0]:g}m to {limits[1]:g}m, added to " + f"{surface.operatingonID}." ) diff --git a/gprMax/cmds_geometry/add_surface_water.py b/gprMax/cmds_geometry/add_surface_water.py index 47e1f654..be271d9b 100644 --- a/gprMax/cmds_geometry/add_surface_water.py +++ b/gprMax/cmds_geometry/add_surface_water.py @@ -85,7 +85,7 @@ class AddSurfaceWater(UserObjectGeometry): xf, yf, zf = p2 if depth <= 0: - logger.exception(f"{self.__str__()} requires a positive value for the " + f"depth of water") + logger.exception(f"{self.__str__()} requires a positive value for the depth of water") raise ValueError # Check for valid orientations @@ -94,7 +94,7 @@ class AddSurfaceWater(UserObjectGeometry): logger.exception(f"{self.__str__()} dimensions are not specified correctly") raise ValueError if xs not in [volume.xs, volume.xf]: - logger.exception(f"{self.__str__()} can only be used on the external surfaces " f"of a fractal box") + logger.exception(f"{self.__str__()} can only be used on the external surfaces of a fractal box") raise ValueError # xminus surface if xs == volume.xs: @@ -110,7 +110,7 @@ class AddSurfaceWater(UserObjectGeometry): logger.exception(f"{self.__str__()} dimensions are not specified correctly") raise ValueError if ys not in [volume.ys, volume.yf]: - logger.exception(f"{self.__str__()} can only be used on the external surfaces " + f"of a fractal box") + logger.exception(f"{self.__str__()} can only be used on the external surfaces of a fractal box") raise ValueError # yminus surface if ys == volume.ys: @@ -123,7 +123,7 @@ class AddSurfaceWater(UserObjectGeometry): elif zs == zf: if zs not in [volume.zs, volume.zf]: - logger.exception(f"{self.__str__()} can only be used on the external surfaces " f"of a fractal box") + logger.exception(f"{self.__str__()} can only be used on the external surfaces of a fractal box") raise ValueError # zminus surface if zs == volume.zs: @@ -141,7 +141,7 @@ class AddSurfaceWater(UserObjectGeometry): surface = next((x for x in volume.fractalsurfaces if x.surfaceID == requestedsurface), None) if not surface: logger.exception( - f"{self.__str__()} specified surface {requestedsurface} " + f"does not have a rough surface applied" + f"{self.__str__()} specified surface {requestedsurface} does not have a rough surface applied" ) raise ValueError @@ -151,7 +151,7 @@ class AddSurfaceWater(UserObjectGeometry): if surface.filldepth < surface.fractalrange[0] or surface.filldepth > surface.fractalrange[1]: logger.exception( f"{self.__str__()} requires a value for the depth of water that lies with the " - + f"range of the requested surface roughness" + f"range of the requested surface roughness" ) raise ValueError @@ -170,7 +170,7 @@ class AddSurfaceWater(UserObjectGeometry): logger.info( f"{self.grid_name(grid)}Water on surface from {xs * grid.dx:g}m, " - + f"{ys * grid.dy:g}m, {zs * grid.dz:g}m, to {xf * grid.dx:g}m, " - + f"{yf * grid.dy:g}m, {zf * grid.dz:g}m with depth {filldepth:g}m, " - + f"added to {surface.operatingonID}." + f"{ys * grid.dy:g}m, {zs * grid.dz:g}m, to {xf * grid.dx:g}m, " + f"{yf * grid.dy:g}m, {zf * grid.dz:g}m with depth {filldepth:g}m, " + f"added to {surface.operatingonID}." ) diff --git a/gprMax/cmds_geometry/box.py b/gprMax/cmds_geometry/box.py index 41b3cfcd..161b9b3c 100644 --- a/gprMax/cmds_geometry/box.py +++ b/gprMax/cmds_geometry/box.py @@ -157,7 +157,7 @@ class Box(UserObjectGeometry): logger.info( f"{self.grid_name(grid)}Box from {p5[0]:g}m, {p5[1]:g}m, " - + f"{p5[2]:g}m, to {p6[0]:g}m, {p6[1]:g}m, {p6[2]:g}m of " - + f"material(s) {', '.join(materialsrequested)} created, " - + f"dielectric smoothing is {dielectricsmoothing}." + f"{p5[2]:g}m, to {p6[0]:g}m, {p6[1]:g}m, {p6[2]:g}m of " + f"material(s) {', '.join(materialsrequested)} created, " + f"dielectric smoothing is {dielectricsmoothing}." ) diff --git a/gprMax/cmds_geometry/cone.py b/gprMax/cmds_geometry/cone.py index e81040c9..aa1926c0 100644 --- a/gprMax/cmds_geometry/cone.py +++ b/gprMax/cmds_geometry/cone.py @@ -85,11 +85,11 @@ class Cone(UserObjectGeometry): x2, y2, z2 = uip.round_to_grid(p2) if r1 < 0: - logger.exception(f"{self.__str__()} the radius of the first face " + f"{r1:g} should be a positive value.") + logger.exception(f"{self.__str__()} the radius of the first face {r1:g} should be a positive value.") raise ValueError if r2 < 0: - logger.exception(f"{self.__str__()} the radius of the second face " + f"{r2:g} should be a positive value.") + logger.exception(f"{self.__str__()} the radius of the second face {r2:g} should be a positive value.") raise ValueError if r1 == 0 and r2 == 0: @@ -158,7 +158,7 @@ class Cone(UserObjectGeometry): dielectricsmoothing = "on" if averaging else "off" logger.info( f"{self.grid_name(grid)}Cone with face centres {p3[0]:g}m, " - + f"{p3[1]:g}m, {p3[2]:g}m and {p4[0]:g}m, {p4[1]:g}m, {p4[2]:g}m, " - + f"with radii {r1:g}m and {r2:g}, of material(s) {', '.join(materialsrequested)} " - + f"created, dielectric smoothing is {dielectricsmoothing}." + f"{p3[1]:g}m, {p3[2]:g}m and {p4[0]:g}m, {p4[1]:g}m, {p4[2]:g}m, " + f"with radii {r1:g}m and {r2:g}, of material(s) {', '.join(materialsrequested)} " + f"created, dielectric smoothing is {dielectricsmoothing}." ) diff --git a/gprMax/cmds_geometry/cylinder.py b/gprMax/cmds_geometry/cylinder.py index aac7b143..0fa75233 100644 --- a/gprMax/cmds_geometry/cylinder.py +++ b/gprMax/cmds_geometry/cylinder.py @@ -146,7 +146,7 @@ class Cylinder(UserObjectGeometry): dielectricsmoothing = "on" if averaging else "off" logger.info( f"{self.grid_name(grid)}Cylinder with face centres {p3[0]:g}m, " - + f"{p3[1]:g}m, {p3[2]:g}m and {p4[0]:g}m, {p4[1]:g}m, {p4[2]:g}m, " - + f"with radius {r:g}m, of material(s) {', '.join(materialsrequested)} " - + f"created, dielectric smoothing is {dielectricsmoothing}." + f"{p3[1]:g}m, {p3[2]:g}m and {p4[0]:g}m, {p4[1]:g}m, {p4[2]:g}m, " + f"with radius {r:g}m, of material(s) {', '.join(materialsrequested)} " + f"created, dielectric smoothing is {dielectricsmoothing}." ) diff --git a/gprMax/cmds_geometry/cylindrical_sector.py b/gprMax/cmds_geometry/cylindrical_sector.py index 1f9d4dde..6308fb1d 100644 --- a/gprMax/cmds_geometry/cylindrical_sector.py +++ b/gprMax/cmds_geometry/cylindrical_sector.py @@ -94,17 +94,15 @@ class CylindricalSector(UserObjectGeometry): sectorangle = 2 * np.pi * (end / 360) if normal not in ["x", "y", "z"]: - logger.exception(f"{self.__str__()} the normal direction must be either " + f"x, y or z.") + logger.exception(f"{self.__str__()} the normal direction must be either x, y or z.") raise ValueError if r <= 0: logger.exception(f"{self.__str__()} the radius {r:g} should be a positive value.") if sectorstartangle < 0 or sectorangle <= 0: - logger.exception(f"{self.__str__()} the starting angle and sector angle should be " + f"a positive values.") + logger.exception(f"{self.__str__()} the starting angle and sector angle should be a positive values.") raise ValueError if sectorstartangle >= 2 * np.pi or sectorangle >= 2 * np.pi: - logger.exception( - f"{self.__str__()} the starting angle and sector angle must be " + f"less than 360 degrees." - ) + logger.exception(f"{self.__str__()} the starting angle and sector angle must be less than 360 degrees.") raise ValueError # Look up requested materials in existing list of material instances @@ -195,18 +193,18 @@ class CylindricalSector(UserObjectGeometry): dielectricsmoothing = "on" if averaging else "off" logger.info( f"{self.grid_name(grid)}Cylindrical sector with centre " - + f"{ctr1:g}m, {ctr2:g}m, radius {r:g}m, starting angle " - + f"{(sectorstartangle / (2 * np.pi)) * 360:.1f} degrees, " - + f"sector angle {(sectorangle / (2 * np.pi)) * 360:.1f} degrees, " - + f"thickness {thickness:g}m, of material(s) {', '.join(materialsrequested)} " - + f"created, dielectric smoothing is {dielectricsmoothing}." + f"{ctr1:g}m, {ctr2:g}m, radius {r:g}m, starting angle " + f"{(sectorstartangle / (2 * np.pi)) * 360:.1f} degrees, " + f"sector angle {(sectorangle / (2 * np.pi)) * 360:.1f} degrees, " + f"thickness {thickness:g}m, of material(s) {', '.join(materialsrequested)} " + f"created, dielectric smoothing is {dielectricsmoothing}." ) else: logger.info( f"{self.grid_name(grid)}Cylindrical sector with centre " - + f"{ctr1:g}m, {ctr2:g}m, radius {r:g}m, starting angle " - + f"{(sectorstartangle / (2 * np.pi)) * 360:.1f} degrees, " - + f"sector angle {(sectorangle / (2 * np.pi)) * 360:.1f} " - + f"degrees, of material(s) {', '.join(materialsrequested)} " - + f"created." + f"{ctr1:g}m, {ctr2:g}m, radius {r:g}m, starting angle " + f"{(sectorstartangle / (2 * np.pi)) * 360:.1f} degrees, " + f"sector angle {(sectorangle / (2 * np.pi)) * 360:.1f} " + f"degrees, of material(s) {', '.join(materialsrequested)} " + f"created." ) diff --git a/gprMax/cmds_geometry/edge.py b/gprMax/cmds_geometry/edge.py index 0e1c6302..27d2c525 100644 --- a/gprMax/cmds_geometry/edge.py +++ b/gprMax/cmds_geometry/edge.py @@ -103,6 +103,6 @@ class Edge(UserObjectGeometry): logger.info( f"{self.grid_name(grid)}Edge from {p3[0]:g}m, {p3[1]:g}m, " - + f"{p3[2]:g}m, to {p4[0]:g}m, {p4[1]:g}m, {p4[2]:g}m of " - + f"material {material_id} created." + f"{p3[2]:g}m, to {p4[0]:g}m, {p4[1]:g}m, {p4[2]:g}m of " + f"material {material_id} created." ) diff --git a/gprMax/cmds_geometry/ellipsoid.py b/gprMax/cmds_geometry/ellipsoid.py index e72a904a..ebd12ce9 100644 --- a/gprMax/cmds_geometry/ellipsoid.py +++ b/gprMax/cmds_geometry/ellipsoid.py @@ -53,7 +53,7 @@ class Ellipsoid(UserObjectGeometry): zr = self.kwargs["zr"] except KeyError: - logger.exception(f"{self.__str__()} please specify a point and " + f"the three semiaxes.") + logger.exception(f"{self.__str__()} please specify a point and the three semiaxes.") raise # Check averaging @@ -140,8 +140,8 @@ class Ellipsoid(UserObjectGeometry): dielectricsmoothing = "on" if averaging else "off" logger.info( f"{self.grid_name(grid)}Ellipsoid with centre {p2[0]:g}m, " - + f"{p2[1]:g}m, {p2[2]:g}m, x-semiaxis {xr:g}m, " - + f"y-semiaxis {yr:g}m and z-semiaxis {zr:g}m of material(s) " - + f"{', '.join(materialsrequested)} created, dielectric " - + f"smoothing is {dielectricsmoothing}." + f"{p2[1]:g}m, {p2[2]:g}m, x-semiaxis {xr:g}m, " + f"y-semiaxis {yr:g}m and z-semiaxis {zr:g}m of material(s) " + f"{', '.join(materialsrequested)} created, dielectric " + f"smoothing is {dielectricsmoothing}." ) diff --git a/gprMax/cmds_geometry/fractal_box.py b/gprMax/cmds_geometry/fractal_box.py index 1aea4a8c..57a2c045 100644 --- a/gprMax/cmds_geometry/fractal_box.py +++ b/gprMax/cmds_geometry/fractal_box.py @@ -87,8 +87,8 @@ class FractalBox(UserObjectGeometry): except KeyError: logger.warning( f"{self.__str__()} no value for seed detected. This " - + "means you will get a different fractal distribution " - + "every time the model runs." + "means you will get a different fractal distribution " + "every time the model runs." ) seed = None @@ -112,24 +112,18 @@ class FractalBox(UserObjectGeometry): xf, yf, zf = p2 if frac_dim < 0: - logger.exception(f"{self.__str__()} requires a positive value for the " + "fractal dimension") + logger.exception(f"{self.__str__()} requires a positive value for the fractal dimension") raise ValueError if weighting[0] < 0: - logger.exception( - f"{self.__str__()} requires a positive value for the " + "fractal weighting in the x direction" - ) + logger.exception(f"{self.__str__()} requires a positive value for the fractal weighting in the x direction") raise ValueError if weighting[1] < 0: - logger.exception( - f"{self.__str__()} requires a positive value for the " + "fractal weighting in the y direction" - ) + logger.exception(f"{self.__str__()} requires a positive value for the fractal weighting in the y direction") raise ValueError if weighting[2] < 0: - logger.exception( - f"{self.__str__()} requires a positive value for the " + "fractal weighting in the z direction" - ) + logger.exception(f"{self.__str__()} requires a positive value for the fractal weighting in the z direction") if n_materials < 0: - logger.exception(f"{self.__str__()} requires a positive value for the " + "number of bins") + logger.exception(f"{self.__str__()} requires a positive value for the number of bins") raise ValueError # Find materials to use to build fractal volume, either from mixing @@ -140,15 +134,11 @@ class FractalBox(UserObjectGeometry): if mixingmodel: if nbins == 1: - logger.exception( - f"{self.__str__()} must be used with more than " + "one material from the mixing model." - ) + logger.exception(f"{self.__str__()} must be used with more than one material from the mixing model.") raise ValueError if isinstance(mixingmodel, ListMaterial) and nbins > len(mixingmodel.mat): logger.exception( - f"{self.__str__()} too many materials/bins " - + "requested compared to materials in " - + "mixing model." + f"{self.__str__()} too many materials/bins " "requested compared to materials in " "mixing model." ) raise ValueError # Create materials from mixing model as number of bins now known @@ -173,13 +163,13 @@ class FractalBox(UserObjectGeometry): dielectricsmoothing = "on" if volume.averaging else "off" logger.info( f"{self.grid_name(grid)}Fractal box {volume.ID} from " - + f"{p3[0]:g}m, {p3[1]:g}m, {p3[2]:g}m, to {p4[0]:g}m, " - + f"{p4[1]:g}m, {p4[2]:g}m with {volume.operatingonID}, " - + f"fractal dimension {volume.dimension:g}, fractal weightings " - + f"{volume.weighting[0]:g}, {volume.weighting[1]:g}, " - + f"{volume.weighting[2]:g}, fractal seeding {volume.seed}, " - + f"with {volume.nbins} material(s) created, dielectric smoothing " - + f"is {dielectricsmoothing}." + f"{p3[0]:g}m, {p3[1]:g}m, {p3[2]:g}m, to {p4[0]:g}m, " + f"{p4[1]:g}m, {p4[2]:g}m with {volume.operatingonID}, " + f"fractal dimension {volume.dimension:g}, fractal weightings " + f"{volume.weighting[0]:g}, {volume.weighting[1]:g}, " + f"{volume.weighting[2]:g}, fractal seeding {volume.seed}, " + f"with {volume.nbins} material(s) created, dielectric smoothing " + f"is {dielectricsmoothing}." ) grid.fractalvolumes.append(volume) diff --git a/gprMax/cmds_geometry/fractal_box_builder.py b/gprMax/cmds_geometry/fractal_box_builder.py index d680c9e0..bf18de5a 100644 --- a/gprMax/cmds_geometry/fractal_box_builder.py +++ b/gprMax/cmds_geometry/fractal_box_builder.py @@ -388,8 +388,8 @@ class FractalBoxBuilder(UserObjectGeometry): if volume.nbins == 1: logger.exception( f"{self.__str__()} is being used with a " - + "single material and no modifications, " - + "therefore please use a #box command instead." + "single material and no modifications, " + "therefore please use a #box command instead." ) raise ValueError else: diff --git a/gprMax/cmds_geometry/geometry_objects_read.py b/gprMax/cmds_geometry/geometry_objects_read.py index e8e487d5..5697df94 100644 --- a/gprMax/cmds_geometry/geometry_objects_read.py +++ b/gprMax/cmds_geometry/geometry_objects_read.py @@ -108,8 +108,8 @@ class GeometryObjectsRead(UserObjectGeometry): ): logger.exception( f"{self.__str__()} requires the spatial resolution " - + "of the geometry objects file to match the spatial " - + "resolution of the model" + "of the geometry objects file to match the spatial " + "resolution of the model" ) raise ValueError @@ -134,9 +134,9 @@ class GeometryObjectsRead(UserObjectGeometry): grid.ID[:, xs : xs + ID.shape[1], ys : ys + ID.shape[2], zs : zs + ID.shape[3]] = ID + numexistmaterials logger.info( f"{self.grid_name(grid)}Geometry objects from file {geofile} " - + f"inserted at {xs * grid.dx:g}m, {ys * grid.dy:g}m, " - + f"{zs * grid.dz:g}m, with corresponding materials file " - + f"{matfile}." + f"inserted at {xs * grid.dx:g}m, {ys * grid.dy:g}m, " + f"{zs * grid.dz:g}m, with corresponding materials file " + f"{matfile}." ) except KeyError: averaging = False @@ -155,7 +155,7 @@ class GeometryObjectsRead(UserObjectGeometry): ) logger.info( f"{self.grid_name(grid)}Geometry objects from file " - + f"(voxels only){geofile} inserted at {xs * grid.dx:g}m, " - + f"{ys * grid.dy:g}m, {zs * grid.dz:g}m, with corresponding " - + f"materials file {matfile}." + f"(voxels only){geofile} inserted at {xs * grid.dx:g}m, " + f"{ys * grid.dy:g}m, {zs * grid.dz:g}m, with corresponding " + f"materials file {matfile}." ) diff --git a/gprMax/cmds_geometry/plate.py b/gprMax/cmds_geometry/plate.py index 005fa535..9246107e 100644 --- a/gprMax/cmds_geometry/plate.py +++ b/gprMax/cmds_geometry/plate.py @@ -148,6 +148,6 @@ class Plate(UserObjectGeometry): logger.info( f"{self.grid_name(grid)}Plate from {p3[0]:g}m, {p3[1]:g}m, " - + f"{p3[2]:g}m, to {p4[0]:g}m, {p4[1]:g}m, {p4[2]:g}m of " - + f"material(s) {', '.join(materialsrequested)} created." + f"{p3[2]:g}m, to {p4[0]:g}m, {p4[1]:g}m, {p4[2]:g}m of " + f"material(s) {', '.join(materialsrequested)} created." ) diff --git a/gprMax/cmds_geometry/sphere.py b/gprMax/cmds_geometry/sphere.py index 796340e9..27211b19 100644 --- a/gprMax/cmds_geometry/sphere.py +++ b/gprMax/cmds_geometry/sphere.py @@ -133,7 +133,7 @@ class Sphere(UserObjectGeometry): dielectricsmoothing = "on" if averaging else "off" logger.info( f"{self.grid_name(grid)}Sphere with centre {p2[0]:g}m, " - + f"{p2[1]:g}m, {p2[2]:g}m, radius {r:g}m, of material(s) " - + f"{', '.join(materialsrequested)} created, dielectric " - + f"smoothing is {dielectricsmoothing}." + f"{p2[1]:g}m, {p2[2]:g}m, radius {r:g}m, of material(s) " + f"{', '.join(materialsrequested)} created, dielectric " + f"smoothing is {dielectricsmoothing}." ) diff --git a/gprMax/cmds_geometry/triangle.py b/gprMax/cmds_geometry/triangle.py index de6235f3..a0aed311 100644 --- a/gprMax/cmds_geometry/triangle.py +++ b/gprMax/cmds_geometry/triangle.py @@ -205,15 +205,15 @@ class Triangle(UserObjectGeometry): dielectricsmoothing = "on" if averaging else "off" logger.info( f"{self.grid_name(grid)}Triangle with coordinates " - + f"{p4[0]:g}m {p4[1]:g}m {p4[2]:g}m, {p5[0]:g}m {p5[1]:g}m " - + f"{p5[2]:g}m, {p6[0]:g}m {p6[1]:g}m {p6[2]:g}m and thickness " - + f"{thickness:g}m of material(s) {', '.join(materialsrequested)} " - + f"created, dielectric smoothing is {dielectricsmoothing}." + f"{p4[0]:g}m {p4[1]:g}m {p4[2]:g}m, {p5[0]:g}m {p5[1]:g}m " + f"{p5[2]:g}m, {p6[0]:g}m {p6[1]:g}m {p6[2]:g}m and thickness " + f"{thickness:g}m of material(s) {', '.join(materialsrequested)} " + f"created, dielectric smoothing is {dielectricsmoothing}." ) else: logger.info( f"{self.grid_name(grid)}Triangle with coordinates " - + f"{p4[0]:g}m {p4[1]:g}m {p4[2]:g}m, {p5[0]:g}m {p5[1]:g}m " - + f"{p5[2]:g}m, {p6[0]:g}m {p6[1]:g}m {p6[2]:g}m of material(s) " - + f"{', '.join(materialsrequested)} created." + f"{p4[0]:g}m {p4[1]:g}m {p4[2]:g}m, {p5[0]:g}m {p5[1]:g}m " + f"{p5[2]:g}m, {p6[0]:g}m {p6[1]:g}m {p6[2]:g}m of material(s) " + f"{', '.join(materialsrequested)} created." )