Skip to content

Commit fecdfda

Browse files
committed
[DOC] Tweaking defaults values to make it compatible with Alesmodel
1 parent 746830e commit fecdfda

File tree

2 files changed

+45
-15
lines changed

2 files changed

+45
-15
lines changed

gempy_engine/core/data/options/evaluation_options.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ class EvaluationOptions:
1515
_number_octree_levels: int = 1
1616
_number_octree_levels_surface: int = 4
1717
curvature_threshold: float = -1 #: Threshold to do octree refinement due to curvature to deal with angular geometries. This curvature assumes that 1 is the maximum curvature of any voxel
18-
error_threshold: float = 1.5 #: Number of standard deviations to consider a voxel as candidate to refine
18+
error_threshold: float = 1. #: Number of standard deviations to consider a voxel as candidate to refine
1919
min_octree_level: int = 2
2020

2121
mesh_extraction: bool = True
2222
mesh_extraction_masking_options: MeshExtractionMaskingOptions = MeshExtractionMaskingOptions.INTERSECT
2323
mesh_extraction_fancy: bool = True
2424

25-
evaluation_chunk_size: int = 5_000_000
25+
evaluation_chunk_size: int = 500_000
2626

2727
compute_scalar_gradient: bool = False
2828

gempy_engine/modules/octrees_topology/_octree_internals.py

Lines changed: 43 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,8 @@ def _additional_refinement_tests(voxel_select, current_octree_level, evaluation_
139139
num_voxels_marked_as_outliers = marked_voxels.sum()
140140
total_voxels = marked_voxels.shape
141141
print(f"Number of voxels marked by stats: {num_voxels_marked_as_outliers} of {total_voxels}."
142-
f"\n Number of voxels marked total : {voxel_select.sum()}"
142+
f"\n Number of voxels marked by corners : {voxel_select.sum()}"
143+
f"\nTotal voxels: {additional_voxel_selected_to_refinement.sum()}"
143144
f"\nDense Grid would be {8 ** (current_octree_level + 1)} voxels")
144145

145146
return BackendTensor.t.array(additional_voxel_selected_to_refinement)
@@ -161,17 +162,46 @@ def _test_refinement_on_stats(exported_fields: ExportedFields, voxel_select_corn
161162
marked_voxels = BackendTensor.t.abs(mean_scalar_per_voxel - mean_scalar_selected) < n_std * std_scalar_selected
162163
voxel_select_stats |= marked_voxels
163164

164-
if plot:
165-
import matplotlib.pyplot as plt
166-
# Color to .5 those values that are not in voxel select but are within 2 std of the mean
167-
mean_scalar_per_voxel = scalar_distance_8.mean(axis=1)
168-
c = np.zeros_like(mean_scalar_per_voxel)
169-
c[voxel_select_stats] = .5
170-
c[voxel_select_corners_eval] = 1
171-
# colorbar between 0 and 1
172-
mean_scalar_per_voxel = BackendTensor.t.to_numpy(mean_scalar_per_voxel)
173-
plt.scatter( y=mean_scalar_per_voxel, x=range(mean_scalar_per_voxel.size), c=c, cmap='viridis', vmin=0, vmax=1, alpha=.8,)
174-
plt.colorbar()
175-
plt.show()
165+
if plot:
166+
import matplotlib.pyplot as plt
167+
from matplotlib.colors import ListedColormap
168+
169+
# Calculate mean scalar per voxel
170+
mean_scalar_per_voxel = scalar_distance_8.mean(axis=1)
171+
c = np.zeros_like(mean_scalar_per_voxel)
172+
173+
# Set colors for different refinement states
174+
c[voxel_select_stats] = 0.5
175+
c[voxel_select_corners_eval] = 1
176+
177+
# Convert tensor to numpy array
178+
mean_scalar_per_voxel = BackendTensor.t.to_numpy(mean_scalar_per_voxel)
179+
180+
# Create custom colormap
181+
cmap = ListedColormap(['#440154', '#21918c', '#fde725']) # Example colors: No refined, Refined by stats, Refined by corners
182+
183+
# Create scatter plot
184+
plt.figure(figsize=(10, 6))
185+
scatter = plt.scatter(
186+
x=range(mean_scalar_per_voxel.size),
187+
y=mean_scalar_per_voxel,
188+
c=c,
189+
cmap=cmap,
190+
vmin=0,
191+
vmax=1,
192+
alpha=0.8
193+
)
194+
195+
# Add labels and title
196+
plt.xlabel('Voxel')
197+
plt.ylabel('Scalar Value')
198+
plt.title('Voxel Scalar Values with Refinement Status')
199+
200+
# Create colorbar with custom labels
201+
cbar = plt.colorbar(scatter, ticks=[0, 0.5, 1])
202+
cbar.ax.set_yticklabels(['No refined', 'Refined by stats', 'Refined by corners'])
203+
204+
# Show plot
205+
plt.show()
176206

177207
return voxel_select_stats

0 commit comments

Comments
 (0)