Skip to content

Commit 640e634

Browse files
committed
docs: updating examples and deps
1 parent 55c303b commit 640e634

File tree

6 files changed

+30
-31
lines changed

6 files changed

+30
-31
lines changed

docs/requirements.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
sphinx==3.5.4
1+
sphinx
22
sphinx_gallery
33
sphinxcontrib-bibtex
44
pydata_sphinx_theme
5-
myst-parser
5+
myst-parser
6+
sphinx-design

docs/source/index.rst

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -90,29 +90,24 @@ constraints.
9090
# load in a dataframe with x,y,z,val,nx,ny,nz to constrain the value and
9191
# gradient normal of the interpolator
9292
data, bb = load_claudius()
93-
# create a transformer to move the data to the centre of mass of the dataset
94-
# this avoid any numerical issues caused by large coordinates. This dataset
95-
# is already axis aligned so we don't need to rotate the data but we can rotate it
96-
# so that the main anisotropy of the dataset is aligned with the x axis.
97-
transformer = EuclideanTransformation(dimensions=3, fit_rotation=False).fit(
98-
data[["X", "Y", "Z"]]
99-
)
100-
data[["X", "Y", "Z"]] = transformer.transform(data[["X", "Y", "Z"]])
93+
10194
# Find the bounding box of the data by finding the extent
10295
bounding_box = BoundingBox().fit(data[["X", "Y", "Z"]])
10396
# assemble an interpolator using the bounding box and the data
10497
interpolator = (
105-
InterpolatorBuilder(interpolatortype="FDI", bounding_box=bounding_box)
98+
InterpolatorBuilder(
99+
interpolatortype="FDI", bounding_box=bounding_box.with_buffer(0.1)
100+
)
106101
.add_value_constraints(data.loc[data["val"].notna(), ["X", "Y", "Z", "val"]].values)
107102
.add_normal_constraints(
108103
data.loc[data["nx"].notna(), ["X", "Y", "Z", "nx", "ny", "nz"]].values
109-
).build()
104+
)
105+
.build()
110106
)
111107
# Set the number of elements in the bounding box to 10000 and create a structured grid
112108
bounding_box.nelements = 10000
113109
mesh = bounding_box.structured_grid()
114110
# add the interpolated values to the mesh at the nodes
115-
# mesh.properties["v"] = interpolator.evaluate_value(bounding_box.regular_grid(order='F'))
116111
mesh.properties["v"] = interpolator.evaluate_value(mesh.nodes)
117112

118113
# or the cell centres

examples/1_basic/plot_2_surface_modelling.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@
123123
# Visualize Model Surfaces
124124
# ~~~~~~~~~~~~~~~~~~~~~~~~
125125
# Plot the surfaces of the geological model using a 3D viewer.
126-
126+
print(model.stratigraphic_column.to_dict())
127127
viewer = Loop3DView(model)
128128
viewer.plot_model_surfaces(cmap="tab20")
129129
viewer.display()

examples/1_basic/plot_3_model_visualisation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,8 @@
121121

122122

123123
viewer.plot_scalar_field(strati, cmap="prism")
124-
print(viewer._build_stratigraphic_cmap(model))
125-
viewer.plot_block_model()
124+
# print(viewer._build_stratigraphic_cmap(model))
125+
viewer.plot_block_model(cmap='tab20')
126126
# Add the data addgrad/addvalue arguments are optional
127127
viewer.plot_data(strati, vector=True, value=True)
128128
viewer.display() # to add an interactive display

examples/2_fold/plot_1_adding_folds_to_surfaces.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@
147147
# 'box',
148148
# paint_with=stratigraphy,
149149
# cmap='prism')
150-
viewer.plot_data(stratigraphy, scale=200)
150+
viewer.plot_data(stratigraphy)
151151
viewer.plot_surface(stratigraphy, value=10)
152152
viewer.show()
153153

