Skip to content

Commit 6000f1d

Browse files
committed
Merge branch 'fix/docs_and_cleanup' of github.com:Loop3D/LoopStructural into fix/docs_and_cleanup
2 parents acce4bc + b013903 commit 6000f1d

8 files changed

+41
-30
lines changed

LoopStructural/datatypes/_bounding_box.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -326,9 +326,7 @@ def get_value(self, name):
326326
if iy == -1:
327327
return self.origin[ix]
328328

329-
return self.bb[
330-
ix,
331-
]
329+
return self.bb[ix,]
332330

333331
def __getitem__(self, name):
334332
if isinstance(name, str):

LoopStructural/interpolators/_finite_difference_interpolator.py

+18-3
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,12 @@ def add_gradient_constraints(self, w=1.0):
272272
idc[inside, :] = gi[node_idx[inside, :]]
273273
inside = np.logical_and(~np.any(idc == -1, axis=1), inside)
274274

275-
(vertices, T, elements, inside_,) = self.support.get_element_gradient_for_location(
275+
(
276+
vertices,
277+
T,
278+
elements,
279+
inside_,
280+
) = self.support.get_element_gradient_for_location(
276281
points[inside, : self.support.dimension]
277282
)
278283
# normalise constraint vector and scale element matrix by this
@@ -335,7 +340,12 @@ def add_norm_constraints(self, w=1.0):
335340
# calculate unit vector for node gradients
336341
# this means we are only constraining direction of grad not the
337342
# magnitude
338-
(vertices, T, elements, inside_,) = self.support.get_element_gradient_for_location(
343+
(
344+
vertices,
345+
T,
346+
elements,
347+
inside_,
348+
) = self.support.get_element_gradient_for_location(
339349
points[inside, : self.support.dimension]
340350
)
341351
# T*=np.product(self.support.step_vector)
@@ -422,7 +432,12 @@ def add_gradient_orthogonal_constraints(
422432
vectors[norm > 0, :] /= norm[norm > 0, None]
423433

424434
# normalise element vector to unit vector for dot product
425-
(vertices, T, elements, inside_,) = self.support.get_element_gradient_for_location(
435+
(
436+
vertices,
437+
T,
438+
elements,
439+
inside_,
440+
) = self.support.get_element_gradient_for_location(
426441
points[inside, : self.support.dimension]
427442
)
428443
T[norm > 0, :, :] /= norm[norm > 0, None, None]

LoopStructural/interpolators/supports/_3d_base_structured.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,9 @@ def origin(self, origin):
162162
length = self.maximum - origin
163163
length /= self.step_vector
164164
self._nsteps = np.ceil(length).astype(np.int64)
165-
self._nsteps[
166-
self._nsteps == 0
167-
] = 3 # need to have a minimum of 3 elements to apply the finite difference mask
165+
self._nsteps[self._nsteps == 0] = (
166+
3 # need to have a minimum of 3 elements to apply the finite difference mask
167+
)
168168
if np.any(~(self._nsteps > 0)):
169169
logger.error(
170170
f"Cannot resize the interpolation support. The proposed number of steps is {self._nsteps}, these must be all > 0"

LoopStructural/interpolators/supports/_3d_structured_tetra.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,9 @@ def _init_face_table(self):
166166
shared_face_index[:] = -1
167167
shared_face_index[row.reshape(-1, 3)[:, 0], :] = col.reshape(-1, 3)
168168

169-
self.shared_elements[
170-
np.arange(self.shared_element_relationships.shape[0]), :
171-
] = shared_face_index
169+
self.shared_elements[np.arange(self.shared_element_relationships.shape[0]), :] = (
170+
shared_face_index
171+
)
172172
# resize
173173
self.shared_elements = self.shared_elements[: len(self.shared_element_relationships), :]
174174

LoopStructural/interpolators/supports/_3d_unstructured_tetra.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,9 @@ def _init_face_table(self):
173173
shared_face_index[:] = -1
174174
shared_face_index[row.reshape(-1, 3)[:, 0], :] = col.reshape(-1, 3)
175175

176-
self.shared_elements[
177-
np.arange(self.shared_element_relationships.shape[0]), :
178-
] = shared_face_index
176+
self.shared_elements[np.arange(self.shared_element_relationships.shape[0]), :] = (
177+
shared_face_index
178+
)
179179
# resize
180180
self.shared_elements = self.shared_elements[: len(self.shared_element_relationships), :]
181181
# flag = np.zeros(self.elements.shape[0])

LoopStructural/interpolators/supports/_face_table.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ def _init_face_table(grid):
6363
shared_face_index = np.zeros((shared_faces.shape[0], grid.dimension), dtype=int)
6464
shared_face_index[:] = -1
6565
shared_face_index[row.reshape(-1, grid.dimension)[:, 0], :] = col.reshape(-1, grid.dimension)
66-
grid._shared_elements[
67-
np.arange(grid.shared_element_relationships.shape[0]), :
68-
] = shared_face_index
66+
grid._shared_elements[np.arange(grid.shared_element_relationships.shape[0]), :] = (
67+
shared_face_index
68+
)
6969
# resize
7070
grid._shared_elements = grid.shared_elements[: len(grid.shared_element_relationships), :]

LoopStructural/modelling/core/geological_model.py

+4-6
Original file line numberDiff line numberDiff line change
@@ -598,12 +598,10 @@ def data(self, data: pd.DataFrame):
598598
* self._data.loc[mask, "polarity"].to_numpy()[:, None]
599599
)
600600
self._data.drop(["strike", "dip"], axis=1, inplace=True)
601-
self._data[
602-
['X', 'Y', 'Z', 'val', 'nx', 'ny', 'nz', 'gx', 'gy', 'gz', 'tx', 'ty', 'tz']
603-
] = self._data[
604-
['X', 'Y', 'Z', 'val', 'nx', 'ny', 'nz', 'gx', 'gy', 'gz', 'tx', 'ty', 'tz']
605-
].astype(
606-
float
601+
self._data[['X', 'Y', 'Z', 'val', 'nx', 'ny', 'nz', 'gx', 'gy', 'gz', 'tx', 'ty', 'tz']] = (
602+
self._data[
603+
['X', 'Y', 'Z', 'val', 'nx', 'ny', 'nz', 'gx', 'gy', 'gz', 'tx', 'ty', 'tz']
604+
].astype(float)
607605
)
608606

609607
def set_model_data(self, data):

LoopStructural/modelling/input/process_data.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -299,9 +299,9 @@ def fault_properties(self, fault_properties):
299299
pts = self.fault_locations.loc[
300300
self.fault_locations["feature_name"] == fname, ["X", "Y", "Z"]
301301
]
302-
fault_properties.loc[
303-
fname, ["centreEasting", "centreNorthing", "centreAltitude"]
304-
] = np.nanmean(pts, axis=0)
302+
fault_properties.loc[fname, ["centreEasting", "centreNorthing", "centreAltitude"]] = (
303+
np.nanmean(pts, axis=0)
304+
)
305305
if (
306306
"avgNormalEasting" not in fault_properties.columns
307307
or "avgNormalNorthing" not in fault_properties.columns
@@ -449,9 +449,9 @@ def _stratigraphic_value(self):
449449
for _name, sg in self.stratigraphic_order:
450450
value = 0.0 # reset for each supergroup
451451
if sg[0] not in self.thicknesses or self.thicknesses[sg[0]] <= 0:
452-
self.thicknesses[
453-
sg[0]
454-
] = np.inf # make the top unit infinite as it should extend to the top of the model
452+
self.thicknesses[sg[0]] = (
453+
np.inf
454+
) # make the top unit infinite as it should extend to the top of the model
455455
for g in reversed(
456456
sg[:-1]
457457
): # don't add the last unit as we never see the base of this unit.

0 commit comments

Comments
 (0)