gebpy 1.1.3__py3-none-any.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 (254) hide show
  1. gebpy/__init__.py +55 -0
  2. gebpy/__pycache__/__init__.cpython-310.pyc +0 -0
  3. gebpy/adapters/__init__.py +0 -0
  4. gebpy/cli/__init__.py +0 -0
  5. gebpy/core/__init__.py +0 -0
  6. gebpy/core/chemistry/__init__.py +0 -0
  7. gebpy/core/chemistry/common.py +1369 -0
  8. gebpy/core/chemistry/elements.py +317 -0
  9. gebpy/core/chemistry/geochemistry.py +1728 -0
  10. gebpy/core/fluids/__init__.py +0 -0
  11. gebpy/core/io/__init__.py +0 -0
  12. gebpy/core/mathematics/__init__.py +0 -0
  13. gebpy/core/minerals/__init__.py +0 -0
  14. gebpy/core/minerals/carbonates.py +412 -0
  15. gebpy/core/minerals/common.py +555 -0
  16. gebpy/core/minerals/config.py +77 -0
  17. gebpy/core/minerals/cyclosilicates.py +0 -0
  18. gebpy/core/minerals/halides.py +0 -0
  19. gebpy/core/minerals/inosilicates.py +0 -0
  20. gebpy/core/minerals/nesosilicates.py +0 -0
  21. gebpy/core/minerals/organics.py +0 -0
  22. gebpy/core/minerals/oxides.py +589 -0
  23. gebpy/core/minerals/phosphates.py +0 -0
  24. gebpy/core/minerals/phospides.py +0 -0
  25. gebpy/core/minerals/phyllosilicates.py +436 -0
  26. gebpy/core/minerals/sorosilicates.py +0 -0
  27. gebpy/core/minerals/sulfates.py +0 -0
  28. gebpy/core/minerals/sulfides.py +459 -0
  29. gebpy/core/minerals/synthesis.py +201 -0
  30. gebpy/core/minerals/tectosilicates.py +433 -0
  31. gebpy/core/physics/__init__.py +0 -0
  32. gebpy/core/physics/common.py +53 -0
  33. gebpy/core/physics/geophysics.py +351 -0
  34. gebpy/core/rocks/__init__.py +0 -0
  35. gebpy/core/rocks/anisotropic_rocks.py +395 -0
  36. gebpy/core/rocks/common.py +95 -0
  37. gebpy/core/rocks/config.py +77 -0
  38. gebpy/core/rocks/isotropic_rocks.py +395 -0
  39. gebpy/core/rocks/sedimentary.py +385 -0
  40. gebpy/core/subsurface/__init__.py +0 -0
  41. gebpy/data_minerals/__init__.py +0 -0
  42. gebpy/data_minerals/albite.yaml +59 -0
  43. gebpy/data_minerals/anatase.yaml +43 -0
  44. gebpy/data_minerals/ankerite.yaml +47 -0
  45. gebpy/data_minerals/annite.yaml +57 -0
  46. gebpy/data_minerals/anorthite.yaml +59 -0
  47. gebpy/data_minerals/antigorite.yaml +53 -0
  48. gebpy/data_minerals/aragonite.yaml +48 -0
  49. gebpy/data_minerals/argutite.yaml +43 -0
  50. gebpy/data_minerals/arsenolite.yaml +40 -0
  51. gebpy/data_minerals/au3oxide.yaml +46 -0
  52. gebpy/data_minerals/avicennite.yaml +40 -0
  53. gebpy/data_minerals/azurite.yaml +53 -0
  54. gebpy/data_minerals/baddeleyite.yaml +49 -0
  55. gebpy/data_minerals/bismite.yaml +49 -0
  56. gebpy/data_minerals/boehmite.yaml +48 -0
  57. gebpy/data_minerals/brookite.yaml +46 -0
  58. gebpy/data_minerals/brucite.yaml +45 -0
  59. gebpy/data_minerals/bunsenite.yaml +40 -0
  60. gebpy/data_minerals/calcite.yaml +45 -0
  61. gebpy/data_minerals/cassiterite.yaml +43 -0
  62. gebpy/data_minerals/cerussite.yaml +48 -0
  63. gebpy/data_minerals/chamosite.yaml +56 -0
  64. gebpy/data_minerals/chlorite.yaml +75 -0
  65. gebpy/data_minerals/chromite.yaml +42 -0
  66. gebpy/data_minerals/chrysotile.yaml +53 -0
  67. gebpy/data_minerals/claudetite.yaml +49 -0
  68. gebpy/data_minerals/clinochlore.yaml +55 -0
  69. gebpy/data_minerals/cochromite.yaml +42 -0
  70. gebpy/data_minerals/corundum.yaml +43 -0
  71. gebpy/data_minerals/crocoite.yaml +51 -0
  72. gebpy/data_minerals/cuprite.yaml +40 -0
  73. gebpy/data_minerals/cuprospinel.yaml +42 -0
  74. gebpy/data_minerals/diaspore.yaml +48 -0
  75. gebpy/data_minerals/dolomite.yaml +47 -0
  76. gebpy/data_minerals/eastonite.yaml +57 -0
  77. gebpy/data_minerals/eskolaite.yaml +43 -0
  78. gebpy/data_minerals/fechlorite.yaml +61 -0
  79. gebpy/data_minerals/fecolumbite.yaml +48 -0
  80. gebpy/data_minerals/ferberite.yaml +51 -0
  81. gebpy/data_minerals/fetantalite.yaml +48 -0
  82. gebpy/data_minerals/franklinite.yaml +42 -0
  83. gebpy/data_minerals/gahnite.yaml +42 -0
  84. gebpy/data_minerals/galaxite.yaml +42 -0
  85. gebpy/data_minerals/geikielite.yaml +45 -0
  86. gebpy/data_minerals/gibbsite.yaml +51 -0
  87. gebpy/data_minerals/glauconite.yaml +69 -0
  88. gebpy/data_minerals/goethite.yaml +48 -0
  89. gebpy/data_minerals/groutite.yaml +48 -0
  90. gebpy/data_minerals/hematite.yaml +43 -0
  91. gebpy/data_minerals/hercynite.yaml +42 -0
  92. gebpy/data_minerals/huebnerite.yaml +51 -0
  93. gebpy/data_minerals/ikaite.yaml +53 -0
  94. gebpy/data_minerals/illite.yaml +55 -0
  95. gebpy/data_minerals/ilmenite.yaml +45 -0
  96. gebpy/data_minerals/jacobsite.yaml +42 -0
  97. gebpy/data_minerals/kalsilite.yaml +47 -0
  98. gebpy/data_minerals/kaolinite.yaml +59 -0
  99. gebpy/data_minerals/karelianite.yaml +43 -0
  100. gebpy/data_minerals/lime.yaml +40 -0
  101. gebpy/data_minerals/litharge.yaml +43 -0
  102. gebpy/data_minerals/magnesiochromite.yaml +42 -0
  103. gebpy/data_minerals/magnesioferrite.yaml +42 -0
  104. gebpy/data_minerals/magnesite.yaml +45 -0
  105. gebpy/data_minerals/magnetite.yaml +41 -0
  106. gebpy/data_minerals/malachite.yaml +53 -0
  107. gebpy/data_minerals/manganite.yaml +51 -0
  108. gebpy/data_minerals/manganochromite.yaml +42 -0
  109. gebpy/data_minerals/manganosite.yaml +40 -0
  110. gebpy/data_minerals/marialite.yaml +49 -0
  111. gebpy/data_minerals/massicot.yaml +46 -0
  112. gebpy/data_minerals/meionite.yaml +49 -0
  113. gebpy/data_minerals/mgchlorite.yaml +61 -0
  114. gebpy/data_minerals/mgcolumbite.yaml +48 -0
  115. gebpy/data_minerals/mgtantalite.yaml +48 -0
  116. gebpy/data_minerals/microcline.yaml +59 -0
  117. gebpy/data_minerals/minium.yaml +44 -0
  118. gebpy/data_minerals/mnchlorite.yaml +61 -0
  119. gebpy/data_minerals/mncolumbite.yaml +48 -0
  120. gebpy/data_minerals/mntantalite.yaml +48 -0
  121. gebpy/data_minerals/monteponite.yaml +40 -0
  122. gebpy/data_minerals/montmorillonite.yaml +77 -0
  123. gebpy/data_minerals/muscovite.yaml +55 -0
  124. gebpy/data_minerals/nanepheline.yaml +47 -0
  125. gebpy/data_minerals/nichlorite.yaml +61 -0
  126. gebpy/data_minerals/nichromite.yaml +42 -0
  127. gebpy/data_minerals/nimite.yaml +55 -0
  128. gebpy/data_minerals/nontronite.yaml +73 -0
  129. gebpy/data_minerals/orthoclase.yaml +53 -0
  130. gebpy/data_minerals/paratellurite.yaml +43 -0
  131. gebpy/data_minerals/pennantite.yaml +61 -0
  132. gebpy/data_minerals/periclase.yaml +40 -0
  133. gebpy/data_minerals/phlogopite.yaml +57 -0
  134. gebpy/data_minerals/plattnerite.yaml +43 -0
  135. gebpy/data_minerals/powellite.yaml +45 -0
  136. gebpy/data_minerals/pyrite.yaml +40 -0
  137. gebpy/data_minerals/pyrolusite.yaml +43 -0
  138. gebpy/data_minerals/pyrophanite.yaml +45 -0
  139. gebpy/data_minerals/pyrophyllite.yaml +59 -0
  140. gebpy/data_minerals/quartz.yaml +43 -0
  141. gebpy/data_minerals/rhodochrosite.yaml +45 -0
  142. gebpy/data_minerals/rutile.yaml +43 -0
  143. gebpy/data_minerals/saponite.yaml +77 -0
  144. gebpy/data_minerals/scheelite.yaml +45 -0
  145. gebpy/data_minerals/scrutinyite.yaml +46 -0
  146. gebpy/data_minerals/senarmontite.yaml +40 -0
  147. gebpy/data_minerals/siderite.yaml +45 -0
  148. gebpy/data_minerals/siderophyllite.yaml +57 -0
  149. gebpy/data_minerals/smithsonite.yaml +45 -0
  150. gebpy/data_minerals/spinel.yaml +42 -0
  151. gebpy/data_minerals/stishovite.yaml +43 -0
  152. gebpy/data_minerals/stolzite.yaml +45 -0
  153. gebpy/data_minerals/talc.yaml +53 -0
  154. gebpy/data_minerals/tistarite.yaml +43 -0
  155. gebpy/data_minerals/trevorite.yaml +42 -0
  156. gebpy/data_minerals/ulvoespinel.yaml +42 -0
  157. gebpy/data_minerals/uraninite.yaml +40 -0
  158. gebpy/data_minerals/valentinite.yaml +46 -0
  159. gebpy/data_minerals/vermiculite.yaml +69 -0
  160. gebpy/data_minerals/wulfenite.yaml +45 -0
  161. gebpy/data_minerals/wustite.yaml +40 -0
  162. gebpy/data_minerals/zincite.yaml +43 -0
  163. gebpy/data_minerals/zincochromite.yaml +42 -0
  164. gebpy/data_rocks/__init__.py +0 -0
  165. gebpy/data_rocks/dolostone.yaml +40 -0
  166. gebpy/data_rocks/limestone.yaml +40 -0
  167. gebpy/data_rocks/marl.yaml +50 -0
  168. gebpy/data_rocks/sandstone.yaml +39 -0
  169. gebpy/data_rocks/shale.yaml +50 -0
  170. gebpy/gebpy_app.py +8732 -0
  171. gebpy/gui/__init__.py +0 -0
  172. gebpy/lib/images/GebPy_Header.png +0 -0
  173. gebpy/lib/images/GebPy_Icon.png +0 -0
  174. gebpy/lib/images/GebPy_Logo.png +0 -0
  175. gebpy/main.py +29 -0
  176. gebpy/modules/__init__.py +0 -0
  177. gebpy/modules/__pycache__/__init__.cpython-310.pyc +0 -0
  178. gebpy/modules/__pycache__/metamorphics.cpython-310.pyc +0 -0
  179. gebpy/modules/__pycache__/silicates.cpython-310.pyc +0 -0
  180. gebpy/modules/carbonates.py +2658 -0
  181. gebpy/modules/chemistry.py +1369 -0
  182. gebpy/modules/core.py +1805 -0
  183. gebpy/modules/elements.py +317 -0
  184. gebpy/modules/evaporites.py +1299 -0
  185. gebpy/modules/exploration.py +1145 -0
  186. gebpy/modules/fluids.py +339 -0
  187. gebpy/modules/geochemistry.py +1727 -0
  188. gebpy/modules/geophysics.py +351 -0
  189. gebpy/modules/gui.py +9093 -0
  190. gebpy/modules/gui_elements.py +145 -0
  191. gebpy/modules/halides.py +485 -0
  192. gebpy/modules/igneous.py +2241 -0
  193. gebpy/modules/metamorphics.py +3222 -0
  194. gebpy/modules/mineralogy.py +442 -0
  195. gebpy/modules/minerals.py +7954 -0
  196. gebpy/modules/ore.py +1648 -0
  197. gebpy/modules/organics.py +530 -0
  198. gebpy/modules/oxides.py +9057 -0
  199. gebpy/modules/petrophysics.py +98 -0
  200. gebpy/modules/phosphates.py +589 -0
  201. gebpy/modules/phospides.py +194 -0
  202. gebpy/modules/plotting.py +619 -0
  203. gebpy/modules/pyllosilicates.py +380 -0
  204. gebpy/modules/sedimentary_rocks.py +908 -0
  205. gebpy/modules/sequences.py +2166 -0
  206. gebpy/modules/series.py +1625 -0
  207. gebpy/modules/silicates.py +11102 -0
  208. gebpy/modules/siliciclastics.py +1846 -0
  209. gebpy/modules/subsurface_2d.py +179 -0
  210. gebpy/modules/sulfates.py +1629 -0
  211. gebpy/modules/sulfides.py +4786 -0
  212. gebpy/plotting/__init__.py +0 -0
  213. gebpy/ui_nb/__init__.py +0 -0
  214. gebpy/user_data/.gitkeep +0 -0
  215. gebpy-1.1.3.dist-info/LICENSE +165 -0
  216. gebpy-1.1.3.dist-info/METADATA +207 -0
  217. gebpy-1.1.3.dist-info/RECORD +254 -0
  218. gebpy-1.1.3.dist-info/WHEEL +5 -0
  219. gebpy-1.1.3.dist-info/entry_points.txt +2 -0
  220. gebpy-1.1.3.dist-info/top_level.txt +1 -0
  221. modules/__init__.py +0 -0
  222. modules/carbonates.py +2658 -0
  223. modules/chemistry.py +1369 -0
  224. modules/core.py +1805 -0
  225. modules/elements.py +317 -0
  226. modules/evaporites.py +1299 -0
  227. modules/exploration.py +765 -0
  228. modules/fluids.py +339 -0
  229. modules/geochemistry.py +1727 -0
  230. modules/geophysics.py +337 -0
  231. modules/gui.py +9093 -0
  232. modules/gui_elements.py +145 -0
  233. modules/halides.py +485 -0
  234. modules/igneous.py +2196 -0
  235. modules/metamorphics.py +2699 -0
  236. modules/mineralogy.py +442 -0
  237. modules/minerals.py +7954 -0
  238. modules/ore.py +1628 -0
  239. modules/organics.py +530 -0
  240. modules/oxides.py +9057 -0
  241. modules/petrophysics.py +98 -0
  242. modules/phosphates.py +589 -0
  243. modules/phospides.py +194 -0
  244. modules/plotting.py +619 -0
  245. modules/pyllosilicates.py +380 -0
  246. modules/sedimentary_rocks.py +908 -0
  247. modules/sequences.py +2166 -0
  248. modules/series.py +1625 -0
  249. modules/silicates.py +11102 -0
  250. modules/siliciclastics.py +1830 -0
  251. modules/subsurface_2d.py +179 -0
  252. modules/sulfates.py +1629 -0
  253. modules/sulfides.py +4786 -0
  254. notebooks/__init__.py +0 -0
