Skip to content

Commit 96306db

Browse files
committed
fix: updating lavavu to use new bounding box
1 parent 1c01bdd commit 96306db

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

LoopStructural/utils/_bounding_box.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ def __init__(
3434
"maxz": (1, 2),
3535
}
3636

37+
@property
38+
def valid(self):
39+
return self._origin is not None and self._maximum is not None
40+
3741
@property
3842
def origin(self) -> np.ndarray:
3943
if self._origin is None:
@@ -87,6 +91,7 @@ def fit(self, locations: np.ndarray):
8791
raise LoopValueError(
8892
f"locations array is {locations.shape[1]}D but bounding box is {self.dimensions}"
8993
)
94+
print("fitting")
9095
self.origin = locations.min(axis=0)
9196
self.maximum = locations.max(axis=0)
9297
return self

LoopStructural/visualisation/lavavu.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def __init__(self, model=None, bounding_box=None, nsteps=None, **kwargs):
4141
self.bounding_box = bounding_box
4242
self.nsteps = nsteps
4343
if model is not None:
44-
self.bounding_box = model.bounding_box
44+
self.bounding_box = model.bounding_box.bb
4545
self.nsteps = model.nsteps
4646
logger.debug("Using bounding box from model")
4747
if self.bounding_box is None or self.nsteps is None:
@@ -255,7 +255,6 @@ def save(self, fname, **kwargs):
255255
self.lv.image(fname, **kwargs)
256256

257257
def export_to_webgl(self, fname, **kwargs):
258-
259258
self.lv.webgl(fname, **kwargs)
260259

261260
def display(self, fname=None, **kwargs):

LoopStructural/visualisation/model_plotter.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def model(self):
4141
@model.setter
4242
def model(self, model):
4343
if model is not None:
44-
self.bounding_box = np.array(model.bounding_box)
44+
self.bounding_box = np.array(model.bounding_box.bb)
4545
self.nsteps = np.array(model.nsteps)
4646
self._model = model
4747
self._nelements = self.nsteps[0] * self.nsteps[1] * self.nsteps[2]
@@ -291,6 +291,7 @@ def add_isosurface(
291291
# update the feature to make sure its current
292292

293293
# do isosurfacing of support using marching tetras/cubes
294+
print(self.bounding_box)
294295
x = np.linspace(
295296
self.bounding_box[0, 0], self.bounding_box[1, 0], self.nsteps[0]
296297
)
@@ -652,7 +653,6 @@ def add_model_surfaces(
652653
n_faults += 1
653654

654655
if self.model.stratigraphic_column and cmap is None:
655-
656656
colours = []
657657
boundaries = []
658658
data = []
@@ -675,7 +675,6 @@ def add_model_surfaces(
675675
if faults:
676676
n_surfaces += n_faults
677677
with tqdm(total=n_surfaces) as pbar:
678-
679678
if strati and self.model.stratigraphic_column:
680679
for g in self.model.stratigraphic_column.keys():
681680
if g in self.model.feature_name_index:
@@ -826,7 +825,6 @@ def add_data(self, feature, disks=False, vectors=False, **kwargs):
826825
else:
827826
features = [feature]
828827
for feature in features:
829-
830828
grad = feature.builder.get_gradient_constraints()
831829
norm = feature.builder.get_norm_constraints()
832830
value = feature.builder.get_value_constraints()

0 commit comments

Comments
 (0)