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

Files changed (43) hide show
  1. rock_physics_open/equinor_utilities/gen_utilities/dict_to_float.py +6 -1
  2. rock_physics_open/equinor_utilities/gen_utilities/dim_check_vector.py +35 -5
  3. rock_physics_open/equinor_utilities/gen_utilities/filter_input.py +11 -6
  4. rock_physics_open/equinor_utilities/gen_utilities/filter_output.py +29 -19
  5. rock_physics_open/equinor_utilities/machine_learning_utilities/__init__.py +18 -5
  6. rock_physics_open/equinor_utilities/machine_learning_utilities/base_pressure_model.py +172 -0
  7. rock_physics_open/equinor_utilities/machine_learning_utilities/exponential_model.py +100 -86
  8. rock_physics_open/equinor_utilities/machine_learning_utilities/friable_pressure_models.py +230 -0
  9. rock_physics_open/equinor_utilities/machine_learning_utilities/import_ml_models.py +23 -4
  10. rock_physics_open/equinor_utilities/machine_learning_utilities/patchy_cement_pressure_models.py +280 -0
  11. rock_physics_open/equinor_utilities/machine_learning_utilities/polynomial_model.py +128 -0
  12. rock_physics_open/equinor_utilities/machine_learning_utilities/sigmoidal_model.py +204 -155
  13. rock_physics_open/equinor_utilities/optimisation_utilities/__init__.py +19 -0
  14. rock_physics_open/equinor_utilities/snapshot_test_utilities/compare_snapshots.py +16 -8
  15. rock_physics_open/equinor_utilities/snapshot_test_utilities/snapshots.py +33 -10
  16. rock_physics_open/fluid_models/brine_model/brine_properties.py +70 -35
  17. rock_physics_open/fluid_models/gas_model/gas_properties.py +79 -37
  18. rock_physics_open/fluid_models/oil_model/dead_oil_density.py +21 -16
  19. rock_physics_open/fluid_models/oil_model/dead_oil_velocity.py +9 -7
  20. rock_physics_open/fluid_models/oil_model/live_oil_density.py +16 -13
  21. rock_physics_open/fluid_models/oil_model/live_oil_velocity.py +3 -3
  22. rock_physics_open/fluid_models/oil_model/oil_properties.py +59 -29
  23. rock_physics_open/sandstone_models/__init__.py +2 -0
  24. rock_physics_open/sandstone_models/constant_cement_optimisation.py +4 -1
  25. rock_physics_open/sandstone_models/friable_optimisation.py +4 -1
  26. rock_physics_open/sandstone_models/patchy_cement_model.py +89 -6
  27. rock_physics_open/sandstone_models/patchy_cement_optimisation.py +4 -1
  28. rock_physics_open/t_matrix_models/__init__.py +0 -10
  29. rock_physics_open/t_matrix_models/carbonate_pressure_substitution.py +1 -1
  30. rock_physics_open/t_matrix_models/curvefit_t_matrix_exp.py +1 -2
  31. rock_physics_open/t_matrix_models/t_matrix_opt_fluid_sub_exp.py +3 -3
  32. rock_physics_open/t_matrix_models/t_matrix_opt_fluid_sub_petec.py +5 -1
  33. rock_physics_open/t_matrix_models/t_matrix_opt_forward_model_exp.py +5 -1
  34. rock_physics_open/t_matrix_models/t_matrix_opt_forward_model_min.py +4 -1
  35. rock_physics_open/t_matrix_models/t_matrix_parameter_optimisation_exp.py +5 -1
  36. rock_physics_open/t_matrix_models/t_matrix_parameter_optimisation_min.py +4 -1
  37. rock_physics_open/version.py +16 -3
  38. {rock_physics_open-0.2.1.dist-info → rock_physics_open-0.3.0.dist-info}/METADATA +4 -8
  39. {rock_physics_open-0.2.1.dist-info → rock_physics_open-0.3.0.dist-info}/RECORD +43 -38
  40. /rock_physics_open/{t_matrix_models → equinor_utilities/optimisation_utilities}/opt_subst_utilities.py +0 -0
  41. {rock_physics_open-0.2.1.dist-info → rock_physics_open-0.3.0.dist-info}/WHEEL +0 -0
  42. {rock_physics_open-0.2.1.dist-info → rock_physics_open-0.3.0.dist-info}/licenses/LICENSE +0 -0
  43. {rock_physics_open-0.2.1.dist-info → rock_physics_open-0.3.0.dist-info}/top_level.txt +0 -0
