geolysis 0.2.0__py3-none-any.whl → 0.3.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
geolysis/core/utils.py ADDED
@@ -0,0 +1,113 @@
1
+ import functools
2
+ import math
3
+ from math import exp, isclose, log, log10, pi, sqrt
4
+ from statistics import fmean
5
+ from typing import Callable, SupportsRound
6
+
7
+ from .constants import DECIMAL_PLACES
8
+
9
+ __all__ = [
10
+ "deg2rad",
11
+ "rad2deg",
12
+ "tan",
13
+ "cot",
14
+ "sin",
15
+ "cos",
16
+ "arctan",
17
+ "round_",
18
+ ]
19
+
20
+ PI = pi
21
+ mean = fmean
22
+
23
+
24
+ def deg2rad(__x: float, /) -> float:
25
+ """Convert angle x from degrees to radians."""
26
+ return math.radians(__x)
27
+
28
+
29
+ def rad2deg(__x: float, /) -> float:
30
+ """Convert angle x from radians to degrees."""
31
+ return math.degrees(__x)
32
+
33
+
34
+ def tan(__x: float, /) -> float:
35
+ """Return the tangent of x (measured in degrees)."""
36
+ return math.tan(deg2rad(__x))
37
+
38
+
39
+ def cot(__x: float, /) -> float:
40
+ """Return the cotangent of x (measured in degrees)."""
41
+ return 1 / tan(__x)
42
+
43
+
44
+ def sin(__x: float, /) -> float:
45
+ """Return the sine of x (measured in degrees)."""
46
+ return math.sin(deg2rad(__x))
47
+
48
+
49
+ def cos(__x: float, /) -> float:
50
+ """Return the cosine of x (measured in degrees)."""
51
+ return math.cos(deg2rad(__x))
52
+
53
+
54
+ def arctan(__x: float, /) -> float:
55
+ """Return the arc tangent (measured in degrees) of x."""
56
+ return rad2deg(math.atan(__x))
57
+
58
+
59
+ def round_(ndigits: int | Callable[..., SupportsRound]) -> Callable:
60
+ """A decorator that rounds the result of a callable to a specified number
61
+ of decimal places.
62
+
63
+ The returned value of the callable shoud support the ``__round__`` dunder
64
+ method and should be a numeric value. ``ndigits`` can either be an int
65
+ which will indicates the number of decimal places to round to or a callable,
66
+ which by default rounds the returned value to 4 decimal places.
67
+
68
+ TypeError is raised when ``ndigits`` is neither an int or a callable.
69
+
70
+ Examples
71
+ --------
72
+ >>> @round_(ndigits=2)
73
+ ... def area_of_circle(radius: float):
74
+ ... return PI * (radius ** 2)
75
+
76
+ >>> area_of_circle(radius=2.0)
77
+ 12.57
78
+
79
+ By default the function is rounded to 4 decimal places.
80
+
81
+ >>> @round_
82
+ ... def area_of_circle(radius: float):
83
+ ... return PI * (radius ** 2)
84
+
85
+ >>> area_of_circle(radius=2.0)
86
+ 12.5664
87
+
88
+ >>> @round_(ndigits=2.0)
89
+ ... def area_of_square(width: float):
90
+ ... return width ** 2
91
+ Traceback (most recent call last):
92
+ ...
93
+ TypeError: ndigits should be an int or a callable.
94
+ """
95
+
96
+ def dec(func, ndigits=DECIMAL_PLACES):
97
+ @functools.wraps(func)
98
+ def wrapper(*args, **kwargs) -> float:
99
+ return round(func(*args, **kwargs), ndigits=ndigits)
100
+
101
+ return wrapper
102
+
103
+ # See if we're being called as @round_ or @round_().
104
+ if isinstance(ndigits, int):
105
+ # We're called with parens.
106
+ return functools.partial(dec, ndigits=ndigits)
107
+ if callable(ndigits):
108
+ # We're called as @round_ without parens.
109
+ f = ndigits
110
+ return dec(f)
111
+ else:
112
+ err_msg = "ndigits should be an int or a callable."
113
+ raise TypeError(err_msg)
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2023 geolysis
3
+ Copyright (c) 2024 geolysis
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -0,0 +1,223 @@
1
+ Metadata-Version: 2.1
2
+ Name: geolysis
3
+ Version: 0.3.0
4
+ Summary: geolysis.core is an opensource software for geotechnical engineering analysis and modeling.
5
+ Author-email: Patrick Boateng <boatengpato.pb@gmail.com>
6
+ License: MIT License
7
+ Project-URL: Homepage, https://github.com/patrickboateng/geolysis
8
+ Project-URL: Repository, https://github.com/patrickboateng/geolysis
9
+ Project-URL: Changelog, https://github.com/patrickboateng/geolysis/blob/main/CHANGELOG.md
10
+ Project-URL: Issue Tracker, https://github.com/patrickboateng/geolysis/issues
11
+ Project-URL: Discussions, https://github.com/patrickboateng/geolysis/discussions
12
+ Keywords: discrete-element-method,geotechnical-engineering,soil-classification,settlement-analysis,bearing-capacity-analysis
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Intended Audience :: Education
16
+ Classifier: Intended Audience :: Science/Research
17
+ Classifier: License :: OSI Approved :: MIT License
18
+ Classifier: Natural Language :: English
19
+ Classifier: Operating System :: OS Independent
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Programming Language :: Python :: Implementation :: CPython
24
+ Classifier: Topic :: Scientific/Engineering
25
+ Requires-Python: >=3.10
26
+ Description-Content-Type: text/markdown
27
+ License-File: LICENSE.txt
28
+ Provides-Extra: dev
29
+ Requires-Dist: black ; extra == 'dev'
30
+ Requires-Dist: pytest ; extra == 'dev'
31
+ Requires-Dist: mypy ; extra == 'dev'
32
+ Requires-Dist: pytest-cov ; extra == 'dev'
33
+ Requires-Dist: coverage ; extra == 'dev'
34
+
35
+ [code_of_conduct_url]: https://github.com/patrickboateng/geolysis/blob/main/CODE_OF_CONDUCT.md/
36
+ [contributing_url]: https://github.com/patrickboateng/geolysis/blob/main/docs/CONTRIBUTING.md#how-to-contribute
37
+ [license_url]: https://github.com/patrickboateng/geolysis/blob/main/LICENSE.txt
38
+
39
+ # geolysis
40
+
41
+ <div align="center">
42
+
43
+ [![PyPI Latest Release](https://img.shields.io/pypi/v/geolysis?style=flat&logo=pypi)](https://pypi.org/project/geolysis/)
44
+ [![PyPI pyversions](https://img.shields.io/pypi/pyversions/geolysis.svg?logo=python&style=flat)](https://pypi.python.org/pypi/geolysis/)
45
+ [![license](https://img.shields.io/pypi/l/geolysis?style=flat&logo=opensourceinitiative)](https://opensource.org/license/mit/)
46
+
47
+ ![Coveralls Status](https://img.shields.io/coverallsCoverage/github/patrickboateng/geolysis?logo=coveralls)
48
+ [![Unit-Tests](https://github.com/patrickboateng/geolysis/actions/workflows/unit-tests.yml/badge.svg)](https://github.com/patrickboateng/geolysis/actions/workflows/unit-tests.yml)
49
+ [![Pkg Build](https://github.com/patrickboateng/geolysis/actions/workflows/pkg_build.yml/badge.svg)](https://github.com/patrickboateng/geolysis/actions/workflows/pkg_build.yml)
50
+ [![Documentation Status](https://readthedocs.org/projects/geolysis/badge/?version=latest)](https://geolysis.readthedocs.io/en/latest/?badge=latest)
51
+
52
+ </div>
53
+
54
+ #
55
+
56
+ `geolysis` is your one-stop shop for all your geotechnical engineering
57
+ solutions, ranging from site investigation and laboratory test analysis
58
+ to advanced geotechnical designs.
59
+
60
+ `geolysis` is divided into four (4) main parts:
61
+
62
+ 1. `geolyis.core (Python Package)`
63
+
64
+ `geolysis.core` is an open-source Python package that provides features
65
+ for analyzing geotechnical results obtained from field and laboratory
66
+ tests. `geolysis.core` is designed specifically to assist developers
67
+ in building applications that can solve complex geotechnical
68
+ problems.
69
+
70
+ Whether you're working on soil mechanics, rock mechanics, or any other
71
+ geotechnical field, `geolysis.core` provides a powerful set of tools
72
+ that can help you design and develop robust solutions. With an
73
+ intuitive API and a wide range of features, this software is an
74
+ essential tool for anyone who needs to work with geotechnical data on
75
+ a regular basis. Whether you're a seasoned geotechnical engineer or a
76
+ new developer just getting started in the field, `geolysis.core` is
77
+ the ideal solution for all your software development needs.
78
+
79
+ Some of the features implemented so far include soil classification,
80
+ standard penetration test analysis (such as SPT N-design and SPT
81
+ N-value corrections), and calculating the allowable bearing capacity of
82
+ soils from Standard Penetration Test N-values. There are more features
83
+ underway, which include settlement analysis, ultimate bearing capacity
84
+ analysis, etc.
85
+
86
+ `geolysis.core` is the foundation application on which other parts of the
87
+ application will depend. Developers can also use `geolysis.core` to power
88
+ their applications.
89
+
90
+ 1. `geolysis.ui (Qt, PySide6)`
91
+
92
+ `geolysis.ui` is a Graphical User Interface (GUI) which will enable
93
+ users to graphically interact with `geolysis`. User will be able to
94
+ input data and view generated plots, such as `PSD` curves,
95
+ `Atterberg Limits` plots, `Compaction` curves, etc within the application.
96
+
97
+ 1. `geolysis.excel (Javascript & Others)`
98
+
99
+ `geolysis.excel` provides a Microsoft Excel add-in for simple geotechnical
100
+ analysis. _More on this later._
101
+
102
+ 1. `geolysis.ai (Python, Pytorch & Others)`
103
+
104
+ `geolysis.ai` explores the use of Artificial Intelligence (**AI**) in
105
+ enhancing productivity in Geotechnical Engineering.
106
+
107
+ ## Project Links
108
+
109
+ - [Documentation](https://geolysis.readthedocs.org/en/latest)
110
+ - [Repo](https://github.com/patrickboateng/geolysis)
111
+ - [PyPi](https://pypi.org/project/geolysis/)
112
+ - [Bug Reports](https://github.com/patrickboateng/geolysis/issues)
113
+ - [Discussions](https://github.com/patrickboateng/geolysis/discussions)
114
+
115
+ <!-- > [!IMPORTANT]
116
+ > Project documentation is underway -->
117
+
118
+ ## Table of Contents
119
+
120
+ - [Motivation](#motivation)
121
+ - [Installation](#installation)
122
+ - [Getting Started](#getting-started)
123
+ - [Soil Classification Example](#soil-classification-example)
124
+ - [Release History](#release-history)
125
+ - [Code of Conduct](#code-of-conduct)
126
+ - [Contributing](#contributing)
127
+ - [License](#license)
128
+ - [Governance of this project](#governance-of-this-project)
129
+ - [Contact Information](#contact-information)
130
+
131
+ ## Motivation
132
+
133
+ `geolysis` is a software solution that aims to support geotechnical
134
+ engineers in their daily work by providing a set of tools that makes
135
+ them perform their tasks in a more efficient and effective manner.
136
+ Moreover, the platform is designed to educate civil engineering
137
+ students, especially those who specialize in geotechnical engineering,
138
+ by exposing them to industry-relevant tools and techniques that will
139
+ help them become industry-ready professionals as soon as they graduate.
140
+ With `geolysis`, users will be better equipped to handle geotechnical
141
+ challenges, make informed decisions, and improve their overall
142
+ productivity.
143
+
144
+ ## Installation
145
+
146
+ ```shell
147
+ pip install geolysis
148
+ ```
149
+
150
+ ## Getting Started
151
+
152
+ ### Soil Classification Example
153
+
154
+ AASHTO classification
155
+
156
+ ```python
157
+
158
+ >>> from geolysis.core.soil_classifier import AASHTO
159
+ >>> aashto_cls = AASHTO(liquid_limit=30.2, plasticity_index=6.3, fines=11.18)
160
+ >>> aashto_cls.soil_class
161
+ 'A-2-4(0)'
162
+ >>> aashto_cls.soil_desc
163
+ 'Silty or clayey gravel and sand'
164
+
165
+ ```
166
+
167
+ USCS Classification
168
+
169
+ ```python
170
+
171
+ >>> from geolysis.core.soil_classifier import USCS
172
+ >>> uscs_cls = USCS(liquid_limit=34.1, plastic_limit=21.1,
173
+ ... fines=47.88, sand=37.84, gravel=14.8)
174
+ >>> uscs_cls.soil_class
175
+ 'SC'
176
+ >>> uscs_cls.soil_desc
177
+ 'Clayey sands'
178
+ >>> uscs_cls = USCS(liquid_limit=30.8, plastic_limit=20.7, fines=10.29,
179
+ ... sand=81.89, gravel=7.83, d_10=0.07, d_30=0.3, d_60=0.8)
180
+ >>> uscs_cls.soil_class
181
+ 'SW-SC'
182
+ >>> uscs_cls.soil_desc
183
+ 'Well graded sand with clay'
184
+
185
+ ```
186
+
187
+ <!-- See the [Quick start section] of the docs for more examples. -->
188
+
189
+ ## Release History
190
+
191
+ Check out the [release notes](https://geolysis.rtfd.io/en/latest/release_notes/index.html)
192
+ for features.
193
+
194
+ ## Code of Conduct
195
+
196
+ This project has a [code of conduct][code_of_conduct_url] that
197
+ we expect all contributors to adhere to. Please read and follow
198
+ it when participating in this project.
199
+
200
+ ## Contributing
201
+
202
+ If you would like to contribute to this project, please read
203
+ the [contributing guidelines][contributing_url]
204
+
205
+ ## License
206
+
207
+ Distributed under the [**MIT**][license_url] license. By using,
208
+ distributing, or contributing to this project, you agree to the
209
+ terms and conditions of this license.
210
+
211
+ ## Governance of this project
212
+
213
+ `geolysis.core` is still developing relatively rapidly, so please
214
+ be patient if things change or features iterate and change quickly.
215
+ Once `geolysis.core` hits `1.0.0`, it will slow down considerably.
216
+
217
+ ## Contact Information
218
+
219
+ - [**LinkedIn**](https://linkedin.com/in/patrickboateng/)
220
+
221
+ > [!IMPORTANT]
222
+ > For questions or comments about `geolysis`, please ask them in the
223
+ > [discussions forum](https://github.com/patrickboateng/geolysis/discussions)
@@ -0,0 +1,14 @@
1
+ geolysis/__init__.py,sha256=zx-qiZgxpqlBnRhbSC3Atn4wTeLI-j3ZfaowNSvMkio,45
2
+ geolysis/core/__init__.py,sha256=T5IlKVd6bNn-QDNpccpTm-H8UUVXTjj-R6HpNYqJODo,149
3
+ geolysis/core/abc_4_cohl_soils.py,sha256=UuIlFqQ222bOdFUf_1_Iign7oJum8dQqlOIMSEtmYVc,15401
4
+ geolysis/core/constants.py,sha256=zUZHKG5JlP-2LTg60C8wMK2sNaqVMs3PodH7ilu8ByQ,991
5
+ geolysis/core/estimators.py,sha256=U9oJsJuEZmxWRzVQYUmH_xm4zYtn9SAdkZMxHrzcJIA,13324
6
+ geolysis/core/foundation.py,sha256=iG5ClXNDOd9TZHr9-gRrTF9jdbRbf92wrL1cAK0yHk4,13692
7
+ geolysis/core/soil_classifier.py,sha256=epViYXXe4VseiZpglVFFOVLUVhm5iJl7zg1_dBLBWwM,28201
8
+ geolysis/core/spt.py,sha256=Cd3nD4vNO115qLwUUJJDcjVR7p3lAKUnf3LQoYe_whU,17109
9
+ geolysis/core/utils.py,sha256=YKsWhp_q4rKS6XefbyuV_i_WLex65yrvYcHws_j2GmE,3070
10
+ geolysis-0.3.0.dist-info/LICENSE.txt,sha256=IeI21JgXY_KBFnrGG2YJmzozgQMM7tLvlikBlsyBLh8,1086
11
+ geolysis-0.3.0.dist-info/METADATA,sha256=FK4JUSvChmcM9O-zEOxgcTsPrHis-rcykIbYNdq5hkQ,9012
12
+ geolysis-0.3.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
13
+ geolysis-0.3.0.dist-info/top_level.txt,sha256=9mnQgOaCRr11dtXff8X-q3FfXjRONd6kHseSy5q2y8g,9
14
+ geolysis-0.3.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.42.0)
2
+ Generator: bdist_wheel (0.43.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1 +0,0 @@
1
- from . import abc