geolysis 0.18.0__py3-none-any.whl → 0.20.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 CHANGED
@@ -1,5 +1,5 @@
1
1
  from . import bearing_capacity, foundation, soil_classifier, spt
2
2
 
3
- __version__ = "0.18.0"
3
+ __version__ = "0.20.0"
4
4
 
5
5
  __all__ = ["foundation", "soil_classifier", "spt", "bearing_capacity"]
@@ -1,26 +1,24 @@
1
1
  from abc import ABC, abstractmethod
2
2
  from dataclasses import dataclass
3
- from typing import Annotated
3
+ from typing import Annotated, Optional
4
4
 
5
5
  from func_validator import (
6
6
  validate_params,
7
- MustBePositive,
8
7
  MustBeNonNegative,
9
8
  MustBeLessThanOrEqual,
10
9
  )
11
10
 
12
11
  from geolysis.foundation import Foundation
13
- from geolysis.utils import round_, add_repr
12
+ from geolysis.utils import round_
14
13
 
15
14
 
16
15
  @dataclass
17
16
  class AllowableBearingCapacityResult:
18
17
  allowable_bearing_capacity: float
19
18
  depth_factor: float
20
- water_correction_factor: float = 1.0
19
+ water_correction_factor: Optional[float] = None
21
20
 
22
21
 
23
- @add_repr
24
22
  class AllowableBearingCapacity(ABC):
25
23
  #: Maximum tolerable foundation settlement (mm).
26
24
  MAX_TOL_SETTLEMENT = 25.4
@@ -44,7 +42,7 @@ class AllowableBearingCapacity(ABC):
44
42
  @validate_params
45
43
  def corrected_spt_n_value(
46
44
  self,
47
- corrected_spt_n_value: Annotated[float, MustBeNonNegative],
45
+ corrected_spt_n_value: Annotated[float, MustBeNonNegative()],
48
46
  ):
49
47
  self._corrected_spt_n_value = corrected_spt_n_value
50
48
 
@@ -58,7 +56,8 @@ class AllowableBearingCapacity(ABC):
58
56
  def tol_settlement(
59
57
  self,
60
58
  tol_settlement: Annotated[
61
- float, MustBePositive, MustBeLessThanOrEqual(25.4)],
59
+ float, MustBeNonNegative(), MustBeLessThanOrEqual(25.4)
60
+ ],
62
61
  ):
63
62
  self._tol_settlement = tol_settlement
64
63
 
@@ -90,6 +89,7 @@ class AllowableBearingCapacity(ABC):
90
89
  """
91
90
  return self._bearing_capacity()
92
91
 
92
+ @round_(ndigits=1)
93
93
  def allowable_applied_load(self) -> float:
94
94
  """Calculate the allowable applied load on the foundation."""
95
95
  return self._bearing_capacity() * self.foundation_size.foundation_area()
@@ -53,20 +53,20 @@ ubc_classes = {
53
53
 
54
54
  @validate_params
55
55
  def create_ubc_4_all_soil_types(
56
- friction_angle: float,
57
- cohesion: float,
58
- moist_unit_wgt: float,
59
- depth: float,
60
- width: float,
61
- length: Optional[float] = None,
62
- factor_of_safety: float = 3.0,
63
- saturated_unit_wgt: float = 20.5,
64
- eccentricity: float = 0.0,
65
- ground_water_level: Optional[float] = inf,
66
- load_angle: float = 0.0,
67
- apply_local_shear: bool = False,
68
- shape: Shape | str = "square",
69
- ubc_type: Annotated[UBCType | str, MustBeMemberOf(UBCType)] = "vesic",
56
+ friction_angle: float,
57
+ cohesion: float,
58
+ moist_unit_wgt: float,
59
+ depth: float,
60
+ width: float,
61
+ length: Optional[float] = None,
62
+ factor_of_safety: float = 3.0,
63
+ saturated_unit_wgt: float = 20.5,
64
+ eccentricity: float = 0.0,
65
+ ground_water_level: Optional[float] = inf,
66
+ load_angle: float = 0.0,
67
+ apply_local_shear: bool = False,
68
+ shape: Shape | str = "square",
69
+ ubc_type: Annotated[UBCType | str, MustBeMemberOf(UBCType)] = "vesic",
70
70
  ) -> UltimateBearingCapacity:
71
71
  r"""A factory function that encapsulate the creation of ultimate
72
72
  bearing capacity.
@@ -33,14 +33,14 @@ class UltimateBearingCapacityResult:
33
33
 
34
34
  class UltimateBearingCapacity(ABC):
35
35
  def __init__(
36
- self,
37
- friction_angle: float,
38
- cohesion: float,
39
- moist_unit_wgt: float,
40
- foundation_size: Foundation,
41
- saturated_unit_wgt: float = 20.5,
42
- apply_local_shear: bool = False,
43
- factor_of_safety: float = 3.0,
36
+ self,
37
+ friction_angle: float,
38
+ cohesion: float,
39
+ moist_unit_wgt: float,
40
+ foundation_size: Foundation,
41
+ saturated_unit_wgt: float = 20.5,
42
+ apply_local_shear: bool = False,
43
+ factor_of_safety: float = 3.0,
44
44
  ) -> None:
