integrate-module 0.95.0__tar.gz → 0.97.0__tar.gz
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.
- {integrate_module-0.95.0 → integrate_module-0.97.0}/PKG-INFO +4 -1
- {integrate_module-0.95.0 → integrate_module-0.97.0}/README.md +3 -0
- {integrate_module-0.95.0 → integrate_module-0.97.0}/integrate/__init__.py +2 -0
- {integrate_module-0.95.0 → integrate_module-0.97.0}/integrate/integrate.py +133 -148
- {integrate_module-0.95.0 → integrate_module-0.97.0}/integrate/integrate_borehole.py +2 -0
- {integrate_module-0.95.0 → integrate_module-0.97.0}/integrate/integrate_hdf5_info_cli.py +0 -0
- {integrate_module-0.95.0 → integrate_module-0.97.0}/integrate/integrate_io.py +769 -449
- {integrate_module-0.95.0 → integrate_module-0.97.0}/integrate/integrate_plot.py +647 -598
- {integrate_module-0.95.0 → integrate_module-0.97.0}/integrate/integrate_query.py +329 -3
- {integrate_module-0.95.0 → integrate_module-0.97.0}/integrate/integrate_rejection.py +102 -99
- {integrate_module-0.95.0 → integrate_module-0.97.0}/integrate_module.egg-info/PKG-INFO +4 -1
- {integrate_module-0.95.0 → integrate_module-0.97.0}/integrate_module.egg-info/SOURCES.txt +0 -1
- {integrate_module-0.95.0 → integrate_module-0.97.0}/pyproject.toml +3 -1
- integrate_module-0.95.0/integrate/integrate_obsolete.py +0 -246
- {integrate_module-0.95.0 → integrate_module-0.97.0}/LICENSE +0 -0
- {integrate_module-0.95.0 → integrate_module-0.97.0}/integrate/gex.py +0 -0
- {integrate_module-0.95.0 → integrate_module-0.97.0}/integrate/integrate_rejection_cli.py +0 -0
- {integrate_module-0.95.0 → integrate_module-0.97.0}/integrate/integrate_timing_cli.py +0 -0
- {integrate_module-0.95.0 → integrate_module-0.97.0}/integrate_module.egg-info/dependency_links.txt +0 -0
- {integrate_module-0.95.0 → integrate_module-0.97.0}/integrate_module.egg-info/entry_points.txt +0 -0
- {integrate_module-0.95.0 → integrate_module-0.97.0}/integrate_module.egg-info/requires.txt +0 -0
- {integrate_module-0.95.0 → integrate_module-0.97.0}/integrate_module.egg-info/top_level.txt +0 -0
- {integrate_module-0.95.0 → integrate_module-0.97.0}/setup.cfg +0 -0
- {integrate_module-0.95.0 → integrate_module-0.97.0}/tests/test_likelihood_multinomial.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: integrate_module
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.97.0
|
|
4
4
|
Summary: Localized probabilistic data integration
|
|
5
5
|
Author-email: Thomas Mejer Hansen <tmeha@geo.au.dk>
|
|
6
6
|
License: MIT
|
|
@@ -46,6 +46,9 @@ This repository contains the INTEGRATE Python module for localized probabilistic
|
|
|
46
46
|
|
|
47
47
|
Assuming you already have Python 3.10+ installed:
|
|
48
48
|
|
|
49
|
+
`libaarhusxyz` must be installed manually before installing `integrate_module`, because the version that supports Python >= 3.12 is only available on GitHub (not PyPI):
|
|
50
|
+
|
|
51
|
+
pip install git+https://github.com/cultpenguin/libaarhusxyz
|
|
49
52
|
pip install integrate_module
|
|
50
53
|
|
|
51
54
|
On Windows, this will also install the Python wrapper for GA-AEM (1D EM forward modeling - GPL v2 code): [ga-aem-forward-win](https://pypi.org/project/ga-aem-forward-win/)
|
|
@@ -13,6 +13,9 @@ This repository contains the INTEGRATE Python module for localized probabilistic
|
|
|
13
13
|
|
|
14
14
|
Assuming you already have Python 3.10+ installed:
|
|
15
15
|
|
|
16
|
+
`libaarhusxyz` must be installed manually before installing `integrate_module`, because the version that supports Python >= 3.12 is only available on GitHub (not PyPI):
|
|
17
|
+
|
|
18
|
+
pip install git+https://github.com/cultpenguin/libaarhusxyz
|
|
16
19
|
pip install integrate_module
|
|
17
20
|
|
|
18
21
|
On Windows, this will also install the Python wrapper for GA-AEM (1D EM forward modeling - GPL v2 code): [ga-aem-forward-win](https://pypi.org/project/ga-aem-forward-win/)
|
|
@@ -70,6 +70,7 @@ from integrate.integrate_io import copy_hdf5_file
|
|
|
70
70
|
from integrate.integrate_io import hdf5_scan
|
|
71
71
|
from integrate.integrate_io import get_case_data
|
|
72
72
|
from integrate.integrate_io import save_data_gaussian
|
|
73
|
+
from integrate.integrate_io import xyz_to_h5
|
|
73
74
|
from integrate.integrate_io import save_data_multinomial
|
|
74
75
|
from integrate.integrate_io import write_data_gaussian # Deprecated - use save_data_gaussian
|
|
75
76
|
from integrate.integrate_io import write_data_multinomial # Deprecated - use save_data_multinomial
|
|
@@ -122,6 +123,7 @@ from integrate.integrate_query import query_plot
|
|
|
122
123
|
from integrate.integrate_query import save_query
|
|
123
124
|
from integrate.integrate_query import load_query
|
|
124
125
|
from integrate.integrate_query import get_prior_model_info
|
|
126
|
+
from integrate.integrate_query import query_from_text
|
|
125
127
|
|
|
126
128
|
# Import gex module functions
|
|
127
129
|
from integrate.gex import read_gex as read_gex2
|
|
@@ -88,11 +88,9 @@ def use_parallel(**kwargs):
|
|
|
88
88
|
|
|
89
89
|
Parameters
|
|
90
90
|
----------
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
If greater than 0, prints information about the environment and
|
|
95
|
-
parallel processing status. Default is 0.
|
|
91
|
+
showInfo : int, optional
|
|
92
|
+
If greater than 0, prints information about the environment and
|
|
93
|
+
parallel processing status. Default is 0.
|
|
96
94
|
|
|
97
95
|
Returns
|
|
98
96
|
-------
|
|
@@ -220,14 +218,12 @@ def integrate_update_prior_attributes(f_prior_h5, **kwargs):
|
|
|
220
218
|
----------
|
|
221
219
|
f_prior_h5 : str
|
|
222
220
|
The path to the HDF5 file to process.
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
showInfo : int, optional
|
|
226
|
-
Level of verbosity for output (default is 0).
|
|
221
|
+
showInfo : int, optional
|
|
222
|
+
Level of verbosity for output (default is 0).
|
|
227
223
|
"""
|
|
228
|
-
|
|
224
|
+
|
|
229
225
|
showInfo = kwargs.get('showInfo', 0)
|
|
230
|
-
|
|
226
|
+
|
|
231
227
|
# Check that hdf5 files exists
|
|
232
228
|
if not os.path.isfile(f_prior_h5):
|
|
233
229
|
if showInfo>=2:
|
|
@@ -338,11 +334,13 @@ def integrate_posterior_stats(f_post_h5='POST.h5', ip_range=None, **kwargs):
|
|
|
338
334
|
|
|
339
335
|
For each **continuous** model parameter ``/Mx``:
|
|
340
336
|
|
|
341
|
-
- ``/Mx/Mean``
|
|
342
|
-
- ``/Mx/LogMean``
|
|
343
|
-
- ``/Mx/Median``
|
|
344
|
-
- ``/Mx/Std``
|
|
345
|
-
- ``/Mx/
|
|
337
|
+
- ``/Mx/Mean`` [Np, Nm] Arithmetic mean of posterior realizations.
|
|
338
|
+
- ``/Mx/LogMean`` [Np, Nm] Geometric mean (exp of mean of log values).
|
|
339
|
+
- ``/Mx/Median`` [Np, Nm] Median of posterior realizations.
|
|
340
|
+
- ``/Mx/Std`` [Np, Nm] Standard deviation of log10(posterior).
|
|
341
|
+
- ``/Mx/HarmonicMean`` [Np, Nm] Trimmed harmonic mean: conductivity samples
|
|
342
|
+
are trimmed 10% each tail, averaged, then inverted back to resistivity.
|
|
343
|
+
- ``/Mx/KL`` [Np, Nm] KL divergence in bits. Only written when
|
|
346
344
|
``computeKL_continuous=True``.
|
|
347
345
|
|
|
348
346
|
For each **discrete** model parameter ``/Mx``:
|
|
@@ -474,6 +472,7 @@ def integrate_posterior_stats(f_post_h5='POST.h5', ip_range=None, **kwargs):
|
|
|
474
472
|
M_mean = np.full((nsounding, nm), np.nan)
|
|
475
473
|
M_std = np.full((nsounding, nm), np.nan)
|
|
476
474
|
M_median = np.full((nsounding, nm), np.nan)
|
|
475
|
+
M_harmonicmean = np.full((nsounding, nm), np.nan)
|
|
477
476
|
if computeKL_continuous:
|
|
478
477
|
M_KL = np.full((nsounding, nm), np.nan)
|
|
479
478
|
|
|
@@ -510,6 +509,10 @@ def integrate_posterior_stats(f_post_h5='POST.h5', ip_range=None, **kwargs):
|
|
|
510
509
|
M_median[iid,:] = np.median(m_post, axis=0)
|
|
511
510
|
with np.errstate(invalid='ignore', divide='ignore'):
|
|
512
511
|
M_std[iid,:] = np.std(np.log10(np.maximum(m_post, 1e-10)), axis=0)
|
|
512
|
+
_c = 1.0 / np.maximum(m_post, 1e-10)
|
|
513
|
+
_k = int(np.floor(0.10 * _c.shape[0]))
|
|
514
|
+
_cs = np.sort(_c, axis=0)
|
|
515
|
+
M_harmonicmean[iid, :] = 1.0 / np.mean(_cs[_k:_c.shape[0]-_k, :], axis=0)
|
|
513
516
|
if computeKL_continuous:
|
|
514
517
|
m_post_log = np.log10(np.maximum(m_post, 1e-10))
|
|
515
518
|
for _i in range(nm):
|
|
@@ -560,16 +563,23 @@ def integrate_posterior_stats(f_post_h5='POST.h5', ip_range=None, **kwargs):
|
|
|
560
563
|
# Geometric Mean: exp(mean(log(x)))
|
|
561
564
|
M_logmean[current_iids, :] = np.exp(np.mean(log_cube, axis=1))
|
|
562
565
|
|
|
563
|
-
# Std of Log10:
|
|
566
|
+
# Std of Log10:
|
|
564
567
|
# Math identity: std(log10(x)) = std(ln(x) / ln(10)) = std(ln(x)) * (1/ln(10))
|
|
565
568
|
# We reuse 'log_cube' and multiply by constant (faster than re-calculating log10)
|
|
566
569
|
M_std[current_iids, :] = np.std(log_cube, axis=1) * INV_LOG_10
|
|
567
570
|
|
|
571
|
+
# Harmonic mean (trimmed 10% each tail in conductivity space)
|
|
572
|
+
_c = 1.0 / np.maximum(m_cube, 1e-10)
|
|
573
|
+
_nr = _c.shape[1]
|
|
574
|
+
_k = int(np.floor(0.10 * _nr))
|
|
575
|
+
_cs = np.sort(_c, axis=1)
|
|
576
|
+
M_harmonicmean[current_iids, :] = 1.0 / np.mean(_cs[:, _k:_nr-_k, :], axis=1)
|
|
577
|
+
|
|
568
578
|
|
|
569
579
|
|
|
570
580
|
|
|
571
581
|
# Create datasets
|
|
572
|
-
for stat in ['Mean', 'Median', 'Std','LogMean']:
|
|
582
|
+
for stat in ['Mean', 'Median', 'Std', 'LogMean', 'HarmonicMean']:
|
|
573
583
|
if stat not in f_post:
|
|
574
584
|
dset = '/%s/%s' % (name,stat)
|
|
575
585
|
if dset not in f_post:
|
|
@@ -581,6 +591,7 @@ def integrate_posterior_stats(f_post_h5='POST.h5', ip_range=None, **kwargs):
|
|
|
581
591
|
f_post['/%s/%s' % (name,'Mean')][:] = M_mean
|
|
582
592
|
f_post['/%s/%s' % (name,'Median')][:] = M_median
|
|
583
593
|
f_post['/%s/%s' % (name,'Std')][:] = M_std
|
|
594
|
+
f_post['/%s/%s' % (name,'HarmonicMean')][:] = M_harmonicmean
|
|
584
595
|
if computeKL_continuous:
|
|
585
596
|
dset = '/%s/KL' % name
|
|
586
597
|
if dset not in f_post:
|
|
@@ -706,7 +717,7 @@ def sample_from_posterior(is_, d_sim, f_data_h5='tTEM-Djursland.h5', N_use=10000
|
|
|
706
717
|
Temperature.
|
|
707
718
|
EV : float
|
|
708
719
|
Expected value.
|
|
709
|
-
|
|
720
|
+
is_index : int
|
|
710
721
|
Index of the posterior sample.
|
|
711
722
|
"""
|
|
712
723
|
with h5py.File(f_data_h5, 'r') as f:
|
|
@@ -862,13 +873,11 @@ def forward_gaaem(C=np.array(()),
|
|
|
862
873
|
Path to GEX file. Default is None.
|
|
863
874
|
showtime : bool, optional
|
|
864
875
|
Flag to display execution time. Default is False.
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
Flag to enable layer compression. Default is True.
|
|
871
|
-
|
|
876
|
+
showInfo : int, optional
|
|
877
|
+
Level of verbosity for output.
|
|
878
|
+
doCompress : bool, optional
|
|
879
|
+
Flag to enable layer compression. Default is True.
|
|
880
|
+
|
|
872
881
|
Returns
|
|
873
882
|
-------
|
|
874
883
|
numpy.ndarray
|
|
@@ -1164,7 +1173,7 @@ def get_process_handle_count():
|
|
|
1164
1173
|
import os
|
|
1165
1174
|
return psutil.Process(os.getpid()).num_handles()
|
|
1166
1175
|
|
|
1167
|
-
def prior_data_gaaem(f_prior_h5, file_gex=None, stmfiles=None, N=0, doMakePriorCopy=True, im=1, id=1, im_height=0, Nhank=280, Nfreq=12, is_log=False, parallel=True, **kwargs):
|
|
1176
|
+
def prior_data_gaaem(f_prior_h5, file_gex=None, stmfiles=None, N=0, doMakePriorCopy=True, im=1, id=1, im_height=0, Nhank=280, Nfreq=12, is_log=False, parallel=True, force_replace=False, **kwargs):
|
|
1168
1177
|
"""
|
|
1169
1178
|
Generate prior data for the GA-AEM method.
|
|
1170
1179
|
|
|
@@ -1202,6 +1211,10 @@ def prior_data_gaaem(f_prior_h5, file_gex=None, stmfiles=None, N=0, doMakePriorC
|
|
|
1202
1211
|
Ncpu : int, optional
|
|
1203
1212
|
Number of CPUs to use for parallel processing. Default is 0, which
|
|
1204
1213
|
uses all available CPUs. Only used when parallel=True.
|
|
1214
|
+
force_replace : bool, optional
|
|
1215
|
+
If True, delete an existing /D{id} dataset before writing.
|
|
1216
|
+
If False (default), print a warning and return early if the
|
|
1217
|
+
dataset already exists.
|
|
1205
1218
|
showInfo : int, optional
|
|
1206
1219
|
Level of verbosity for output (0=silent, 1=normal, 2=verbose).
|
|
1207
1220
|
|
|
@@ -1304,27 +1317,27 @@ def prior_data_gaaem(f_prior_h5, file_gex=None, stmfiles=None, N=0, doMakePriorC
|
|
|
1304
1317
|
Dname = '/D%d' % id
|
|
1305
1318
|
|
|
1306
1319
|
|
|
1307
|
-
|
|
1320
|
+
with h5py.File(f_prior_data_h5, 'r') as f_prior_r:
|
|
1321
|
+
if im_height>0:
|
|
1322
|
+
if (showInfo>1):
|
|
1323
|
+
print('Using M%d for height' % im_height)
|
|
1324
|
+
tx_height = f_prior_r[Mheight][:]
|
|
1308
1325
|
|
|
1309
|
-
|
|
1310
|
-
if
|
|
1311
|
-
|
|
1312
|
-
|
|
1326
|
+
# Get thickness
|
|
1327
|
+
if 'x' in f_prior_r[Mname].attrs:
|
|
1328
|
+
z = f_prior_r[Mname].attrs['x']
|
|
1329
|
+
else:
|
|
1330
|
+
z = f_prior_r[Mname].attrs['z']
|
|
1331
|
+
thickness = np.diff(z)
|
|
1313
1332
|
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
thickness = np.diff(z)
|
|
1333
|
+
# Get conductivity
|
|
1334
|
+
if Mname in f_prior_r.keys():
|
|
1335
|
+
C = 1 / f_prior_r[Mname][:]
|
|
1336
|
+
else:
|
|
1337
|
+
print('Could not load %s from %s' % (Mname, f_prior_data_h5))
|
|
1320
1338
|
|
|
1321
|
-
|
|
1322
|
-
if Mname in f_prior.keys():
|
|
1323
|
-
C = 1 / f_prior[Mname][:]
|
|
1324
|
-
else:
|
|
1325
|
-
print('Could not load %s from %s' % (Mname, f_prior_data_h5))
|
|
1339
|
+
N = f_prior_r[Mname].shape[0]
|
|
1326
1340
|
|
|
1327
|
-
N = f_prior[Mname].shape[0]
|
|
1328
1341
|
t1 = time.time()
|
|
1329
1342
|
if not parallel:
|
|
1330
1343
|
if (showInfo>-1):
|
|
@@ -1430,16 +1443,21 @@ def prior_data_gaaem(f_prior_h5, file_gex=None, stmfiles=None, N=0, doMakePriorC
|
|
|
1430
1443
|
print('prior_data_gaaem: Time=%5.1fs/%d soundings. %4.1fms/sounding, %3.1fit/s' % (t_elapsed, N, 1000*t_elapsed/N,N/t_elapsed))
|
|
1431
1444
|
|
|
1432
1445
|
# Write D to f_prior['/D1']
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1446
|
+
with h5py.File(f_prior_data_h5, 'a') as f_prior:
|
|
1447
|
+
if Dname in f_prior:
|
|
1448
|
+
if force_replace:
|
|
1449
|
+
del f_prior[Dname]
|
|
1450
|
+
else:
|
|
1451
|
+
print("Key '%s' already exists in %s. Use force_replace=True to overwrite." % (Dname, f_prior_data_h5))
|
|
1452
|
+
return f_prior_data_h5
|
|
1453
|
+
f_prior[Dname] = D
|
|
1441
1454
|
|
|
1442
|
-
|
|
1455
|
+
# Add method, type, file_ex, and im as attributes to '/D1'
|
|
1456
|
+
f_prior[Dname].attrs['method'] = method
|
|
1457
|
+
f_prior[Dname].attrs['type'] = type
|
|
1458
|
+
f_prior[Dname].attrs['im'] = im
|
|
1459
|
+
f_prior[Dname].attrs['Nhank'] = Nhank
|
|
1460
|
+
f_prior[Dname].attrs['Nfreq'] = Nfreq
|
|
1443
1461
|
|
|
1444
1462
|
integrate_update_prior_attributes(f_prior_data_h5)
|
|
1445
1463
|
|
|
@@ -1462,13 +1480,11 @@ def prior_data_identity(f_prior_h5, id=0, im=1, N=0, doMakePriorCopy=False, **kw
|
|
|
1462
1480
|
Number of soundings to consider. Default is 0 (use all).
|
|
1463
1481
|
doMakePriorCopy : bool, optional
|
|
1464
1482
|
Flag indicating whether to make a copy of the prior file. Default is False.
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
Flag to force deletion of existing data. Default is True.
|
|
1471
|
-
|
|
1483
|
+
showInfo : int, optional
|
|
1484
|
+
Level of verbosity for output.
|
|
1485
|
+
forceDeleteExisting : bool, optional
|
|
1486
|
+
Flag to force deletion of existing data. Default is True.
|
|
1487
|
+
|
|
1472
1488
|
Returns
|
|
1473
1489
|
-------
|
|
1474
1490
|
str
|
|
@@ -1476,7 +1492,7 @@ def prior_data_identity(f_prior_h5, id=0, im=1, N=0, doMakePriorCopy=False, **kw
|
|
|
1476
1492
|
"""
|
|
1477
1493
|
import integrate as ig
|
|
1478
1494
|
import time
|
|
1479
|
-
|
|
1495
|
+
|
|
1480
1496
|
type = 'idenity'
|
|
1481
1497
|
method = '--'
|
|
1482
1498
|
showInfo = kwargs.get('showInfo', 0)
|
|
@@ -1599,12 +1615,10 @@ def prior_model_layered(lay_dist='uniform', dz = 1, z_max = 90,
|
|
|
1599
1615
|
values below this threshold (including zero or negative values from 'normal'
|
|
1600
1616
|
distribution) will be clamped to this value. Ensures physically realistic
|
|
1601
1617
|
positive resistivity values. Default is 0.001 Ohm·m.
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
showInfo : int, optional
|
|
1607
|
-
Level of verbosity for output.
|
|
1618
|
+
f_prior_h5 : str, optional
|
|
1619
|
+
Path to the prior model file in HDF5 format. Default is ''.
|
|
1620
|
+
showInfo : int, optional
|
|
1621
|
+
Level of verbosity for output.
|
|
1608
1622
|
|
|
1609
1623
|
Returns
|
|
1610
1624
|
-------
|
|
@@ -1826,12 +1840,10 @@ def prior_model_workbench_direct(N=100000, RHO_dist='log-uniform', z1=0, z_max=
|
|
|
1826
1840
|
values below this threshold (including zero or negative values from 'normal'
|
|
1827
1841
|
distribution) will be clamped to this value. Ensures physically realistic
|
|
1828
1842
|
positive resistivity values. Default is 0.001 Ohm·m.
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
showInfo : int, optional
|
|
1834
|
-
Level of verbosity for output.
|
|
1843
|
+
f_prior_h5 : str, optional
|
|
1844
|
+
Path to the prior model file in HDF5 format. Default is ''.
|
|
1845
|
+
showInfo : int, optional
|
|
1846
|
+
Level of verbosity for output.
|
|
1835
1847
|
|
|
1836
1848
|
Returns
|
|
1837
1849
|
-------
|
|
@@ -1961,12 +1973,10 @@ def prior_model_workbench(N=100000, p=2, z1=0, z_max= 100, dz=1,
|
|
|
1961
1973
|
values below this threshold (including zero or negative values from 'normal'
|
|
1962
1974
|
distribution) will be clamped to this value. Ensures physically realistic
|
|
1963
1975
|
positive resistivity values. Default is 0.001 Ohm·m.
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
showInfo : int, optional
|
|
1969
|
-
Level of verbosity for output.
|
|
1976
|
+
f_prior_h5 : str, optional
|
|
1977
|
+
Path to the prior model file in HDF5 format. Default is ''.
|
|
1978
|
+
showInfo : int, optional
|
|
1979
|
+
Level of verbosity for output.
|
|
1970
1980
|
|
|
1971
1981
|
Returns
|
|
1972
1982
|
-------
|
|
@@ -2215,9 +2225,8 @@ def posterior_cumulative_thickness(f_post_h5, im=2, icat=[0], usePrior=False, **
|
|
|
2215
2225
|
i_use[i,:]=np.arange(nr)
|
|
2216
2226
|
|
|
2217
2227
|
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
f_prior.close()
|
|
2228
|
+
with h5py.File(f_prior_h5,'r') as f_prior:
|
|
2229
|
+
M_prior = f_prior[Mstr][:]
|
|
2221
2230
|
nz = M_prior.shape[1]
|
|
2222
2231
|
|
|
2223
2232
|
thick_mean = np.zeros((ns))
|
|
@@ -2352,72 +2361,48 @@ def synthetic_case(case='Wedge', **kwargs):
|
|
|
2352
2361
|
case : str, optional
|
|
2353
2362
|
The type of synthetic case to generate. Options are 'Wedge' and '3Layer'.
|
|
2354
2363
|
Default is 'Wedge'.
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
Step size in the x-dimension. Default is 1.
|
|
2398
|
-
z_max : int, optional
|
|
2399
|
-
Maximum z-dimension size. Default is 60.
|
|
2400
|
-
dz : float, optional
|
|
2401
|
-
Step size in the z-dimension. Default is 1.
|
|
2402
|
-
z1 : float, optional
|
|
2403
|
-
Depth at which the first layer ends. Default is z_max/3.
|
|
2404
|
-
z_thick : float, optional
|
|
2405
|
-
Thickness of the second layer. Default is z_max/2.
|
|
2406
|
-
rho1_1 : float, optional
|
|
2407
|
-
Density at the start of the first layer. Default is 120.
|
|
2408
|
-
Overridden by rho_1 if provided.
|
|
2409
|
-
rho1_2 : float, optional
|
|
2410
|
-
Density at the end of the first layer. Default is 10.
|
|
2411
|
-
Overridden by rho_1 if provided.
|
|
2412
|
-
rho2_1 : float, optional
|
|
2413
|
-
Density at the start of the second layer. Default is rho1_2.
|
|
2414
|
-
Overridden by rho_2 if provided.
|
|
2415
|
-
rho2_2 : float, optional
|
|
2416
|
-
Density at the end of the second layer. Default is rho1_1.
|
|
2417
|
-
Overridden by rho_2 if provided.
|
|
2418
|
-
rho3 : float, optional
|
|
2419
|
-
Density of the third layer. Default is 120.
|
|
2420
|
-
Overridden by rho_3 if provided.
|
|
2364
|
+
showInfo : int, optional
|
|
2365
|
+
If greater than 0, print information about the generated case. Default is 0.
|
|
2366
|
+
rho_1 : list or array_like, optional
|
|
2367
|
+
Resistivity values for layer 1 along the profile. If a single value [v],
|
|
2368
|
+
resistivity is constant at v. If multiple values [v1, v2, ...], resistivity
|
|
2369
|
+
varies from v1 (left) to v2 (middle) to vN (right) using interpolation.
|
|
2370
|
+
Only used when rho_1, rho_2, and rho_3 are all provided.
|
|
2371
|
+
rho_2 : list or array_like, optional
|
|
2372
|
+
Resistivity values for layer 2 along the profile. Same format as rho_1.
|
|
2373
|
+
rho_3 : list or array_like, optional
|
|
2374
|
+
Resistivity values for layer 3 along the profile. Same format as rho_1.
|
|
2375
|
+
x_max : int, optional
|
|
2376
|
+
Maximum x-dimension size. Default is 1000 for 'Wedge', 100 for '3Layer'.
|
|
2377
|
+
dx : float, optional
|
|
2378
|
+
Step size in the x-dimension.
|
|
2379
|
+
z_max : int, optional
|
|
2380
|
+
Maximum z-dimension size. Default is 90 for 'Wedge', 60 for '3Layer'.
|
|
2381
|
+
dz : float, optional
|
|
2382
|
+
Step size in the z-dimension. Default is 1.
|
|
2383
|
+
z1 : float, optional
|
|
2384
|
+
Depth at which the wedge starts ('Wedge': default z_max/10) or first layer
|
|
2385
|
+
ends ('3Layer': default z_max/3).
|
|
2386
|
+
rho : list, optional
|
|
2387
|
+
Density values for different layers ('Wedge' case). Default is [100, 200, 120].
|
|
2388
|
+
Overridden by rho_1, rho_2, rho_3 if all three are provided.
|
|
2389
|
+
wedge_angle : float, optional
|
|
2390
|
+
Angle of the wedge in degrees ('Wedge' case). Default is 1.
|
|
2391
|
+
x_range : float, optional
|
|
2392
|
+
Range in the x-dimension for the cosine function ('3Layer' case).
|
|
2393
|
+
Default is x_max/4.
|
|
2394
|
+
z_thick : float, optional
|
|
2395
|
+
Thickness of the second layer ('3Layer' case). Default is z_max/2.
|
|
2396
|
+
rho1_1 : float, optional
|
|
2397
|
+
Density at the start of the first layer ('3Layer'). Default is 120.
|
|
2398
|
+
rho1_2 : float, optional
|
|
2399
|
+
Density at the end of the first layer ('3Layer'). Default is 10.
|
|
2400
|
+
rho2_1 : float, optional
|
|
2401
|
+
Density at the start of the second layer ('3Layer'). Default is rho1_2.
|
|
2402
|
+
rho2_2 : float, optional
|
|
2403
|
+
Density at the end of the second layer ('3Layer'). Default is rho1_1.
|
|
2404
|
+
rho3 : float, optional
|
|
2405
|
+
Density of the third layer ('3Layer'). Default is 120.
|
|
2421
2406
|
|
|
2422
2407
|
Returns
|
|
2423
2408
|
-------
|
|
@@ -623,10 +623,12 @@ def Pobs_to_datagrid(P_obs, X, Y, f_data_h5, r_data=10, r_dis=100, doPlot=False)
|
|
|
623
623
|
2. Converts distance weight to temperature: T = 1 / w_dis
|
|
624
624
|
3. Caps maximum temperature at 100 (very weak influence)
|
|
625
625
|
4. For each grid point:
|
|
626
|
+
|
|
626
627
|
- If T < 100: include point (i_use=1) and apply temperature scaling
|
|
627
628
|
- If T ≥ 100: exclude point (i_use=0) and set observations to NaN
|
|
628
629
|
|
|
629
630
|
Temperature scaling reduces probability certainty with distance:
|
|
631
|
+
|
|
630
632
|
- T = 1 (close to observation): Original probabilities preserved
|
|
631
633
|
- T > 1 (far from observation): Probabilities become more uniform
|
|
632
634
|
- T ≥ 100 (very far): Observations effectively ignored
|
|
File without changes
|