Skip to content

Commit

Permalink
fix: model plotter uses BaseFeature to check type
Browse files Browse the repository at this point in the history
  • Loading branch information
Lachlan Grose committed Jun 8, 2022
1 parent 0c68788 commit a2bd0f0
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions LoopStructural/visualisation/model_plotter.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from skimage.measure import marching_cubes_lewiner as marching_cubes


from LoopStructural.modelling.features import GeologicalFeature
from LoopStructural.modelling.features import GeologicalFeature, BaseFeature
from LoopStructural.utils.helper import create_surface, get_vectors, create_box


Expand Down Expand Up @@ -143,7 +143,13 @@ def _add_vector_marker(self, location, vector, name, symbol_type="arrow", **kwar
pass

def add_section(
self, geological_feature=None, axis="x", value=None, paint_with=None, **kwargs
self,
geological_feature=None,
axis="x",
value=None,
paint_with=None,
name=None,
**kwargs,
):
"""
Expand Down Expand Up @@ -186,14 +192,20 @@ def add_section(
if value is None:
value = np.nanmean(self.bounding_box[:, 2])
zz[:] = value
name = "nothing"
if geological_feature == "model" and self.model is not None:
name = kwargs.get("name", "model_section")
if paint_with == None:
paint_with = lambda xyz: self.model.evaluate_model(xyz, scale=False)
elif geological_feature is not None:
elif geological_feature is not None and isinstance(
geological_feature, BaseFeature
):
name = kwargs.get("name", geological_feature.name)
paint_with = geological_feature
elif callable(geological_feature):
if name is None:
name = "unnamed_callable"
paint_with = geological_feature

name = "{}_section_at_{}_of_{}".format(axis, value, name)
colour = kwargs.get("colour", "red")

Expand Down

0 comments on commit a2bd0f0

Please sign in to comment.