@@ -0,0 +1,385 @@
1
+ #!/usr/bin/env python
2
+ # -*-coding: utf-8 -*-
3
+
4
+ #-----------------------------------------------
5
+
6
+ # Name: sedimentary.py
7
+ # Author: Maximilian A. Beeskow
8
+ # Version: 1.0
9
+ # Date: 15.12.2025
10
+
11
+ #-----------------------------------------------
12
+
13
+ """
14
+ Module: sedimentary.py
15
+ This module controls the generation of the synthetic data of the oxides minerals.
16
+ """
17
+
18
+ # PACKAGES
19
+ import yaml
20
+ import numpy as np
21
+ import pandas as pd
22
+ from pathlib import Path
23
+
24
+ # MODULES
25
+ from ..minerals.synthesis import MineralDataGeneration
26
+ from ..rocks.common import RockGeneration
27
+
28
+ # Code
29
+ BASE_PATH = Path(__file__).resolve().parents[2]
30
+ DATA_PATH = BASE_PATH / "data_rocks"
31
+
32
+ class SedimentaryRocks:
33
+ _yaml_cache = {}
34
+ _mineralogy_cache = {}
35
+ _mineral_groups_cache = {}
36
+ _rocks = {"Sandstone", "Limestone", "Dolostone", "Marl"}
37
+
38
+ def __init__(self, name, random_seed, rounding: int = 3) -> None:
39
+ self.name = name
40
+ self.random_seed = random_seed
41
+ self.rng = np.random.default_rng(random_seed)
42
+ self.current_seed = int(np.round(self.rng.uniform(0, 1000), 0))
43
+ self.rounding = rounding
44
+ self.data_path = DATA_PATH
45
+ self.rock_gen = RockGeneration()
46
+ self.conversion_factors = self.rock_gen._determine_oxide_conversion_factors()
47
+ self.cache = {}
48
+
49
+ def _load_yaml(self, rock_name: str) -> dict:
50
+ # 1) Cache-Hit
51
+ if rock_name in SedimentaryRocks._yaml_cache:
52
+ return SedimentaryRocks._yaml_cache[rock_name]
53
+
54
+ # 2) Laden von Disk
55
+ yaml_file = self.data_path/f"{rock_name}.yaml"
56
+ if not yaml_file.exists():
57
+ raise FileNotFoundError(f"No YAML file found for {rock_name}.")
58
+
59
+ with open(yaml_file, "r") as f:
60
+ data = yaml.safe_load(f)
61
+
62
+ if "mineralogy" in data and rock_name not in SedimentaryRocks._mineralogy_cache:
63
+ self._compile_mineralogy(rock_name, data["mineralogy"])
64
+
65
+ if "mineral_groups" in data:
66
+ self._compile_mineral_groups(rock_name, data["mineral_groups"])
67
+
68
+ # 3) Cache schreiben
69
+ SedimentaryRocks._yaml_cache[rock_name] = data
70
+
71
+ return data
72
+
73
+ def _compile_mineralogy(self, rock_name: str, mineralogy_dict: dict):
74
+ """
75
+ Extracts and compiles all chemistry formulas from the YAML file.
76
+ Stores the compiled ASTs in the global formula cache.
77
+ """
78
+ if rock_name not in SedimentaryRocks._mineralogy_cache:
79
+ SedimentaryRocks._mineralogy_cache[rock_name] = {}
80
+
81
+ for element, entry in mineralogy_dict.items():
82
+ mineral = element
83
+ interval = list(entry.values())
84
+ lower_limit = interval[0]
85
+ upper_limit = interval[1]
86
+ compiled = [lower_limit, upper_limit]
87
+ SedimentaryRocks._mineralogy_cache[rock_name][mineral] = compiled
88
+
89
+ def _compile_mineral_groups(self, rock_name: str, group_dict: dict):
90
+ if rock_name not in SedimentaryRocks._mineral_groups_cache:
91
+ SedimentaryRocks._mineral_groups_cache[rock_name] = {}
92
+
93
+ for group, entry in group_dict.items():
94
+ minerals = entry["minerals"]
95
+ min_val = entry["min"]
96
+ max_val = entry["max"]
97
+
98
+ SedimentaryRocks._mineral_groups_cache[rock_name][group] = {
99
+ "minerals": minerals,
100
+ "min": min_val,
101
+ "max": max_val
102
+ }
103
+
104
+ def _sample_mineralogy(self, rock_name: str, number: int):
105
+ has_groups = rock_name in SedimentaryRocks._mineral_groups_cache
106
+
107
+ if not has_groups:
108
+ # ---- Modus A: flach ----
109
+ mineral_limits = SedimentaryRocks._mineralogy_cache[rock_name]
110
+ mins = [v[0] for v in mineral_limits.values()]
111
+ maxs = [v[1] for v in mineral_limits.values()]
112
+ minerals = list(mineral_limits.keys())
113
+
114
+ comp = self._sample_bounded_simplex_batch(mins, maxs, number)
115
+ return minerals, comp
116
+
117
+ # ---- Modus B: gruppiert ----
118
+ groups = SedimentaryRocks._mineral_groups_cache[rock_name]
119
+ mineral_limits = SedimentaryRocks._mineralogy_cache[rock_name]
120
+
121
+ # 1️⃣ Gruppen + freie Minerale
122
+ group_names = list(groups.keys())
123
+ group_mins = [groups[g]["min"] for g in group_names]
124
+ group_maxs = [groups[g]["max"] for g in group_names]
125
+
126
+ free_minerals = [
127
+ m for m in mineral_limits
128
+ if not any(m in groups[g]["minerals"] for g in groups)
129
+ ]
130
+
131
+ free_mins = [mineral_limits[m][0] for m in free_minerals]
132
+ free_maxs = [mineral_limits[m][1] for m in free_minerals]
133
+
134
+ labels = group_names + free_minerals
135
+ mins = group_mins + free_mins
136
+ maxs = group_maxs + free_maxs
137
+
138
+ # 2️⃣ Top-Level-Sampling
139
+ top_comp = self._sample_bounded_simplex_batch(mins, maxs, number)
140
+
141
+ # 3️⃣ Gruppen intern auflösen
142
+ mineral_list = []
143
+ mineral_comp = []
144
+
145
+ for i, label in enumerate(labels):
146
+ frac = top_comp[:, i]
147
+
148
+ if label in groups:
149
+ minerals = groups[label]["minerals"]
150
+ n = len(minerals)
151
+ split = self.rng.dirichlet(np.ones(n), size=number)
152
+
153
+ for j, m in enumerate(minerals):
154
+ mineral_list.append(m)
155
+ mineral_comp.append(frac * split[:, j])
156
+ else:
157
+ mineral_list.append(label)
158
+ mineral_comp.append(frac)
159
+
160
+ comp = np.vstack(mineral_comp).T
161
+ return mineral_list, comp
162
+
163
+ def _sample_bounded_simplex_batch(self, min_vals, max_vals, number):
164
+ min_vals = np.asarray(min_vals, dtype=float)
165
+ max_vals = np.asarray(max_vals, dtype=float)
166
+ n = len(min_vals)
167
+
168
+ # --- Konsistenz ---
169
+ if min_vals.sum() > 1:
170
+ raise ValueError("Sum of minimum fractions > 1")
171
+
172
+ if max_vals.sum() < 1:
173
+ raise ValueError("Sum of maximum fractions < 1")
174
+
175
+ span = max_vals - min_vals
176
+ samples = np.zeros((number, n))
177
+
178
+ for i in range(number):
179
+ remaining = 1.0 - min_vals.sum()
180
+ order = np.arange(n)
181
+
182
+ self.rng.shuffle(order)
183
+ x = np.zeros(n)
184
+
185
+ for j in order[:-1]:
186
+ upper = min(span[j], remaining)
187
+ val = self.rng.uniform(0, upper)
188
+ x[j] = val
189
+ remaining -= val
190
+
191
+ x[order[-1]] = remaining
192
+ samples[i] = min_vals + x
193
+
194
+ return samples
195
+
196
+ def _collect_mineral_data(self, list_minerals, number):
197
+ _mineral_data = []
198
+ for index, mineral in enumerate(list_minerals):
199
+ data_init = MineralDataGeneration(mineral, number)
200
+ data_mineral = data_init.generate_data()
201
+ is_fixed = data_mineral.shape[0] == 1
202
+ if is_fixed and number > 1:
203
+ data_mineral = pd.concat([data_mineral]*number, ignore_index=True)
204
+ elif not is_fixed and data_mineral.shape[0] != number:
205
+ raise ValueError(
206
+ f"Mineral '{mineral}' returned {data_mineral.shape[0]} rows, "
207
+ f"but expected {number}.")
208
+ _mineral_data.append(data_mineral)
209
+
210
+ return _mineral_data
211
+
212
+ def _extract_mineral_property_data(self, list_minerals, data_mineral, property):
213
+ arrays = [data_mineral[i][property].to_numpy() for i in range(len(list_minerals))]
214
+ return np.vstack(arrays)
215
+
216
+ def _update_bulk_density_data(self, _bulk_data, density_fluid, number):
217
+ porosity = _bulk_data["porosity"]
218
+ _bulk_data["rho_s"] = _bulk_data["rho"]
219
+ _bulk_data["rho"] = (1 - porosity)*_bulk_data["rho"] + porosity*density_fluid
220
+ _bulk_data["rho_f"] = np.ones(number)*density_fluid
221
+
222
+ return _bulk_data
223
+
224
+ def _update_seismic_velocities(self, _bulk_data):
225
+ val_G = _bulk_data["G"]*10**9
226
+ val_rho = _bulk_data["rho"]
227
+ val_K = _bulk_data["K"]*10**9
228
+ _bulk_data["vS"] = (val_G/val_rho)**0.5
229
+ _bulk_data["vP"] = ((val_K + 4/3*val_G)/val_rho)**0.5
230
+ _bulk_data["vP/vS"] = _bulk_data["vP"]/_bulk_data["vS"]
231
+
232
+ return _bulk_data
233
+
234
+ def _update_elastic_parameter_data(self, _bulk_data):
235
+ val_G = _bulk_data["G"]*10**9
236
+ val_K = _bulk_data["K"]*10**9
237
+ _bulk_data["E"] = ((9*val_K*val_G)/(3*val_K + val_G))*1e-9
238
+ _bulk_data["poisson"] = (3*val_K - 2*val_G)/(2*(3*val_K + val_G))
239
+ _bulk_data["lame"] = (val_K - (2*val_G)/3)*1e-9
240
+
241
+ return _bulk_data
242
+
243
+ def _extract_element_data(self, data_minerals, list_elements):
244
+ seen = set(list_elements)
245
+ ordered = list(list_elements)
246
+
247
+ for dataset in data_minerals:
248
+ for key in dataset.keys():
249
+ if key.startswith("chemistry."):
250
+ element = key[len("chemistry."):]
251
+ if element not in seen:
252
+ seen.add(element)
253
+ ordered.append(element)
254
+
255
+ return ordered
256
+
257
+ def _extract_oxide_data(self, data_minerals, list_oxides):
258
+ seen = set(list_oxides)
259
+ ordered = list(list_oxides)
260
+
261
+ for dataset in data_minerals:
262
+ for key in dataset.keys():
263
+ if key.startswith("compounds."):
264
+ oxide = key[len("compounds."):]
265
+ if oxide not in seen:
266
+ seen.add(oxide)
267
+ ordered.append(oxide)
268
+
269
+ # Spezialfall Pyrit
270
+ if dataset["mineral"][0] == "Py":
271
+ for oxide in ("Fe2O3", "SO3"):
272
+ if oxide not in seen:
273
+ seen.add(oxide)
274
+ ordered.append(oxide)
275
+ if "FeS2" in seen:
276
+ seen.remove("FeS2")
277
+ ordered = [o for o in ordered if o != "FeS2"]
278
+
279
+ return ordered
280
+
281
+ def _update_chemistry_data(self, _bulk_data, data_minerals, data_composition, element, number):
282
+ n_minerals = len(data_minerals)
283
+ helper = np.zeros((n_minerals, number))
284
+ key_element = "chemistry." + element
285
+
286
+ for i, dataset in enumerate(data_minerals):
287
+ if key_element in dataset:
288
+ helper[i, :] = dataset[key_element].to_numpy()
289
+
290
+ bulk_values = np.sum(data_composition * helper.T, axis=1)
291
+ _bulk_data["w." + element] = bulk_values
292
+
293
+ return _bulk_data
294
+
295
+ def _update_oxide_data(self, bulk_data, list_oxides):
296
+ for oxide in list_oxides:
297
+ cation, anion = self.rock_gen._get_elements_of_compound(compound=oxide)
298
+ if anion == "O":
299
+ key_cation = "w." + cation
300
+ values = self.conversion_factors[oxide]["factor"]*bulk_data[key_cation]
301
+ key_oxide = "w." + oxide
302
+ bulk_data[key_oxide] = values
303
+ else:
304
+ print("There is a non-oxide compound part of the list.")
305
+
306
+ return bulk_data
307
+
308
+ def _assign_mineral_amounts(self, bulk_data, data_amounts):
309
+ for mineral, values in data_amounts.items():
310
+ key_mineral = "phi." + mineral
311
+ bulk_data[key_mineral] = values
312
+
313
+ return bulk_data
314
+
315
+ def generate_dataset(self, number: int = 1, fluid: str = "water", density_fluid=None) -> None:
316
+ if density_fluid is None:
317
+ if fluid == "water":
318
+ density_fluid = 1000
319
+ elif fluid == "oil":
320
+ density_fluid = 800
321
+ elif fluid == "natural gas":
322
+ density_fluid = 750
323
+
324
+ siliciclastics = {"Sandstone"}
325
+ data_yaml = self._load_yaml(rock_name=self.name)
326
+ min_porosity = data_yaml["physical_properties"]["porosity"]["min"]
327
+ max_porosity = data_yaml["physical_properties"]["porosity"]["max"]
328
+ porosity = self.rng.uniform(min_porosity, max_porosity, number)
329
+ mineral_limits = SedimentaryRocks._mineralogy_cache[self.name]
330
+ _limits = {"lower": [], "upper": []}
331
+
332
+ for mineral, values in mineral_limits.items():
333
+ _limits["lower"].append(values[0])
334
+ _limits["upper"].append(values[1])
335
+
336
+ list_minerals = list(SedimentaryRocks._mineralogy_cache[self.name].keys())
337
+ _properties = ["rho", "vP", "vS", "K", "G", "GR", "PE"]
338
+ _bulk_data = {}
339
+ # Collect mineralogical composition data
340
+ n_minerals = len(list_minerals)
341
+ _helper_composition = np.zeros((number, n_minerals))
342
+ _helper_mineral_amounts = {mineral: np.zeros(number) for mineral in list_minerals}
343
+
344
+ _helper_composition = self._sample_bounded_simplex_batch(
345
+ min_vals=_limits["lower"], max_vals=_limits["upper"], number=number)
346
+ _helper_mineral_amounts = {mineral: _helper_composition[:, j] for j, mineral in enumerate(list_minerals)}
347
+
348
+ # Collect mineral data
349
+ _helper_elements = []
350
+ _helper_oxides = []
351
+ _mineral_data = self._collect_mineral_data(list_minerals=list_minerals, number=number)
352
+ _helper_elements = self._extract_element_data(data_minerals=_mineral_data, list_elements=_helper_elements)
353
+ _helper_oxides = self._extract_oxide_data(data_minerals=_mineral_data, list_oxides=_helper_oxides)
354
+ _helper_bulk_data = {}
355
+ for property in ["rho", "K", "G", "GR", "PE"]:
356
+ _helper_property = self._extract_mineral_property_data(
357
+ list_minerals=list_minerals, data_mineral=_mineral_data, property=property)
358
+ _helper_bulk_data[property] = np.sum(_helper_composition*_helper_property.T, axis=1)
359
+ # Assign porosity data
360
+ _helper_bulk_data["porosity"] = porosity
361
+ # Update bulk density data
362
+ _helper_bulk_data = self._update_bulk_density_data(
363
+ _bulk_data=_helper_bulk_data, density_fluid=density_fluid, number=number)
364
+ # Update bulk seismic velocity data
365
+ _helper_bulk_data = self._update_seismic_velocities(_bulk_data=_helper_bulk_data)
366
+ # Update elastic parameter data
367
+ _helper_bulk_data = self._update_elastic_parameter_data(_bulk_data=_helper_bulk_data)
368
+ # Update chemistry data
369
+ for element in _helper_elements:
370
+ _helper_bulk_data = self._update_chemistry_data(
371
+ _bulk_data=_helper_bulk_data, data_minerals=_mineral_data, data_composition=_helper_composition,
372
+ element=element, number=number)
373
+ # Update oxide data
374
+ _helper_bulk_data = self._update_oxide_data(bulk_data=_helper_bulk_data, list_oxides=_helper_oxides)
375
+ # Update rock composition data
376
+ _helper_bulk_data = self._assign_mineral_amounts(
377
+ bulk_data=_helper_bulk_data, data_amounts=_helper_mineral_amounts)
378
+ # Conversion to a pandas dataframe object
379
+ _bulk_data = pd.DataFrame(_helper_bulk_data)
380
+
381
+ return _bulk_data
382
+
383
+ # TEST
384
+ if __name__ == "__main__":
385
+ DEFAULT_DATA = SedimentaryRocks(name="Sandstone", random_seed=42).generate_dataset(number=10)
File without changes
File without changes
@@ -0,0 +1,59 @@
1
+ mineral: Albite
2
+ group: Tectosilicates
3
+ formula: NaAlSi3O8
4
+ last updated: 10.12.2025
5
+
6
+ metadata:
7
+ key: "Ab"
8
+ crystal_system: "triclinic"
9
+
10
+ chemistry:
11
+ Na: 1
12
+ Al: 1
13
+ Si: 3
14
+ O: 8
15
+
16
+ oxides:
17
+ Na2O: 1
18
+ Al2O3: 1
19
+ SiO2: 1
20
+
21
+ physical_properties:
22
+ K:
23
+ value: 103.45e9
24
+ ref: "unknown"
25
+ G:
26
+ value: 69.0e9
27
+ ref: "unknown"
28
+
29
+ cell_data:
30
+ space_group:
31
+ value: "C1"
32
+ ref: "www.handbookofmineralogy.org"
33
+ a:
34
+ value: 8.137
35
+ ref: "www.handbookofmineralogy.org"
36
+ b:
37
+ value: 12.785
38
+ ref: "www.handbookofmineralogy.org"
39
+ c:
40
+ value: 7.1583
41
+ ref: "www.handbookofmineralogy.org"
42
+ alpha:
43
+ value: 94.26
44
+ ref: "www.handbookofmineralogy.org"
45
+ beta:
46
+ value: 116.60
47
+ ref: "www.handbookofmineralogy.org"
48
+ gamma:
49
+ value: 87.71
50
+ ref: "www.handbookofmineralogy.org"
51
+ Z:
52
+ value: 4
53
+ ref: "www.handbookofmineralogy.org"
54
+
55
+ sources:
56
+ - author: "John W. Anthony, Richard A. Bideaux, Kenneth W. Bladh, and Monte C. Nichols"
57
+ title: "Handbook of Mineralogy"
58
+ publisher: "Mineralogical Society of America, Chantilly, VA"
59
+ url: "http://www.handbookofmineralogy.org/"
@@ -0,0 +1,43 @@
1
+ mineral: Anatase
2
+ group: Oxides
3
+ formula: TiO2
4
+ last updated: 10.12.2025
5
+
6
+ metadata:
7
+ key: "Anat"
8
+ crystal_system: "tetragonal"
9
+
10
+ chemistry:
11
+ Ti: 1
12
+ O: 2
13
+
14
+ oxides:
15
+ TiO2: 1
16
+
17
+ physical_properties:
18
+ K:
19
+ value: 36.5e9
20
+ ref: "unknown"
21
+ G:
22
+ value: 45.6e9
23
+ ref: "unknown"
24
+
25
+ cell_data:
26
+ space_group:
27
+ value: "P321"
28
+ ref: "www.webmineral.com"
29
+ a:
30
+ value: 3.793
31
+ ref: "www.webmineral.com"
32
+ c:
33
+ value: 9.52
34
+ ref: "www.webmineral.com"
35
+ Z:
36
+ value: 4
37
+ ref: "www.webmineral.com"
38
+
39
+ sources:
40
+ - author: "John W. Anthony, Richard A. Bideaux, Kenneth W. Bladh, and Monte C. Nichols"
41
+ title: "Handbook of Mineralogy"
42
+ publisher: "Mineralogical Society of America, Chantilly, VA"
43
+ url: "http://www.handbookofmineralogy.org/"
@@ -0,0 +1,47 @@
1
+ mineral: Ankerite
2
+ group: Carbonates
3
+ formula: Ca Fe (CO3)2
4
+ last updated: 10.12.2025
5
+
6
+ metadata:
7
+ key: "Ank"
8
+ crystal_system: "trigonal"
9
+
10
+ chemistry:
11
+ Ca: 1
12
+ Fe: 1
13
+ C: 2
14
+ O: 6
15
+
16
+ oxides:
17
+ CaO: 1
18
+ FeO: 1
19
+ CO2: 1
20
+
21
+ physical_properties:
22
+ K:
23
+ value: 73.0e9
24
+ ref: "unknown"
25
+ G:
26
+ value: 32.0e9
27
+ ref: "unknown"
28
+
29
+ cell_data:
30
+ space_group:
31
+ value: "R3"
32
+ ref: "www.handbookofmineralogy.org"
33
+ a:
34
+ value: 4.83
35
+ ref: "www.handbookofmineralogy.org"
36
+ c:
37
+ value: 16.167
38
+ ref: "www.handbookofmineralogy.org"
39
+ Z:
40
+ value: 3
41
+ ref: "www.handbookofmineralogy.org"
42
+
43
+ sources:
44
+ - author: "unknown"
45
+ title: "unknown"
46
+ publisher: "www.handbookofmineralogy.org"
47
+ url: ["www.handbookofmineralogy.org", "www.webmineral.com"]
@@ -0,0 +1,57 @@
1
+ mineral: Annite
2
+ group: Phyllosilicates
3
+ formula: KFe3AlSi3O10(OH)2
4
+ last updated: 10.12.2025
5
+
6
+ metadata:
7
+ key: "Ann"
8
+ crystal_system: "monoclinic"
9
+
10
+ chemistry:
11
+ K: 1
12
+ Fe: 3
13
+ Al: 1
14
+ Si: 3
15
+ O: 12
16
+ H: 2
17
+
18
+ oxides:
19
+ K2O: 1
20
+ FeO: 1
21
+ Al2O3: 1
22
+ SiO2: 1
23
+ H2O: 1
24
+
25
+ physical_properties:
26
+ K:
27
+ value: 114.72e9
28
+ ref: "unknown"
29
+ G:
30
+ value: 58.61e9
31
+ ref: "unknown"
32
+
33
+ cell_data:
34
+ space_group:
35
+ value: "C2/m"
36
+ ref: "www.handbookofmineralogy.org"
37
+ a:
38
+ value: 5.3860
39
+ ref: "www.handbookofmineralogy.org"
40
+ b:
41
+ value: 9.3241
42
+ ref: "www.handbookofmineralogy.org"
43
+ c:
44
+ value: 10.2683
45
+ ref: "www.handbookofmineralogy.org"
46
+ beta:
47
+ value: 100.63
48
+ ref: "www.handbookofmineralogy.org"
49
+ Z:
50
+ value: 2
51
+ ref: "www.handbookofmineralogy.org"
52
+
53
+ sources:
54
+ - author: "John W. Anthony, Richard A. Bideaux, Kenneth W. Bladh, and Monte C. Nichols"
55
+ title: "Handbook of Mineralogy"
56
+ publisher: "Mineralogical Society of America, Chantilly, VA"
57
+ url: "http://www.handbookofmineralogy.org/"
@@ -0,0 +1,59 @@
1
+ mineral: Anorthite
2
+ group: Tectosilicates
3
+ formula: CaAl2Si2O8
4
+ last updated: 10.12.2025
5
+
6
+ metadata:
7
+ key: "An"
8
+ crystal_system: "triclinic"
9
+
10
+ chemistry:
11
+ Ca: 2
12
+ Al: 2
13
+ Si: 2
14
+ O: 8
15
+
16
+ oxides:
17
+ CaO: 1
18
+ Al2O3: 1
19
+ SiO2: 1
20
+
21
+ physical_properties:
22
+ K:
23
+ value: 114.72e9
24
+ ref: "unknown"
25
+ G:
26
+ value: 73.72e9
27
+ ref: "unknown"
28
+
29
+ cell_data:
30
+ space_group:
31
+ value: "P1"
32
+ ref: "www.handbookofmineralogy.org"
33
+ a:
34
+ value: 8.1768
35
+ ref: "www.handbookofmineralogy.org"
36
+ b:
37
+ value: 12.8768
38
+ ref: "www.handbookofmineralogy.org"
39
+ c:
40
+ value: 14.1690
41
+ ref: "www.handbookofmineralogy.org"
42
+ alpha:
43
+ value: 93.17
44
+ ref: "www.handbookofmineralogy.org"
45
+ beta:
46
+ value: 115.85
47
+ ref: "www.handbookofmineralogy.org"
48
+ gamma:
49
+ value: 92.22
50
+ ref: "www.handbookofmineralogy.org"
51
+ Z:
52
+ value: 8
53
+ ref: "www.handbookofmineralogy.org"
54
+
55
+ sources:
56
+ - author: "John W. Anthony, Richard A. Bideaux, Kenneth W. Bladh, and Monte C. Nichols"
57
+ title: "Handbook of Mineralogy"
58
+ publisher: "Mineralogical Society of America, Chantilly, VA"
59
+ url: "http://www.handbookofmineralogy.org/"