@@ -190,6 +190,8 @@
190190
# fold limb rotation angle is found by finding the the angle to rotate the
191191
# folded foliation to be parallel to the plane of the axial foliation
192192
# shown in B and C.
193+
# The wavelength can be specified by the user or in some cases estimated
194+
# from the s-variogram of the fold frame coordinate system.
193195
#
194196
mdata = pd.concat([data[:npoints], data[data["feature_name"] == "s1"]])
195197
model = GeologicalModel(boundary_points[0, :], boundary_points[1, :])
@@ -202,10 +204,10 @@
202204
)
203205
stratigraphy = model.create_and_add_folded_foliation(
204206
"s0",
205-
fold_frame,
207+
fold_frame=fold_frame,
206208
nelements=10000,
207209
fold_axis=[-6.51626577e-06, -5.00013645e-01, -8.66017526e-01],
208-
# limb_wl=1
210+
limb_wl=12000,
209211
buffer=0.5,
210212
)
211213
viewer = Loop3DView(model, background="white")
@@ -220,7 +222,7 @@
220222
# isovalue=0.4,
221223
opacity=0.5,
222224
)
223-
viewer.plot_data(stratigraphy, scale=200)
225+
viewer.plot_data(stratigraphy)
224226
# viewer.add_isosurface(fold_frame[1],colour='green',alpha=0.5)
225227
# viewer.add_vector_field(fold_frame[0],locations=fold_frame[0].get_interpolator().support.barycentre)
226228
# viewer.add_data(fold_frame[1])
@@ -234,6 +236,7 @@
234236
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
235237
rotation_plots = RotationAnglePlotter(stratigraphy)
236238
rotation_plots.add_fold_limb_data()
239+
rotation_plots.add_limb_svariogram()
237240
# plt.plot(stratigraphy.builder.fold.fold_limb_rotation.fold_frame_coordinate,stratigraphy['limb_rotation'],'bo')
238241
# x = np.linspace(fold_frame[0].min(),fold_frame[0].max(),100)
239242
# plt.plot(x,stratigraphy['fold'].fold_limb_rotation(x),'r--')

examples/2_fold/_refolded_folds.py renamed to examples/2_fold/plot_2__refolded_folds.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"""
77

88
from LoopStructural import GeologicalModel
9+
from LoopStructural.modelling.features import fold
910
from LoopStructural.visualisation import Loop3DView, RotationAnglePlotter
1011
from LoopStructural.datasets import load_laurent2016
1112
import pandas as pd
@@ -36,10 +37,9 @@
3637
model.set_model_data(data)
3738
s2 = model.create_and_add_fold_frame("s2", nelements=10000, buffer=0.5, solver="lu", damp=True)
3839
viewer = Loop3DView(model)
39-
viewer.add_scalar_field(s2[0], cmap="prism")
40-
viewer.add_isosurface(s2[0], slices=[0, 1])
41-
viewer.add_data(s2[0])
42-
viewer.rotate(rotation)
40+
viewer.plot_scalar_field(s2[0], cmap="prism")
41+
viewer.plot_surface(s2[0], [0, 1])
42+
viewer.plot_data(s2[0])
4343
viewer.display()
4444

4545

@@ -48,12 +48,13 @@
4848
# ~~~~~~~~~~~~
4949
#
5050

51-
s1 = model.create_and_add_folded_fold_frame("s1", av_fold_axis=True, nelements=50000, buffer=0.3)
51+
s1 = model.create_and_add_folded_fold_frame(
52+
"s1", fold_frame=s2, av_fold_axis=True, nelements=50000, buffer=0.3, limb_wl=4
53+
)
5254

5355

5456
viewer = Loop3DView(model)
55-
viewer.add_scalar_field(s1[0], cmap="prism")
56-
viewer.rotate([-69.11979675292969, 15.704944610595703, 6.00014591217041])
57+
viewer.plot_scalar_field(s1[0], cmap="prism")
5758
viewer.display()
5859

5960
######################################################################
@@ -77,14 +78,14 @@
7778

7879
s0 = model.create_and_add_folded_foliation(
7980
"s0",
81+
fold_frame=s1,
8082
av_fold_axis=True,
8183
nelements=50000,
8284
buffer=0.2,
8385
)
8486

8587
viewer = Loop3DView(model)
86-
viewer.add_scalar_field(s0, cmap="tab20")
87-
viewer.rotate([-69.11979675292969, 15.704944610595703, 6.00014591217041])
88+
viewer.plot_scalar_field(s0, cmap="tab20")
8889
viewer.display()
8990

9091
######################################################################
@@ -102,8 +103,7 @@
102103
# ax[1].plot(s0['limb_svariogram'].lags,s1['limb_svariogram'].variogram,'bo')
103104

104105
viewer = Loop3DView(model)
105-
viewer.add_isosurface(s0, nslices=10, paint_with=s0, cmap="tab20")
106+
viewer.plot_surface(s0, 10, paint_with=s0, cmap="tab20")
106107
# viewer.add_data(s0)
107108
# viewer.add_fold(s0['fold'],locations=s0['support'].barycentre[::80])
108-
viewer.rotate([-69.11979675292969, 15.704944610595703, 6.00014591217041])
109109
viewer.display()

0 commit comments

Comments
 (0)