geolysis 0.4.2__py3-none-any.whl → 0.4.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- geolysis/__init__.py +1 -3
- geolysis/foundation.py +165 -98
- geolysis/soil_classifier.py +161 -99
- geolysis/spt.py +89 -44
- {geolysis-0.4.2.dist-info → geolysis-0.4.3.dist-info}/METADATA +43 -78
- geolysis-0.4.3.dist-info/RECORD +9 -0
- {geolysis-0.4.2.dist-info → geolysis-0.4.3.dist-info}/WHEEL +1 -1
- geolysis/utils.py +0 -78
- geolysis/validators.py +0 -54
- geolysis-0.4.2.dist-info/RECORD +0 -11
- {geolysis-0.4.2.dist-info → geolysis-0.4.3.dist-info}/LICENSE.txt +0 -0
- {geolysis-0.4.2.dist-info → geolysis-0.4.3.dist-info}/top_level.txt +0 -0
geolysis/spt.py
CHANGED
@@ -1,15 +1,50 @@
|
|
1
|
+
""" Standard penetration test module.
|
2
|
+
|
3
|
+
Enums
|
4
|
+
=====
|
5
|
+
|
6
|
+
.. autosummary::
|
7
|
+
:toctree: _autosummary
|
8
|
+
:nosignatures:
|
9
|
+
|
10
|
+
HammerType
|
11
|
+
SamplerType
|
12
|
+
|
13
|
+
Classes
|
14
|
+
=======
|
15
|
+
|
16
|
+
.. autosummary::
|
17
|
+
:toctree: _autosummary
|
18
|
+
|
19
|
+
SPTNDesign
|
20
|
+
EnergyCorrection
|
21
|
+
GibbsHoltzOPC
|
22
|
+
BazaraaPeckOPC
|
23
|
+
PeckOPC
|
24
|
+
LiaoWhitmanOPC
|
25
|
+
SkemptonOPC
|
26
|
+
DilatancyCorrection
|
27
|
+
"""
|
1
28
|
import enum
|
2
29
|
from abc import abstractmethod
|
3
30
|
from typing import Final, Sequence
|
4
31
|
|
5
|
-
from geolysis import validators
|
6
|
-
|
32
|
+
from geolysis.utils import isclose, log10, mean, round_, sqrt, validators, \
|
33
|
+
enum_repr
|
7
34
|
|
8
|
-
__all__ = ["
|
9
|
-
"
|
35
|
+
__all__ = ["SPTNDesign",
|
36
|
+
"HammerType",
|
37
|
+
"SamplerType",
|
38
|
+
"EnergyCorrection",
|
39
|
+
"GibbsHoltzOPC",
|
40
|
+
"BazaraaPeckOPC",
|
41
|
+
"PeckOPC",
|
42
|
+
"LiaoWhitmanOPC",
|
43
|
+
"SkemptonOPC",
|
44
|
+
"DilatancyCorrection"]
|
10
45
|
|
11
46
|
|
12
|
-
class
|
47
|
+
class SPTNDesign:
|
13
48
|
""" SPT Design Calculations.
|
14
49
|
|
15
50
|
Due to uncertainty in field procedure in standard penetration test and also
|
@@ -21,35 +56,43 @@ class SPTDesign:
|
|
21
56
|
N-value from the base.
|
22
57
|
"""
|
23
58
|
|
24
|
-
def __init__(self,
|
59
|
+
def __init__(self, corrected_spt_n_values: Sequence[float]) -> None:
|
25
60
|
"""
|
26
|
-
:param
|
27
|
-
|
28
|
-
|
29
|
-
:type spt_n_values: Sequence[float]
|
61
|
+
:param corrected_spt_n_values: Corrected SPT N-values within the
|
62
|
+
foundation influence zone.
|
63
|
+
:type corrected_spt_n_values: Sequence[float]
|
30
64
|
"""
|
31
|
-
self.
|
65
|
+
self.corrected_spt_n_values = corrected_spt_n_values
|
66
|
+
|
67
|
+
@property
|
68
|
+
def corrected_spt_n_values(self) -> Sequence[float]:
|
69
|
+
return self._corrected_spt_n_values
|
70
|
+
|
71
|
+
@corrected_spt_n_values.setter
|
72
|
+
@validators.min_len(1)
|
73
|
+
def corrected_spt_n_values(self, val: Sequence[float]) -> None:
|
74
|
+
self._corrected_spt_n_values = val
|
32
75
|
|
33
76
|
@round_(ndigits=1)
|
34
77
|
def average_spt_n_design(self) -> float:
|
35
78
|
"""Calculates the average of the corrected SPT N-values within the
|
36
79
|
foundation influence zone.
|
37
80
|
"""
|
38
|
-
return mean(self.
|
81
|
+
return mean(self.corrected_spt_n_values)
|
39
82
|
|
40
83
|
@round_(ndigits=1)
|
41
84
|
def minimum_spt_n_design(self):
|
42
85
|
"""The lowest SPT N-value within the influence zone can be taken as the
|
43
86
|
:math:`N_{design}` as suggested by ``Terzaghi & Peck (1948)``.
|
44
87
|
"""
|
45
|
-
return min(self.
|
88
|
+
return min(self.corrected_spt_n_values)
|
46
89
|
|
47
90
|
@round_(ndigits=1)
|
48
91
|
def weighted_spt_n_design(self):
|
49
92
|
r"""Calculates the weighted average of the corrected SPT N-values
|
50
93
|
within the foundation influence zone.
|
51
94
|
|
52
|
-
|
95
|
+
:Equation:
|
53
96
|
|
54
97
|
.. math::
|
55
98
|
|
@@ -60,14 +103,16 @@ class SPTDesign:
|
|
60
103
|
sum_total = 0.0
|
61
104
|
sum_wgts = 0.0
|
62
105
|
|
63
|
-
for i,
|
106
|
+
for i, corr_spt_n_val in enumerate(self.corrected_spt_n_values,
|
107
|
+
start=1):
|
64
108
|
wgt = 1 / i ** 2
|
65
|
-
sum_total += wgt *
|
109
|
+
sum_total += wgt * corr_spt_n_val
|
66
110
|
sum_wgts += wgt
|
67
111
|
|
68
112
|
return sum_total / sum_wgts
|
69
113
|
|
70
114
|
|
115
|
+
@enum_repr
|
71
116
|
class HammerType(enum.StrEnum):
|
72
117
|
"""Enumeration of hammer types."""
|
73
118
|
AUTOMATIC = enum.auto()
|
@@ -77,6 +122,7 @@ class HammerType(enum.StrEnum):
|
|
77
122
|
DROP = PIN = enum.auto()
|
78
123
|
|
79
124
|
|
125
|
+
@enum_repr
|
80
126
|
class SamplerType(enum.StrEnum):
|
81
127
|
"""Enumeration of sampler types."""
|
82
128
|
STANDARD = enum.auto()
|
@@ -93,7 +139,7 @@ class EnergyCorrection:
|
|
93
139
|
the measured N-value to :math:`N_{60}` assuming 60% hammer energy being
|
94
140
|
transferred to the tip of the standard split spoon.
|
95
141
|
|
96
|
-
|
142
|
+
:Equation:
|
97
143
|
|
98
144
|
.. math::
|
99
145
|
|
@@ -102,6 +148,7 @@ class EnergyCorrection:
|
|
102
148
|
``ENERGY``: 0.6, 0.55, etc
|
103
149
|
"""
|
104
150
|
|
151
|
+
#: Hammer efficiency factors
|
105
152
|
HAMMER_EFFICIENCY_FACTORS = {HammerType.AUTOMATIC: 0.70,
|
106
153
|
HammerType.DONUT_1: 0.60,
|
107
154
|
HammerType.DONUT_2: 0.50,
|
@@ -109,11 +156,14 @@ class EnergyCorrection:
|
|
109
156
|
HammerType.DROP: 0.45,
|
110
157
|
HammerType.PIN: 0.45}
|
111
158
|
|
159
|
+
#: Sampler correction factors
|
112
160
|
SAMPLER_CORRECTION_FACTORS = {SamplerType.STANDARD: 1.00,
|
113
161
|
SamplerType.NON_STANDARD: 1.20}
|
114
162
|
|
115
|
-
def __init__(self, recorded_spt_n_value: int, *,
|
116
|
-
|
163
|
+
def __init__(self, recorded_spt_n_value: int, *,
|
164
|
+
energy_percentage=0.6,
|
165
|
+
borehole_diameter=65.0,
|
166
|
+
rod_length=3.0,
|
117
167
|
hammer_type=HammerType.DONUT_1,
|
118
168
|
sampler_type=SamplerType.STANDARD):
|
119
169
|
"""
|
@@ -136,7 +186,6 @@ class EnergyCorrection:
|
|
136
186
|
:param sampler_type: Sampler type, defaults to :attr:`SamplerType.STANDARD`
|
137
187
|
:type sampler_type: SamplerType, optional
|
138
188
|
"""
|
139
|
-
|
140
189
|
self.recorded_spt_n_value = recorded_spt_n_value
|
141
190
|
self.energy_percentage = energy_percentage
|
142
191
|
self.borehole_diameter = borehole_diameter
|
@@ -197,7 +246,6 @@ class EnergyCorrection:
|
|
197
246
|
corr = 1.05
|
198
247
|
else:
|
199
248
|
corr = 1.15
|
200
|
-
|
201
249
|
return corr
|
202
250
|
|
203
251
|
@property
|
@@ -216,7 +264,6 @@ class EnergyCorrection:
|
|
216
264
|
corr = 0.95
|
217
265
|
else:
|
218
266
|
corr = 1.00
|
219
|
-
|
220
267
|
return corr
|
221
268
|
|
222
269
|
def correction(self) -> float:
|
@@ -241,7 +288,7 @@ class OPC:
|
|
241
288
|
:param std_spt_n_value: SPT N-value standardized for field procedures.
|
242
289
|
:type std_spt_n_value: float
|
243
290
|
|
244
|
-
:param eop: Effective overburden pressure (:math:`
|
291
|
+
:param eop: Effective overburden pressure (:math:`kPa`).
|
245
292
|
:type eop: float
|
246
293
|
"""
|
247
294
|
self.std_spt_n_value = std_spt_n_value
|
@@ -260,7 +307,7 @@ class OPC:
|
|
260
307
|
def corrected_spt_n_value(self) -> float:
|
261
308
|
"""Corrected SPT N-value."""
|
262
309
|
corrected_spt = self.correction() * self.std_spt_n_value
|
263
|
-
# Corrected SPT should not be more
|
310
|
+
# Corrected SPT should not be more
|
264
311
|
# than 2 times the Standardized SPT
|
265
312
|
return min(corrected_spt, 2 * self.std_spt_n_value)
|
266
313
|
|
@@ -272,7 +319,7 @@ class OPC:
|
|
272
319
|
class GibbsHoltzOPC(OPC):
|
273
320
|
r"""Overburden Pressure Correction according to ``Gibbs & Holtz (1957)``.
|
274
321
|
|
275
|
-
|
322
|
+
:Equation:
|
276
323
|
|
277
324
|
.. math:: C_N = \dfrac{350}{\sigma_o + 70} \, \sigma_o \le 280kN/m^2
|
278
325
|
|
@@ -295,16 +342,14 @@ class GibbsHoltzOPC(OPC):
|
|
295
342
|
def correction(self) -> float:
|
296
343
|
"""SPT Correction."""
|
297
344
|
corr = 350.0 / (self.eop + 70.0)
|
298
|
-
if corr > 2.0
|
299
|
-
corr /= 2.0
|
300
|
-
return corr
|
345
|
+
return corr / 2.0 if corr > 2.0 else corr
|
301
346
|
|
302
347
|
|
303
348
|
class BazaraaPeckOPC(OPC):
|
304
349
|
r"""Overburden Pressure Correction according to ``Bazaraa (1967)``, and
|
305
350
|
also by ``Peck and Bazaraa (1969)``.
|
306
351
|
|
307
|
-
|
352
|
+
:Equation:
|
308
353
|
|
309
354
|
.. math::
|
310
355
|
|
@@ -316,7 +361,7 @@ class BazaraaPeckOPC(OPC):
|
|
316
361
|
C_N &= 1 \, , \, \sigma_o = 71.8kN/m^2
|
317
362
|
"""
|
318
363
|
|
319
|
-
#: Maximum effective overburden pressure
|
364
|
+
#: Maximum effective overburden pressure (:math:`kPa`).
|
320
365
|
STD_PRESSURE: Final = 71.8
|
321
366
|
|
322
367
|
@property
|
@@ -342,7 +387,7 @@ class BazaraaPeckOPC(OPC):
|
|
342
387
|
class PeckOPC(OPC):
|
343
388
|
r"""Overburden Pressure Correction according to ``Peck et al. (1974)``.
|
344
389
|
|
345
|
-
|
390
|
+
:Equation:
|
346
391
|
|
347
392
|
.. math:: C_N = 0.77 \log \left(\dfrac{2000}{\sigma_o} \right)
|
348
393
|
"""
|
@@ -364,7 +409,7 @@ class PeckOPC(OPC):
|
|
364
409
|
class LiaoWhitmanOPC(OPC):
|
365
410
|
r"""Overburden Pressure Correction according to ``Liao & Whitman (1986)``.
|
366
411
|
|
367
|
-
|
412
|
+
:Equation:
|
368
413
|
|
369
414
|
.. math:: C_N = \sqrt{\dfrac{100}{\sigma_o}}
|
370
415
|
"""
|
@@ -386,7 +431,7 @@ class LiaoWhitmanOPC(OPC):
|
|
386
431
|
class SkemptonOPC(OPC):
|
387
432
|
r"""Overburden Pressure Correction according to ``Skempton (1986)``.
|
388
433
|
|
389
|
-
|
434
|
+
:Equation:
|
390
435
|
|
391
436
|
.. math:: C_N = \dfrac{2}{1 + 0.01044 \cdot \sigma_o}
|
392
437
|
"""
|
@@ -412,7 +457,7 @@ class DilatancyCorrection:
|
|
412
457
|
correction, overburden pressure correction is applied first and then
|
413
458
|
dilatancy correction is applied.
|
414
459
|
|
415
|
-
|
460
|
+
:Equation:
|
416
461
|
|
417
462
|
.. math::
|
418
463
|
|
@@ -422,26 +467,26 @@ class DilatancyCorrection:
|
|
422
467
|
(N_1)_{60} &= (N_1)_{60} \, , \, (N_1)_{60} \le 15
|
423
468
|
"""
|
424
469
|
|
425
|
-
def __init__(self,
|
470
|
+
def __init__(self, corr_spt_n_value: float) -> None:
|
426
471
|
"""
|
427
|
-
:param
|
472
|
+
:param corr_spt_n_value: SPT N-value standardized for field procedures
|
428
473
|
and/or corrected for overburden pressure.
|
429
|
-
:type
|
474
|
+
:type corr_spt_n_value: float
|
430
475
|
"""
|
431
|
-
self.
|
476
|
+
self.corr_spt_n_value = corr_spt_n_value
|
432
477
|
|
433
478
|
@property
|
434
|
-
def
|
479
|
+
def corr_spt_n_value(self) -> float:
|
435
480
|
return self._std_spt_n_value
|
436
481
|
|
437
|
-
@
|
482
|
+
@corr_spt_n_value.setter
|
438
483
|
@validators.gt(0.0)
|
439
|
-
def
|
484
|
+
def corr_spt_n_value(self, val: float) -> None:
|
440
485
|
self._std_spt_n_value = val
|
441
486
|
|
442
487
|
@round_(ndigits=1)
|
443
488
|
def corrected_spt_n_value(self) -> float:
|
444
489
|
"""Corrected SPT N-value."""
|
445
|
-
if self.
|
446
|
-
return self.
|
447
|
-
return 15.0 + 0.5 * (self.
|
490
|
+
if self.corr_spt_n_value <= 15.0:
|
491
|
+
return self.corr_spt_n_value
|
492
|
+
return 15.0 + 0.5 * (self.corr_spt_n_value - 15.0)
|
@@ -1,15 +1,15 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: geolysis
|
3
|
-
Version: 0.4.
|
4
|
-
Summary: geolysis
|
3
|
+
Version: 0.4.3
|
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
|
7
|
-
Project-URL: Homepage, https://
|
8
|
-
Project-URL: Documentation, https://geolysis.
|
7
|
+
Project-URL: Homepage, https://docs.geolysis.io
|
8
|
+
Project-URL: Documentation, https://docs.geolysis.io
|
9
9
|
Project-URL: Repository, https://github.com/patrickboateng/geolysis
|
10
10
|
Project-URL: Discussions, https://github.com/patrickboateng/geolysis/discussions
|
11
11
|
Project-URL: Issue Tracker, https://github.com/patrickboateng/geolysis/issues
|
12
|
-
Keywords: geotechnical-engineering,soil-classification,
|
12
|
+
Keywords: geotechnical-engineering,soil-classification,bearing-capacity-analysis,standard-penetration-test-analysis
|
13
13
|
Classifier: Development Status :: 4 - Beta
|
14
14
|
Classifier: Intended Audience :: Developers
|
15
15
|
Classifier: Intended Audience :: Education
|
@@ -29,14 +29,15 @@ Requires-Dist: pytest; extra == "dev"
|
|
29
29
|
Requires-Dist: pytest-cov; extra == "dev"
|
30
30
|
Requires-Dist: coverage; extra == "dev"
|
31
31
|
|
32
|
-
<
|
32
|
+
<div align="center">
|
33
33
|
<img src="https://raw.githubusercontent.com/patrickboateng/geolysis/dev/docs/source/_static/branding/geolysislogo.svg"
|
34
34
|
alt="geolysislogo" width="75%" />
|
35
|
-
</
|
35
|
+
</div><br>
|
36
36
|
|
37
37
|
<div align="center">
|
38
38
|
|
39
39
|
[](https://pypi.org/project/geolysis/)
|
40
|
+
[](https://pepy.tech/projects/geolysis)
|
40
41
|
[](https://pypi.python.org/pypi/geolysis/)
|
41
42
|
[](https://opensource.org/license/mit/)
|
42
43
|
|
@@ -116,106 +117,70 @@ Here are brief descriptions of these projects:
|
|
116
117
|
|
117
118
|
## Installation
|
118
119
|
|
119
|
-
**_Note: Work on the latest update is still in progress, so the usage example
|
120
|
-
below
|
121
|
-
will not function if installed._**
|
122
|
-
|
123
120
|
```shell
|
124
|
-
|
121
|
+
$ pip install geolysis
|
125
122
|
```
|
126
123
|
|
127
124
|
## Usage Example
|
128
125
|
|
129
126
|
```python
|
130
127
|
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
...
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
...
|
140
|
-
clf_type = "USCS")
|
141
|
-
>> > clf = uscs_clf.classify()
|
142
|
-
>> > clf
|
128
|
+
>>> from geolysis.soil_classifier import create_soil_classifier
|
129
|
+
>>> uscs_clf = create_soil_classifier(liquid_limit=34.1,
|
130
|
+
... plastic_limit=21.1,
|
131
|
+
... fines=47.88,
|
132
|
+
... sand=37.84,
|
133
|
+
... clf_type="USCS")
|
134
|
+
>>> clf = uscs_clf.classify()
|
135
|
+
>>> clf
|
143
136
|
SoilClf(symbol='SC', description='Clayey sands')
|
144
|
-
|
137
|
+
>>> clf.symbol
|
145
138
|
'SC'
|
146
|
-
|
139
|
+
>>> clf.description
|
147
140
|
'Clayey sands'
|
148
141
|
|
149
142
|
```
|
150
143
|
|
151
144
|
```python
|
152
145
|
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
...
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
...
|
162
|
-
clf_type = "AASHTO")
|
163
|
-
>> > clf = aashto_clf.classify()
|
164
|
-
>> > clf
|
146
|
+
>>> from geolysis.soil_classifier import create_soil_classifier
|
147
|
+
>>> aashto_clf = create_soil_classifier(liquid_limit=34.1,
|
148
|
+
... plastic_limit=21.1,
|
149
|
+
... fines=47.88,
|
150
|
+
... sand=37.84, # Sand is optional for AASHTO classification
|
151
|
+
... clf_type="AASHTO")
|
152
|
+
>>> clf = aashto_clf.classify()
|
153
|
+
>>> clf
|
165
154
|
SoilClf(symbol='A-6(4)', description='Clayey soils')
|
166
|
-
|
155
|
+
>>> clf.symbol
|
167
156
|
'A-6(4)'
|
168
|
-
|
157
|
+
>>> clf.description
|
169
158
|
'Clayey soils'
|
170
159
|
|
171
160
|
```
|
172
161
|
|
173
162
|
## Features
|
174
163
|
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
<tr>
|
186
|
-
<td rowspan="4">
|
187
|
-
<strong>Standard Penetration Test (SPT) Analysis</strong>
|
188
|
-
</td>
|
189
|
-
<td>SPT Energy Correction</td>
|
190
|
-
</tr>
|
191
|
-
<tr>
|
192
|
-
<td>SPT Overburden Pressure Correction</td>
|
193
|
-
</tr>
|
194
|
-
<tr>
|
195
|
-
<td>Dilatancy Correction</td>
|
196
|
-
</tr>
|
197
|
-
<tr>
|
198
|
-
<td>SPT N-Design Calculation</td>
|
199
|
-
</tr>
|
200
|
-
<tr>
|
201
|
-
<td rowspan="2">
|
202
|
-
<strong>Bearing Capacity Estimation</strong>
|
203
|
-
</td>
|
204
|
-
<td>Allowable Bearing Capacity Estimation</td>
|
205
|
-
</tr>
|
206
|
-
<tr>
|
207
|
-
<td>Ultimate Bearing Capacity Estimation</td>
|
208
|
-
</tr>
|
209
|
-
</table>
|
164
|
+
| | |
|
165
|
+
|----------------------------------------------|---------------------------------------|
|
166
|
+
| **Soil Classification** | AASHTO Classification System |
|
167
|
+
| | Unified Soil Classification System |
|
168
|
+
| **Standard Penetration Test (SPT) Analysis** | SPT Energy Correction |
|
169
|
+
| | SPT Overburden Pressure Correction |
|
170
|
+
| | Dilatancy Correction |
|
171
|
+
| | SPT N-Design Calculation |
|
172
|
+
| **Bearing Capacity Estimation** | Allowable Bearing Capacity Estimation |
|
173
|
+
| | Ultimate Bearing Capacity Estimation |
|
210
174
|
|
211
175
|
## Documentation
|
212
176
|
|
213
|
-
Full documentation is available [here](https://
|
214
|
-
|
215
|
-
**_Note: Work on the latest documentation is still ongoing._**
|
177
|
+
Full documentation is available [here](https://docs.geolysis.io/en/latest/)
|
216
178
|
|
217
179
|
## Contributing
|
218
180
|
|
181
|
+
Contribution guidelines can be
|
182
|
+
found [here](https://docs.geolysis.io/en/latest/dev_guide/index.html)
|
183
|
+
|
219
184
|
## License
|
220
185
|
|
221
186
|
This project is licensed under the MIT License - see the
|
@@ -0,0 +1,9 @@
|
|
1
|
+
geolysis/__init__.py,sha256=Nyg0pmk5ea9-SLCAFEIF96ByFx4-TJFtrqYPN-Zn6g4,22
|
2
|
+
geolysis/foundation.py,sha256=KIZewS9-l_tSDtgy9Ym5ADHETTuho3GJPBguh3Y28fw,10149
|
3
|
+
geolysis/soil_classifier.py,sha256=GsT7qNwfXjZh0zo1O2e7iTN35ywdvzEs4vgaaqYA7Lo,26786
|
4
|
+
geolysis/spt.py,sha256=E8rg6wKL4jbX8Xz-p9KdyfGxcQr8TdoZR4ZA9eUU4aI,14246
|
5
|
+
geolysis-0.4.3.dist-info/LICENSE.txt,sha256=ap6sMs3lT7ICbEXBhgihwH1BTCVcjmCQkIkwVnil1Ak,1065
|
6
|
+
geolysis-0.4.3.dist-info/METADATA,sha256=-hGWQ3izaFfDhQ44lc7ZSM83WmllA-RbbQYuKqWKWUQ,7394
|
7
|
+
geolysis-0.4.3.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
|
8
|
+
geolysis-0.4.3.dist-info/top_level.txt,sha256=9mnQgOaCRr11dtXff8X-q3FfXjRONd6kHseSy5q2y8g,9
|
9
|
+
geolysis-0.4.3.dist-info/RECORD,,
|
geolysis/utils.py
DELETED
@@ -1,78 +0,0 @@
|
|
1
|
-
import functools
|
2
|
-
import math
|
3
|
-
from math import exp, inf, isclose, log10, pi, sqrt
|
4
|
-
from statistics import fmean as mean
|
5
|
-
from typing import Callable, SupportsRound
|
6
|
-
|
7
|
-
__all__ = ["inf", "pi", "deg2rad", "rad2deg", "tan", "cot", "sin", "cos",
|
8
|
-
"arctan", "round_", "mean", "exp", "isclose", "log10", "sqrt"]
|
9
|
-
|
10
|
-
|
11
|
-
def deg2rad(x: float, /) -> float:
|
12
|
-
"""Convert angle x from degrees to radians."""
|
13
|
-
return math.radians(x)
|
14
|
-
|
15
|
-
|
16
|
-
def rad2deg(x: float, /) -> float:
|
17
|
-
"""Convert angle x from radians to degrees."""
|
18
|
-
return math.degrees(x)
|
19
|
-
|
20
|
-
|
21
|
-
def tan(x: float, /) -> float:
|
22
|
-
"""Return the tangent of x (measured in degrees)."""
|
23
|
-
return math.tan(deg2rad(x))
|
24
|
-
|
25
|
-
|
26
|
-
def cot(x: float, /) -> float:
|
27
|
-
"""Return the cotangent of x (measured in degrees)."""
|
28
|
-
return 1 / tan(x)
|
29
|
-
|
30
|
-
|
31
|
-
def sin(x: float, /) -> float:
|
32
|
-
"""Return the sine of x (measured in degrees)."""
|
33
|
-
return math.sin(deg2rad(x))
|
34
|
-
|
35
|
-
|
36
|
-
def cos(x: float, /) -> float:
|
37
|
-
"""Return the cosine of x (measured in degrees)."""
|
38
|
-
return math.cos(deg2rad(x))
|
39
|
-
|
40
|
-
|
41
|
-
def arctan(x: float, /) -> float:
|
42
|
-
"""Return the arc tangent (measured in degrees) of x."""
|
43
|
-
return rad2deg(math.atan(x))
|
44
|
-
|
45
|
-
|
46
|
-
def round_(ndigits: int | Callable[..., SupportsRound]) -> Callable:
|
47
|
-
"""A decorator that rounds the result of a callable to a specified number
|
48
|
-
of decimal places.
|
49
|
-
|
50
|
-
The returned value of the callable should support the ``__round__`` dunder
|
51
|
-
method and should be a numeric value. ``ndigits`` can either be an int
|
52
|
-
which will indicate the number of decimal places to round to or a
|
53
|
-
callable. If ``ndigits`` is callable the default decimal places is 2.
|
54
|
-
|
55
|
-
TypeError is raised when ``ndigits`` is neither an int nor a callable.
|
56
|
-
"""
|
57
|
-
|
58
|
-
default_dp = 2
|
59
|
-
|
60
|
-
def dec(fn) -> Callable[..., float]:
|
61
|
-
@functools.wraps(fn)
|
62
|
-
def wrapper(*args, **kwargs) -> float:
|
63
|
-
dp = ndigits if not callable(ndigits) else default_dp
|
64
|
-
res = fn(*args, **kwargs)
|
65
|
-
return round(res, ndigits=dp)
|
66
|
-
|
67
|
-
return wrapper
|
68
|
-
|
69
|
-
# See if we're being called as @round_ or @round_().
|
70
|
-
# We're called with parens.
|
71
|
-
if isinstance(ndigits, int):
|
72
|
-
return dec
|
73
|
-
|
74
|
-
# We're called as @round_ without parens.
|
75
|
-
if callable(ndigits):
|
76
|
-
return dec(ndigits)
|
77
|
-
|
78
|
-
raise TypeError("ndigits must be an int or a callable")
|
geolysis/validators.py
DELETED
@@ -1,54 +0,0 @@
|
|
1
|
-
import operator
|
2
|
-
from typing import Callable, TypeAlias
|
3
|
-
|
4
|
-
|
5
|
-
class _NumberValidator:
|
6
|
-
def __init__(self, bound: float,
|
7
|
-
compare_op: str,
|
8
|
-
compare_fn: Callable,
|
9
|
-
exc_type=ValueError,
|
10
|
-
err_msg=None) -> None:
|
11
|
-
self.bound = bound
|
12
|
-
self.compare_op = compare_op
|
13
|
-
self.compare_fn = compare_fn
|
14
|
-
self.exc_type = exc_type
|
15
|
-
self.err_msg = err_msg
|
16
|
-
|
17
|
-
def __call__(self, fn):
|
18
|
-
def wrapper(obj, val):
|
19
|
-
if not self.compare_fn(val, self.bound):
|
20
|
-
if self.err_msg:
|
21
|
-
msg = self.err_msg
|
22
|
-
else:
|
23
|
-
msg = f"{fn.__name__} must be {self.compare_op} {self.bound}"
|
24
|
-
raise self.exc_type(msg)
|
25
|
-
return fn(obj, val)
|
26
|
-
|
27
|
-
return wrapper
|
28
|
-
|
29
|
-
|
30
|
-
Number: TypeAlias = int | float
|
31
|
-
|
32
|
-
|
33
|
-
def lt(val: Number, /, *, exc_type=ValueError, err_msg=None):
|
34
|
-
return _NumberValidator(val, "<", operator.lt, exc_type, err_msg)
|
35
|
-
|
36
|
-
|
37
|
-
def le(val: Number, /, *, exc_type=ValueError, err_msg=None):
|
38
|
-
return _NumberValidator(val, "<=", operator.le, exc_type, err_msg)
|
39
|
-
|
40
|
-
|
41
|
-
def eq(val: Number, /, *, exc_type=ValueError, err_msg=None):
|
42
|
-
return _NumberValidator(val, "==", operator.eq, exc_type, err_msg)
|
43
|
-
|
44
|
-
|
45
|
-
def ne(val: Number, /, *, exc_type=ValueError, err_msg=None):
|
46
|
-
return _NumberValidator(val, "!=", operator.ne, exc_type, err_msg)
|
47
|
-
|
48
|
-
|
49
|
-
def ge(val: Number, /, *, exc_type=ValueError, err_msg=None):
|
50
|
-
return _NumberValidator(val, ">=", operator.ge, exc_type, err_msg)
|
51
|
-
|
52
|
-
|
53
|
-
def gt(val: Number, /, *, exc_type=ValueError, err_msg=None):
|
54
|
-
return _NumberValidator(val, ">", operator.gt, exc_type, err_msg)
|
geolysis-0.4.2.dist-info/RECORD
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
geolysis/__init__.py,sha256=XZTtMHzfsLe7mt08DNl_2Qui1xPYU8f504pS-Q8yKzY,77
|
2
|
-
geolysis/foundation.py,sha256=aZVLOrRSx1ALwJwQwrnCQOMc4fQf4gAoBmHjI0tyNLo,9548
|
3
|
-
geolysis/soil_classifier.py,sha256=FhfWYEo5dIQ1QWL83u5lX19AfMCCsnf0Klb67ekOLHc,26133
|
4
|
-
geolysis/spt.py,sha256=jlO2gIGpM-sKhBQRSaCe3iNFZ8xKq9XiZnxVcxzhyBg,13647
|
5
|
-
geolysis/utils.py,sha256=lonWt3VIB-zQjplCTzwUSIBxah4sB4fBh1l92iXE-NY,2313
|
6
|
-
geolysis/validators.py,sha256=j6ek90_si4caeVmPMEPTvSxBh0LnxiqXWKzUjF0Htbc,1662
|
7
|
-
geolysis-0.4.2.dist-info/LICENSE.txt,sha256=ap6sMs3lT7ICbEXBhgihwH1BTCVcjmCQkIkwVnil1Ak,1065
|
8
|
-
geolysis-0.4.2.dist-info/METADATA,sha256=yjsbp0sU4JTVH_S63ncjIyCruTBs1eucjd6ktoUIzNs,7059
|
9
|
-
geolysis-0.4.2.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
10
|
-
geolysis-0.4.2.dist-info/top_level.txt,sha256=9mnQgOaCRr11dtXff8X-q3FfXjRONd6kHseSy5q2y8g,9
|
11
|
-
geolysis-0.4.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|