Skip to content

Commit

Permalink
fix: featuretype enum
Browse files Browse the repository at this point in the history
  • Loading branch information
Lachlan Grose committed Jul 15, 2022
1 parent 80c2566 commit c256746
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 8 deletions.
3 changes: 2 additions & 1 deletion LoopStructural/analysis/_fault_intersection.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from skimage.measure import marching_cubes
import pandas as pd
import numpy as np
from LoopStructural.modelling.features import FeatureType

from LoopStructural.utils import getLogger

Expand All @@ -26,7 +27,7 @@ def calculate_fault_intersections(model, threshold=0.001):
"""
fault_names = []
for f in model.features:
if f.type == "fault":
if f.type == FeatureType.FAULT:
fault_names.append(f.name)
fault_matrix = pd.DataFrame(columns=fault_names)
for f in fault_names:
Expand Down
4 changes: 2 additions & 2 deletions LoopStructural/modelling/core/geological_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -1791,7 +1791,7 @@ def evaluate_fault_displacements(self, points, scale=True):
points = self.scale(points, inplace=False)
vals = np.zeros(points.shape[0])
for f in self.features:
if f.type == "fault":
if f.type == FeatureType.FAULT:
disp = f.displacementfeature.evaluate_value(points)
vals[~np.isnan(disp)] += disp[~np.isnan(disp)]
return (
Expand Down Expand Up @@ -1898,7 +1898,7 @@ def update(self, verbose=False, progressbar=True):
total_dof = 0
nfeatures = 0
for f in self.features:
if f.type == "fault":
if f.type == FeatureType.FAULT:
nfeatures += 3
total_dof += f[0].interpolator.nx * 3
if isinstance(f, StructuralFrame):
Expand Down
1 change: 1 addition & 0 deletions LoopStructural/modelling/features/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class FeatureType(IntEnum):
LAMBDA = 6
UNCONFORMITY = 7
INTRUSION = 8
FAULT = 9


from ._base_geological_feature import BaseFeature
Expand Down
2 changes: 1 addition & 1 deletion LoopStructural/modelling/features/fault/_fault_segment.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def __init__(
kwargs
"""
StructuralFrame.__init__(self, features, name, fold)
self.type = FeatureType.INTERPOLATED
self.type = FeatureType.FAULT
self.displacement = displacement
self._faultfunction = BaseFault.fault_displacement
self.steps = steps
Expand Down
3 changes: 2 additions & 1 deletion LoopStructural/visualisation/map_viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from LoopStructural.utils import getLogger

logger = getLogger(__name__)
from LoopStructural.modelling.features import FeatureType


class MapView:
Expand Down Expand Up @@ -372,7 +373,7 @@ def add_fault_displacements(self, z=0, cmap="rainbow"):

def add_faults(self, **kwargs):
for f in self.model.features:
if f.type == "fault":
if f.type == FeatureType.FAULT:
# create a function to return true if displacement > 0
def mask(x):
val = f.displacementfeature.evaluate_value(x)
Expand Down
11 changes: 8 additions & 3 deletions LoopStructural/visualisation/model_plotter.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from LoopStructural.utils import getLogger
from LoopStructural.utils import LoopImportError
from LoopStructural.modelling.features import FeatureType

logger = getLogger(__name__)

Expand All @@ -13,7 +14,11 @@
from skimage.measure import marching_cubes_lewiner as marching_cubes


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


Expand Down Expand Up @@ -634,7 +639,7 @@ def add_model_surfaces(
n_units += 1
n_faults = 0
for f in self.model.features:
if f.type == "fault":
if f.type == FeatureType.FAULT:
n_faults += 1

if self.model.stratigraphic_column and cmap is None:
Expand Down Expand Up @@ -688,7 +693,7 @@ def add_model_surfaces(

if faults:
for f in self.model.features:
if f.type == "fault":
if f.type == FeatureType.FAULT:

def mask(x):
val = f.displacementfeature.evaluate_value(x)
Expand Down

0 comments on commit c256746

Please sign in to comment.