LoopStructural 1.0.1__zip
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of LoopStructural might be problematic. Click here for more details.
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/__init__.py +33 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/__pycache__/__init__.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/datasets/__init__.py +12 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/datasets/__pycache__/__init__.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/datasets/__pycache__/_base.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/datasets/_base.py +65 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/datasets/data/claudius.csv +21049 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/datasets/data/claudiusbb.txt +2 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/datasets/data/duplex.csv +126 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/datasets/data/duplexbb.txt +2 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/datasets/data/intrusion.csv +1017 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/datasets/data/intrusionbb.txt +2 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/datasets/data/onefoldbb.txt +2 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/datasets/data/onefolddata.csv +2226 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/datasets/data/refolded_bb.txt +2 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/datasets/data/refolded_fold.csv +2126 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/__init__.py +31 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/__pycache__/__init__.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/__pycache__/discrete_fold_interpolator.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/__pycache__/discrete_interpolator.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/__pycache__/finite_difference_interpolator.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/__pycache__/geological_interpolator.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/__pycache__/operator.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/__pycache__/piecewiselinear_interpolator.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/__pycache__/structured_grid.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/__pycache__/structured_tetra.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/__pycache__/surfe_wrapper.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/cython/__init__.py +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/cython/__pycache__/__init__.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/cython/dsi_helper.c +27805 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/cython/dsi_helper.cp37-win_amd64.pyd +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/discrete_fold_interpolator.py +168 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/discrete_interpolator.py +551 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/finite_difference_interpolator.py +339 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/geological_interpolator.py +178 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/operator.py +46 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/piecewiselinear_interpolator.py +300 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/structured_grid.py +460 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/structured_tetra.py +637 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/surfe_wrapper.py +119 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/__init__.py +46 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/__pycache__/__init__.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/core/__init__.py +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/core/__pycache__/__init__.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/core/__pycache__/geological_model.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/core/geological_model.py +1179 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fault/__init__.py +3 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fault/__pycache__/__init__.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fault/__pycache__/fault_function.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fault/__pycache__/fault_function_feature.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fault/__pycache__/fault_segment.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fault/fault_function.py +187 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fault/fault_function_feature.py +75 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fault/fault_segment.py +270 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/__init__.py +7 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/__pycache__/__init__.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/__pycache__/cross_product_geological_feature.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/__pycache__/geological_feature.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/__pycache__/geological_feature_builder.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/__pycache__/region_feature.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/__pycache__/structural_frame.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/__pycache__/structural_frame_builder.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/__pycache__/unconformity_feature.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/cross_product_geological_feature.py +77 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/geological_feature.py +276 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/geological_feature_builder.py +289 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/region_feature.py +31 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/structural_frame.py +116 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/structural_frame_builder.py +179 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/unconformity_feature.py +69 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fold/__init__.py +8 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fold/__pycache__/__init__.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fold/__pycache__/fold.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fold/__pycache__/fold_rotation_angle.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fold/__pycache__/fold_rotation_angle_feature.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fold/__pycache__/foldframe.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fold/__pycache__/svariogram.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fold/fold.py +135 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fold/fold_rotation_angle.py +132 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fold/fold_rotation_angle_feature.py +57 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fold/foldframe.py +191 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fold/svariogram.py +179 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/utils/__init__.py +14 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/utils/__pycache__/__init__.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/utils/__pycache__/exceptions.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/utils/__pycache__/helper.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/utils/__pycache__/map2loop.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/utils/__pycache__/utils.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/utils/exceptions.py +9 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/utils/helper.py +373 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/utils/map2loop.py +229 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/utils/utils.py +76 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/visualisation/__init__.py +19 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/visualisation/__pycache__/__init__.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/visualisation/__pycache__/map_viewer.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/visualisation/__pycache__/model_plotter.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/visualisation/__pycache__/model_visualisation.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/visualisation/__pycache__/rotation_angle_plotter.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/visualisation/__pycache__/sphinx_scraper.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/visualisation/map_viewer.py +122 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/visualisation/model_plotter.py +16 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/visualisation/model_visualisation.py +704 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/visualisation/rotation_angle_plotter.py +66 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/visualisation/sphinx_scraper.py +34 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural-1.0.1-py3.7.egg-info/PKG-INFO +10 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural-1.0.1-py3.7.egg-info/SOURCES.txt +60 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural-1.0.1-py3.7.egg-info/dependency_links.txt +1 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural-1.0.1-py3.7.egg-info/requires.txt +3 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural-1.0.1-py3.7.egg-info/top_level.txt +2 -0
- Miniconda/envs/loop/Lib/site-packages/tests/__init__.py +0 -0
- Miniconda/envs/loop/Lib/site-packages/tests/__pycache__/__init__.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/tests/__pycache__/test_faults.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/tests/__pycache__/test_fold.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/tests/__pycache__/test_interpolator.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/tests/__pycache__/test_refolded.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/tests/test_faults.py +17 -0
- Miniconda/envs/loop/Lib/site-packages/tests/test_fold.py +57 -0
- Miniconda/envs/loop/Lib/site-packages/tests/test_interpolator.py +88 -0
- Miniconda/envs/loop/Lib/site-packages/tests/test_refolded.py +22 -0
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
|
|
3
|
+
import numpy as np
|
|
4
|
+
|
|
5
|
+
from LoopStructural.modelling.features.structural_frame import StructuralFrame
|
|
6
|
+
|
|
7
|
+
logger = logging.getLogger(__name__)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class FoldFrame(StructuralFrame):
|
|
11
|
+
def __init__(self, name, features, fold=None):
|
|
12
|
+
"""
|
|
13
|
+
A structural frame that can calculate the fold axis/limb rotation angle
|
|
14
|
+
Same constructor arguments as parent StructuralFrame
|
|
15
|
+
|
|
16
|
+
Parameters
|
|
17
|
+
----------
|
|
18
|
+
name
|
|
19
|
+
features
|
|
20
|
+
"""
|
|
21
|
+
super().__init__(name, features, fold)
|
|
22
|
+
self.model = None
|
|
23
|
+
|
|
24
|
+
def set_model(self, model):
|
|
25
|
+
self.model = model
|
|
26
|
+
|
|
27
|
+
def calculate_fold_axis_rotation(self, feature_builder):
|
|
28
|
+
"""
|
|
29
|
+
Calculate the fold axis rotation angle by finding the angle between the
|
|
30
|
+
intersection lineation and the gradient to the 1st coordinate of the
|
|
31
|
+
fold frame
|
|
32
|
+
Parameters
|
|
33
|
+
----------
|
|
34
|
+
feature_builder - GeologicalFeatureInterpolator
|
|
35
|
+
- the builder for the geological feature that is folded
|
|
36
|
+
|
|
37
|
+
Returns
|
|
38
|
+
-------
|
|
39
|
+
|
|
40
|
+
"""
|
|
41
|
+
gpoints = feature_builder.get_gradient_constraints()[:,:6]
|
|
42
|
+
npoints = feature_builder.get_norm_constraints()[:,:6]
|
|
43
|
+
points = []
|
|
44
|
+
if gpoints.shape[0] > 0:
|
|
45
|
+
points.append(gpoints)
|
|
46
|
+
if npoints.shape[0] > 0:
|
|
47
|
+
points.append(npoints)
|
|
48
|
+
if len(points) == 0:
|
|
49
|
+
return 0, 0
|
|
50
|
+
points = np.vstack(points)
|
|
51
|
+
# We need to ignore the fault when we are calculating the splot because it is done
|
|
52
|
+
# in the restored space
|
|
53
|
+
# self.features[0].faults_enabled = False
|
|
54
|
+
# self.features[1].faults_enabled = False
|
|
55
|
+
s1g = self.features[0].evaluate_gradient(points[:, :3])
|
|
56
|
+
s1g /= np.linalg.norm(s1g, axis=1)[:, None]
|
|
57
|
+
s1gyg = self.features[1].evaluate_gradient(points[:, :3])
|
|
58
|
+
s1gyg /= np.linalg.norm(s1gyg, axis=1)[:, None]
|
|
59
|
+
l1 = points[:, 3:]
|
|
60
|
+
l1 /= np.linalg.norm(l1, axis=1)[:, None]
|
|
61
|
+
fad = self.features[1].evaluate_value(points[:, :3])
|
|
62
|
+
# Turn the faults back on
|
|
63
|
+
# self.features[0].faults_enabled = True
|
|
64
|
+
# self.features[1].faults_enabled = True
|
|
65
|
+
|
|
66
|
+
# project s0 onto axis plane B X A X B
|
|
67
|
+
projected_l1 = np.cross(s1g, np.cross(l1, s1g, axisa=1, axisb=1),
|
|
68
|
+
axisa=1, axisb=1)
|
|
69
|
+
projected_s1gyg = np.cross(s1g, np.cross(s1gyg, s1g, axisa=1, axisb=1),
|
|
70
|
+
axisa=1, axisb=1)
|
|
71
|
+
|
|
72
|
+
# einsum dot product
|
|
73
|
+
far = np.einsum('ij,ij->i', projected_l1, projected_s1gyg)
|
|
74
|
+
far = np.rad2deg(np.arccos(far))
|
|
75
|
+
# scalar triple product
|
|
76
|
+
stp = np.einsum('ij,ij->i', np.cross(l1, s1gyg, axisa=1, axisb=1), s1g)
|
|
77
|
+
# check bounds
|
|
78
|
+
far-=90
|
|
79
|
+
# far[stp < 0] = 360.- far[stp < 0]
|
|
80
|
+
far[far>90] = far[far>90]+-180
|
|
81
|
+
far[far<-90] = far[far<-90]+180
|
|
82
|
+
|
|
83
|
+
return far, fad
|
|
84
|
+
|
|
85
|
+
def calculate_fold_limb_rotation(self, feature_builder, axis=None):
|
|
86
|
+
"""
|
|
87
|
+
Calculate the fold limb rotation angle using the axis specified and
|
|
88
|
+
the normals to the folded foliation
|
|
89
|
+
Parameters
|
|
90
|
+
----------
|
|
91
|
+
feature_builder - GeologicalFeatureInterpolator
|
|
92
|
+
the feature interpolator for the folded feature that has the
|
|
93
|
+
datapoints the fold limb rotation angle is
|
|
94
|
+
going to be calculated for
|
|
95
|
+
axis - GeologicalFeature
|
|
96
|
+
Optional. Fold axis feature that when queried for location
|
|
97
|
+
returns the fold axis
|
|
98
|
+
|
|
99
|
+
Returns
|
|
100
|
+
-------
|
|
101
|
+
fold_limb_rotation, coordinate_0
|
|
102
|
+
"""
|
|
103
|
+
# self.features[0].faults_enabled = False
|
|
104
|
+
# self.features[1].faults_enabled = False
|
|
105
|
+
|
|
106
|
+
gpoints = feature_builder.interpolator.get_gradient_constraints()[:,:6]
|
|
107
|
+
npoints = feature_builder.interpolator.get_norm_constraints()[:,:6]
|
|
108
|
+
points = []
|
|
109
|
+
if gpoints.shape[0] > 0:
|
|
110
|
+
points.append(gpoints)
|
|
111
|
+
if npoints.shape[0] > 0:
|
|
112
|
+
points.append(npoints)
|
|
113
|
+
if len(points) == 0:
|
|
114
|
+
logger.error("No points to calculate fold rotation angle")
|
|
115
|
+
return np.array([0]), np.array([0])
|
|
116
|
+
points = np.vstack(points)
|
|
117
|
+
# for f in feature_builder.faults:
|
|
118
|
+
# points[:,:3] = f.apply_to_points(points[:,:3])
|
|
119
|
+
# get the normals from the points array
|
|
120
|
+
s0g = points[:, 3:]
|
|
121
|
+
|
|
122
|
+
# calculate the gradient and value of the first coordinate of the
|
|
123
|
+
# fold frame
|
|
124
|
+
# for the locations and normalise
|
|
125
|
+
s1g = self.features[0].evaluate_gradient(points[:, :3])
|
|
126
|
+
s1g /= np.linalg.norm(s1g, axis=1)[:, None]
|
|
127
|
+
s1 = self.features[0].evaluate_value(points[:, :3])
|
|
128
|
+
# self.features[0].faults_enabled = True
|
|
129
|
+
# self.features[1].faults_enabled = True
|
|
130
|
+
|
|
131
|
+
if axis is None:
|
|
132
|
+
logger.info("Not using fold axis for fold limb rotation angle calculation")
|
|
133
|
+
r2 = np.einsum('ij,ij->i', s1g, s0g)
|
|
134
|
+
|
|
135
|
+
return np.rad2deg(np.arcsin(r2)), s1
|
|
136
|
+
if axis is not None:
|
|
137
|
+
fold_axis = axis(points[:, :3])
|
|
138
|
+
# project s0 onto axis plane B X A X B
|
|
139
|
+
projected_s0 = np.cross(fold_axis,
|
|
140
|
+
np.cross(s0g, fold_axis, axisa=1, axisb=1),
|
|
141
|
+
axisa=1, axisb=1)
|
|
142
|
+
projected_s1 = np.cross(fold_axis,
|
|
143
|
+
np.cross(s1g, fold_axis, axisa=1, axisb=1),
|
|
144
|
+
axisa=1, axisb=1)
|
|
145
|
+
projected_s0 /= np.linalg.norm(projected_s0, axis=1)[:, None]
|
|
146
|
+
projected_s1 /= np.linalg.norm(projected_s1, axis=1)[:, None]
|
|
147
|
+
r2 = np.einsum('ij,ij->i', projected_s1, projected_s0) #
|
|
148
|
+
# adjust the fold rotation angle so that its always between -90
|
|
149
|
+
# and 90
|
|
150
|
+
vv = np.cross(s1g, s0g, axisa=1, axisb=1)
|
|
151
|
+
ds = np.einsum('ij,ij->i', fold_axis, vv)
|
|
152
|
+
flr = np.where(ds > 0, np.rad2deg(np.arcsin(r2)),
|
|
153
|
+
(- np.rad2deg(np.arcsin(r2))))
|
|
154
|
+
flr = np.where(flr < -90, (180. + flr), flr)
|
|
155
|
+
flr = np.where(flr > 90, -(180. - flr), flr)
|
|
156
|
+
return flr, s1
|
|
157
|
+
|
|
158
|
+
def calculate_intersection_lineation(self, feature_builder):
|
|
159
|
+
"""
|
|
160
|
+
Calculate the intersection lineation by finding the cross product
|
|
161
|
+
between the first fold frame
|
|
162
|
+
coordinate and the vector representing the normal to the folded
|
|
163
|
+
foliation
|
|
164
|
+
Parameters
|
|
165
|
+
----------
|
|
166
|
+
feature_builder - GeologicalFeatureInterpolator
|
|
167
|
+
the feature builder that contains the data points that the
|
|
168
|
+
intersection lineation is calculated for
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
Returns Nx3 array of doubles
|
|
172
|
+
-------
|
|
173
|
+
|
|
174
|
+
"""
|
|
175
|
+
self.features[0].faults_enabled = False
|
|
176
|
+
gpoints = feature_builder.interpolator.get_gradient_constraints()[:,:6]
|
|
177
|
+
npoints = feature_builder.interpolator.get_norm_constraints()[:,:6]
|
|
178
|
+
points = []
|
|
179
|
+
if gpoints.shape[0] > 0:
|
|
180
|
+
points.append(gpoints)
|
|
181
|
+
if npoints.shape[0] > 0:
|
|
182
|
+
points.append(npoints)
|
|
183
|
+
points = np.vstack(points)
|
|
184
|
+
s1g = self.features[0].evaluate_gradient(points[:, :3])
|
|
185
|
+
s1g /= np.linalg.norm(points[:, :3], axis=1)[:, None]
|
|
186
|
+
s0g = points[:, 3:]
|
|
187
|
+
s0g /= np.linalg.norm(s0g, axis=1)[:, None]
|
|
188
|
+
l1 = np.cross(s1g, s0g, axisa=1, axisb=1)
|
|
189
|
+
l1 /= np.linalg.norm(l1, axis=1)[:, None]
|
|
190
|
+
self.features[0].faults_enabled = True
|
|
191
|
+
return l1
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
|
|
3
|
+
import numpy as np
|
|
4
|
+
|
|
5
|
+
logger = logging.getLogger(__name__)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def find_peaks_and_troughs(x, y):
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
Parameters
|
|
12
|
+
----------
|
|
13
|
+
x np.array or list
|
|
14
|
+
x axis data for plot
|
|
15
|
+
y np.array or list
|
|
16
|
+
y axis data for plot
|
|
17
|
+
Returns
|
|
18
|
+
-------
|
|
19
|
+
(np.array, np.array)
|
|
20
|
+
Notes
|
|
21
|
+
-----
|
|
22
|
+
Returns the loations of maxima/minima on the curve using finite
|
|
23
|
+
difference forward/backwards
|
|
24
|
+
finding the change in derivative
|
|
25
|
+
"""
|
|
26
|
+
if len(x) != len(y):
|
|
27
|
+
return False
|
|
28
|
+
pairsx = []
|
|
29
|
+
pairsy = []
|
|
30
|
+
# #TODO numpyize
|
|
31
|
+
for i in range(0, len(x)):
|
|
32
|
+
if i < 1:
|
|
33
|
+
pairsx.append(x[i])
|
|
34
|
+
pairsy.append(y[i])
|
|
35
|
+
|
|
36
|
+
continue
|
|
37
|
+
if i > len(x) - 2:
|
|
38
|
+
pairsx.append(x[i])
|
|
39
|
+
pairsy.append(y[i])
|
|
40
|
+
continue
|
|
41
|
+
left_grad = (y[i - 1] - y[i]) / (x[i - 1] - x[i])
|
|
42
|
+
right_grad = (y[i] - y[i + 1]) / (x[i] - x[i + 1])
|
|
43
|
+
if np.sign(left_grad) != np.sign(right_grad):
|
|
44
|
+
pairsx.append(x[i])
|
|
45
|
+
pairsy.append(y[i])
|
|
46
|
+
return pairsx, pairsy
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
class SVariogram():
|
|
50
|
+
"""
|
|
51
|
+
The SVariogram is an experimental semi-variogram.
|
|
52
|
+
"""
|
|
53
|
+
|
|
54
|
+
def __init__(self, xdata, ydata):
|
|
55
|
+
self.xdata = xdata
|
|
56
|
+
self.ydata = ydata
|
|
57
|
+
self.dist = np.abs(self.xdata[:, None] - self.xdata[None, :])
|
|
58
|
+
self.variance_matrix = (self.ydata[:, None] - self.ydata[None, :]) ** 2
|
|
59
|
+
self.lags = None
|
|
60
|
+
self.variogram = None
|
|
61
|
+
|
|
62
|
+
def calc_semivariogram(self, lag = None, nlag = None, lags = None):
|
|
63
|
+
"""
|
|
64
|
+
Calculate a semi-variogram for the x and y data for this object.
|
|
65
|
+
You can specify the lags as an array or specify the step size and
|
|
66
|
+
number of steps.
|
|
67
|
+
If neither are specified then the lags are created to be the average
|
|
68
|
+
spacing of the data
|
|
69
|
+
|
|
70
|
+
Parameters
|
|
71
|
+
----------
|
|
72
|
+
step: float
|
|
73
|
+
lag distance for the s-variogram
|
|
74
|
+
nstep: int
|
|
75
|
+
number of lags for the s-variogram
|
|
76
|
+
lags: array
|
|
77
|
+
num
|
|
78
|
+
|
|
79
|
+
Returns
|
|
80
|
+
-------
|
|
81
|
+
|
|
82
|
+
"""
|
|
83
|
+
logger.info("Calculating S-Variogram")
|
|
84
|
+
if lag is not None:
|
|
85
|
+
step = lag
|
|
86
|
+
logger.info("Using lag: %f kwarg for S-variogram"%step)
|
|
87
|
+
|
|
88
|
+
if nlag is not None:
|
|
89
|
+
nstep = nlag
|
|
90
|
+
logger.info("Using nlag %i kwarg for s-variogram"%nstep)
|
|
91
|
+
|
|
92
|
+
self.lags = np.arange(step / 2., nstep * step, step)
|
|
93
|
+
|
|
94
|
+
if nlag is None and lag is not None:
|
|
95
|
+
nstep = int(
|
|
96
|
+
np.ceil((np.nanmax(self.xdata) - np.nanmin(self.xdata)) / step))
|
|
97
|
+
logger.info("Using lag kwarg but calculating nlag as %i for s-variogram"%nstep)
|
|
98
|
+
|
|
99
|
+
self.lags = np.arange(step / 2., nstep * step, step)
|
|
100
|
+
|
|
101
|
+
if lags is not None:
|
|
102
|
+
self.lags = lags
|
|
103
|
+
|
|
104
|
+
if self.lags is None:
|
|
105
|
+
# time to guess the step size
|
|
106
|
+
# find the average distance between elements in the input data
|
|
107
|
+
d = np.copy(self.dist)
|
|
108
|
+
d[d == 0] = np.nan
|
|
109
|
+
|
|
110
|
+
step = np.nanmean(np.nanmin(d, axis=1))*4.
|
|
111
|
+
# find number of steps to cover range in data
|
|
112
|
+
nstep = int(
|
|
113
|
+
np.ceil((np.nanmax(self.xdata) - np.nanmin(self.xdata)) / step))
|
|
114
|
+
self.lags = np.arange(step / 2., nstep * step, step)
|
|
115
|
+
logger.info("Using average minimum nearest neighbour distance "
|
|
116
|
+
"as lag distance size {} and using {} lags".format(step,nstep))
|
|
117
|
+
tol = self.lags[1] - self.lags[0]
|
|
118
|
+
self.variogram = np.zeros(self.lags.shape)
|
|
119
|
+
self.variogram[:] = np.nan
|
|
120
|
+
npairs = np.zeros(self.lags.shape)
|
|
121
|
+
for i in range(len(self.lags)):
|
|
122
|
+
logic = np.logical_and(self.dist > self.lags[i]
|
|
123
|
+
- tol / 2.,
|
|
124
|
+
self.dist < self.lags[i] + tol / 2.)
|
|
125
|
+
npairs[i] = np.sum(logic.astype(int))
|
|
126
|
+
if npairs[i] > 0:
|
|
127
|
+
self.variogram[i] = np.mean(self.variance_matrix[logic])
|
|
128
|
+
return self.lags, self.variogram, npairs
|
|
129
|
+
|
|
130
|
+
def find_wavelengths(self, **kwargs):
|
|
131
|
+
"""
|
|
132
|
+
Picks the wavelengths of the fold by finding the maximum and
|
|
133
|
+
minimums of the s-variogram
|
|
134
|
+
the fold wavelength is the first minimum but it is more reliable to
|
|
135
|
+
use the first maximum
|
|
136
|
+
as the estimate of the wavelength.
|
|
137
|
+
|
|
138
|
+
Parameters
|
|
139
|
+
----------
|
|
140
|
+
kwargs : object
|
|
141
|
+
"""
|
|
142
|
+
h, var, npairs = self.calc_semivariogram(**kwargs)
|
|
143
|
+
|
|
144
|
+
px, py = find_peaks_and_troughs(h, var)
|
|
145
|
+
|
|
146
|
+
averagex = []
|
|
147
|
+
averagey = []
|
|
148
|
+
for i in range(len(px) - 1):
|
|
149
|
+
averagex.append((px[i] + px[i + 1]) / 2.)
|
|
150
|
+
averagey.append((py[i] + py[i + 1]) / 2.)
|
|
151
|
+
i += 1 # iterate twice
|
|
152
|
+
# find the extrema of the average curve
|
|
153
|
+
px2, py2 = find_peaks_and_troughs(averagex, averagey)
|
|
154
|
+
wl1 = 0.
|
|
155
|
+
wl1py = 0.
|
|
156
|
+
for i in range(len(px)):
|
|
157
|
+
if i > 0 and i < len(px) - 1:
|
|
158
|
+
if py[i] > 10:
|
|
159
|
+
|
|
160
|
+
if py[i - 1] < py[i] * .7:
|
|
161
|
+
if py[i + 1] < py[i] * .7:
|
|
162
|
+
wl1 = px[i]
|
|
163
|
+
if wl1 > 0.:
|
|
164
|
+
wl1py = py[i]
|
|
165
|
+
break
|
|
166
|
+
wl2 = 0.
|
|
167
|
+
for i in range(len(px2)):
|
|
168
|
+
if i > 0 and i < len(px2) - 1:
|
|
169
|
+
if py2[i - 1] < py2[i] * .90:
|
|
170
|
+
if py2[i + 1] < py2[i] * .90:
|
|
171
|
+
wl2 = px2[i]
|
|
172
|
+
if wl2 > 0. and wl2 > wl1 * 2 and wl1py < py2[i]:
|
|
173
|
+
break
|
|
174
|
+
if wl1 == 0.0 and wl2 == 0.0:
|
|
175
|
+
return 2 * (np.max(self.xdata) - np.min(self.xdata)), 0.
|
|
176
|
+
if np.isclose(wl1, 0.0):
|
|
177
|
+
return np.array([wl2 * 2., wl1 * 2.])
|
|
178
|
+
# wavelength is 2x the peak on the curve
|
|
179
|
+
return np.array([wl1 * 2., wl2 * 2.])
|
Miniconda/envs/loop/Lib/site-packages/LoopStructural/utils/__pycache__/__init__.cpython-37.pyc
ADDED
|
Binary file
|
Miniconda/envs/loop/Lib/site-packages/LoopStructural/utils/__pycache__/exceptions.cpython-37.pyc
ADDED
|
Binary file
|
|
Binary file
|
Miniconda/envs/loop/Lib/site-packages/LoopStructural/utils/__pycache__/map2loop.cpython-37.pyc
ADDED
|
Binary file
|
|
Binary file
|