45
45
  r"""
46
46
  :param friction_angle: Internal angle of friction for general
@@ -82,8 +82,8 @@ class UltimateBearingCapacity(ABC):
82
82
  @friction_angle.setter
83
83
  @validate_params
84
84
  def friction_angle(
85
- self,
86
- friction_angle: Annotated[float, MustBeNonNegative],
85
+ self,
86
+ friction_angle: Annotated[float, MustBeNonNegative()],
87
87
  ):
88
88
  self._friction_angle = friction_angle
89
89
 
@@ -102,7 +102,7 @@ class UltimateBearingCapacity(ABC):
102
102
 
103
103
  @cohesion.setter
104
104
  @validate_params
105
- def cohesion(self, cohesion: Annotated[float, MustBeNonNegative]):
105
+ def cohesion(self, cohesion: Annotated[float, MustBeNonNegative()]):
106
106
  self._cohesion = cohesion
107
107
 
108
108
  @property
@@ -112,7 +112,8 @@ class UltimateBearingCapacity(ABC):
112
112
 
113
113
  @moist_unit_wgt.setter
114
114
  @validate_params
115
- def moist_unit_wgt(self, moist_unit_wgt: Annotated[float, MustBePositive]):
115
+ def moist_unit_wgt(self,
116
+ moist_unit_wgt: Annotated[float, MustBePositive()]):
116
117
  self._moist_unit_wgt = moist_unit_wgt
117
118
 
118
119
  @property
@@ -123,8 +124,8 @@ class UltimateBearingCapacity(ABC):
123
124
  @saturated_unit_wgt.setter
124
125
  @validate_params
125
126
  def saturated_unit_wgt(
126
- self,
127
- saturated_unit_wgt: Annotated[float, MustBePositive],
127
+ self,
128
+ saturated_unit_wgt: Annotated[float, MustBePositive()],
128
129
  ):
129
130
  self._saturated_unit_wgt = saturated_unit_wgt
130
131
 
@@ -184,6 +185,7 @@ class UltimateBearingCapacity(ABC):
184
185
  d_2 = depth - d_1
185
186
  unit_wgt = self.saturated_unit_wgt - 9.81
186
187
  eop = self.moist_unit_wgt * d_1 + unit_wgt * d_2
188
+
187
189
  return eop * self.n_q * self.s_q * self.d_q * self.i_q
188
190
 
189
191
  def _embedment_term(self, coef: float = 0.5) -> float:
@@ -203,20 +205,20 @@ class UltimateBearingCapacity(ABC):
203
205
  unit_wgt = wgt + (d / width) * (self.moist_unit_wgt - wgt)
204
206
 
205
207
  return (
206
- coef
207
- * unit_wgt
208
- * width
209
- * self.n_gamma
210
- * self.s_gamma
211
- * self.d_gamma
212
- * self.i_gamma
208
+ coef
209
+ * unit_wgt
210
+ * width
211
+ * self.n_gamma
212
+ * self.s_gamma
213
+ * self.d_gamma
214
+ * self.i_gamma
213
215
  )
214
216
 
215
217
  def _bearing_capacity(self) -> float:
216
218
  return (
217
- self._cohesion_term(1.0)
218
- + self._surcharge_term()
219
- + self._embedment_term(0.5)
219
+ self._cohesion_term(1.0)
220
+ + self._surcharge_term()
221
+ + self._embedment_term(0.5)
220
222
  )
221
223
 
222
224
  def bearing_capacity_results(self) -> UltimateBearingCapacityResult:
@@ -270,12 +272,15 @@ class UltimateBearingCapacity(ABC):
270
272
 
271
273
  @property
272
274
  @abstractmethod
273
- def n_c(self) -> float: ...
275
+ def n_c(self) -> float:
276
+ ...
274
277
 
275
278
  @property
276
279
  @abstractmethod
277
- def n_q(self) -> float: ...
280
+ def n_q(self) -> float:
281
+ ...
278
282
 
279
283
  @property
280
284
  @abstractmethod
281
- def n_gamma(self) -> float: ...
285
+ def n_gamma(self) -> float:
286
+ ...
@@ -7,7 +7,6 @@ from geolysis.utils import (
7
7
  pi,
8
8
  round_,
9
9
  tandeg,
10
- add_repr,
11
10
  )
12
11
  from ._core import UltimateBearingCapacity
13
12
 
@@ -27,7 +26,7 @@ class TerzaghiBearingCapacityFactors:
27
26
  if isclose(friction_angle, 0.0):
28
27
  return 5.7
29
28
  return cotdeg(friction_angle) * (
30
- TerzaghiBearingCapacityFactors.n_q(friction_angle) - 1.0
29
+ TerzaghiBearingCapacityFactors.n_q(friction_angle) - 1.0
31
30
  )
32
31
 
33
32
  @staticmethod
@@ -40,12 +39,12 @@ class TerzaghiBearingCapacityFactors:
40
39
  @staticmethod
41
40
  @round_(ndigits=2)
42
41
  def n_gamma(friction_angle: float) -> float:
43
- return (TerzaghiBearingCapacityFactors.n_q(friction_angle) - 1.0) * tandeg(
42
+ return (TerzaghiBearingCapacityFactors.n_q(
43
+ friction_angle) - 1.0) * tandeg(
44
44
  1.4 * friction_angle
45
45
  )
46
46
 
47
47
 
48
- @add_repr
49
48
  class TerzaghiUltimateBearingCapacity(UltimateBearingCapacity):
50
49
 
51
50
  @property
@@ -76,9 +75,9 @@ class TerzaghiUBC4StripFooting(TerzaghiUltimateBearingCapacity):
76
75
  def _bearing_capacity(self) -> float:
77
76
  """Calculates ultimate bearing capacity for strip footing."""
78
77
  return (
79
- self._cohesion_term(1.0)
80
- + self._surcharge_term()
81
- + self._embedment_term(0.5)
78
+ self._cohesion_term(1.0)
79
+ + self._surcharge_term()
80
+ + self._embedment_term(0.5)
82
81
  )
83
82
 
84
83
 
@@ -94,9 +93,9 @@ class TerzaghiUBC4CircularFooting(TerzaghiUltimateBearingCapacity):
94
93
  def _bearing_capacity(self) -> float:
95
94
  """Calculates ultimate bearing capacity for circular footing."""
96
95
  return (
97
- self._cohesion_term(1.3)
98
- + self._surcharge_term()
99
- + self._embedment_term(0.3)
96
+ self._cohesion_term(1.3)
97
+ + self._surcharge_term()
98
+ + self._embedment_term(0.3)
100
99
  )
101
100
 
102
101
 
@@ -111,9 +110,9 @@ class TerzaghiUBC4SquareFooting(TerzaghiUltimateBearingCapacity):
111
110
  def _bearing_capacity(self):
112
111
  """Calcalates ultimate bearing capacity for square footing."""
113
112
  return (
114
- self._cohesion_term(1.3)
115
- + self._surcharge_term()
116
- + self._embedment_term(0.4)
113
+ self._cohesion_term(1.3)
114
+ + self._surcharge_term()
115
+ + self._embedment_term(0.4)
117
116
  )
118
117
 
119
118
 
@@ -134,7 +133,7 @@ class TerzaghiUBC4RectangularFooting(TerzaghiUltimateBearingCapacity):
134
133
  emb_coef = (1.0 - 0.2 * (width / length)) / 2.0
135
134
 
136
135
  return (
137
- self._cohesion_term(coh_coef)
138
- + self._surcharge_term()
139
- + self._embedment_term(emb_coef)
136
+ self._cohesion_term(coh_coef)
137
+ + self._surcharge_term()
138
+ + self._embedment_term(emb_coef)
140
139
  )
@@ -5,7 +5,6 @@ from geolysis.utils import (
5
5
  sindeg,
6
6
  tandeg,
7
7
  atan,
8
- add_repr,
9
8
  cotdeg,
10
9
  exp,
11
10
  pi,
@@ -23,7 +22,7 @@ class VesicBearingCapacityFactors:
23
22
  if isclose(friction_angle, 0.0):
24
23
  return 5.14
25
24
  return cotdeg(friction_angle) * (
26
- VesicBearingCapacityFactors.n_q(friction_angle) - 1.0
25
+ VesicBearingCapacityFactors.n_q(friction_angle) - 1.0
27
26
  )
28
27
 
29
28
  @staticmethod
@@ -37,9 +36,9 @@ class VesicBearingCapacityFactors:
37
36
  @round_(ndigits=2)
38
37
  def n_gamma(friction_angle: float) -> float:
39
38
  return (
40
- 2.0
41
- * (VesicBearingCapacityFactors.n_q(friction_angle) + 1.0)
42
- * tandeg(friction_angle)
39
+ 2.0
40
+ * (VesicBearingCapacityFactors.n_q(friction_angle) + 1.0)
41
+ * tandeg(friction_angle)
43
42
  )
44
43
 
45
44
 
@@ -47,10 +46,10 @@ class VesicShapeFactors:
47
46
  @staticmethod
48
47
  @round_(ndigits=3)
49
48
  def s_c(
50
- friction_angle: float,
51
- f_width: float,
52
- f_length: float,
53
- f_shape: Shape,
49
+ friction_angle: float,
50
+ f_width: float,
51
+ f_length: float,
52
+ f_shape: Shape,
54
53
  ) -> float:
55
54
  n_q = VesicBearingCapacityFactors.n_q(friction_angle)
56
55
  n_c = VesicBearingCapacityFactors.n_c(friction_angle)
@@ -63,10 +62,10 @@ class VesicShapeFactors:
63
62
  @staticmethod
64
63
  @round_(ndigits=3)
65
64
  def s_q(
66
- friction_angle: float,
67
- f_width: float,
68
- f_length: float,
69
- f_shape: Shape,
65
+ friction_angle: float,
66
+ f_width: float,
67
+ f_length: float,
68
+ f_shape: Shape,
70
69
  ) -> float:
71
70
  if f_shape == Shape.STRIP:
72
71
  return 1.0
@@ -118,18 +117,19 @@ class VesicDepthFactors:
118
117
  _d_q = 1.0
119
118
  else:
120
119
  _d_q = (
121
- 1.0
122
- + 2
123
- * tandeg(friction_angle)
124
- * (1 - sindeg(friction_angle)) ** 2
125
- * d2w
120
+ 1.0
121
+ + 2
122
+ * tandeg(friction_angle)
123
+ * (1 - sindeg(friction_angle)) ** 2
124
+ * d2w
126
125
  )
127
126
  else:
128
127
  if isclose(friction_angle, 0.0):
129
128
  _d_q = 1.0
130
129
  else:
131
130
  _d_q = 1.0 + (
132
- 2.0 * tandeg(friction_angle) * (1 - sindeg(friction_angle)) ** 2
131
+ 2.0 * tandeg(friction_angle) * (
132
+ 1 - sindeg(friction_angle)) ** 2
133
133
  ) * atan(d2w)
134
134
  return _d_q
135
135
 
@@ -158,7 +158,6 @@ class VesicInclinationFactors:
158
158
  return (1.0 - load_angle / friction_angle) ** 2.0
159
159
 
160
160
 
161
- @add_repr
162
161
  class VesicUltimateBearingCapacity(UltimateBearingCapacity):
163
162
  """Ultimate bearing capacity for soils according to `Vesic (1973)`.
