rock-physics-open 0.1.3__py3-none-any.whl → 0.2.1__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.

Potentially problematic release.


This version of rock-physics-open might be problematic. Click here for more details.

@@ -11,18 +11,19 @@ from rock_physics_open.equinor_utilities.various_utilities import disp_result_st
11
11
 
12
12
  from .snapshots import get_snapshot_name
13
13
 
14
- DISPLAY_RESULTS = False
15
-
16
14
 
17
15
  def compare_snapshots(
18
16
  test_results: Union[np.ndarray, tuple, DataFrame],
19
17
  saved_results: tuple,
18
+ name_arr=None,
19
+ display_results: bool = False,
20
20
  ) -> bool:
21
21
  test_results = _validate_input(test_results, saved_results)
22
22
 
23
- if DISPLAY_RESULTS:
23
+ if display_results:
24
24
  title = str(inspect.stack()[1].function)
25
- name_arr = [f"arr_{i}" for i in range(len(test_results))]
25
+ if not name_arr:
26
+ name_arr = [f"arr_{i}" for i in range(len(test_results))]
26
27
  disp_result_stats(title, test_results, name_arr)
27
28
 
28
29
  r_tol = 0.01
@@ -1,5 +1,4 @@
1
1
  import inspect
2
- import os
3
2
  from pathlib import Path
4
3
 
5
4
  import numpy as np
@@ -7,9 +6,14 @@ import numpy as np
7
6
  INITIATE = False
8
7
 
9
8
 
10
- def get_snapshot_name(step: int = 1, include_snapshot_dir=True) -> str:
9
+ def get_snapshot_name(
10
+ step: int = 1,
11
+ include_filename: bool = True,
12
+ include_function_name: bool = True,
13
+ include_extension: bool = True,
14
+ include_snapshot_dir=True,
15
+ ) -> str:
11
16
  """
12
-
13
17
  Parameters
14
18
  ----------
15
19
  step: number of steps in the trace to collect information from
@@ -18,15 +22,29 @@ def get_snapshot_name(step: int = 1, include_snapshot_dir=True) -> str:
18
22
  Returns
19
23
  -------
20
24
  name of snapshot file
21
-
22
25
  """
23
- # Get filename and function name of calling function
24
26
  trace = inspect.stack()
25
- dir_name = Path(trace[step].filename).parent.joinpath("snapshots")
26
- file_name = "_".join(
27
- (Path(trace[step].filename).stem, trace[step].function + ".npz")
28
- )
29
- return os.path.join(dir_name, file_name) if include_snapshot_dir else file_name
27
+ for frame in trace[step:]:
28
+ if not any(
29
+ keyword in frame.function
30
+ for keyword in [
31
+ "pydev",
32
+ "ipython-input",
33
+ "interactiveshell",
34
+ "async_helpers",
35
+ ]
36
+ ):
37
+ break
38
+ else:
39
+ frame = trace[step]
40
+
41
+ dir_name = Path(frame.filename).parent / "snapshots"
42
+ file_name = Path(frame.filename).stem if include_filename else ""
43
+ function_name = frame.function if include_function_name else ""
44
+ extension = ".npz" if include_extension else ""
45
+ parts = [part for part in [file_name, function_name] if part]
46
+ base_name = "_".join(parts) + extension
47
+ return str(dir_name / base_name) if include_snapshot_dir else base_name
30
48
 
31
49
 
32
50
  def store_snapshot(snapshot_name: str, *args: np.ndarray) -> bool:
@@ -1,5 +1,6 @@
1
+ import importlib
2
+
1
3
  import numpy as np
2
- import pkg_resources
3
4
  import scipy.optimize
4
5
  from scipy.interpolate import RegularGridInterpolator
5
6
 
@@ -420,11 +421,16 @@ def carbon_dioxide_density(absolute_temperature, pressure, interpolate=False, **
420
421
  absolute_temperature, pressure, **kwargs
421
422
  )
422
423
  assert interpolate is True
