LoopStructural 1.0.9__cp38-cp38-win32.whl

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.
Files changed (77) hide show
  1. LoopStructural/__init__.py +36 -0
  2. LoopStructural/analysis/__init__.py +2 -0
  3. LoopStructural/analysis/_fault_displacement.py +67 -0
  4. LoopStructural/analysis/_fault_intersection.py +36 -0
  5. LoopStructural/analysis/_plane_fit.py +43 -0
  6. LoopStructural/datasets/__init__.py +12 -0
  7. LoopStructural/datasets/_base.py +65 -0
  8. LoopStructural/datasets/data/claudius.csv +21049 -0
  9. LoopStructural/datasets/data/claudiusbb.txt +2 -0
  10. LoopStructural/datasets/data/duplex.csv +126 -0
  11. LoopStructural/datasets/data/duplexbb.txt +2 -0
  12. LoopStructural/datasets/data/intrusion.csv +1017 -0
  13. LoopStructural/datasets/data/intrusionbb.txt +2 -0
  14. LoopStructural/datasets/data/onefoldbb.txt +2 -0
  15. LoopStructural/datasets/data/onefolddata.csv +2226 -0
  16. LoopStructural/datasets/data/refolded_bb.txt +2 -0
  17. LoopStructural/datasets/data/refolded_fold.csv +2126 -0
  18. LoopStructural/interpolators/__init__.py +34 -0
  19. LoopStructural/interpolators/base_structured_3d_support.py +101 -0
  20. LoopStructural/interpolators/cython/__init__.py +0 -0
  21. LoopStructural/interpolators/cython/dsi_helper.c +31046 -0
  22. LoopStructural/interpolators/cython/dsi_helper.cp38-win32.pyd +0 -0
  23. LoopStructural/interpolators/discrete_fold_interpolator.py +202 -0
  24. LoopStructural/interpolators/discrete_interpolator.py +584 -0
  25. LoopStructural/interpolators/finite_difference_interpolator.py +399 -0
  26. LoopStructural/interpolators/geological_interpolator.py +197 -0
  27. LoopStructural/interpolators/operator.py +61 -0
  28. LoopStructural/interpolators/piecewiselinear_interpolator.py +437 -0
  29. LoopStructural/interpolators/structured_grid.py +421 -0
  30. LoopStructural/interpolators/structured_tetra.py +681 -0
  31. LoopStructural/interpolators/surfe_wrapper.py +118 -0
  32. LoopStructural/modelling/__init__.py +46 -0
  33. LoopStructural/modelling/core/__init__.py +0 -0
  34. LoopStructural/modelling/core/geological_model.py +1513 -0
  35. LoopStructural/modelling/core/geological_model_graph.py +880 -0
  36. LoopStructural/modelling/core/stratigraphic_column.py +5 -0
  37. LoopStructural/modelling/fault/__init__.py +4 -0
  38. LoopStructural/modelling/fault/fault_builder.py +143 -0
  39. LoopStructural/modelling/fault/fault_function.py +188 -0
  40. LoopStructural/modelling/fault/fault_function_feature.py +76 -0
  41. LoopStructural/modelling/fault/fault_segment.py +298 -0
  42. LoopStructural/modelling/features/__init__.py +8 -0
  43. LoopStructural/modelling/features/cross_product_geological_feature.py +90 -0
  44. LoopStructural/modelling/features/geological_feature.py +252 -0
  45. LoopStructural/modelling/features/geological_feature_builder.py +414 -0
  46. LoopStructural/modelling/features/lambda_geological_feature.py +36 -0
  47. LoopStructural/modelling/features/region_feature.py +34 -0
  48. LoopStructural/modelling/features/structural_frame.py +133 -0
  49. LoopStructural/modelling/features/structural_frame_builder.py +206 -0
  50. LoopStructural/modelling/features/unconformity_feature.py +74 -0
  51. LoopStructural/modelling/fold/__init__.py +8 -0
  52. LoopStructural/modelling/fold/fold.py +143 -0
  53. LoopStructural/modelling/fold/fold_rotation_angle.py +133 -0
  54. LoopStructural/modelling/fold/fold_rotation_angle_feature.py +58 -0
  55. LoopStructural/modelling/fold/foldframe.py +193 -0
  56. LoopStructural/modelling/fold/svariogram.py +180 -0
  57. LoopStructural/utils/__init__.py +18 -0
  58. LoopStructural/utils/bounding_box.py +21 -0
  59. LoopStructural/utils/exceptions.py +10 -0
  60. LoopStructural/utils/helper.py +382 -0
  61. LoopStructural/utils/logging.py +60 -0
  62. LoopStructural/utils/map2loop.py +353 -0
  63. LoopStructural/utils/regions.py +11 -0
  64. LoopStructural/utils/utils.py +69 -0
  65. LoopStructural/visualisation/__init__.py +31 -0
  66. LoopStructural/visualisation/map_viewer.py +322 -0
  67. LoopStructural/visualisation/model_plotter.py +17 -0
  68. LoopStructural/visualisation/model_visualisation.py +1113 -0
  69. LoopStructural/visualisation/rotation_angle_plotter.py +83 -0
  70. LoopStructural/visualisation/sphinx_scraper.py +34 -0
  71. LoopStructural/visualisation/stratigraphic_column.py +60 -0
  72. LoopStructural-1.0.9.dist-info/LICENSE +21 -0
  73. LoopStructural-1.0.9.dist-info/METADATA +19 -0
  74. LoopStructural-1.0.9.dist-info/RECORD +77 -0
  75. LoopStructural-1.0.9.dist-info/WHEEL +5 -0
  76. LoopStructural-1.0.9.dist-info/top_level.txt +2 -0
  77. tests/__init__.py +0 -0
