Cleanup formatting

这个提交包含在:
Craig Warren
2023-10-13 20:36:40 +01:00
父节点 e787140b96
当前提交 a061e64c68
共有 6 个文件被更改,包括 14 次插入14 次删除

查看文件

@@ -7,8 +7,9 @@ repos:
- id: end-of-file-fixer - id: end-of-file-fixer
- id: check-yaml - id: check-yaml
- id: check-added-large-files - id: check-added-large-files
- repo: https://github.com/psf/black - id: check-toml
rev: 23.7.0 - repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.9.1
hooks: hooks:
- id: black - id: black
args: ["--line-length", "120"] # Adjust the max line length value as needed. args: ["--line-length", "120"] # Adjust the max line length value as needed.

查看文件

@@ -8,4 +8,4 @@ from toolboxes.GPRAntennaModels.GSSI import antenna_like_GSSI_1500
gssi_objects = antenna_like_GSSI_1500(0.125, 0.094, 0.100, resolution=0.001) gssi_objects = antenna_like_GSSI_1500(0.125, 0.094, 0.100, resolution=0.001)
for obj in gssi_objects: for obj in gssi_objects:
print(obj.__str__()) print(obj.__str__())
#end_python: #end_python:

查看文件

@@ -171,8 +171,8 @@ class ExcitationFile(UserObjectMulti):
# Interpolate waveform values # Interpolate waveform values
w.userfunc = interpolate.interp1d(waveformtime, singlewaveformvalues, **kwargs) w.userfunc = interpolate.interp1d(waveformtime, singlewaveformvalues, **kwargs)
logger.info(self.grid_name(grid) + logger.info(
f"User waveform {w.ID} created using {timestr} and, if " self.grid_name(grid) + f"User waveform {w.ID} created using {timestr} and, if "
f"required, interpolation parameters (kind: {kwargs['kind']}, " f"required, interpolation parameters (kind: {kwargs['kind']}, "
f"fill value: {kwargs['fill_value']})." f"fill value: {kwargs['fill_value']})."
) )
@@ -837,9 +837,7 @@ class Rx(UserObjectMulti):
def _do_rotate(self, grid): def _do_rotate(self, grid):
"""Performs rotation.""" """Performs rotation."""
new_pt = (self.kwargs["p1"][0] + grid.dx, new_pt = (self.kwargs["p1"][0] + grid.dx, self.kwargs["p1"][1] + grid.dy, self.kwargs["p1"][2] + grid.dz)
self.kwargs["p1"][1] + grid.dy,
self.kwargs["p1"][2] + grid.dz)
pts = np.array([self.kwargs["p1"], new_pt]) pts = np.array([self.kwargs["p1"], new_pt])
rot_pts = rotate_2point_object(pts, self.axis, self.angle, self.origin) rot_pts = rotate_2point_object(pts, self.axis, self.angle, self.origin)
self.kwargs["p1"] = tuple(rot_pts[0, :]) self.kwargs["p1"] = tuple(rot_pts[0, :])

查看文件

@@ -69,7 +69,8 @@ def write_hdf5_outputfile(outputfile, G):
# Write meta data and data for any subgrids # Write meta data and data for any subgrids
sg_rxs = [True for sg in G.subgrids if sg.rxs] sg_rxs = [True for sg in G.subgrids if sg.rxs]
if sg_rxs: sg_tls = [True for sg in G.subgrids if sg.transmissionlines]
if sg_rxs or sg_tls:
for sg in G.subgrids: for sg in G.subgrids:
grp = f.create_group(f"/subgrids/{sg.name}") grp = f.create_group(f"/subgrids/{sg.name}")
write_hd5_data(grp, sg, is_subgrid=True) write_hd5_data(grp, sg, is_subgrid=True)

查看文件

@@ -276,7 +276,8 @@ class ModelBuildRun:
# Write output data to file if they are any receivers in any grids # Write output data to file if they are any receivers in any grids
sg_rxs = [True for sg in self.G.subgrids if sg.rxs] sg_rxs = [True for sg in self.G.subgrids if sg.rxs]
if self.G.rxs or sg_rxs: sg_tls = [True for sg in self.G.subgrids if sg.transmissionlines]
if self.G.rxs or sg_rxs or self.G.transmissionlines or sg_tls:
write_hdf5_outputfile(config.get_model_config().output_file_path_ext, self.G) write_hdf5_outputfile(config.get_model_config().output_file_path_ext, self.G)
# Write any snapshots to file for each grid # Write any snapshots to file for each grid

查看文件

@@ -231,14 +231,13 @@ class PML:
self.initialise_field_arrays() self.initialise_field_arrays()
def check_kappamin(self): def check_kappamin(self):
"""Checks that the sum of all kappamin values, i.e. when a multi-pole """Checks that the sum of all kappamin values, i.e. when a multi-pole
PML is used, is not less than one. PML is used, is not less than one.
""" """
kappamin = sum(cfs.kappa.min for cfs in self.CFS) kappamin = sum(cfs.kappa.min for cfs in self.CFS)
if kappamin < 1: if kappamin < 1:
logger.exception(f"Sum of kappamin value(s) for PML is {kappamin} " logger.exception(f"Sum of kappamin value(s) for PML is {kappamin} " "and must be greater than one.")
"and must be greater than one.")
raise ValueError raise ValueError
def initialise_field_arrays(self): def initialise_field_arrays(self):