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

Potentially problematic release.


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

@@ -32,12 +32,16 @@ def compare_snapshots(
32
32
 
33
33
  for i, (test_item, saved_item) in enumerate(zip(test_results, saved_results)):
34
34
  try:
35
+ if name_arr:
36
+ err_msg = f"saved and generated result for {name_arr[i]} differ"
37
+ else:
38
+ err_msg = f"saved result for variable {i} differ"
35
39
  np.testing.assert_allclose(
36
40
  test_item,
37
41
  saved_item,
38
42
  rtol=r_tol,
39
43
  equal_nan=equal_nan,
40
- err_msg=f"saved and generated result for variable {i} differ",
44
+ err_msg=err_msg,
41
45
  )
42
46
  except AssertionError as error:
43
47
  open_mode = "w" if no_difference_found else "a"
@@ -46,9 +50,14 @@ def compare_snapshots(
46
50
  log_file = re.sub("npz", "log", get_snapshot_name(step=2))
47
51
 
48
52
  with open(log_file, open_mode) as file:
49
- file.write(f"Test filepath: {str(inspect.stack()[1].filename)} \n")
50
- file.write(f"Test function: {str(inspect.stack()[1].function)} \n")
51
- file.write(f"Test variable number: {i} \n")
53
+ file.write(
54
+ f"Test function: "
55
+ f"{get_snapshot_name(include_extension=False, include_snapshot_dir=False, include_filename=False)} \n"
56
+ )
57
+ if name_arr:
58
+ file.write(f"Test variable: {name_arr[i]} \n")
59
+ else:
60
+ file.write(f"Test variable number: {i} \n")
52
61
 
53
62
  for line in str(error).splitlines():
54
63
  mismatched_elements_index = (
@@ -72,7 +81,7 @@ def compare_snapshots(
72
81
  file.write(line + "\n")
73
82
  continue
74
83
 
75
- reg_index = re.search(r"\d+ differ", line)
84
+ reg_index = re.search(r"differ", line)
76
85
 
77
86
  if reg_index:
78
87
  if isinstance(test_item, np.ndarray):
@@ -91,7 +100,7 @@ def compare_snapshots(
91
100
  tab = "\t"
92
101
  for difference in differences:
93
102
  file.write(
94
- f"{tab}[{difference[0]:4}]=> {difference[1]:.4g} != {difference[2]:.4g}\n"
103
+ f"{tab}[{difference[0]:4}]=> {difference[1]:.8g} != {difference[2]:.8g}\n"
95
104
  )
96
105
  file.write(f"{'_' * 40}\n")
97
106
  return no_difference_found
@@ -5,6 +5,34 @@ import numpy as np
5
5
 
6
6
  INITIATE = False
7
7
 
8
+ SYSTEM_AND_DEBUG_FCN = [
9
+ "pydev",
10
+ "ipython-input",
11
+ "interactiveshell",
12
+ "async_helpers",
13
+ "handle_snapshots",
14
+ "run_code",
15
+ "run_ast_nodes",
16
+ "run_cell_async",
17
+ "_pseudo_sync_runner",
18
+ "_run_cell",
19
+ "run_cell",
20
+ "add_exec",
21
+ "do_add_exec",
22
+ "add_exec",
23
+ "ipython_exec_code",
24
+ "console_exec",
25
+ "do_it",
26
+ "process_internal_commands",
27
+ "_do_wait_suspend",
28
+ "do_wait_suspend",
29
+ "compare_snapshots",
30
+ "handle_snapshots",
31
+ "wrapper",
32
+ "run_tests",
33
+ "<module>",
34
+ ]
35
+
8
36
 
9
37
  def get_snapshot_name(
10
38
  step: int = 1,
@@ -18,6 +46,9 @@ def get_snapshot_name(
18
46
  ----------
19
47
  step: number of steps in the trace to collect information from
20
48
  include_snapshot_dir: absolute directory name included in snapshot name
49
+ include_filename: whether to include filename in snapshot name
50
+ include_function_name: whether to include function name in snapshot name
51
+ include_extension: whether to include extension in snapshot name
21
52
 
22
53
  Returns
23
54
  -------
@@ -25,20 +56,12 @@ def get_snapshot_name(
25
56
  """
26
57
  trace = inspect.stack()
27
58
  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
- ):
59
+ if not any(keyword in frame.function for keyword in SYSTEM_AND_DEBUG_FCN):
37
60
  break
38
61
  else:
39
62
  frame = trace[step]
40
63
 
41
- dir_name = Path(frame.filename).parent / "snapshots"
64
+ dir_name = Path(frame.filename).parents[1] / "data" / "snapshots"
42
65
  file_name = Path(frame.filename).stem if include_filename else ""
43
66
  function_name = frame.function if include_function_name else ""
44
67
  extension = ".npz" if include_extension else ""
@@ -1,7 +1,14 @@
1
1
  # file generated by setuptools-scm
2
2
  # don't change, don't track in version control
3
3
 
4
- __all__ = ["__version__", "__version_tuple__", "version", "version_tuple"]
4
+ __all__ = [
5
+ "__version__",
6
+ "__version_tuple__",
7
+ "version",
8
+ "version_tuple",
9
+ "__commit_id__",
10
+ "commit_id",
11
+ ]
5
12
 
6
13
  TYPE_CHECKING = False
7
14
  if TYPE_CHECKING:
@@ -9,13 +16,19 @@ if TYPE_CHECKING:
9
16
  from typing import Union
10
17
 
11
18
  VERSION_TUPLE = Tuple[Union[int, str], ...]
19
+ COMMIT_ID = Union[str, None]
12
20
  else:
13
21
  VERSION_TUPLE = object
22
+ COMMIT_ID = object
14
23
 
15
24
  version: str
16
25
  __version__: str
17
26
  __version_tuple__: VERSION_TUPLE
18
27
  version_tuple: VERSION_TUPLE
28
+ commit_id: COMMIT_ID
29
+ __commit_id__: COMMIT_ID
19
30
 
20
- __version__ = version = '0.2.1'
21
- __version_tuple__ = version_tuple = (0, 2, 1)
31
+ __version__ = version = '0.2.3'
32
+ __version_tuple__ = version_tuple = (0, 2, 3)
33
+
34
+ __commit_id__ = commit_id = None
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rock_physics_open
3
- Version: 0.2.1
3
+ Version: 0.2.3
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
- 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>
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>, Einar Wigum Arbo <earb@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
9
  Project-URL: Changelog, https://github.com/equinor/rock-physics-open/blob/main/CHANGELOG.md
@@ -80,7 +80,7 @@ Alternatively, you can update the dependencies in your `pyproject.toml` file:
80
80
  <!-- x-release-please-start-version -->
81
81
  ```toml
82
82
  dependencies = [
83
- "rock-physics-open == 0.2.1",
83
+ "rock-physics-open == 0.2.3",
84
84
  ]
85
85
  ```
86
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=UoNvMtd4wCG76RwoSpNCUtaFyTwakGcZolfjXzNVSMY,511
2
+ rock_physics_open/version.py,sha256=kBRz0P2plw1eVdIpt70W6m1LMbEIhLY3RyOfVGdubaI,704
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=DBF9SNrC7H2V_zTNjmWK-Nz5b0uqNdx5Nktt858VJak,5457
27
- rock_physics_open/equinor_utilities/snapshot_test_utilities/snapshots.py,sha256=CXLttELG2krN41WYph-zUFnhE3852g3HZlkp7yTTlIE,2085
26
+ rock_physics_open/equinor_utilities/snapshot_test_utilities/compare_snapshots.py,sha256=l2F9C1NQOwHJG6_HPOO0daWSaUg5N5-PFx45-j90N7g,5759
27
+ rock_physics_open/equinor_utilities/snapshot_test_utilities/snapshots.py,sha256=_UvX78IoPDPTCAbblHD9fH_Yn-LwkDOA9MuU69bPdbM,2691
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
@@ -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.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,,
138
+ rock_physics_open-0.2.3.dist-info/licenses/LICENSE,sha256=46mU2C5kSwOnkqkw9XQAJlhBL2JAf1_uCD8lVcXyMRg,7652
139
+ rock_physics_open-0.2.3.dist-info/METADATA,sha256=hBSKTCwVUb9KD9Fesl_WeRcbz7VDDW8SnIbUCsAHwIA,4114
140
+ rock_physics_open-0.2.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
141
+ rock_physics_open-0.2.3.dist-info/top_level.txt,sha256=zFBbfbv2pshFJvcvcLLigDmlJjjg08iDdb6ABgncaP8,18
142
+ rock_physics_open-0.2.3.dist-info/RECORD,,