@@ -0,0 +1,202 @@
1
+ """
2
+ Piecewise linear interpolator using folds
3
+ """
4
+ import logging
5
+
6
+ import numpy as np
7
+ from LoopStructural.interpolators.cython.dsi_helper import fold_cg
8
+
9
+ from LoopStructural.interpolators.piecewiselinear_interpolator import \
10
+ PiecewiseLinearInterpolator
11
+
12
+ from LoopStructural.utils import getLogger
13
+ logger = getLogger(__name__)
14
+
15
+
16
+ class DiscreteFoldInterpolator(PiecewiseLinearInterpolator):
17
+ """
18
+
19
+ """
20
+ def __init__(self, support, fold):
21
+ """
22
+ A piecewise linear interpolator that can also use fold constraints defined in Laurent et al., 2016
23
+
24
+ Parameters
25
+ ----------
26
+ support
27
+ discrete support with nodes and elements etc
28
+ fold FoldEvent
29
+ a fold event with a valid geometry
30
+ """
31
+
32
+ PiecewiseLinearInterpolator.__init__(self, support)
33
+ self.type = ['foldinterpolator']
34
+ self.fold = fold
35
+
36
+
37
+ @classmethod
38
+ def from_piecewise_linear_and_fold(cls, pli, fold):
39
+ """
40
+ Constructor from an existing piecewise linear interpolation object and a fold object
41
+ copies data from the PLI to the DFI
42
+
43
+ Parameters
44
+ ----------
45
+ pli : PiecewiseLinearInterpolator
46
+ existing interpolator
47
+ fold : FoldEvent
48
+ a fold event with a valid
49
+
50
+ Returns
51
+ -------
52
+ DiscreteFoldInterpolator
53
+
54
+ """
55
+ # create a blank fold interpolator
56
+ interpolator = cls(pli.support, fold)
57
+
58
+ # copy the data and stuff from the existing interpolator
59
+ interpolator.region = pli.region
60
+ interpolator.shape = pli.shape
61
+ interpolator.region_map = pli.region_map
62
+ interpolator.p_i = pli.p_i
63
+ interpolator.p_g = pli.p_g
64
+ interpolator.p_t = pli.p_t
65
+ interpolator.n_i = pli.n_i
66
+ interpolator.n_g = pli.n_g
67
+ interpolator.n_t = pli.n_t
68
+ interpolator.propertyname = pli.propertyname
69
+ return interpolator
70
+
71
+ def update_fold(self, fold):
72
+ """
73
+
74
+ Parameters
75
+ ----------
76
+ fold : FoldEvent
77
+ a fold that contrains the geometry we are trying to add
78
+
79
+ Returns
80
+ -------
81
+
82
+ """
83
+ logger.error('updating fold, this should be done by accessing the fold attribute')
84
+ self.fold = fold
85
+
86
+ def add_fold_constraints(self, fold_orientation=10., fold_axis_w=10., fold_regularisation=[.1,0.01,0.01],
87
+ fold_normalisation=1.,
88
+ fold_norm=1., step=2):
89
+ """
90
+
91
+ Parameters
92
+ ----------
93
+ fold_orientation : double
94
+ weight for the fold direction/orientation in the least squares system
95
+ fold_axis_w : double
96
+ weight for the fold axis in the least squares system
97
+ fold_regularisation : list
98
+ weight for the fold regularisation in the least squares system
99
+ fold_normalisation : double
100
+ weight for the fold norm constraint in the least squares system
101
+ fold_norm
102
+ length of the interpolation norm in the least squares system
103
+ step: int
104
+ array step for adding constraints
105
+
106
+
107
+ Returns
108
+ -------
109
+
110
+ Notes
111
+ -----
112
+ For more information about the fold weights see EPSL paper by Gautier Laurent 2016
113
+
114
+ """
115
+ # get the gradient of all of the elements of the mesh
116
+ eg = self.support.get_element_gradients(np.arange(self.support.n_elements))
117
+ # get array of all nodes for all elements N,4,3
118
+ nodes = self.support.nodes[self.support.get_elements()[np.arange(self.support.n_elements)]]
119
+ # calculate the fold geometry for the elements barycentre
120
+ deformed_orientation, fold_axis, dgz = \
121
+ self.fold.get_deformed_orientation(self.support.barycentre())
122
+ element_idx = np.arange(self.support.n_elements)
123
+ np.random.shuffle(element_idx)
124
+ # calculate element volume for weighting
125
+ vecs = nodes[:, 1:, :] - nodes[:, 0, None, :]
126
+ vol = np.abs(np.linalg.det(vecs)) / 6
127
+ if fold_orientation is not None:
128
+ """
129
+ dot product between vector in deformed ori plane = 0
130
+ """
131
+ np.random.shuffle(element_idx)
132
+
133
+ logger.info("Adding fold orientation constraint to %s w = %f"%(self.propertyname, fold_orientation))
134
+ A = np.einsum('ij,ijk->ik', deformed_orientation[element_idx[::step],:], eg[element_idx[::step],:,:])
135
+ A *= vol[element_idx[::step], None]
136
+ A *= fold_orientation
137
+ B = np.zeros(A.shape[0])
138
+ idc = self.support.get_elements()[element_idx[::step],:]
139
+ self.add_constraints_to_least_squares(A, B, idc, name='fold orientation')
140
+
141
+ if fold_axis_w is not None:
142
+ """
143
+ dot product between axis and gradient should be 0
144
+ """
145
+ np.random.shuffle(element_idx)
146
+
147
+ logger.info("Adding fold axis constraint to %s w = %f"%(self.propertyname,fold_axis_w))
148
+ A = np.einsum('ij,ijk->ik', fold_axis[element_idx[::step],:], eg[element_idx[::step],:,:])
149
+ A *= vol[element_idx[::step], None]
150
+ A *= fold_axis_w
151
+ B = np.zeros(A.shape[0]).tolist()
152
+ idc = self.support.get_elements()[element_idx[::step],:]
153
+
154
+ self.add_constraints_to_least_squares(A, B, idc, name='fold axis')
155
+
156
+ if fold_normalisation is not None:
157
+ """
158
+ specify scalar norm in X direction
159
+ """
160
+ np.random.shuffle(element_idx)
161
+
162
+ logger.info("Adding fold normalisation constraint to %s w = %f"%(self.propertyname,fold_normalisation))
163
+ A = np.einsum('ij,ijk->ik', dgz[element_idx[::step],:], eg[element_idx[::step],:,:])
164
+ A *= vol[element_idx[::step], None]
165
+ A *= fold_normalisation
166
+ B = np.ones(A.shape[0])
167
+
168
+ if fold_norm is not None:
169
+ B[:] = fold_norm
170
+ B *= fold_normalisation
171
+ B *= vol[element_idx[::step]]
172
+ idc = self.support.get_elements()[element_idx[::step],:]
173
+
174
+ self.add_constraints_to_least_squares(A, B, idc, name='fold normalisation')
175
+
176
+ if fold_regularisation is not None:
177
+ """
178
+ fold constant gradient
179
+ """
180
+ logger.info("Adding fold regularisation constraint to {} w = {} {} {}".format(self.propertyname,
181
+ fold_regularisation[0],fold_regularisation[1],fold_regularisation[1]))
182
+
183
+ idc, c, ncons = fold_cg(eg, dgz, self.support.get_neighbours(), self.support.get_elements(), self.support.nodes)
184
+ A = np.array(c[:ncons, :])
185
+ A *= fold_regularisation[0]
186
+ B = np.zeros(A.shape[0])
187
+ idc = np.array(idc[:ncons, :])
188
+ self.add_constraints_to_least_squares(A, B, idc, name='fold regularisation 1')
189
+
190
+ idc, c, ncons = fold_cg(eg, deformed_orientation, self.support.get_neighbours(), self.support.get_elements(), self.support.nodes)
191
+ A = np.array(c[:ncons, :])
192
+ A *= fold_regularisation[1]
193
+ B = np.zeros(A.shape[0])
194
+ idc = np.array(idc[:ncons, :])
195
+ self.add_constraints_to_least_squares(A, B, idc, name='fold regularisation 2')
196
+
197
+ idc, c, ncons = fold_cg(eg, fold_axis, self.support.get_neighbours(), self.support.get_elements(), self.support.nodes)
198
+ A = np.array(c[:ncons, :])
199
+ A *= fold_regularisation[2]
200
+ B = np.zeros(A.shape[0])
201
+ idc = np.array(idc[:ncons, :])
202
+ self.add_constraints_to_least_squares(A, B, idc, name='fold regularisation 3')