423
- fp = pkg_resources.resource_filename(
424
- "rock_physics.fluid_models.gas_model.span_wagner.tables",
425
- "carbon_dioxide_density.npz",
424
+
425
+ ref = (
426
+ importlib.resources.files(
427
+ "rock_physics.fluid_models.gas_model.span_wagner.tables"
428
+ )
429
+ / "carbon_dioxide_density.npz"
426
430
  )
427
- interpolator = load_lookup_table_interpolator(fp)
431
+ with importlib.resources.as_file(ref) as fp:
432
+ interpolator = load_lookup_table_interpolator(fp)
433
+
428
434
  return interpolator(absolute_temperature, pressure)
429
435
 
430
436
 
@@ -17,5 +17,5 @@ __version__: str
17
17
  __version_tuple__: VERSION_TUPLE
18
18
  version_tuple: VERSION_TUPLE
19
19
 
20
- __version__ = version = '0.1.3'
21
- __version_tuple__ = version_tuple = (0, 1, 3)
20
+ __version__ = version = '0.2.1'
21
+ __version_tuple__ = version_tuple = (0, 2, 1)
@@ -1,11 +1,12 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rock_physics_open
3
- Version: 0.1.3
3
+ Version: 0.2.1
4
4
  Summary: Equinor Rock Physics Module
5
5
  Author-email: Harald Flesche <hfle@equinor.com>, Eivind Jahren <ejah@equinor.com>, Jimmy Zurcher <jiz@equinor.com>
6
6
  Maintainer-email: Harald Flesche <hfle@equinor.com>, Eirik Ola Aksnes <eoaksnes@equinor.com>, Christopher Collin Løkken <chcl@equinor.com>, Sivert Utne <sutn@equinor.com>
7
7
  Project-URL: Repository, https://github.com/equinor/rock-physics-open
8
8
  Project-URL: Homepage, https://github.com/equinor/rock-physics-open
9
+ Project-URL: Changelog, https://github.com/equinor/rock-physics-open/blob/main/CHANGELOG.md
9
10
  Keywords: energy,subsurface,seismic,rock physics,scientific,engineering
10
11
  Classifier: Intended Audience :: Science/Research
11
12
  Classifier: Topic :: Scientific/Engineering
@@ -14,6 +15,7 @@ Classifier: Topic :: Software Development :: Libraries
14
15
  Classifier: Topic :: Utilities
15
16
  Classifier: Operating System :: POSIX :: Linux
16
17
  Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
17
19
  Classifier: Natural Language :: English
18
20
  Requires-Python: >=3.11
19
21
  Description-Content-Type: text/markdown
@@ -78,7 +80,7 @@ Alternatively, you can update the dependencies in your `pyproject.toml` file:
78
80
  <!-- x-release-please-start-version -->
79
81
  ```toml
80
82
  dependencies = [
81
- "rock-physics-open == 0.1.3",
83
+ "rock-physics-open == 0.2.1",
82
84
  ]
83
85
  ```
84
86
  <!-- x-release-please-end-version -->
@@ -1,5 +1,5 @@
1
1
  rock_physics_open/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- rock_physics_open/version.py,sha256=NIzzV8ZM0W-CSLuEs1weG4zPrn_-8yr1AwwI1iuS6yo,511
2
+ rock_physics_open/version.py,sha256=UoNvMtd4wCG76RwoSpNCUtaFyTwakGcZolfjXzNVSMY,511
3
3
  rock_physics_open/equinor_utilities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  rock_physics_open/equinor_utilities/anisotropy.py,sha256=toEsuIW_gHr34gZQpam3sQTl0ap6nAq1pW5hcX9GOHI,4469
5
5
  rock_physics_open/equinor_utilities/conversions.py,sha256=d6SGPbzYsmYBvhDqnohg1lPjAeYGOc0z_vdsuFeNlb4,194
@@ -23,8 +23,8 @@ rock_physics_open/equinor_utilities/machine_learning_utilities/import_ml_models.
23
23
  rock_physics_open/equinor_utilities/machine_learning_utilities/run_regression.py,sha256=L0bCEsMCvcOn6Ji9oDLztY-TaEEYvp1b7bYZQSJ_-II,4799
24
24
  rock_physics_open/equinor_utilities/machine_learning_utilities/sigmoidal_model.py,sha256=XczrkhwSF1bAO0XcYMirbj0ilLyZG6RgT7cX2owPufw,6001
25
25
  rock_physics_open/equinor_utilities/snapshot_test_utilities/__init__.py,sha256=lcbI80ZH6JQS0jI-eUITFBafHVRdhQ5VwttPolHnJyI,255
26
- rock_physics_open/equinor_utilities/snapshot_test_utilities/compare_snapshots.py,sha256=-3sPFISobumPT6cdfqIeL9cwodXFG31nmBWzm3Er5VI,5399
27
- rock_physics_open/equinor_utilities/snapshot_test_utilities/snapshots.py,sha256=lx-UoaZ0KygSYTJKD9h7hwvgBZGduyBcZqWuQoxU7GY,1532
26
+ rock_physics_open/equinor_utilities/snapshot_test_utilities/compare_snapshots.py,sha256=DBF9SNrC7H2V_zTNjmWK-Nz5b0uqNdx5Nktt858VJak,5457
27
+ rock_physics_open/equinor_utilities/snapshot_test_utilities/snapshots.py,sha256=CXLttELG2krN41WYph-zUFnhE3852g3HZlkp7yTTlIE,2085
28
28
  rock_physics_open/equinor_utilities/std_functions/__init__.py,sha256=MLOfMxRazS9tGOVvuLkUp-E4b6jRWOP4YCLf8si624c,1121
29
29
  rock_physics_open/equinor_utilities/std_functions/backus_ave.py,sha256=sYaXSfqjR69U_UFaMmrD5aEbR_0FrL7ZIWGg-Yi8QNo,1607
30
30
  rock_physics_open/equinor_utilities/std_functions/dvorkin_nur.py,sha256=TerlLcuP92ihf5vHaJES5KLyleG3CR7NWSExDI1jLIY,2138
@@ -86,7 +86,7 @@ rock_physics_open/shale_models/sca.py,sha256=eSzPBFQnm6SoL8f5UACs_PSlCgXU3QgwK69
86
86
  rock_physics_open/shale_models/shale4_mineral.py,sha256=aJ2KIWR3EUtjDjJ-mBYQACVv6QQg_73HFW9FNwicwsc,3862
87
87
  rock_physics_open/shale_models/shale4_mineral_dem_overlay.py,sha256=ty8yKoUVuBKeLT17gdS1BHBV1EJCQIpl-b5JG2fF4I8,2660
88
88
  rock_physics_open/span_wagner/__init__.py,sha256=cnvKCSmO0_KkEhbbV3BoDsV-NhlGLnDpBwErI8TPKuQ,80
89
- rock_physics_open/span_wagner/co2_properties.py,sha256=a2KBm86VMF4FZLcXdU7G0_cOPeGqMarat-HtpFw1_n4,16287
89
+ rock_physics_open/span_wagner/co2_properties.py,sha256=7w-VZjR6vUOxX-NWTpLhoXH4fiUCNXd8-HBTrg-nm4w,16358
90
90
  rock_physics_open/span_wagner/coefficients.py,sha256=dGSW58MWnx064LaW0RwIaSDjP1aqV_5Bs9pk9Aaz9j0,3878
91
91
  rock_physics_open/span_wagner/equations.py,sha256=wE99XBrx70NqgxS1qdyGlKTusGihWrtdv3KlpifCz_c,3001
92
92
  rock_physics_open/span_wagner/tables/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -135,8 +135,8 @@ rock_physics_open/ternary_plots/shale_prop_ternary.py,sha256=5-NB4LoXRP7JPQYaJBZ
135
135
  rock_physics_open/ternary_plots/ternary_patches.py,sha256=oYaIkCbzC4L19VWBz5iphVdQnpHX9kdy0p2NK65aIIM,7256
136
136
  rock_physics_open/ternary_plots/ternary_plot_utilities.py,sha256=weFDWyzd7wgr3xB63Q-xtT-KoJA6FNIDWuTkA7jr94Q,5669
137
137
  rock_physics_open/ternary_plots/unconventionals_ternary.py,sha256=KWjcBrjI8Tgr2FYpz1ey-DPuhUeSC7b5mpN8OzwNa4I,1823
138
- rock_physics_open-0.1.3.dist-info/licenses/LICENSE,sha256=46mU2C5kSwOnkqkw9XQAJlhBL2JAf1_uCD8lVcXyMRg,7652
139
- rock_physics_open-0.1.3.dist-info/METADATA,sha256=vE1bqOfLEormD8hwmSLv24KXfA2x50ugzE7xVFq3_aw,3934
140
- rock_physics_open-0.1.3.dist-info/WHEEL,sha256=DnLRTWE75wApRYVsjgc6wsVswC54sMSJhAEd4xhDpBk,91
141
- rock_physics_open-0.1.3.dist-info/top_level.txt,sha256=zFBbfbv2pshFJvcvcLLigDmlJjjg08iDdb6ABgncaP8,18
142
- rock_physics_open-0.1.3.dist-info/RECORD,,
138
+ rock_physics_open-0.2.1.dist-info/licenses/LICENSE,sha256=46mU2C5kSwOnkqkw9XQAJlhBL2JAf1_uCD8lVcXyMRg,7652
139
+ rock_physics_open-0.2.1.dist-info/METADATA,sha256=AmuCWkHVmurlmByxtjArsXpe_OEm1ZvfbMDunRy1yLA,4077
140
+ rock_physics_open-0.2.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
141
+ rock_physics_open-0.2.1.dist-info/top_level.txt,sha256=zFBbfbv2pshFJvcvcLLigDmlJjjg08iDdb6ABgncaP8,18
142
+ rock_physics_open-0.2.1.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.4.0)
2
+ Generator: setuptools (80.9.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5