@@ -1,188 +1,237 @@
1
+ from __future__ import annotations
2
+
1
3
  import pickle
2
- from io import BufferedIOBase
3
- from typing import Union
4
+ from typing import Any
4
5
 
5
6
  import numpy as np
6
7
 
8
+ from .base_pressure_model import BasePressureModel
9
+
10
+
11
+ class SigmoidalPressureModel(BasePressureModel):
12
+ """
13
+ Sigmoidal pressure sensitivity model for velocity prediction.
14
+
15
+ Uses nested sigmoid functions: velocity amplitude varies with porosity,
16
+ and velocity varies sigmoidally with effective pressure using the amplitude.
17
+
18
+ Input format (n,3): [porosity, p_eff_in_situ, p_eff_depleted]
19
+
20
+ The model applies two sigmoid transformations:
21
+ 1. Porosity -> velocity amplitude using phi_model parameters
22
+ 2. Effective pressure -> velocity using p_eff_model parameters and amplitude
23
+ """
7
24
 
8
- class Sigmoid:
9
25
  def __init__(
10
26
  self,
11
- amplitude: float = None,
12
- median_point: float = None,
13
- x_scaling: float = None,
14
- bias: float = None,
15
- description="",
27
+ phi_amplitude: float,
28
+ phi_median_point: float,
29
+ phi_x_scaling: float,
30
+ phi_bias: float,
31
+ p_eff_median_point: float,
32
+ p_eff_x_scaling: float,
33
+ p_eff_bias: float,
34
+ model_max_pressure: float | None = None,
35
+ description: str = "",
16
36
  ):
17
- self._amplitude = amplitude
18
- self._median_point = median_point
19
- self._x_scaling = x_scaling
20
- self._bias = bias
21
- self._description = description
22
-
23
- def todict(self):
24
- return {
25
- "amplitude": self._amplitude,
26
- "median_point": self._median_point,
27
- "x_scaling": self._x_scaling,
28
- "bias": self._bias,
29
- "description": self._description,
30
- }
37
+ """
38
+ Initialize sigmoidal pressure model.
39
+
40
+ Parameters
41
+ ----------
42
+ phi_amplitude : float
43
+ Amplitude parameter for porosity sigmoid [m/s].
44
+ phi_median_point : float
45
+ Median point for porosity sigmoid [fraction].
46
+ phi_x_scaling : float
47
+ X-scaling parameter for porosity sigmoid [unitless].
48
+ phi_bias : float
49
+ Bias parameter for porosity sigmoid [m/s].
50
+ p_eff_median_point : float
51
+ Median point for pressure sigmoid [Pa].
52
+ p_eff_x_scaling : float
53
+ X-scaling parameter for pressure sigmoid [1/Pa].
54
+ p_eff_bias : float
55
+ Bias parameter for pressure sigmoid [m/s].
56
+ model_max_pressure : float | None
57
+ Maximum pressure for predict_max method [Pa].
58
+ description : str
59
+ Model description.
60
+ """
61
+ super().__init__(model_max_pressure, description)
62
+ # Porosity model parameters
63
+ self._phi_amplitude = phi_amplitude
64
+ self._phi_median_point = phi_median_point
65
+ self._phi_x_scaling = phi_x_scaling
66
+ self._phi_bias = phi_bias
67
+ # Pressure model parameters
68
+ self._p_eff_median_point = p_eff_median_point
69
+ self._p_eff_x_scaling = p_eff_x_scaling
70
+ self._p_eff_bias = p_eff_bias
31
71
 
