geolysis 0.5.0__py3-none-any.whl → 0.6.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.
- geolysis/__init__.py +1 -1
- geolysis/bearing_capacity/abc/cohl/__init__.py +13 -27
- geolysis/bearing_capacity/abc/cohl/_core.py +1 -1
- geolysis/bearing_capacity/abc/cohl/bowles_abc.py +2 -13
- geolysis/bearing_capacity/abc/cohl/meyerhof_abc.py +2 -13
- geolysis/bearing_capacity/abc/cohl/terzaghi_abc.py +2 -13
- geolysis/bearing_capacity/ubc/__init__.py +11 -22
- geolysis/bearing_capacity/ubc/_core.py +22 -5
- geolysis/bearing_capacity/ubc/hansen_ubc.py +12 -22
- geolysis/bearing_capacity/ubc/terzaghi_ubc.py +6 -19
- geolysis/bearing_capacity/ubc/vesic_ubc.py +12 -22
- geolysis/foundation.py +16 -48
- geolysis/soil_classifier.py +17 -57
- geolysis/spt.py +34 -102
- geolysis/utils/__init__.py +26 -14
- geolysis/utils/validators.py +19 -19
- {geolysis-0.5.0.dist-info → geolysis-0.6.0.dist-info}/METADATA +1 -1
- geolysis-0.6.0.dist-info/RECORD +23 -0
- {geolysis-0.5.0.dist-info → geolysis-0.6.0.dist-info}/WHEEL +1 -1
- geolysis-0.5.0.dist-info/RECORD +0 -23
- {geolysis-0.5.0.dist-info → geolysis-0.6.0.dist-info}/licenses/LICENSE.txt +0 -0
- {geolysis-0.5.0.dist-info → geolysis-0.6.0.dist-info}/top_level.txt +0 -0
geolysis/__init__.py
CHANGED
@@ -1,28 +1,12 @@
|
|
1
|
-
"""
|
2
|
-
|
3
|
-
|
4
|
-
=====
|
5
|
-
|
6
|
-
.. autosummary::
|
7
|
-
:toctree: _autosummary
|
8
|
-
:nosignatures:
|
9
|
-
|
10
|
-
ABCType
|
11
|
-
|
12
|
-
Functions
|
13
|
-
=========
|
14
|
-
|
15
|
-
.. autosummary::
|
16
|
-
:toctree: _autosummary
|
17
|
-
|
18
|
-
create_allowable_bearing_capacity
|
1
|
+
"""This package provides a factory function and utilities for creating
|
2
|
+
allowable bearing capacity calculations using methods like Bowles, Meyerhof,
|
3
|
+
and Terzaghi for various foundation types and shapes.
|
19
4
|
"""
|
20
|
-
|
21
5
|
import enum
|
22
6
|
from typing import Optional
|
23
7
|
|
24
8
|
from geolysis.foundation import FoundationType, Shape, create_foundation
|
25
|
-
from geolysis.utils import enum_repr, inf
|
9
|
+
from geolysis.utils import enum_repr, inf, ErrorMsg
|
26
10
|
|
27
11
|
from ._core import AllowableBearingCapacity
|
28
12
|
from .bowles_abc import BowlesABC4MatFoundation, BowlesABC4PadFoundation
|
@@ -79,14 +63,14 @@ def create_allowable_bearing_capacity(corrected_spt_n_value: float,
|
|
79
63
|
:type ground_water_level: float, optional
|
80
64
|
|
81
65
|
:param shape: Shape of foundation footing, defaults to
|
82
|
-
:
|
66
|
+
:py:enum:mem:`~geolysis.foundation.Shape.SQUARE`.
|
83
67
|
:type shape: str, optional
|
84
68
|
|
85
69
|
:param foundation_type: Type of foundation, defaults to "pad".
|
86
70
|
:type foundation_type: FoundationType | str, optional
|
87
71
|
|
88
72
|
:param abc_type: Type of allowable bearing capacity calculation to apply.
|
89
|
-
Available values can be found in :
|
73
|
+
Available values can be found in :py:enum:`ABCType`,
|
90
74
|
defaults to None.
|
91
75
|
:type abc_type: ABCType | str, optional
|
92
76
|
|
@@ -96,8 +80,10 @@ def create_allowable_bearing_capacity(corrected_spt_n_value: float,
|
|
96
80
|
footing.
|
97
81
|
:raises ValueError: Raised if an invalid footing ``shape`` is provided.
|
98
82
|
"""
|
99
|
-
|
100
|
-
|
83
|
+
|
84
|
+
msg = ErrorMsg(param_name="abc_type",
|
85
|
+
param_value=abc_type,
|
86
|
+
param_type=ABCType)
|
101
87
|
|
102
88
|
if abc_type is None:
|
103
89
|
raise ValueError(msg)
|
@@ -107,12 +93,12 @@ def create_allowable_bearing_capacity(corrected_spt_n_value: float,
|
|
107
93
|
except ValueError as e:
|
108
94
|
raise ValueError(msg) from e
|
109
95
|
|
110
|
-
msg = (f"{foundation_type=} is not supported, Supported "
|
111
|
-
f"types are: {list(FoundationType)}")
|
112
|
-
|
113
96
|
try:
|
114
97
|
foundation_type = FoundationType(str(foundation_type).casefold())
|
115
98
|
except ValueError as e:
|
99
|
+
msg = ErrorMsg(param_name="foundation_type",
|
100
|
+
param_value=foundation_type,
|
101
|
+
param_type=FoundationType)
|
116
102
|
raise ValueError(msg) from e
|
117
103
|
|
118
104
|
# exception from create_foundation will automaatically propagate
|
@@ -1,14 +1,3 @@
|
|
1
|
-
""" Bowles allowable bearing capacity.
|
2
|
-
|
3
|
-
Classes
|
4
|
-
=======
|
5
|
-
|
6
|
-
.. autosummary::
|
7
|
-
:toctree: _autosummary
|
8
|
-
|
9
|
-
BowlesABC4PadFoundation
|
10
|
-
BowlesABC4MatFoundation
|
11
|
-
"""
|
12
1
|
from geolysis.foundation import FoundationSize
|
13
2
|
from geolysis.utils import round_
|
14
3
|
|
@@ -63,7 +52,7 @@ class BowlesABC4PadFoundation(AllowableBearingCapacity):
|
|
63
52
|
tol_settlement=tol_settlement,
|
64
53
|
foundation_size=foundation_size)
|
65
54
|
|
66
|
-
@round_
|
55
|
+
@round_(ndigits=2)
|
67
56
|
def bearing_capacity(self) -> float:
|
68
57
|
"""Calculate the allowable bearing capacity of the pad foundation."""
|
69
58
|
n_corr = self.corrected_spt_n_value
|
@@ -100,7 +89,7 @@ class BowlesABC4MatFoundation(BowlesABC4PadFoundation):
|
|
100
89
|
=================== ====================================== ===========
|
101
90
|
"""
|
102
91
|
|
103
|
-
@round_
|
92
|
+
@round_(ndigits=2)
|
104
93
|
def bearing_capacity(self) -> float:
|
105
94
|
"""Calculate the allowable bearing capacity of the mat foundation."""
|
106
95
|
n_corr = self.corrected_spt_n_value
|
@@ -1,14 +1,3 @@
|
|
1
|
-
""" Meyerhof allowable bearing capacity.
|
2
|
-
|
3
|
-
Classes
|
4
|
-
=======
|
5
|
-
|
6
|
-
.. autosummary::
|
7
|
-
:toctree: _autosummary
|
8
|
-
|
9
|
-
MeyerhofABC4PadFoundation
|
10
|
-
MeyerhofABC4MatFoundation
|
11
|
-
"""
|
12
1
|
from geolysis.foundation import FoundationSize
|
13
2
|
from geolysis.utils import round_
|
14
3
|
|
@@ -63,7 +52,7 @@ class MeyerhofABC4PadFoundation(AllowableBearingCapacity):
|
|
63
52
|
tol_settlement=tol_settlement,
|
64
53
|
foundation_size=foundation_size)
|
65
54
|
|
66
|
-
@round_
|
55
|
+
@round_(ndigits=2)
|
67
56
|
def bearing_capacity(self):
|
68
57
|
"""Calculates the allowable bearing capacity of the pad foundation."""
|
69
58
|
n_corr = self.corrected_spt_n_value
|
@@ -100,7 +89,7 @@ class MeyerhofABC4MatFoundation(MeyerhofABC4PadFoundation):
|
|
100
89
|
=================== ====================================== ===========
|
101
90
|
"""
|
102
91
|
|
103
|
-
@round_
|
92
|
+
@round_(ndigits=2)
|
104
93
|
def bearing_capacity(self):
|
105
94
|
"""Calculate the allowable bearing capacity of the mat foundation."""
|
106
95
|
n_corr = self.corrected_spt_n_value
|
@@ -1,14 +1,3 @@
|
|
1
|
-
"""Terzaghi allowable bearing capacity.
|
2
|
-
|
3
|
-
Classes
|
4
|
-
=======
|
5
|
-
|
6
|
-
.. autosummary::
|
7
|
-
:toctree: _autosummary
|
8
|
-
|
9
|
-
TerzaghiABC4PadFoundation
|
10
|
-
TerzaghiABC4MatFoundation
|
11
|
-
"""
|
12
1
|
from geolysis.foundation import FoundationSize
|
13
2
|
from geolysis.utils import round_
|
14
3
|
|
@@ -92,7 +81,7 @@ class TerzaghiABC4PadFoundation(AllowableBearingCapacity):
|
|
92
81
|
|
93
82
|
return min(cw, 2.0)
|
94
83
|
|
95
|
-
@round_
|
84
|
+
@round_(ndigits=2)
|
96
85
|
def bearing_capacity(self):
|
97
86
|
"""Calculates the allowable bearing capacity of the pad foundation."""
|
98
87
|
n_corr = self.corrected_spt_n_value
|
@@ -135,7 +124,7 @@ class TerzaghiABC4MatFoundation(TerzaghiABC4PadFoundation):
|
|
135
124
|
=================== ====================================== ===========
|
136
125
|
"""
|
137
126
|
|
138
|
-
@round_
|
127
|
+
@round_(ndigits=2)
|
139
128
|
def bearing_capacity(self):
|
140
129
|
"""Calculates the allowable bearing capacity of the mat foundation."""
|
141
130
|
n_corr = self.corrected_spt_n_value
|
@@ -1,33 +1,20 @@
|
|
1
|
-
"""
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
.. autosummary::
|
7
|
-
:toctree: _autosummary
|
8
|
-
:nosignatures:
|
9
|
-
|
10
|
-
UBCType
|
11
|
-
|
12
|
-
Functions
|
13
|
-
=========
|
14
|
-
|
15
|
-
.. autosummary::
|
16
|
-
:toctree: _autosummary
|
17
|
-
|
18
|
-
create_ultimate_bearing_capacity
|
1
|
+
"""
|
2
|
+
This package provides a factory function and utilities for creating ultimate
|
3
|
+
bearing capacity calculations using methods like Hansen, Terzaghi, and Vesic
|
4
|
+
for various foundation shapes.
|
19
5
|
"""
|
20
6
|
import enum
|
21
7
|
from typing import Optional
|
22
8
|
|
23
9
|
from geolysis.foundation import Shape, create_foundation
|
24
|
-
from geolysis.utils import enum_repr
|
10
|
+
from geolysis.utils import enum_repr, ErrorMsg
|
25
11
|
|
26
12
|
from ._core import UltimateBearingCapacity
|
27
13
|
from .hansen_ubc import HansenUltimateBearingCapacity
|
28
14
|
from .terzaghi_ubc import (TerzaghiUBC4CircularFooting,
|
29
15
|
TerzaghiUBC4RectangularFooting,
|
30
|
-
TerzaghiUBC4SquareFooting,
|
16
|
+
TerzaghiUBC4SquareFooting,
|
17
|
+
TerzaghiUBC4StripFooting)
|
31
18
|
from .vesic_ubc import VesicUltimateBearingCapacity
|
32
19
|
|
33
20
|
__all__ = ["UBCType",
|
@@ -118,8 +105,10 @@ def create_ultimate_bearing_capacity(friction_angle: float,
|
|
118
105
|
footing.
|
119
106
|
:raises ValueError: Raised if an invalid footing shape is provided.
|
120
107
|
"""
|
121
|
-
|
122
|
-
|
108
|
+
|
109
|
+
msg = ErrorMsg(param_name="ubc_type",
|
110
|
+
param_value=ubc_type,
|
111
|
+
param_type=UBCType)
|
123
112
|
|
124
113
|
if ubc_type is None:
|
125
114
|
raise ValueError(msg)
|
@@ -43,11 +43,20 @@ class UltimateBearingCapacity(ABC):
|
|
43
43
|
|
44
44
|
@property
|
45
45
|
def friction_angle(self) -> float:
|
46
|
-
"""Return friction angle for local shear in the case of local shear
|
46
|
+
r"""Return friction angle for local shear in the case of local shear
|
47
47
|
failure or general shear in the case of general shear failure.
|
48
|
+
|
49
|
+
:Equation:
|
50
|
+
|
51
|
+
In the case of local shear failure:
|
52
|
+
|
53
|
+
.. math::
|
54
|
+
|
55
|
+
\phi' = \tan^{-1} \left(\frac{2}{3} \tan \phi\right)
|
56
|
+
|
48
57
|
"""
|
49
58
|
if self.apply_local_shear:
|
50
|
-
return arctan((2 / 3) * tan(self._friction_angle))
|
59
|
+
return arctan((2.0 / 3.0) * tan(self._friction_angle))
|
51
60
|
return self._friction_angle
|
52
61
|
|
53
62
|
@friction_angle.setter
|
@@ -57,8 +66,16 @@ class UltimateBearingCapacity(ABC):
|
|
57
66
|
|
58
67
|
@property
|
59
68
|
def cohesion(self) -> float:
|
60
|
-
"""Return cohesion for local shear in the case of local shear failure
|
69
|
+
r"""Return cohesion for local shear in the case of local shear failure
|
61
70
|
or general shear in the case of general shear failure.
|
71
|
+
|
72
|
+
:Equation:
|
73
|
+
|
74
|
+
In the case of local shear failure:
|
75
|
+
|
76
|
+
.. math::
|
77
|
+
|
78
|
+
C^{'} = \dfrac{2}{3} \cdot C
|
62
79
|
"""
|
63
80
|
if self.apply_local_shear:
|
64
81
|
return (2.0 / 3.0) * self._cohesion
|
@@ -169,8 +186,8 @@ class UltimateBearingCapacity(ABC):
|
|
169
186
|
return (coef * self.moist_unit_wgt * width * self.n_gamma
|
170
187
|
* self.s_gamma * self.d_gamma * self.i_gamma * water_corr)
|
171
188
|
|
172
|
-
@round_
|
173
|
-
def bearing_capacity(self):
|
189
|
+
@round_(ndigits=2)
|
190
|
+
def bearing_capacity(self) -> float:
|
174
191
|
"""Calculates the ultimate bearing capacity."""
|
175
192
|
return (self._cohesion_term(1.0)
|
176
193
|
+ self._surcharge_term()
|
@@ -1,13 +1,3 @@
|
|
1
|
-
""" Hansen ultimate bearing capacity module.
|
2
|
-
|
3
|
-
Classes
|
4
|
-
=======
|
5
|
-
|
6
|
-
.. autosummary::
|
7
|
-
:toctree: _autosummary
|
8
|
-
|
9
|
-
HansenUltimateBearingCapacity
|
10
|
-
"""
|
11
1
|
from geolysis.foundation import Shape
|
12
2
|
from geolysis.utils import cos, cot, exp, isclose, pi, round_, sin, tan
|
13
3
|
|
@@ -16,25 +6,25 @@ from ._core import UltimateBearingCapacity
|
|
16
6
|
__all__ = ["HansenUltimateBearingCapacity"]
|
17
7
|
|
18
8
|
|
19
|
-
@round_
|
9
|
+
@round_(ndigits=2)
|
20
10
|
def n_c(friction_angle: float) -> float:
|
21
11
|
if isclose(friction_angle, 0.0):
|
22
12
|
return 5.14
|
23
13
|
return cot(friction_angle) * (n_q(friction_angle) - 1.0)
|
24
14
|
|
25
15
|
|
26
|
-
@round_
|
16
|
+
@round_(ndigits=2)
|
27
17
|
def n_q(friction_angle: float) -> float:
|
28
18
|
return (tan(45.0 + friction_angle / 2.0) ** 2.0
|
29
19
|
* exp(pi * tan(friction_angle)))
|
30
20
|
|
31
21
|
|
32
|
-
@round_
|
22
|
+
@round_(ndigits=2)
|
33
23
|
def n_gamma(friction_angle: float) -> float:
|
34
24
|
return 1.8 * (n_q(friction_angle) - 1.0) * tan(friction_angle)
|
35
25
|
|
36
26
|
|
37
|
-
@round_
|
27
|
+
@round_(ndigits=2)
|
38
28
|
def s_c(f_width: float, f_length: float, f_shape: Shape) -> float:
|
39
29
|
if f_shape == Shape.STRIP:
|
40
30
|
return 1.0
|
@@ -44,7 +34,7 @@ def s_c(f_width: float, f_length: float, f_shape: Shape) -> float:
|
|
44
34
|
return 1.3
|
45
35
|
|
46
36
|
|
47
|
-
@round_
|
37
|
+
@round_(ndigits=2)
|
48
38
|
def s_q(f_width: float, f_length: float, f_shape: Shape) -> float:
|
49
39
|
if f_shape == Shape.STRIP:
|
50
40
|
return 1.0
|
@@ -54,7 +44,7 @@ def s_q(f_width: float, f_length: float, f_shape: Shape) -> float:
|
|
54
44
|
return 1.2
|
55
45
|
|
56
46
|
|
57
|
-
@round_
|
47
|
+
@round_(ndigits=2)
|
58
48
|
def s_gamma(f_width: float, f_length: float, f_shape: Shape) -> float:
|
59
49
|
if f_shape == Shape.STRIP:
|
60
50
|
return 1.0
|
@@ -66,22 +56,22 @@ def s_gamma(f_width: float, f_length: float, f_shape: Shape) -> float:
|
|
66
56
|
return 0.6
|
67
57
|
|
68
58
|
|
69
|
-
@round_
|
59
|
+
@round_(ndigits=2)
|
70
60
|
def d_c(f_depth: float, f_width: float) -> float:
|
71
61
|
return 1.0 + 0.35 * f_depth / f_width
|
72
62
|
|
73
63
|
|
74
|
-
@round_
|
64
|
+
@round_(ndigits=2)
|
75
65
|
def d_q(f_depth: float, f_width: float) -> float:
|
76
66
|
return d_c(f_depth, f_width)
|
77
67
|
|
78
68
|
|
79
|
-
@round_
|
69
|
+
@round_(ndigits=2)
|
80
70
|
def d_gamma() -> float:
|
81
71
|
return 1.0
|
82
72
|
|
83
73
|
|
84
|
-
@round_
|
74
|
+
@round_(ndigits=2)
|
85
75
|
def i_c(cohesion: float,
|
86
76
|
load_angle: float,
|
87
77
|
f_width: float,
|
@@ -89,12 +79,12 @@ def i_c(cohesion: float,
|
|
89
79
|
return 1.0 - sin(load_angle) / (2.0 * cohesion * f_width * f_length)
|
90
80
|
|
91
81
|
|
92
|
-
@round_
|
82
|
+
@round_(ndigits=2)
|
93
83
|
def i_q(load_angle: float) -> float:
|
94
84
|
return 1.0 - (1.5 * sin(load_angle)) / cos(load_angle)
|
95
85
|
|
96
86
|
|
97
|
-
@round_
|
87
|
+
@round_(ndigits=2)
|
98
88
|
def i_gamma(load_angle: float) -> float:
|
99
89
|
return i_q(load_angle) ** 2.0
|
100
90
|
|
@@ -1,16 +1,3 @@
|
|
1
|
-
""" Terzaghi ultimate bearing capacity module.
|
2
|
-
|
3
|
-
Classes
|
4
|
-
=======
|
5
|
-
|
6
|
-
.. autosummary::
|
7
|
-
:toctree: _autosummary
|
8
|
-
|
9
|
-
TerzaghiUBC4StripFooting
|
10
|
-
TerzaghiUBC4CircularFooting
|
11
|
-
TerzaghiUBC4SquareFooting
|
12
|
-
TerzaghiUBC4RectangularFooting
|
13
|
-
"""
|
14
1
|
from abc import ABC
|
15
2
|
|
16
3
|
from geolysis.utils import cos, cot, deg2rad, exp, isclose, pi, round_, tan
|
@@ -23,21 +10,21 @@ __all__ = ["TerzaghiUBC4StripFooting",
|
|
23
10
|
"TerzaghiUBC4RectangularFooting"]
|
24
11
|
|
25
12
|
|
26
|
-
@round_
|
13
|
+
@round_(ndigits=2)
|
27
14
|
def n_c(friction_angle: float) -> float:
|
28
15
|
if isclose(friction_angle, 0.0):
|
29
16
|
return 5.7
|
30
17
|
return cot(friction_angle) * (n_q(friction_angle) - 1.0)
|
31
18
|
|
32
19
|
|
33
|
-
@round_
|
20
|
+
@round_(ndigits=2)
|
34
21
|
def n_q(friction_angle: float) -> float:
|
35
22
|
return (exp((3.0 * pi / 2.0 - deg2rad(friction_angle))
|
36
23
|
* tan(friction_angle))
|
37
24
|
/ (2.0 * (cos(45.0 + friction_angle / 2.0)) ** 2.0))
|
38
25
|
|
39
26
|
|
40
|
-
@round_
|
27
|
+
@round_(ndigits=2)
|
41
28
|
def n_gamma(friction_angle: float) -> float:
|
42
29
|
return (n_q(friction_angle) - 1.0) * tan(1.4 * friction_angle)
|
43
30
|
|
@@ -113,7 +100,7 @@ class TerzaghiUBC4StripFooting(TerzaghiUltimateBearingCapacity):
|
|
113
100
|
- —
|
114
101
|
"""
|
115
102
|
|
116
|
-
@round_
|
103
|
+
@round_(ndigits=2)
|
117
104
|
def bearing_capacity(self) -> float:
|
118
105
|
"""Calculates ultimate bearing capacity for strip footing."""
|
119
106
|
return (self._cohesion_term(1.0)
|
@@ -156,7 +143,7 @@ class TerzaghiUBC4CircularFooting(TerzaghiUltimateBearingCapacity):
|
|
156
143
|
- —
|
157
144
|
"""
|
158
145
|
|
159
|
-
@round_
|
146
|
+
@round_(ndigits=2)
|
160
147
|
def bearing_capacity(self) -> float:
|
161
148
|
"""Calculates ultimate bearing capacity for circular footing."""
|
162
149
|
return (self._cohesion_term(1.3)
|
@@ -205,7 +192,7 @@ class TerzaghiUBC4RectangularFooting(TerzaghiUltimateBearingCapacity):
|
|
205
192
|
- —
|
206
193
|
"""
|
207
194
|
|
208
|
-
@round_
|
195
|
+
@round_(ndigits=2)
|
209
196
|
def bearing_capacity(self) -> float:
|
210
197
|
"""Calculates ultimate bearing capacity for rectangular footing."""
|
211
198
|
width = self.foundation_size.width
|
@@ -1,13 +1,3 @@
|
|
1
|
-
"""Vesic ultimate bearing capacity module.
|
2
|
-
|
3
|
-
Classes
|
4
|
-
=======
|
5
|
-
|
6
|
-
.. autosummary::
|
7
|
-
:toctree: _autosummary
|
8
|
-
|
9
|
-
VesicUltimateBearingCapacity
|
10
|
-
"""
|
11
1
|
from geolysis.foundation import Shape
|
12
2
|
from geolysis.utils import isclose, round_, sin, tan
|
13
3
|
|
@@ -17,22 +7,22 @@ from ._core import UltimateBearingCapacity
|
|
17
7
|
__all__ = ["VesicUltimateBearingCapacity"]
|
18
8
|
|
19
9
|
|
20
|
-
@round_
|
10
|
+
@round_(ndigits=2)
|
21
11
|
def n_c(friction_angle: float) -> float:
|
22
12
|
return hansen_ubc.n_c(friction_angle)
|
23
13
|
|
24
14
|
|
25
|
-
@round_
|
15
|
+
@round_(ndigits=2)
|
26
16
|
def n_q(friction_angle: float) -> float:
|
27
17
|
return hansen_ubc.n_q(friction_angle)
|
28
18
|
|
29
19
|
|
30
|
-
@round_
|
20
|
+
@round_(ndigits=2)
|
31
21
|
def n_gamma(friction_angle: float) -> float:
|
32
22
|
return 2.0 * (n_q(friction_angle) + 1.0) * tan(friction_angle)
|
33
23
|
|
34
24
|
|
35
|
-
@round_
|
25
|
+
@round_(ndigits=2)
|
36
26
|
def s_c(friction_angle: float,
|
37
27
|
f_width: float,
|
38
28
|
f_length: float,
|
@@ -48,7 +38,7 @@ def s_c(friction_angle: float,
|
|
48
38
|
return 1.0 + (_n_q / _n_c)
|
49
39
|
|
50
40
|
|
51
|
-
@round_
|
41
|
+
@round_(ndigits=2)
|
52
42
|
def s_q(friction_angle: float,
|
53
43
|
f_width: float,
|
54
44
|
f_length: float,
|
@@ -61,7 +51,7 @@ def s_q(friction_angle: float,
|
|
61
51
|
return 1.0 + tan(friction_angle)
|
62
52
|
|
63
53
|
|
64
|
-
@round_
|
54
|
+
@round_(ndigits=2)
|
65
55
|
def s_gamma(f_width: float, f_length: float, f_shape: Shape) -> float:
|
66
56
|
if f_shape == Shape.STRIP:
|
67
57
|
return 1.0
|
@@ -71,34 +61,34 @@ def s_gamma(f_width: float, f_length: float, f_shape: Shape) -> float:
|
|
71
61
|
return 0.6
|
72
62
|
|
73
63
|
|
74
|
-
@round_
|
64
|
+
@round_(ndigits=2)
|
75
65
|
def d_c(f_depth: float, f_width: float) -> float:
|
76
66
|
return 1.0 + 0.4 * f_depth / f_width
|
77
67
|
|
78
68
|
|
79
|
-
@round_
|
69
|
+
@round_(ndigits=2)
|
80
70
|
def d_q(friction_angle: float, f_depth: float, f_width: float) -> float:
|
81
71
|
return (1.0 + 2.0 * tan(friction_angle)
|
82
72
|
* (1.0 - sin(friction_angle)) ** 2.0
|
83
73
|
* (f_depth / f_width))
|
84
74
|
|
85
75
|
|
86
|
-
@round_
|
76
|
+
@round_(ndigits=2)
|
87
77
|
def d_gamma() -> float:
|
88
78
|
return 1.0
|
89
79
|
|
90
80
|
|
91
|
-
@round_
|
81
|
+
@round_(ndigits=2)
|
92
82
|
def i_c(load_angle: float) -> float:
|
93
83
|
return (1.0 - load_angle / 90.0) ** 2.0
|
94
84
|
|
95
85
|
|
96
|
-
@round_
|
86
|
+
@round_(ndigits=2)
|
97
87
|
def i_q(load_angle: float) -> float:
|
98
88
|
return i_c(load_angle)
|
99
89
|
|
100
90
|
|
101
|
-
@round_
|
91
|
+
@round_(ndigits=2)
|
102
92
|
def i_gamma(friction_angle: float, load_angle: float) -> float:
|
103
93
|
if isclose(friction_angle, 0.0):
|
104
94
|
return 1.0
|
geolysis/foundation.py
CHANGED
@@ -1,41 +1,10 @@
|
|
1
|
-
"""
|
2
|
-
|
3
|
-
Enums
|
4
|
-
=====
|
5
|
-
|
6
|
-
.. autosummary::
|
7
|
-
:toctree: _autosummary
|
8
|
-
:nosignatures:
|
9
|
-
|
10
|
-
Shape
|
11
|
-
FoundationType
|
12
|
-
|
13
|
-
Classes
|
14
|
-
=======
|
15
|
-
|
16
|
-
.. autosummary::
|
17
|
-
:toctree: _autosummary
|
18
|
-
|
19
|
-
StripFooting
|
20
|
-
CircularFooting
|
21
|
-
SquareFooting
|
22
|
-
RectangularFooting
|
23
|
-
FoundationSize
|
24
|
-
|
25
|
-
Functions
|
26
|
-
=========
|
27
|
-
|
28
|
-
.. autosummary::
|
29
|
-
:toctree: _autosummary
|
30
|
-
|
31
|
-
create_foundation
|
32
|
-
"""
|
33
|
-
|
1
|
+
"""This module provides classes and utilities for modeling various foundation
|
2
|
+
footing types, their dimensions, and properties."""
|
34
3
|
import enum
|
35
4
|
from abc import ABC, abstractmethod
|
36
5
|
from typing import Optional, TypeVar
|
37
6
|
|
38
|
-
from .utils import enum_repr, inf, isclose, validators
|
7
|
+
from .utils import enum_repr, inf, isclose, validators, ErrorMsg
|
39
8
|
|
40
9
|
__all__ = ["create_foundation",
|
41
10
|
"FoundationSize",
|
@@ -260,18 +229,18 @@ class FoundationSize:
|
|
260
229
|
:type footing_size: FootingSize
|
261
230
|
|
262
231
|
:param eccentricity: The deviation of the foundation load from the
|
263
|
-
center of gravity of the foundation footing,
|
232
|
+
center of gravity of the foundation footing (m),
|
264
233
|
defaults to 0.0. This means that the foundation
|
265
234
|
load aligns with the center of gravity of the
|
266
|
-
foundation footing
|
235
|
+
foundation footing.
|
267
236
|
:type eccentricity: float, optional
|
268
237
|
|
269
238
|
:param ground_water_level: Depth of the water below ground level (m),
|
270
|
-
defaults to
|
239
|
+
defaults to None.
|
271
240
|
:type ground_water_level: float, optional
|
272
241
|
|
273
242
|
:param foundation_type: Type of foundation, defaults to
|
274
|
-
:
|
243
|
+
:py:enum:mem:`~FoundationType.PAD`
|
275
244
|
:type foundation_type: FoundationType, optional
|
276
245
|
"""
|
277
246
|
self.depth = depth
|
@@ -317,7 +286,7 @@ class FoundationSize:
|
|
317
286
|
@property
|
318
287
|
def eccentricity(self) -> float:
|
319
288
|
"""The deviation of the foundation load from the center of gravity of
|
320
|
-
the foundation footing.
|
289
|
+
the foundation footing (m).
|
321
290
|
"""
|
322
291
|
return self._eccentricity
|
323
292
|
|
@@ -343,7 +312,7 @@ class FoundationSize:
|
|
343
312
|
|
344
313
|
@property
|
345
314
|
def effective_width(self) -> float:
|
346
|
-
"""Returns the effective width of the foundation footing."""
|
315
|
+
"""Returns the effective width of the foundation footing (m)."""
|
347
316
|
return self.width - 2.0 * self.eccentricity
|
348
317
|
|
349
318
|
def footing_params(self) -> tuple[float, float, Shape]:
|
@@ -389,24 +358,22 @@ def create_foundation(depth: float,
|
|
389
358
|
:type ground_water_level: float, optional
|
390
359
|
|
391
360
|
:param foundation_type: Type of foundation footing, defaults to
|
392
|
-
FoundationType.PAD
|
361
|
+
:py:enum:mem:`~FoundationType.PAD`.
|
393
362
|
:type foundation_type: FoundationType, optional
|
394
363
|
|
395
|
-
:param shape: Shape of foundation footing, defaults to
|
364
|
+
:param shape: Shape of foundation footing, defaults to
|
365
|
+
:py:enum:mem:`~Shape.SQUARE`
|
396
366
|
:type shape: Shape | str, optional
|
397
367
|
|
398
368
|
:raises ValueError: Raised when length is not provided for a rectangular
|
399
369
|
footing.
|
400
370
|
:raises ValueError: Raised if an invalid footing shape is provided.
|
401
371
|
"""
|
402
|
-
shape = str(shape).casefold()
|
403
372
|
|
404
373
|
try:
|
405
|
-
shape = Shape(shape)
|
374
|
+
shape = Shape(str(shape).casefold())
|
406
375
|
except ValueError as e:
|
407
|
-
msg = (
|
408
|
-
f"types are: {list(Shape)}")
|
409
|
-
|
376
|
+
msg = ErrorMsg(param_name="shape", param_value=shape, param_type=Shape)
|
410
377
|
raise ValueError(msg) from e
|
411
378
|
|
412
379
|
if shape is Shape.STRIP:
|
@@ -417,7 +384,8 @@ def create_foundation(depth: float,
|
|
417
384
|
footing_size = CircularFooting(diameter=width)
|
418
385
|
else: # RECTANGLE
|
419
386
|
if not length:
|
420
|
-
|
387
|
+
msg = ErrorMsg(msg="Length of footing must be provided.")
|
388
|
+
raise ValueError(msg)
|
421
389
|
footing_size = RectangularFooting(width=width, length=length)
|
422
390
|
|
423
391
|
return FoundationSize(depth=depth,
|
geolysis/soil_classifier.py
CHANGED
@@ -1,48 +1,10 @@
|
|
1
|
-
"""
|
2
|
-
|
3
|
-
Exceptions
|
4
|
-
==========
|
5
|
-
|
6
|
-
.. autosummary::
|
7
|
-
:toctree: _autosummary
|
8
|
-
|
9
|
-
SizeDistError
|
10
|
-
|
11
|
-
Enums
|
12
|
-
=====
|
13
|
-
|
14
|
-
.. autosummary::
|
15
|
-
:toctree: _autosummary
|
16
|
-
:nosignatures:
|
17
|
-
|
18
|
-
ClfType
|
19
|
-
USCSSymbol
|
20
|
-
AASHTOSymbol
|
21
|
-
|
22
|
-
Classes
|
23
|
-
=======
|
24
|
-
|
25
|
-
.. autosummary::
|
26
|
-
:toctree: _autosummary
|
27
|
-
|
28
|
-
AtterbergLimits
|
29
|
-
PSD
|
30
|
-
AASHTO
|
31
|
-
USCS
|
32
|
-
|
33
|
-
Functions
|
34
|
-
=========
|
35
|
-
|
36
|
-
.. autosummary::
|
37
|
-
:toctree: _autosummary
|
38
|
-
|
39
|
-
create_soil_classifier
|
1
|
+
"""This module provides classes for soil classification using systems like
|
2
|
+
USCS and AASHTO, based on particle size distribution and Atterberg limits.
|
40
3
|
"""
|
41
4
|
import enum
|
42
|
-
from
|
43
|
-
from typing import NamedTuple, Optional, Protocol, Sequence
|
5
|
+
from typing import NamedTuple, Optional, Sequence
|
44
6
|
|
45
|
-
from .utils import enum_repr, isclose, round_, validators
|
7
|
+
from .utils import enum_repr, isclose, round_, validators, ErrorMsg
|
46
8
|
|
47
9
|
__all__ = ["ClfType",
|
48
10
|
"AtterbergLimits",
|
@@ -181,7 +143,7 @@ class AtterbergLimits:
|
|
181
143
|
self._plastic_limit = val
|
182
144
|
|
183
145
|
@property
|
184
|
-
@round_
|
146
|
+
@round_(2)
|
185
147
|
def plasticity_index(self) -> float:
|
186
148
|
"""Plasticity index (PI) is the range of water content over which the
|
187
149
|
soil remains in the plastic state.
|
@@ -210,7 +172,7 @@ class AtterbergLimits:
|
|
210
172
|
"""
|
211
173
|
return 4 <= self.plasticity_index <= 7 and 10 < self.liquid_limit < 30
|
212
174
|
|
213
|
-
@round_
|
175
|
+
@round_(ndigits=2)
|
214
176
|
def liquidity_index(self, nmc: float) -> float:
|
215
177
|
r"""Return the liquidity index of the soil.
|
216
178
|
|
@@ -228,7 +190,7 @@ class AtterbergLimits:
|
|
228
190
|
"""
|
229
191
|
return ((nmc - self.plastic_limit) / self.plasticity_index) * 100.0
|
230
192
|
|
231
|
-
@round_
|
193
|
+
@round_(2)
|
232
194
|
def consistency_index(self, nmc: float) -> float:
|
233
195
|
r"""Return the consistency index of the soil.
|
234
196
|
|
@@ -279,7 +241,8 @@ class _SizeDistribution:
|
|
279
241
|
graded.
|
280
242
|
|
281
243
|
:param coarse_soil: Coarse fraction of the soil sample. Valid arguments
|
282
|
-
are
|
244
|
+
are :py:enum:mem:`~USCSSymbol.GRAVEL` and
|
245
|
+
:py:enum:mem:`~USCSSymbol.SAND`.
|
283
246
|
"""
|
284
247
|
if coarse_soil is USCSSymbol.GRAVEL:
|
285
248
|
if 1 < self.coeff_of_curvature < 3 and self.coeff_of_uniformity >= 4:
|
@@ -336,7 +299,7 @@ class PSD:
|
|
336
299
|
return USCSSymbol.SAND
|
337
300
|
|
338
301
|
@property
|
339
|
-
@round_
|
302
|
+
@round_(ndigits=2)
|
340
303
|
def coeff_of_curvature(self) -> float:
|
341
304
|
r"""Coefficient of curvature of soil sample.
|
342
305
|
|
@@ -350,7 +313,7 @@ class PSD:
|
|
350
313
|
return self.size_dist.coeff_of_curvature
|
351
314
|
|
352
315
|
@property
|
353
|
-
@round_
|
316
|
+
@round_(ndigits=2)
|
354
317
|
def coeff_of_uniformity(self) -> float:
|
355
318
|
r"""Coefficient of uniformity of soil sample.
|
356
319
|
|
@@ -683,11 +646,6 @@ class USCS:
|
|
683
646
|
f"{coarse_material_type}{fine_material_type}")
|
684
647
|
|
685
648
|
|
686
|
-
class SoilClassifier(Protocol):
|
687
|
-
@abstractmethod
|
688
|
-
def classify(self) -> SoilClf: ...
|
689
|
-
|
690
|
-
|
691
649
|
@enum_repr
|
692
650
|
class ClfType(enum.StrEnum):
|
693
651
|
"""Enumeration of soil classification types."""
|
@@ -703,7 +661,7 @@ def create_soil_classifier(liquid_limit: float,
|
|
703
661
|
add_group_idx: bool = True,
|
704
662
|
organic: bool = False,
|
705
663
|
clf_type: Optional[ClfType | str] = None
|
706
|
-
) ->
|
664
|
+
) -> AASHTO | USCS:
|
707
665
|
""" A factory function that encapsulates the creation of a soil classifier.
|
708
666
|
|
709
667
|
:param liquid_limit: Water content beyond which soils flows under their own
|
@@ -752,8 +710,9 @@ def create_soil_classifier(liquid_limit: float,
|
|
752
710
|
:raises ValueError: Raises ValueError if ``sand`` is not provided for
|
753
711
|
:class:`USCS` classification.
|
754
712
|
"""
|
755
|
-
msg = (
|
756
|
-
|
713
|
+
msg = ErrorMsg(param_name="clf_type",
|
714
|
+
param_value=clf_type,
|
715
|
+
param_type=ClfType)
|
757
716
|
|
758
717
|
if clf_type is None:
|
759
718
|
raise ValueError(msg)
|
@@ -774,7 +733,8 @@ def create_soil_classifier(liquid_limit: float,
|
|
774
733
|
|
775
734
|
# USCS classification
|
776
735
|
if sand is None:
|
777
|
-
|
736
|
+
msg = ErrorMsg(msg=f"sand must be specified for USCS classification")
|
737
|
+
raise ValueError(msg)
|
778
738
|
|
779
739
|
psd = PSD(fines=fines, sand=sand, d_10=d_10, d_30=d_30, d_60=d_60)
|
780
740
|
clf = USCS(atterberg_limits=atterberg_lmts, psd=psd, organic=organic)
|
geolysis/spt.py
CHANGED
@@ -1,44 +1,13 @@
|
|
1
|
-
""" Standard
|
2
|
-
|
3
|
-
|
4
|
-
=====
|
5
|
-
|
6
|
-
.. autosummary::
|
7
|
-
:toctree: _autosummary
|
8
|
-
:nosignatures:
|
9
|
-
|
10
|
-
HammerType
|
11
|
-
SamplerType
|
12
|
-
OPCType
|
13
|
-
|
14
|
-
Classes
|
15
|
-
=======
|
16
|
-
|
17
|
-
.. autosummary::
|
18
|
-
:toctree: _autosummary
|
19
|
-
|
20
|
-
SPTNDesign
|
21
|
-
EnergyCorrection
|
22
|
-
GibbsHoltzOPC
|
23
|
-
BazaraaPeckOPC
|
24
|
-
PeckOPC
|
25
|
-
LiaoWhitmanOPC
|
26
|
-
SkemptonOPC
|
27
|
-
DilatancyCorrection
|
28
|
-
|
29
|
-
Functions
|
30
|
-
=========
|
31
|
-
|
32
|
-
.. autosummary::
|
33
|
-
:toctree: _autosummary
|
34
|
-
|
35
|
-
create_spt_correction
|
1
|
+
"""This module provides classes for performing Standard Penetration Test (SPT)
|
2
|
+
corrections, including energy, overburden pressure, and dilatancy corrections,
|
3
|
+
as well as calculating design N-values.
|
36
4
|
"""
|
37
5
|
import enum
|
38
6
|
from abc import abstractmethod
|
39
7
|
from typing import Final, Sequence
|
40
8
|
|
41
|
-
from .utils import enum_repr, isclose, log10, mean, round_, sqrt, validators
|
9
|
+
from .utils import enum_repr, isclose, log10, mean, round_, sqrt, validators, \
|
10
|
+
ErrorMsg
|
42
11
|
|
43
12
|
__all__ = ["SPTNDesign",
|
44
13
|
"HammerType",
|
@@ -49,11 +18,13 @@ __all__ = ["SPTNDesign",
|
|
49
18
|
"PeckOPC",
|
50
19
|
"LiaoWhitmanOPC",
|
51
20
|
"SkemptonOPC",
|
52
|
-
"DilatancyCorrection"
|
21
|
+
"DilatancyCorrection",
|
22
|
+
"OPCType",
|
23
|
+
"create_overburden_pressure_correction"]
|
53
24
|
|
54
25
|
|
55
26
|
class SPTNDesign:
|
56
|
-
"""
|
27
|
+
"""SPT Design Calculations.
|
57
28
|
|
58
29
|
Due to uncertainty in field procedure in standard penetration test and also
|
59
30
|
to consider all the N-value in the influence zone of a foundation, a method
|
@@ -147,14 +118,6 @@ class EnergyCorrection:
|
|
147
118
|
in testing procedures may be at least partially compensated by converting
|
148
119
|
the measured N-value to :math:`N_{60}` assuming 60% hammer energy being
|
149
120
|
transferred to the tip of the standard split spoon.
|
150
|
-
|
151
|
-
:Equation:
|
152
|
-
|
153
|
-
.. math::
|
154
|
-
|
155
|
-
N_{ENERGY} = \dfrac{E_H \cdot C_B \cdot C_S \cdot C_R \cdot N}{ENERGY}
|
156
|
-
|
157
|
-
``ENERGY``: 0.6, 0.55, etc
|
158
121
|
"""
|
159
122
|
|
160
123
|
_HAMMER_EFFICIENCY_FACTORS = {HammerType.AUTOMATIC: 0.70,
|
@@ -187,13 +150,13 @@ class EnergyCorrection:
|
|
187
150
|
:param rod_length: Length of SPT rod, defaults to 3.0. (m)
|
188
151
|
:type rod_length: float, optional
|
189
152
|
|
190
|
-
:param hammer_type: Hammer type, defaults to :
|
153
|
+
:param hammer_type: Hammer type, defaults to :py:enum:mem:`~HammerType.DONUT_1`
|
191
154
|
:type hammer_type: HammerType, optional
|
192
155
|
|
193
|
-
:param sampler_type: Sampler type, defaults to :
|
156
|
+
:param sampler_type: Sampler type, defaults to :py:enum:mem:`~SamplerType.STANDARD`
|
194
157
|
:type sampler_type: SamplerType, optional
|
195
158
|
"""
|
196
|
-
self.recorded_spt_n_value = recorded_spt_n_value
|
159
|
+
self.recorded_spt_n_value = int(recorded_spt_n_value)
|
197
160
|
self.energy_percentage = energy_percentage
|
198
161
|
self.borehole_diameter = borehole_diameter
|
199
162
|
self.rod_length = rod_length
|
@@ -278,7 +241,16 @@ class EnergyCorrection:
|
|
278
241
|
return corr
|
279
242
|
|
280
243
|
def correction(self) -> float:
|
281
|
-
"""Energy correction factor.
|
244
|
+
r"""Energy correction factor.
|
245
|
+
|
246
|
+
:Equation:
|
247
|
+
|
248
|
+
.. math::
|
249
|
+
|
250
|
+
N_{ENERGY} = \dfrac{E_H \cdot C_B \cdot C_S \cdot C_R \cdot N}{ENERGY}
|
251
|
+
|
252
|
+
``ENERGY``: 0.6, 0.55, etc
|
253
|
+
"""
|
282
254
|
numerator = (self.hammer_efficiency
|
283
255
|
* self.borehole_diameter_correction
|
284
256
|
* self.sampler_correction
|
@@ -502,12 +474,12 @@ class DilatancyCorrection:
|
|
502
474
|
"""SPT N-value standardized for field procedures and/or corrected for
|
503
475
|
overburden pressure.
|
504
476
|
"""
|
505
|
-
return self.
|
477
|
+
return self._corr_spt_n_value
|
506
478
|
|
507
479
|
@corr_spt_n_value.setter
|
508
480
|
@validators.gt(0.0)
|
509
481
|
def corr_spt_n_value(self, val: float) -> None:
|
510
|
-
self.
|
482
|
+
self._corr_spt_n_value = val
|
511
483
|
|
512
484
|
@round_(ndigits=1)
|
513
485
|
def corrected_spt_n_value(self) -> float:
|
@@ -537,66 +509,30 @@ class OPCType(enum.StrEnum):
|
|
537
509
|
SKEMPTON = enum.auto()
|
538
510
|
|
539
511
|
|
540
|
-
def
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
rod_length=3.0,
|
545
|
-
hammer_type=HammerType.DONUT_1,
|
546
|
-
sampler_type=SamplerType.STANDARD,
|
547
|
-
opc_type: OPCType | str = OPCType.GIBBS,
|
548
|
-
apply_dilatancy_correction: bool = False
|
549
|
-
) -> OPC | DilatancyCorrection:
|
550
|
-
"""A factory function that encapsulates the creation of spt correction.
|
512
|
+
def create_overburden_pressure_correction(std_spt_n_value: float, eop,
|
513
|
+
opc_type: OPCType | str = OPCType.GIBBS) -> OPC:
|
514
|
+
"""A factory function that encapsulates the creation of overburden
|
515
|
+
pressure correction.
|
551
516
|
|
552
|
-
:param
|
553
|
-
:type
|
517
|
+
:param std_spt_n_value: SPT N-value standardized for field procedures.
|
518
|
+
:type std_spt_n_value: float
|
554
519
|
|
555
520
|
:param eop: Effective overburden pressure (:math:`kPa`).
|
556
521
|
:type eop: float
|
557
522
|
|
558
|
-
:param energy_percentage: Energy percentage reaching the tip of the
|
559
|
-
sampler, defaults to 0.6
|
560
|
-
:type energy_percentage: float, optional
|
561
|
-
|
562
|
-
:param borehole_diameter: Borehole diameter, defaults to 65.0 (mm).
|
563
|
-
:type borehole_diameter: float, optional
|
564
|
-
|
565
|
-
:param rod_length: Rod length, defaults to 3.0 (m).
|
566
|
-
:type rod_length: float, optional
|
567
|
-
|
568
|
-
:param hammer_type: Hammer type, defaults to :attr:`HammerType.DONUT_1`
|
569
|
-
:type hammer_type: HammerType, optional
|
570
|
-
|
571
|
-
:param sampler_type: Sampler type, defaults to :attr:`SamplerType.STANDARD`
|
572
|
-
:type sampler_type: SamplerType, optional
|
573
|
-
|
574
523
|
:param opc_type: Overburden Pressure Correction type to apply,
|
575
|
-
defaults to :
|
524
|
+
defaults to :py:enum:mem:`~OPCType.GIBBS`
|
576
525
|
:type opc_type: OPCType, optional
|
577
|
-
|
578
|
-
:param apply_dilatancy_correction: Indicates whether to apply dilatancy
|
579
|
-
correction, defaults to False.
|
580
|
-
:type apply_dilatancy_correction: bool, optional
|
581
526
|
"""
|
582
527
|
|
583
528
|
try:
|
584
529
|
opc_type = OPCType(str(opc_type).casefold())
|
585
530
|
except ValueError as e:
|
586
|
-
msg = (
|
587
|
-
|
531
|
+
msg = ErrorMsg(param_name="opc_type",
|
532
|
+
param_value=opc_type,
|
533
|
+
param_type=OPCType)
|
588
534
|
raise ValueError(msg) from e
|
589
535
|
|
590
|
-
energy_correction = EnergyCorrection(
|
591
|
-
recorded_spt_n_value=recorded_spt_n_value,
|
592
|
-
energy_percentage=energy_percentage,
|
593
|
-
borehole_diameter=borehole_diameter,
|
594
|
-
rod_length=rod_length,
|
595
|
-
hammer_type=hammer_type,
|
596
|
-
sampler_type=sampler_type)
|
597
|
-
|
598
|
-
std_spt_n_value = energy_correction.standardized_spt_n_value()
|
599
|
-
|
600
536
|
opc_types = {OPCType.GIBBS: GibbsHoltzOPC,
|
601
537
|
OPCType.BAZARAA: BazaraaPeckOPC,
|
602
538
|
OPCType.PECK: PeckOPC,
|
@@ -606,8 +542,4 @@ def create_spt_correction(recorded_spt_n_value: int,
|
|
606
542
|
opc_class = opc_types[opc_type]
|
607
543
|
opc_corr = opc_class(std_spt_n_value=std_spt_n_value, eop=eop)
|
608
544
|
|
609
|
-
if apply_dilatancy_correction:
|
610
|
-
corr_spt_n_value = opc_corr.corrected_spt_n_value()
|
611
|
-
return DilatancyCorrection(corr_spt_n_value=corr_spt_n_value)
|
612
|
-
|
613
545
|
return opc_corr
|
geolysis/utils/__init__.py
CHANGED
@@ -2,11 +2,13 @@ import functools
|
|
2
2
|
import math
|
3
3
|
from math import exp, inf, isclose, log10, pi, sqrt
|
4
4
|
from statistics import fmean as mean
|
5
|
-
from typing import Callable, SupportsRound
|
5
|
+
from typing import Callable, SupportsRound, Iterable, Any, Optional, \
|
6
|
+
NotRequired, TypedDict, Unpack
|
6
7
|
|
7
8
|
from . import validators
|
8
9
|
|
9
|
-
__all__ = ["
|
10
|
+
__all__ = ["ErrorMsg",
|
11
|
+
"enum_repr",
|
10
12
|
"inf",
|
11
13
|
"pi",
|
12
14
|
"deg2rad",
|
@@ -77,24 +79,34 @@ def round_(ndigits: int | Callable[..., SupportsRound]) -> Callable:
|
|
77
79
|
TypeError is raised when ``ndigits`` is neither an int nor a callable.
|
78
80
|
"""
|
79
81
|
|
80
|
-
default_dp = 2
|
81
|
-
|
82
82
|
def dec(fn) -> Callable[..., float]:
|
83
83
|
@functools.wraps(fn)
|
84
84
|
def wrapper(*args, **kwargs) -> float:
|
85
|
-
dp = ndigits if not callable(ndigits) else default_dp
|
86
85
|
res = fn(*args, **kwargs)
|
87
|
-
return round(res, ndigits=
|
86
|
+
return round(res, ndigits=ndigits)
|
88
87
|
|
89
88
|
return wrapper
|
90
89
|
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
90
|
+
return dec
|
91
|
+
|
92
|
+
|
93
|
+
class _ErrorParams(TypedDict):
|
94
|
+
param_name: NotRequired[str]
|
95
|
+
param_value: NotRequired[Any]
|
96
|
+
param_type: NotRequired[Any]
|
97
|
+
|
98
|
+
|
99
|
+
class ErrorMsg(str):
|
100
|
+
|
101
|
+
@staticmethod
|
102
|
+
def __new__(cls, *args, msg: Optional[str] = None,
|
103
|
+
**kw: Unpack[_ErrorParams]):
|
104
|
+
if msg:
|
105
|
+
return super().__new__(cls, msg)
|
95
106
|
|
96
|
-
|
97
|
-
|
98
|
-
return dec(ndigits)
|
107
|
+
# Assume kwargs contains values for param_name, param_value,
|
108
|
+
# param_type, if not, KeyError exception is raised
|
99
109
|
|
100
|
-
|
110
|
+
msg = (f"Invalid value for {kw["param_name"]}: {kw['param_value']}, "
|
111
|
+
f"Supported types are: {list(kw["param_type"])}")
|
112
|
+
return super().__new__(cls, msg)
|
geolysis/utils/validators.py
CHANGED
@@ -8,8 +8,7 @@ Number: TypeAlias = int | float
|
|
8
8
|
def _num_validator(bound: float, /, *,
|
9
9
|
compare_symbol: str,
|
10
10
|
compare_fn: Callable,
|
11
|
-
err_msg: str
|
12
|
-
exc_type: Callable):
|
11
|
+
exc_type: Callable, err_msg: str):
|
13
12
|
def dec(fn):
|
14
13
|
def wrapper(obj, val):
|
15
14
|
if not compare_fn(val, bound):
|
@@ -25,15 +24,14 @@ def _num_validator(bound: float, /, *,
|
|
25
24
|
def _len_validator(bound: float, /, *,
|
26
25
|
compare_symbol: str,
|
27
26
|
compare_fn: Callable,
|
28
|
-
err_msg: str
|
29
|
-
exc_type: Callable):
|
27
|
+
exc_type: Callable, err_msg: str):
|
30
28
|
def dec(fn):
|
31
29
|
def wrapper(obj, val):
|
32
30
|
_len = len(val)
|
33
31
|
if not compare_fn(_len, bound):
|
34
32
|
msg = f"Length of '{fn.__name__}' must be {compare_symbol} {bound}"
|
35
33
|
raise exc_type(err_msg if err_msg else msg)
|
36
|
-
|
34
|
+
fn(obj, val)
|
37
35
|
|
38
36
|
return wrapper
|
39
37
|
|
@@ -43,38 +41,40 @@ def _len_validator(bound: float, /, *,
|
|
43
41
|
def min_len(m_len: int, /, *, exc_type=ValueError, err_msg=None):
|
44
42
|
return _len_validator(m_len, compare_symbol=">=",
|
45
43
|
compare_fn=operator.ge,
|
46
|
-
err_msg=err_msg
|
47
|
-
exc_type=exc_type)
|
44
|
+
exc_type=exc_type, err_msg=err_msg)
|
48
45
|
|
49
46
|
|
50
|
-
|
51
|
-
|
47
|
+
def lt(val: Number, /, *, exc_type=ValueError, err_msg=None):
|
48
|
+
return _num_validator(val, compare_symbol="<",
|
49
|
+
compare_fn=operator.lt,
|
50
|
+
exc_type=exc_type, err_msg=err_msg)
|
52
51
|
|
53
52
|
|
54
53
|
def le(val: Number, /, *, exc_type=ValueError, err_msg=None):
|
55
54
|
return _num_validator(val, compare_symbol="<=",
|
56
55
|
compare_fn=operator.le,
|
57
|
-
err_msg=err_msg
|
58
|
-
exc_type=exc_type)
|
56
|
+
exc_type=exc_type, err_msg=err_msg)
|
59
57
|
|
60
58
|
|
61
|
-
|
62
|
-
|
59
|
+
def eq(val: Number, /, *, exc_type=ValueError, err_msg=None):
|
60
|
+
return _num_validator(val, compare_symbol="==",
|
61
|
+
compare_fn=operator.eq,
|
62
|
+
exc_type=exc_type, err_msg=err_msg)
|
63
63
|
|
64
64
|
|
65
|
-
|
66
|
-
|
65
|
+
def ne(val: Number, /, *, exc_type=ValueError, err_msg=None):
|
66
|
+
return _num_validator(val, compare_symbol="!=",
|
67
|
+
compare_fn=operator.ne,
|
68
|
+
exc_type=exc_type, err_msg=err_msg)
|
67
69
|
|
68
70
|
|
69
71
|
def ge(val: Number, /, *, exc_type=ValueError, err_msg=None):
|
70
72
|
return _num_validator(val, compare_symbol=">=",
|
71
73
|
compare_fn=operator.ge,
|
72
|
-
err_msg=err_msg
|
73
|
-
exc_type=exc_type)
|
74
|
+
exc_type=exc_type, err_msg=err_msg)
|
74
75
|
|
75
76
|
|
76
77
|
def gt(val: Number, /, *, exc_type=ValueError, err_msg=None):
|
77
78
|
return _num_validator(val, compare_symbol=">",
|
78
79
|
compare_fn=operator.gt,
|
79
|
-
err_msg=err_msg
|
80
|
-
exc_type=exc_type)
|
80
|
+
exc_type=exc_type, err_msg=err_msg)
|
@@ -0,0 +1,23 @@
|
|
1
|
+
geolysis/__init__.py,sha256=N6jRDNL2L9U1UQjnCq3QP90Dd7HSn8dKdlS8mVtGWNs,122
|
2
|
+
geolysis/foundation.py,sha256=wO_4TNetFOiW1ekFNyIQSYu-sIBuOfUWs6pazBwmmqU,11528
|
3
|
+
geolysis/soil_classifier.py,sha256=kcBirodL4JiCRTGk1ODjfnu_3UkOOUiBI1Z-rrdFi3E,26786
|
4
|
+
geolysis/spt.py,sha256=EncVQgocKcC4FVgDircbddVKhm_qX0AKZeE17DLuJBQ,16869
|
5
|
+
geolysis/bearing_capacity/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
6
|
+
geolysis/bearing_capacity/abc/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
7
|
+
geolysis/bearing_capacity/abc/cohl/__init__.py,sha256=OWpsgmVCZEkhN-TQDYNjtoCdBU8BMsIP7zLq2Cx79aI,5345
|
8
|
+
geolysis/bearing_capacity/abc/cohl/_core.py,sha256=ddyVTCTIqolllOwcX7s-czYO2bPAmKTlkvFAj3LNRqc,1744
|
9
|
+
geolysis/bearing_capacity/abc/cohl/bowles_abc.py,sha256=kUAZWR5exvRNoOB6pXoxmyOiQorPNtnZwBoaXCk9z0I,4096
|
10
|
+
geolysis/bearing_capacity/abc/cohl/meyerhof_abc.py,sha256=3iriC_pQCKRf_4QtDm8163lnKNZUvJ9M7c7ZyRRrID8,4056
|
11
|
+
geolysis/bearing_capacity/abc/cohl/terzaghi_abc.py,sha256=EOGfA7_IM0vCa5gLBaBOiEgop4nKBtghoA5EZC7k9dM,5308
|
12
|
+
geolysis/bearing_capacity/ubc/__init__.py,sha256=5Dk-1vE37Gijr_fNO61-RX7AFjYKNUGOxxU59a0TIJg,5970
|
13
|
+
geolysis/bearing_capacity/ubc/_core.py,sha256=CmhJyGi_GTy4DupX7m-PXlEdVmxZOgc2BVF9owByxOg,6160
|
14
|
+
geolysis/bearing_capacity/ubc/hansen_ubc.py,sha256=exkYLUG4W8AecJVbYC4lnE58KbssVUsjI0lJ7Mu5pqw,7170
|
15
|
+
geolysis/bearing_capacity/ubc/terzaghi_ubc.py,sha256=zoTf2pVTd1zN_6-yuNK9njo-8rn4o3CSccAEiivc2AE,6514
|
16
|
+
geolysis/bearing_capacity/ubc/vesic_ubc.py,sha256=zlFI26tY_L1LCb6T7q4NY4E0pTivdjYyTttp-VcIlvk,7405
|
17
|
+
geolysis/utils/__init__.py,sha256=kRUcJ7BqEtmWHDEvDImIidQqILtg8n8omsPCH-P_zas,2983
|
18
|
+
geolysis/utils/validators.py,sha256=nMZi044cbAcsgiH4yxKDELhIFuUMy7Rn8kgGzXWjEcA,2674
|
19
|
+
geolysis-0.6.0.dist-info/licenses/LICENSE.txt,sha256=ap6sMs3lT7ICbEXBhgihwH1BTCVcjmCQkIkwVnil1Ak,1065
|
20
|
+
geolysis-0.6.0.dist-info/METADATA,sha256=gzxdbg5V_atQSIKnaWub5TBmptHZH6j0ggIo6zOgSzg,7368
|
21
|
+
geolysis-0.6.0.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
22
|
+
geolysis-0.6.0.dist-info/top_level.txt,sha256=9mnQgOaCRr11dtXff8X-q3FfXjRONd6kHseSy5q2y8g,9
|
23
|
+
geolysis-0.6.0.dist-info/RECORD,,
|
geolysis-0.5.0.dist-info/RECORD
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
geolysis/__init__.py,sha256=ZCOADVfMhsjfbWiOYyJ4i81gtOtXLxRJkaNaeO2q2Qw,122
|
2
|
-
geolysis/foundation.py,sha256=_oOv-JLl8WTT81WXNaIDZzXiVTL8EwGjXi9-kmbuNSA,11722
|
3
|
-
geolysis/soil_classifier.py,sha256=AaTgcFOqpqnYvoIzXlyPBjzYhSCtgsbRae_VzD_3C4Y,27056
|
4
|
-
geolysis/spt.py,sha256=Fe5tlqvTquyfw8lFEnNQtZrRXrG1lWnflX-w-Cx5Epo,18659
|
5
|
-
geolysis/bearing_capacity/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
6
|
-
geolysis/bearing_capacity/abc/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
7
|
-
geolysis/bearing_capacity/abc/cohl/__init__.py,sha256=r-NG8fTPpNgqBriejIEkNNE3cX4X2rRqyCFYMK3RS3Y,5312
|
8
|
-
geolysis/bearing_capacity/abc/cohl/_core.py,sha256=t8nAr8ITAILQmbK5Rzie9ZCn6ODW87XLsiwULvyOMns,1741
|
9
|
-
geolysis/bearing_capacity/abc/cohl/bowles_abc.py,sha256=beYKA2yEEQ8mVKgEK6ZBlHuiWvDXE-jm5A6RhXXkPaI,4236
|
10
|
-
geolysis/bearing_capacity/abc/cohl/meyerhof_abc.py,sha256=deoFp8Tdy-eCA4-hOY6lPpvCp71rcqD9v3qhsM-H9vA,4202
|
11
|
-
geolysis/bearing_capacity/abc/cohl/terzaghi_abc.py,sha256=xYQ4moHm_2UDnUhyP1Uq54i7Yzo5l6GKjj380_prtRM,5453
|
12
|
-
geolysis/bearing_capacity/ubc/__init__.py,sha256=dwpPLRtFJ0ck0bOimGZA8zqqS8fp71_Qi0Av_A-iBkM,5956
|
13
|
-
geolysis/bearing_capacity/ubc/_core.py,sha256=Zq6DGAyrjw1OR2QZwShkdc_8BzEaKaqNNo70bhiWEu4,5858
|
14
|
-
geolysis/bearing_capacity/ubc/hansen_ubc.py,sha256=J3H8yZmrEC413pquMGbZ8Z7L47u9AXvtJbQOORvhsAU,7184
|
15
|
-
geolysis/bearing_capacity/ubc/terzaghi_ubc.py,sha256=k5P_TrEa7Uc17MbWmLrZDWlZJQLqOs01glQpfeJRxbc,6688
|
16
|
-
geolysis/bearing_capacity/ubc/vesic_ubc.py,sha256=_N4bkqYWVer7yxuFAbnEYay9BsPewbtfXgK6DJyy8hw,7416
|
17
|
-
geolysis/utils/__init__.py,sha256=Q3eBBOi_JKnydu6su-TswdI2bIT4PZ7V43NIIGaTj2w,2616
|
18
|
-
geolysis/utils/validators.py,sha256=ETvqwXtBFE17keDE5plYcSOztFNbSuJVqB6M6SmxBaQ,2556
|
19
|
-
geolysis-0.5.0.dist-info/licenses/LICENSE.txt,sha256=ap6sMs3lT7ICbEXBhgihwH1BTCVcjmCQkIkwVnil1Ak,1065
|
20
|
-
geolysis-0.5.0.dist-info/METADATA,sha256=AwMRfh8uVQ5fjX2Vw9q0NwBx8_LtB9gm4ITfxdBkRck,7368
|
21
|
-
geolysis-0.5.0.dist-info/WHEEL,sha256=tTnHoFhvKQHCh4jz3yCn0WPTYIy7wXx3CJtJ7SJGV7c,91
|
22
|
-
geolysis-0.5.0.dist-info/top_level.txt,sha256=9mnQgOaCRr11dtXff8X-q3FfXjRONd6kHseSy5q2y8g,9
|
23
|
-
geolysis-0.5.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|