164
163
 
@@ -229,4 +228,5 @@ class VesicUltimateBearingCapacity(UltimateBearingCapacity):
229
228
  @property
230
229
  def i_gamma(self) -> float:
231
230
  r"""Inclination factor $I_{\gamma}$."""
232
- return VesicInclinationFactors.i_gamma(self.friction_angle, self.load_angle)
231
+ return VesicInclinationFactors.i_gamma(self.friction_angle,
232
+ self.load_angle)
geolysis/foundation.py CHANGED
@@ -1,6 +1,6 @@
1
1
  import enum
2
2
  from abc import ABC, abstractmethod
3
- from typing import Optional, TypeAlias, TypeVar, Annotated
3
+ from typing import Optional, TypeVar, Annotated
4
4
 
5
5
  from func_validator import (
6
6
  validate_params,
@@ -11,7 +11,7 @@ from func_validator import (
11
11
  DependsOn,
12
12
  )
13
13
 
14
- from .utils import AbstractStrEnum, inf, isclose, pi, round_, add_repr, isinf
14
+ from .utils import AbstractStrEnum, inf, isclose, pi, round_, isinf
15
15
 
16
16
  __all__ = [
17
17
  "create_foundation",
@@ -102,7 +102,6 @@ class FootingSize(ABC):
102
102
  return self._SHAPE
103
103
 
104
104
 
105
- @add_repr
106
105
  class StripFooting(FootingSize):
107
106
  """A class representation of strip footing."""
108
107
 
@@ -141,7 +140,6 @@ class StripFooting(FootingSize):
141
140
  return self.width * self.length
142
141
 
143
142
 
144
- @add_repr
145
143
  class CircularFooting(FootingSize):
146
144
  """A class representation of circular footing.
147
145
 
@@ -191,10 +189,9 @@ class CircularFooting(FootingSize):
191
189
 
192
190
  def area(self) -> float:
193
191
  """Area of circular footing ($m^2$)."""
194
- return pi * self.diameter**2 / 4
192
+ return pi * self.diameter ** 2 / 4
195
193
 
196
194
 
197
- @add_repr
198
195
  class SquareFooting(FootingSize):
199
196
  """A class representation of square footing."""
200
197
 
@@ -227,10 +224,9 @@ class SquareFooting(FootingSize):
227
224
 
228
225
  def area(self) -> float:
229
226
  """Area of square footing ($m^2$)."""
230
- return self.width**2
227
+ return self.width ** 2
231
228
 
232
229
 
233
- @add_repr
234
230
  class RectangularFooting(FootingSize):
235
231
  """A class representation of rectangular footing."""
236
232
 
@@ -267,18 +263,17 @@ class RectangularFooting(FootingSize):
267
263
  return self.width * self.length
268
264
 
269
265
 
270
- @add_repr
271
266
  class Foundation:
272
267
  """A simple class representing a foundation structure."""
273
268
 
274
269
  def __init__(
275
- self,
276
- depth: float,
277
- footing_size: FootingSize,
278
- eccentricity: float = 0.0,
279
- load_angle: float = 0.0,
280
- ground_water_level: Optional[float] = inf,
281
- foundation_type: FoundationType = FoundationType.PAD,
270
+ self,
271
+ depth: float,
272
+ footing_size: FootingSize,
273
+ eccentricity: float = 0.0,
274
+ load_angle: float = 0.0,
275
+ ground_water_level: Optional[float] = inf,
276
+ foundation_type: FoundationType = FoundationType.PAD,
282
277
  ) -> None:
283
278
  r"""
284
279
  :param depth: Depth of foundation (m).
@@ -307,7 +302,7 @@ class Foundation:
307
302
 
308
303
  @depth.setter
309
304
  @validate_params
310
- def depth(self, depth: Annotated[float, MustBePositive]) -> None:
305
+ def depth(self, depth: Annotated[float, MustBePositive()]) -> None:
311
306
  self._depth = depth
312
307
 
313
308
  @property
@@ -316,7 +311,7 @@ class Foundation:
316
311
  return self.footing_size.width
317
312
 
318
313
  @width.setter
319
- def width(self, width: Annotated[float, MustBePositive]):
314
+ def width(self, width: Annotated[float, MustBePositive()]):
320
315
  self.footing_size.width = width
321
316
 
322
317
  @property
@@ -325,7 +320,7 @@ class Foundation:
325
320
  return self.footing_size.length
326
321
 
327
322
  @length.setter
328
- def length(self, length: Annotated[float, MustBePositive]):
323
+ def length(self, length: Annotated[float, MustBePositive()]):
329
324
  self.footing_size.length = length
330
325
 
331
326
  @property
@@ -342,7 +337,8 @@ class Foundation:
342
337
 
343
338
  @eccentricity.setter
344
339
  @validate_params
345
- def eccentricity(self, eccentricity: Annotated[float, MustBeNonNegative]) -> None:
340
+ def eccentricity(self, eccentricity: Annotated[
341
+ float, MustBeNonNegative()]) -> None:
346
342
  self._eccentricity = eccentricity
347
343
 
348
344
  @property
@@ -353,8 +349,9 @@ class Foundation:
353
349
  @load_angle.setter
354
350
  @validate_params
355
351
  def load_angle(
356
- self,
357
- load_angle: Annotated[float, MustBeBetween(min_value=0.0, max_value=90.0)],
352
+ self,
353
+ load_angle: Annotated[
354
+ float, MustBeBetween(min_value=0.0, max_value=90.0)],
358
355
  ) -> None:
359
356
  self._load_angle = load_angle
360
357
 
@@ -366,8 +363,8 @@ class Foundation:
366
363
  @ground_water_level.setter
367
364
  @validate_params
368
365
  def ground_water_level(
369
- self,
370
- ground_water_level: Annotated[float, MustBePositive],
366
+ self,
367
+ ground_water_level: Annotated[float, MustBePositive()],
371
368
  ):
372
369
  self._ground_water_level = ground_water_level
373
370
 
@@ -379,8 +376,9 @@ class Foundation:
379
376
  @foundation_type.setter
380
377
  @validate_params
381
378
  def foundation_type(
382
- self,
383
- foundation_type: Annotated[FoundationType, MustBeMemberOf(FoundationType)],
379
+ self,
380
+ foundation_type: Annotated[
381
+ FoundationType, MustBeMemberOf(FoundationType)],
384
382
  ):
385
383
  self._foundation_type = foundation_type
386
384
 
@@ -412,14 +410,14 @@ class Foundation:
412
410
 
413
411
  @validate_params
414
412
  def create_foundation(
415
- depth: float,
416
- width: float,
417
- length: Annotated[float, DependsOn(shape=Shape.RECTANGLE)] = None,
418
- eccentricity: float = 0.0,
419
- load_angle: float = 0.0,
420
- ground_water_level: Optional[float] = inf,
421
- foundation_type: FoundationType = "pad",
422
- shape: Annotated[Shape | str, MustBeMemberOf(Shape)] = "square",
413
+ depth: float,
414
+ width: float,
415
+ length: Annotated[float, DependsOn(shape=Shape.RECTANGLE)] = None,
416
+ eccentricity: float = 0.0,
417
+ load_angle: float = 0.0,
418
+ ground_water_level: Optional[float] = inf,
419
+ foundation_type: FoundationType = "pad",
420
+ shape: Annotated[Shape | str, MustBeMemberOf(Shape)] = "square",
423
421
  ) -> Foundation:
424
422
  r"""A factory function that encapsulate the creation of a foundation.
425
423
 
@@ -1,8 +1,12 @@
1
1
  import enum
2
2
  from dataclasses import dataclass
3
- from typing import Annotated, Sequence
3
+ from typing import Annotated, Sequence, Optional
4
4
 
5
- from func_validator import validate_params, MustBeNonNegative
5
+ from func_validator import (
6
+ validate_params,
7
+ MustBeNonNegative,
8
+ MustBePositive,
9
+ )
6
10
 
7
11
  from .utils import isclose, round_
8
12
 
@@ -257,7 +261,8 @@ class AtterbergLimits:
257
261
 
258
262
  @liquid_limit.setter
259
263
  @validate_params
260
- def liquid_limit(self, liquid_limit: Annotated[float, MustBeNonNegative]):
264
+ def liquid_limit(self,
265
+ liquid_limit: Annotated[float, MustBeNonNegative()]):
261
266
  self._liquid_limit = liquid_limit
262
267
 
263
268
  @property
@@ -270,7 +275,7 @@ class AtterbergLimits:
270
275
  @plastic_limit.setter
271
276
  @validate_params
272
277
  def plastic_limit(self,
273
- plastic_limit: Annotated[float, MustBeNonNegative]):
278
+ plastic_limit: Annotated[float, MustBeNonNegative()]):
274
279
  if self.liquid_limit < plastic_limit:
275
280
  msg = (
276
281
  f"plastic_limit: {plastic_limit} cannot be greater than "
@@ -533,7 +538,7 @@ class AASHTO:
533
538
 
534
539
  @fines.setter
535
540
  @validate_params
536
- def fines(self, fines: Annotated[float, MustBeNonNegative]):
541
+ def fines(self, fines: Annotated[float, MustBeNonNegative()]):
537
542
  self._fines = fines
538
543
 
539
544
  @round_(ndigits=0)
@@ -808,14 +813,15 @@ def create_aashto_classifier(
808
813
  return AASHTO(atterberg_limits, fines)
809
814
 
810
815
 
816
+ @validate_params
811
817
  def create_uscs_classifier(
812
818
  liquid_limit: float,
813
819
  plastic_limit: float,
814
820
  fines: float,
815
821
  sand: float,
816
- d_10: float | None = None,
817
- d_30: float | None = None,
818
- d_60: float | None = None,
822
+ d_10: Annotated[Optional[float], MustBePositive()] = None,
823
+ d_30: Annotated[Optional[float], MustBePositive()] = None,
824
+ d_60: Annotated[Optional[float], MustBePositive()] = None,
819
825
  organic: bool = False,
820
826
  ):
821
827
  """A helper function that encapsulates the creation of a USCS
geolysis/spt.py CHANGED
@@ -61,9 +61,9 @@ class SPT:
61
61
  """
62
62
 
63
63
  def __init__(
64
- self,
65
- corrected_spt_n_values: Sequence[float],
66
- method: SPTDesignMethod.WEIGHTED = "wgt",
64
+ self,
65
+ corrected_spt_n_values: Sequence[float],
66
+ method: SPTDesignMethod.WEIGHTED = "wgt",
67
67
  ):
68
68
  """
69
69
  :param corrected_spt_n_values: Corrected SPT N-values within the
@@ -82,12 +82,12 @@ class SPT:
82
82
  @corrected_spt_n_values.setter
83
83
  @validate_params
84
84
  def corrected_spt_n_values(
85
- self,
86
- corrected_spt_n_values: Annotated[
87
- Sequence[float],
88
- MustHaveLengthGreaterThan(1),
89
- MustHaveValuesBetween(min_value=1.0, max_value=100.0),
90
- ],
85
+ self,
86
+ corrected_spt_n_values: Annotated[
87
+ Sequence[float],
88
+ MustHaveLengthGreaterThan(1),
89
+ MustHaveValuesBetween(min_value=1.0, max_value=100.0),
90
+ ],
91
91
  ) -> None:
92
92
  self._corrected_spt_n_values = corrected_spt_n_values
93
93
 
@@ -115,7 +115,7 @@ class SPT:
115
115
  total_wgt = 0.0
116
116
 
117
117
  for i, corr_spt_n_val in enumerate(vals, start=1):
118
- wgt = 1 / i**2
118
+ wgt = 1 / i ** 2
119
119
  total_wgted_spt += wgt * corr_spt_n_val
120
120
  total_wgt += wgt
121
121
 
@@ -220,14 +220,14 @@ class EnergyCorrection:
220
220
  }
221
221
 
222
222
  def __init__(
223
- self,
224
- recorded_spt_n_value: int,
225
- *,
226
- energy_percentage=0.6,
227
- borehole_diameter=65.0,
228
- rod_length=3.0,
229
- hammer_type=HammerType.DONUT_1,
230
- sampler_type=SamplerType.STANDARD,
223
+ self,
224
+ recorded_spt_n_value: int,
225
+ *,
226
+ energy_percentage=0.6,
227
+ borehole_diameter=65.0,
228
+ rod_length=3.0,
229
+ hammer_type=HammerType.DONUT_1,
230
+ sampler_type=SamplerType.STANDARD,
231
231
  ):
232
232
  """
233
233
  :param recorded_spt_n_value: Recorded SPT N-value from field.
@@ -254,8 +254,9 @@ class EnergyCorrection:
254
254
  @recorded_spt_n_value.setter
255
255
  @validate_params
256
256
  def recorded_spt_n_value(
257
- self,
258
- recorded_spt_n_value: Annotated[int, MustBeBetween(min_value=0, max_value=100)],
257
+ self,
258
+ recorded_spt_n_value: Annotated[
259
+ int, MustBeBetween(min_value=0, max_value=100)],
259
260
  ) -> None:
260
261
  self._recorded_spt_value = recorded_spt_n_value
261
262
 
@@ -267,10 +268,10 @@ class EnergyCorrection:
267
268
  @energy_percentage.setter
268
269
  @validate_params
269
270
  def energy_percentage(
270
- self,
271
- energy_percentage: Annotated[
272
- float, MustBeBetween(min_value=0.0, max_value=1.0)
273
- ],
271
+ self,
272
+ energy_percentage: Annotated[
273
+ float, MustBeBetween(min_value=0.0, max_value=1.0)
274
+ ],
274
275
  ) -> None:
275
276
  self._energy_percentage = energy_percentage
276
277
 
@@ -282,10 +283,10 @@ class EnergyCorrection:
282
283
  @borehole_diameter.setter
283
284
  @validate_params
284
285
  def borehole_diameter(
285
- self,
286
- borehole_diameter: Annotated[
287
- float, MustBeBetween(min_value=65.0, max_value=200.0)
288
- ],
286
+ self,
287
+ borehole_diameter: Annotated[
288
+ float, MustBeBetween(min_value=65.0, max_value=200.0)
289
+ ],
289
290
  ) -> None:
290
291
  self._borehole_diameter = borehole_diameter
291
292
 
@@ -296,7 +297,7 @@ class EnergyCorrection:
296
297
 
297
298
  @rod_length.setter
298
299
  @validate_params
299
- def rod_length(self, rod_length: Annotated[float, MustBePositive]):
300
+ def rod_length(self, rod_length: Annotated[float, MustBePositive()]):
300
301
  self._rod_length = rod_length
301
302
 
302
303
  @property
@@ -306,8 +307,8 @@ class EnergyCorrection:
306
307
  @hammer_type.setter
307
308
  @validate_params
308
309
  def hammer_type(
309
- self,
310
- hammer_type: Annotated[HammerType, MustBeMemberOf(HammerType)],
310
+ self,
311
+ hammer_type: Annotated[HammerType, MustBeMemberOf(HammerType)],
311
312
  ):
312
313
  self._hammer_type = hammer_type
313
314
 
@@ -318,7 +319,8 @@ class EnergyCorrection:
318
319
  @sampler_type.setter
319
320
  @validate_params
320
321
  def sampler_type(
321
- self, sampler_type: Annotated[SamplerType, MustBeMemberOf(SamplerType)]
322
+ self,
323
+ sampler_type: Annotated[SamplerType, MustBeMemberOf(SamplerType)]
322
324
  ):
323
325
  self._sampler_type = sampler_type
324
326
 
@@ -367,10 +369,10 @@ class EnergyCorrection:
367
369
  `ENERGY`: 0.6, 0.55, etc
368
370
  """
369
371
  numerator = (
370
- self.hammer_efficiency
371
- * self.borehole_diameter_correction
372
- * self.sampler_correction
373
- * self.rod_length_correction
372
+ self.hammer_efficiency
373
+ * self.borehole_diameter_correction
374
+ * self.sampler_correction
375
+ * self.rod_length_correction
374
376
  )
375
377
  return numerator / self.energy_percentage
376
378
 
@@ -399,7 +401,7 @@ class OPC:
399
401
 
400
402
  @eop.setter
401
403
  @validate_params
402
- def eop(self, eop: Annotated[float, MustBeNonNegative]):
404
+ def eop(self, eop: Annotated[float, MustBeNonNegative()]):
403
405
  """Effective overburden pressure ($kPa$)."""
404
406
  self._eop = eop
405
407
 
@@ -411,10 +413,10 @@ class OPC:
411
413
  @std_spt_n_value.setter
412
414
  @validate_params
413
415
  def std_spt_n_value(
414
- self,
415
- std_spt_n_value: Annotated[
416
- float, MustBeBetween(min_value=0.0, max_value=100.0)
417
- ],
416
+ self,
417
+ std_spt_n_value: Annotated[
418
+ float, MustBeBetween(min_value=0.0, max_value=100.0)
419
+ ],
418
420
  ):
419
421
  self._std_spt_n_value = std_spt_n_value
420
422
 
@@ -444,8 +446,9 @@ class GibbsHoltzOPC(OPC):
444
446
  @eop.setter
445
447
  @validate_params
446
448
  def eop(
447
- self,
448
- eop: Annotated[float, MustBeBetween(min_value=0.0, max_value=280.0)],
449
+ self,
450
+ eop: Annotated[
451
+ float, MustBeBetween(min_value=0.0, max_value=280.0)],
449
452
  ):
450
453
  self._eop = eop
451
454
 
@@ -538,10 +541,10 @@ class DilatancyCorrection:
538
541
  @corr_spt_n_value.setter
539
542
  @validate_params
540
543
  def corr_spt_n_value(
541
- self,
542
- corr_spt_n_value: Annotated[
543
- float, MustBeBetween(min_value=0.0, max_value=100.0)
544
- ],
544
+ self,
545
+ corr_spt_n_value: Annotated[
546
+ float, MustBeBetween(min_value=0.0, max_value=100.0)
547
+ ],
545
548
  ):
546
549
  self._corr_spt_n_value = corr_spt_n_value
547
550
 
@@ -587,9 +590,9 @@ _opctypes = {
587
590
 
588
591
  @validate_params
589
592
  def create_overburden_pressure_correction(
590
- std_spt_n_value: float,
591
- eop: float,
592
- opc_type: Annotated[OPCType | str, MustBeMemberOf(OPCType)] = "gibbs",
593
+ std_spt_n_value: float,
594
+ eop: float,
595
+ opc_type: Annotated[OPCType | str, MustBeMemberOf(OPCType)] = "gibbs",
593
596
  ):
594
597
  """A factory function that encapsulates the creation of overburden
595
598
  pressure correction.
@@ -5,7 +5,7 @@ from typing import Callable
5
5
  from .math import *
6
6
  from . import math as m
7
7
 
8
- __all__ = ["AbstractStrEnum", "add_repr", "round_"] + m.__all__
8
+ __all__ = ["AbstractStrEnum", "round_"] + m.__all__
9
9
 
10
10
 
11
11
  class StrEnumMeta(enum.EnumMeta):
@@ -26,23 +26,6 @@ class AbstractStrEnum(enum.StrEnum, metaclass=StrEnumMeta):
26
26
  """
27
27
 
28
28
 
29
- def add_repr(cls):
30
- """A class decorator that adds a __repr__ method to the class."""
31
-
32
- def __repr__(self) -> str:
33
- inst_attrs = self.__dict__
34
- attrs = (f"{key.strip('_')}={val}" for key, val in inst_attrs.items())
35
- return f"{type(self).__name__}({', '.join(attrs)})"
36
-
37
- def __str__(self) -> str:
38
- return repr(self)
39
-
40
- cls.__repr__ = __repr__
41
- cls.__str__ = __str__
42
-
43
- return cls
44
-
45
-
46
29
  def round_(ndigits: int) -> Callable:
47
30
  """A decorator that rounds the result of a callable to a specified
48
31
  number of decimal places.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: geolysis
3
- Version: 0.18.0
3
+ Version: 0.20.0
4
4
  Summary: geolysis is an opensource software for geotechnical engineering analysis and modeling.
5
5
  Author-email: Patrick Boateng <boatengpato.pb@gmail.com>
6
6
  License: MIT License
@@ -0,0 +1,23 @@
1
+ geolysis/__init__.py,sha256=rYeTl8-JY-5Tj1wQlcLuXeKWx3Iw_y-_ZJyE4VP6ynY,161
2
+ geolysis/exceptions.py,sha256=NocUF7-vaFsBJyi0QmH2EBFCpO2RT90RLEB66BCW_X0,74
3
+ geolysis/foundation.py,sha256=bJ3TtJXSJ7ckjhhZhDE4KS8XAmh4NacFa3y4YHwo-G4,13258
4
+ geolysis/soil_classifier.py,sha256=bZl8f7mMiRWHqdftzLbBok8RoP13W1AgQiRUeqrbef0,27941
5
+ geolysis/spt.py,sha256=DEYdOjIg2JcfcR-UqL8sSW_Sj6GsrzjaioITol2tFQE,17513
6
+ geolysis/bearing_capacity/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
+ geolysis/bearing_capacity/abc/__init__.py,sha256=nycD68gdA116n2VX5fT_hq7ZZz3CF4OVuU3DIgnlnZw,518
8
+ geolysis/bearing_capacity/abc/_cohl/__init__.py,sha256=eelKtboxHhzq1uBcaW5liUqSUUpiWoDeg5ufO2beRHY,3351
9
+ geolysis/bearing_capacity/abc/_cohl/_core.py,sha256=kwWGekawMUnMzFrgKhnKsohFBOEzZ3a0MIfb_vy5g_o,2943
10
+ geolysis/bearing_capacity/abc/_cohl/bowles_abc.py,sha256=frjZXiVGTR53gRjYNYfYMlx-q9TLltyPHbJFpN7XOiY,2414
11
+ geolysis/bearing_capacity/abc/_cohl/meyerhof_abc.py,sha256=vXDdtFwYzmD2vOXEQxSQb-jp1bPlB4blmcfNi1zAk78,2377
12
+ geolysis/bearing_capacity/abc/_cohl/terzaghi_abc.py,sha256=D8-t9fKCnA4y_cSXk2dCfXPrkeUdNizAf8CDhOCLL0Y,3297
13
+ geolysis/bearing_capacity/ubc/__init__.py,sha256=olc5EYJ761wSMTfhxd59PX_lSjQnIMH-VgziaNyOYE8,4306
14
+ geolysis/bearing_capacity/ubc/_core.py,sha256=HRjDxXCR6DdtwJhRx9ZDNJjfYiuf3ELdUlmlrQzlq2g,8270
15
+ geolysis/bearing_capacity/ubc/_terzaghi_ubc.py,sha256=3xroPeHvDgb7h6HytUHbtkK5f8lkPraUNHvbqUkgvIw,4363
16
+ geolysis/bearing_capacity/ubc/_vesic_ubc.py,sha256=FvtLBUvR0t9O4N6WYuM6VqWuj55O7sZBZ2_RT1RkijM,6934
17
+ geolysis/utils/__init__.py,sha256=_KUctxGCiI9I-faB1iXMy-H1BQeU2LW9TmSpdDNy0Yw,1331
18
+ geolysis/utils/math.py,sha256=Nqg6SFIy3peSC-n-rq0KjryOdWTqh9jCF2L_qvx5Yg8,1231
19
+ geolysis-0.20.0.dist-info/licenses/LICENSE.txt,sha256=ap6sMs3lT7ICbEXBhgihwH1BTCVcjmCQkIkwVnil1Ak,1065
20
+ geolysis-0.20.0.dist-info/METADATA,sha256=MGAevwbhepXtJJhluB6bc37LW19AobiZuiyKt_7DQI8,6833
21
+ geolysis-0.20.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
22
+ geolysis-0.20.0.dist-info/top_level.txt,sha256=9mnQgOaCRr11dtXff8X-q3FfXjRONd6kHseSy5q2y8g,9
23
+ geolysis-0.20.0.dist-info/RECORD,,
@@ -1,23 +0,0 @@
1
- geolysis/__init__.py,sha256=7N_ThGwXWmtndvNkpcgc08s6wzi7BSfOI8q87D8p9Ak,161
2
- geolysis/exceptions.py,sha256=NocUF7-vaFsBJyi0QmH2EBFCpO2RT90RLEB66BCW_X0,74
3
- geolysis/foundation.py,sha256=IlNm-Wnujug_NdiKTejlzlFxXtlpiGGrOvaqkFEHYnU,13188
4
- geolysis/soil_classifier.py,sha256=4P0l-zpjdcB2Q6NbjBCNTv1reK_-8uQiZnEH-y_ZKvY,27758
5
- geolysis/spt.py,sha256=7xa4KkzBjbtSFo0zoZleCCCyeE81w4d2eicjlFy3p28,17273
6
- geolysis/bearing_capacity/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
- geolysis/bearing_capacity/abc/__init__.py,sha256=nycD68gdA116n2VX5fT_hq7ZZz3CF4OVuU3DIgnlnZw,518
8
- geolysis/bearing_capacity/abc/_cohl/__init__.py,sha256=eelKtboxHhzq1uBcaW5liUqSUUpiWoDeg5ufO2beRHY,3351
9
- geolysis/bearing_capacity/abc/_cohl/_core.py,sha256=99l3RuK5eq7VSjdu4gfMfxSqkX72pgVz5qpZosshsnc,2919
10
- geolysis/bearing_capacity/abc/_cohl/bowles_abc.py,sha256=frjZXiVGTR53gRjYNYfYMlx-q9TLltyPHbJFpN7XOiY,2414
11
- geolysis/bearing_capacity/abc/_cohl/meyerhof_abc.py,sha256=vXDdtFwYzmD2vOXEQxSQb-jp1bPlB4blmcfNi1zAk78,2377
12
- geolysis/bearing_capacity/abc/_cohl/terzaghi_abc.py,sha256=D8-t9fKCnA4y_cSXk2dCfXPrkeUdNizAf8CDhOCLL0Y,3297
13
- geolysis/bearing_capacity/ubc/__init__.py,sha256=y7CknadZ5BKGNptl-VglhMXV_vh2wjYLFWQ9GfSy4E0,4362
14
- geolysis/bearing_capacity/ubc/_core.py,sha256=WZUSzgC-RhPTR3t1ECh3A934SMRWeuPyytlNqwpE-0s,8126
15
- geolysis/bearing_capacity/ubc/_terzaghi_ubc.py,sha256=3g1kyugpuNy4lvcG_uZBOd3PWIkVJ_-VJWZxkrqX-p4,4322
16
- geolysis/bearing_capacity/ubc/_vesic_ubc.py,sha256=yZS1RH1NfHoYk9UNCKFSjjEOok-mLkStt2rg5X_zG7Y,6810
17
- geolysis/utils/__init__.py,sha256=T4B8itFH9971MMFpOaAbOMzkIPfrAkZQtGa6jcaI_mY,1768
18
- geolysis/utils/math.py,sha256=Nqg6SFIy3peSC-n-rq0KjryOdWTqh9jCF2L_qvx5Yg8,1231
19
- geolysis-0.18.0.dist-info/licenses/LICENSE.txt,sha256=ap6sMs3lT7ICbEXBhgihwH1BTCVcjmCQkIkwVnil1Ak,1065
20
- geolysis-0.18.0.dist-info/METADATA,sha256=qcGkhtECL4tHi2yZwKMsbwOBhLc0TbKEZ0tEXjxswNU,6833
21
- geolysis-0.18.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
22
- geolysis-0.18.0.dist-info/top_level.txt,sha256=9mnQgOaCRr11dtXff8X-q3FfXjRONd6kHseSy5q2y8g,9
23
- geolysis-0.18.0.dist-info/RECORD,,