32
72
  @property
33
- def amplitude(self):
34
- return self._amplitude
73
+ def phi_amplitude(self) -> float:
74
+ """Porosity sigmoid amplitude."""
75
+ return self._phi_amplitude
35
76
 
36
77
  @property
37
- def median_point(self):
38
- return self._median_point
78
+ def phi_median_point(self) -> float:
79
+ """Porosity sigmoid median point."""
80
+ return self._phi_median_point
39
81
 
40
82
  @property
41
- def x_scaling(self):
42
- return self._x_scaling
83
+ def phi_x_scaling(self) -> float:
84
+ """Porosity sigmoid x-scaling."""
85
+ return self._phi_x_scaling
43
86
 
44
87
  @property
45
- def bias(self):
46
- return self._bias
88
+ def phi_bias(self) -> float:
89
+ """Porosity sigmoid bias."""
90
+ return self._phi_bias
47
91
 
48
92
  @property
49
- def description(self):
50
- return self._description
51
-
52
- def predict(self, x):
53
- if isinstance(x, list):
54
- x = np.array(x)
55
- if not self._valid():
56
- return None
57
- return (
58
- self._amplitude / (1 + np.exp(-self._x_scaling * (x - self._median_point)))
59
- + self._bias
60
- )
61
-
62
- def predict_amp(self, x, amp):
63
- if isinstance(x, list):
64
- x = np.array(x)
65
- if isinstance(amp, list):
66
- amp = np.array(amp)
67
- if not self._valid(variant="amp"):
68
- return None
69
- return (
70
- amp / (1 + np.exp(-self._x_scaling * (x - self._median_point))) + self._bias
71
- )
72
-
73
- @classmethod
74
- def save(cls, file):
75
- with open(file, "wb") as f_out:
76
- pickle.dump(cls, f_out)
77
-
78
- @classmethod
79
- def load(cls, file):
80
- with open(file, "rb") as f_in:
81
- return pickle.load(f_in)
82
-
83
- def _valid(self, variant=None):
84
- if variant is None and self.amplitude is None:
85
- raise ValueError('object field "variant" is not set')
86
- if self.median_point is None:
87
- raise ValueError('object field "median_point" is not set')
88
- if self.x_scaling is None:
89
- raise ValueError('object field "x_scaling" is not set')
90
- if self.bias is None:
91
- raise ValueError('object field "bias" is not set')
92
- return True
93
-
94
-
95
- class CarbonateSigmoidalPressure:
96
- def __init__(
97
- self,
98
- phi_model: Union[dict, Sigmoid] = None,
99
- p_eff_model: Union[dict, Sigmoid] = None,
100
- ):
101
- if isinstance(phi_model, Sigmoid):
102
- self._phi_model = phi_model
103
- elif isinstance(phi_model, dict):
104
- self._phi_model = Sigmoid(**phi_model)
105
- else:
106
- self._phi_model = None
107
- if isinstance(p_eff_model, Sigmoid):
108
- self._p_eff_model = p_eff_model
109
- elif isinstance(p_eff_model, dict):
110
- self._p_eff_model = Sigmoid(**p_eff_model)
111
- else:
112
- self._p_eff_model = None
93
+ def p_eff_median_point(self) -> float:
94
+ """Pressure sigmoid median point."""
95
+ return self._p_eff_median_point
113
96
 
114
97
  @property
