Skip to content

Commit

Permalink
updating docs
Browse files Browse the repository at this point in the history
  • Loading branch information
lachlangrose committed Nov 1, 2024
1 parent 5c44747 commit 3f59a75
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 61 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
2a. Modelling folds
Modelling folds
====================
This tutorial will show how Loop Structural improves the modelling of
Expand Down
2 changes: 1 addition & 1 deletion examples/2_modelling_workflow/plot_2_refolded_folds.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
2b. Refolded folds
Refolded folds
===================
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
3c. Defining the fault displacement function
Defining the fault displacement function
============================================
"""
Expand Down
100 changes: 50 additions & 50 deletions examples/2_modelling_workflow/plot_3_faulted_intrusion.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
"""
3a. Modelling faults using structural frames
Modelling faults using structural frames
========================================
"""

# from LoopStructural import GeologicalModel
# from LoopStructural.visualisation import Loop3DView
from LoopStructural import GeologicalModel
from LoopStructural.visualisation import Loop3DView
from LoopStructural.datasets import load_intrusion
import numpy as np
import matplotlib.pyplot as plt
Expand Down Expand Up @@ -51,54 +51,54 @@
# # fault frame and an expected displacement model.
# #

# model = GeologicalModel(bb[0, :], bb[1, :])
# model.set_model_data(data)
# fault = model.create_and_add_fault(
# "fault", 500, nelements=10000, steps=4, interpolatortype="FDI", buffer=0.3
# )
model = GeologicalModel(bb[0, :], bb[1, :])
model.set_model_data(data)
fault = model.create_and_add_fault(
"fault", 500, nelements=10000, steps=4, interpolatortype="FDI", buffer=0.3
)

# viewer = Loop3DView(model)
# viewer.plot_surface(
# fault,
# 0.0,
# # slices=[0,1]#nslices=10
# )
# xyz = model.data[model.data["feature_name"] == "strati"][["X", "Y", "Z"]].to_numpy()
# xyz = xyz[fault.evaluate(xyz).astype(bool), :]
# viewer.plot_vector_field(fault)
# viewer.add_points(
# model.rescale(
# model.data[model.data["feature_name"] == "strati"][["X", "Y", "Z"]],
# inplace=False,
# ),
# name="prefault",
# )
# viewer.show()
viewer = Loop3DView(model)
viewer.plot_surface(
fault,
0.0,
# slices=[0,1]#nslices=10
)
xyz = model.data[model.data["feature_name"] == "strati"][["X", "Y", "Z"]].to_numpy()
xyz = xyz[fault.evaluate(xyz).astype(bool), :]
viewer.plot_vector_field(fault)
viewer.add_points(
model.rescale(
model.data[model.data["feature_name"] == "strati"][["X", "Y", "Z"]].values,
inplace=False,
),
name="prefault",
)
viewer.show()


# displacement = 400 # INSERT YOUR DISPLACEMENT NUMBER HERE BEFORE #
displacement = 400 # INSERT YOUR DISPLACEMENT NUMBER HERE BEFORE #

# model = GeologicalModel(bb[0, :], bb[1, :])
# model.set_model_data(data)
# fault = model.create_and_add_fault(
# "fault", displacement, nelements=2000, steps=4, interpolatortype="PLI", buffer=2
# )
# strati = model.create_and_add_foliation("strati", nelements=30000, interpolatortype="PLI", cgw=0.03)
# model.update()
# viewer = Loop3DView(model)
# viewer.plot_surface(strati, 0.0)
# # viewer.add_data(model.features[0][0])
# viewer.plot_data(strati)
# viewer.plot_surface(
# fault,
# value=0.0,
# # slices=[0,1]#nslices=10
# )
# viewer.add_points(
# model.rescale(
# model.data[model.data["feature_name"] == "strati"][["X", "Y", "Z"]],
# inplace=False,
# ),
# name="prefault",
# )
# viewer.show()
model = GeologicalModel(bb[0, :], bb[1, :])
model.set_model_data(data)
fault = model.create_and_add_fault(
"fault", displacement, nelements=2000, steps=4, interpolatortype="PLI", buffer=2
)
strati = model.create_and_add_foliation("strati", nelements=30000, interpolatortype="PLI", cgw=0.03)
model.update()
viewer = Loop3DView(model)
viewer.plot_surface(strati, 0.0)
# viewer.add_data(model.features[0][0])
viewer.plot_data(strati)
viewer.plot_surface(
fault,
value=0.0,
# slices=[0,1]#nslices=10
)
viewer.add_points(
model.rescale(
model.data[model.data["feature_name"] == "strati"][["X", "Y", "Z"]].values,
inplace=False,
),
name="prefault",
)
viewer.show()
4 changes: 0 additions & 4 deletions examples/2_modelling_workflow/plot_6_fault_network.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
"""
Fault network
"""

"""
Modelling a fault network in LoopStructural
===============================================
Expand Down
40 changes: 36 additions & 4 deletions examples/4_performance/plot_1_solver_iterations.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
In some cases a satisfactory solution can be found with a small number of iterations.
In the example below we show the time taken to solve the problem for different numbers of iterations
and show the resulting model.
We can see that for a lower number of iterations the solution is not satisfactory but as the number of
iterations increases the solution beocmes satisfactory.
"""

from LoopStructural import GeologicalModel
Expand All @@ -25,7 +27,10 @@
data, bb = load_claudius()
model = GeologicalModel(bb[0, :], bb[1, :])
model.data = data
isovalue = 220
isovalue = 0
images = {}
view = Loop3DView(model, off_screen=True)

for maxiter in [10, 100, 500, 1000, 10000]:
start = time.time()
model.create_and_add_foliation(
Expand All @@ -34,7 +39,34 @@
model.update()
end = time.time()
print(f"maxiter: {maxiter} time: {end-start} seconds")
view = Loop3DView(model)
view.plot_surface(model["strati"], [220])
view.show()
view.plot_surface(model["strati"], [0, 60, 250, 330])
view.plot_data(model["strati"])

images[maxiter] = view.screenshot()
view.clear()

data = data.drop(data.index[data["val"] == 250])
data = data.drop(data.index[data["val"] == 330])
images2 = {}
model = GeologicalModel(bb[0, :], bb[1, :])
model.data = data
for maxiter in [10, 100, 500, 1000, 10000]:
start = time.time()
model.create_and_add_foliation(
"strati", interpolatortype="FDI", solver_kwargs={"maxiter": maxiter}
)
model.update()
end = time.time()
print(f"maxiter: {maxiter} time: {end-start} seconds")
view.plot_surface(model["strati"], [0, 60], name='surface')
view.plot_data(model["strati"], name='data')
images2[maxiter] = view.screenshot()
view.clear()
import matplotlib.pyplot as plt

fig, ax = plt.subplots(len(images), 2, figsize=(10, 20))
for i, (maxiter) in enumerate(images.keys()):
ax[i, 0].imshow(images[maxiter])
ax[i, 0].set_title(f"maxiter: {maxiter}")
ax[i, 1].imshow(images2[maxiter])
ax[i, 1].set_title(f"maxiter: {maxiter}")

0 comments on commit 3f59a75

Please sign in to comment.