115
- def phi_model(self):
116
- return self._phi_model
117
-
118
- @phi_model.setter
119
- def phi_model(self, phi_mod):
120
- if isinstance(phi_mod, Sigmoid):
121
- self._phi_model = phi_mod
122
- else:
123
- raise ValueError(
124
- f"{type(self)}: expected input Sigmoid object, received {type(phi_mod)}"
125
- )
98
+ def p_eff_x_scaling(self) -> float:
99
+ """Pressure sigmoid x-scaling."""
100
+ return self._p_eff_x_scaling
126
101
 
127
102
  @property
128
- def p_eff_model(self):
129
- return self._p_eff_model
130
-
131
- @p_eff_model.setter
132
- def p_eff_model(self, p_eff_mod):
133
- if isinstance(p_eff_mod, Sigmoid):
134
- self._p_eff_model = p_eff_mod
135
- else:
103
+ def p_eff_bias(self) -> float:
104
+ """Pressure sigmoid bias."""
105
+ return self._p_eff_bias
106
+
107
+ def validate_input(self, inp_arr: np.ndarray) -> np.ndarray:
108
+ """
109
+ Validate input for sigmoidal model.
110
+
111
+ Parameters
112
+ ----------
113
+ inp_arr : np.ndarray
114
+ Input array to validate.
115
+
116
+ Returns
117
+ -------
118
+ np.ndarray
119
+ Validated input array.
120
+
121
+ Raises
122
+ ------
123
+ ValueError
124
+ If input format is invalid.
125
+ """
126
+ if not isinstance(inp_arr, np.ndarray):
127
+ raise ValueError("Input must be numpy ndarray.")
128
+ if inp_arr.ndim != 2 or inp_arr.shape[1] != 3:
136
129
  raise ValueError(
137
- f"{type(self)}: expected input Sigmoid object, received {type(p_eff_mod)}"
130
+ "Input must be (n,3): [porosity, p_eff_in_situ, p_eff_depleted]"
138
131
  )
139
-
140
- def predict(self, inp_arr: np.ndarray) -> np.ndarray:
141
- # Don't save any of the intermediate calculations, only return the difference between the effective pressure
142
- # cases. The method name is set to be the same as for other machine learning models
143
- self._validate_input(inp_arr)
144
- velocity_amp = self._phi_model.predict(inp_arr[:, 0].flatten())
145
- velocity_init = self._p_eff_model.predict_amp(
146
- inp_arr[:, 1].flatten(), velocity_amp
132
+ return inp_arr
133
+
134
+ def _sigmoid_phi(self, phi: np.ndarray) -> np.ndarray:
135
+ """
136
+ Calculate velocity amplitude from porosity using sigmoid function.
137
+
138
+ Parameters
139
+ ----------
140
+ phi : np.ndarray
141
+ Porosity values [fraction].
142
+
143
+ Returns
144
+ -------
145
+ np.ndarray
146
+ Velocity amplitude values [m/s].
147
+ """
148
+ return (
149
+ self._phi_amplitude
150
+ / (1 + np.exp(-self._phi_x_scaling * (phi - self._phi_median_point)))
151
+ + self._phi_bias
147
152
  )
148
- velocity_depl = self._p_eff_model.predict_amp(
149
- inp_arr[:, 2].flatten(), velocity_amp
153
+
154
+ def _sigmoid_p_eff(self, p_eff: np.ndarray, amplitude: np.ndarray) -> np.ndarray:
155
+ """
156
+ Calculate velocity from effective pressure using sigmoid function with amplitude.
157
+
158
+ Parameters
159
+ ----------
160
+ p_eff : np.ndarray
161
+ Effective pressure values [Pa].
162
+ amplitude : np.ndarray
163
+ Velocity amplitude values [m/s].
164
+
165
+ Returns
166
+ -------
167
+ np.ndarray
168
+ Velocity values [m/s].
169
+ """
170
+ return (
171
+ amplitude
172
+ / (1 + np.exp(-self._p_eff_x_scaling * (p_eff - self._p_eff_median_point)))
173
+ + self._p_eff_bias
150
174
  )
151
- return velocity_depl - velocity_init
152
175
 
153
176
  def predict_abs(self, inp_arr: np.ndarray, case: str = "in_situ") -> np.ndarray:
154
- # Method for access to absolute results, not just the difference
155
- self._validate_input(inp_arr)
156
- velocity_amp = self._phi_model.predict(inp_arr[:, 0].flatten())
157
- if case == "in_situ":
158
- return self._p_eff_model.predict_amp(inp_arr[:, 1].flatten(), velocity_amp)
159
- return self._p_eff_model.predict_amp(inp_arr[:, 2].flatten(), velocity_amp)
160
-
161
- def _validate_input(self, input_array):
162
- if not isinstance(input_array, np.ndarray):
163
- raise ValueError(
164
- f"{type(input_array)}: should be numpy array with shape n x 3"
165
- )
166
- if not ((input_array.ndim == 2) and (input_array.shape[1] == 3)):
167
- raise ValueError(
168
- f'{type(self)}: Input array should be of shape n x 3, with columns in sequence "PHIT", '
169
- f'"P_EFF_in_situ" and "P_EFF_depleted"'
170
- )
171
-
172
- def todict(self):
177
+ """
178
+ Calculate absolute velocity for specified pressure case.
179
+
180
+ Parameters
181
+ ----------
182
+ inp_arr : np.ndarray
183
+ Validated input array (n,3).
184
+ case : str
185
+ Pressure case: "in_situ" or "depleted".
186
+
187
+ Returns
188
+ -------
189
+ np.ndarray
190
+ Velocity values [m/s].
191
+ """
192
+ arr = self.validate_input(inp_arr)
193
+
194
+ phi = arr[:, 0]
195
+ p_in_situ = arr[:, 1]
196
+ p_depleted = arr[:, 2]
197
+
198
+ # Calculate velocity amplitude from porosity
199
+ velocity_amplitude = self._sigmoid_phi(phi)
200
+
201
+ # Select pressure based on case
202
+ p_eff = p_in_situ if case == "in_situ" else p_depleted
203
+
204
+ # Calculate velocity from effective pressure and amplitude
205
+ return self._sigmoid_p_eff(p_eff, velocity_amplitude)
206
+
207
+ def todict(self) -> dict[str, Any]:
208
+ """Convert model to dictionary."""
173
209
  return {
174
- "phi_model": self._phi_model.todict(),
175
- "p_eff_model": self._p_eff_model.todict(),
210
+ "phi_amplitude": self._phi_amplitude,
211
+ "phi_median_point": self._phi_median_point,
212
+ "phi_x_scaling": self._phi_x_scaling,
213
+ "phi_bias": self._phi_bias,
214
+ "p_eff_median_point": self._p_eff_median_point,
215
+ "p_eff_x_scaling": self._p_eff_x_scaling,
216
+ "p_eff_bias": self._p_eff_bias,
217
+ "model_max_pressure": self._model_max_pressure,
218
+ "description": self._description,
176
219
  }
177
220
 
178
- def save(self, file: Union[str, BufferedIOBase]):
179
- with open(file, "wb") as f_out:
180
- pickle.dump(self.todict(), f_out)
181
-
182
221
  @classmethod
183
- def load(cls, file: Union[str, BufferedIOBase]):
222
+ def load(cls, file: str | bytes) -> "SigmoidalPressureModel":
223
+ """Load sigmoidal model from pickle file."""
184
224
  with open(file, "rb") as f_in:
185
- load_dict = pickle.load(f_in)
186
- return cls(
187
- phi_model=load_dict["phi_model"], p_eff_model=load_dict["p_eff_model"]
188
- )
225
+ d = pickle.load(f_in)
226
+
227
+ return cls(
228
+ phi_amplitude=d["phi_amplitude"],
229
+ phi_median_point=d["phi_median_point"],
230
+ phi_x_scaling=d["phi_x_scaling"],
231
+ phi_bias=d["phi_bias"],
232
+ p_eff_median_point=d["p_eff_median_point"],
233
+ p_eff_x_scaling=d["p_eff_x_scaling"],
234
+ p_eff_bias=d["p_eff_bias"],
235
+ model_max_pressure=d["model_max_pressure"],
236
+ description=d["description"],
237
+ )
@@ -0,0 +1,19 @@
1
+ from .opt_subst_utilities import (
2
+ gen_mod_routine,
3
+ gen_opt_routine,
4
+ gen_sub_routine,
5
+ load_opt_params,
6
+ opt_param_info,
7
+ opt_param_to_ascii,
8
+ save_opt_params,
9
+ )
10
+
11
+ __all__ = [
12
+ "gen_mod_routine",
13
+ "gen_sub_routine",
14
+ "gen_opt_routine",
15
+ "opt_param_to_ascii",
16
+ "opt_param_info",
17
+ "save_opt_params",
18
+ "load_opt_params",
19
+ ]
@@ -1,7 +1,6 @@
1
1
  import inspect
2
2
  import math
3
3
  import re
4
- from typing import Union
5
4
  from warnings import warn
6
5
 
7
6
  import numpy as np
@@ -13,7 +12,7 @@ from .snapshots import get_snapshot_name
13
12
 
14
13
 
15
14
  def compare_snapshots(
16
- test_results: Union[np.ndarray, tuple, DataFrame],
15
+ test_results: np.ndarray | tuple | DataFrame,
17
16
  saved_results: tuple,
18
17
  name_arr=None,
19
18
  display_results: bool = False,
@@ -32,12 +31,16 @@ def compare_snapshots(
32
31
 
33
32
  for i, (test_item, saved_item) in enumerate(zip(test_results, saved_results)):
34
33
  try:
34
+ if name_arr:
35
+ err_msg = f"saved and generated result for {name_arr[i]} differ"
36
+ else:
37
+ err_msg = f"saved result for variable {i} differ"
35
38
  np.testing.assert_allclose(
36
39
  test_item,
37
40
  saved_item,
38
41
  rtol=r_tol,
39
42
  equal_nan=equal_nan,
40
- err_msg=f"saved and generated result for variable {i} differ",
43
+ err_msg=err_msg,
41
44
  )
42
45
  except AssertionError as error:
43
46
  open_mode = "w" if no_difference_found else "a"
@@ -46,9 +49,14 @@ def compare_snapshots(
46
49
  log_file = re.sub("npz", "log", get_snapshot_name(step=2))
47
50
 
48
51
  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")
52
+ file.write(
53
+ f"Test function: "
54
+ f"{get_snapshot_name(include_extension=False, include_snapshot_dir=False, include_filename=False)} \n"
55
+ )
56
+ if name_arr:
57
+ file.write(f"Test variable: {name_arr[i]} \n")
58
+ else:
59
+ file.write(f"Test variable number: {i} \n")
52
60
 
53
61
  for line in str(error).splitlines():
54
62
  mismatched_elements_index = (
@@ -72,7 +80,7 @@ def compare_snapshots(
72
80
  file.write(line + "\n")
73
81
  continue
74
82
 
75
- reg_index = re.search(r"\d+ differ", line)
83
+ reg_index = re.search(r"differ", line)
76
84
 
77
85
  if reg_index:
78
86
  if isinstance(test_item, np.ndarray):
@@ -91,7 +99,7 @@ def compare_snapshots(
91
99
  tab = "\t"
92
100
  for difference in differences:
93
101
  file.write(
94
- f"{tab}[{difference[0]:4}]=> {difference[1]:.4g} != {difference[2]:.4g}\n"
102
+ f"{tab}[{difference[0]:4}]=> {difference[1]:.8g} != {difference[2]:.8g}\n"
95
103
  )
96
104
  file.write(f"{'_' * 40}\n")
97
105
  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 ""