From 3f0a418a3ce997a9614be6bd9d9a2917f6b5e607 Mon Sep 17 00:00:00 2001 From: jsh9 <25124332+jsh9@users.noreply.github.com> Date: Sun, 8 Jan 2023 18:16:41 -0800 Subject: [PATCH] Update example and docstring; v0.5.1 --- PySeismoSoil/__init__.py | 2 +- PySeismoSoil/class_curves.py | 2 +- docs/source/conf.py | 2 +- docs/source/index.rst | 2 +- examples/Demo_04_Curves.ipynb | 203 ++++++++++++++++++++-------------- setup.py | 2 +- 6 files changed, 128 insertions(+), 85 deletions(-) diff --git a/PySeismoSoil/__init__.py b/PySeismoSoil/__init__.py index 8de3123..034e128 100644 --- a/PySeismoSoil/__init__.py +++ b/PySeismoSoil/__init__.py @@ -1,3 +1,3 @@ # Author: Jian Shi -__version__ = 'v0.5.0' +__version__ = 'v0.5.1' diff --git a/PySeismoSoil/class_curves.py b/PySeismoSoil/class_curves.py index 384f689..486d7f2 100644 --- a/PySeismoSoil/class_curves.py +++ b/PySeismoSoil/class_curves.py @@ -211,7 +211,7 @@ class Damping_Curve(Curve): ---------- data : numpy.ndarray A 2D numpy array with 2 columns. Its 0th column contains the strain - array, and the 1st column contains the G/Gmax values. + array, and the 1st column contains the damping values. strain_unit : {'1', '%'} The unit of the strain. damping_unit : {'1', '%'} diff --git a/docs/source/conf.py b/docs/source/conf.py index 842402f..3987f82 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -23,7 +23,7 @@ author = 'Jian Shi' # The full version, including alpha/beta/rc tags -release = 'v0.5.0' +release = 'v0.5.1' # -- General configuration --------------------------------------------------- diff --git a/docs/source/index.rst b/docs/source/index.rst index a94e964..d4c9802 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -73,7 +73,7 @@ To report bugs and submit suggestions, please use the `"Issues" section " + ] + }, + "metadata": { + "needs_background": "light" + }, + "output_type": "display_data" + } + ], + "source": [ + "damping_curve.plot();" ] }, { @@ -179,7 +203,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 11, "metadata": {}, "outputs": [ { @@ -196,12 +220,16 @@ } ], "source": [ - "HH_x_param = damping.get_HH_x_param(pop_size=30, n_gen=3, show_fig=True);" + "HH_x_param = damping_curve.get_HH_x_param(\n", + " pop_size=30,\n", + " n_gen=3,\n", + " show_fig=True,\n", + ");" ] }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 12, "metadata": {}, "outputs": [ { @@ -210,7 +238,7 @@ "PySeismoSoil.class_parameters.HH_Param" ] }, - "execution_count": 11, + "execution_count": 12, "metadata": {}, "output_type": "execute_result" } @@ -228,7 +256,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 13, "metadata": {}, "outputs": [ { @@ -247,7 +275,7 @@ "}" ] }, - "execution_count": 12, + "execution_count": 13, "metadata": {}, "output_type": "execute_result" } @@ -265,7 +293,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 14, "metadata": {}, "outputs": [ { @@ -282,12 +310,16 @@ } ], "source": [ - "H4_x_param = damping.get_H4_x_param(pop_size=30, n_gen=3, show_fig=True);" + "H4_x_param = damping_curve.get_H4_x_param(\n", + " pop_size=30,\n", + " n_gen=3,\n", + " show_fig=True,\n", + ");" ] }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 15, "metadata": {}, "outputs": [ { @@ -296,7 +328,7 @@ "PySeismoSoil.class_parameters.MKZ_Param" ] }, - "execution_count": 14, + "execution_count": 15, "metadata": {}, "output_type": "execute_result" } @@ -314,7 +346,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 16, "metadata": {}, "outputs": [ { @@ -328,7 +360,7 @@ "}" ] }, - "execution_count": 15, + "execution_count": 16, "metadata": {}, "output_type": "execute_result" } @@ -346,16 +378,27 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 17, "metadata": {}, "outputs": [], "source": [ - "stress_curve = Stress_Curve(data)" + "strain = np.geomspace(1e-2, 10, num=20)\n", + "y = strain ** 2\n", + "fictitious_stress_data = np.column_stack((strain, y))" ] }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 18, + "metadata": {}, + "outputs": [], + "source": [ + "stress_curve = Stress_Curve(fictitious_stress_data)" + ] + }, + { + "cell_type": "code", + "execution_count": 19, "metadata": {}, "outputs": [ { @@ -368,7 +411,7 @@ " 335.98182863, 483.29302386, 695.19279618, 1000. ])" ] }, - "execution_count": 17, + "execution_count": 19, "metadata": {}, "output_type": "execute_result" } @@ -379,20 +422,20 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 20, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "array([0.00000000e+00, 1.06913808e-04, 3.28133240e-04, 7.85866790e-04,\n", - " 1.73298071e-03, 3.69269019e-03, 7.74759970e-03, 1.61377674e-02,\n", - " 3.34981829e-02, 6.94192796e-02, 1.43744989e-01, 2.97535144e-01,\n", - " 6.15748211e-01, 1.27417499e+00, 2.63655090e+00, 5.45549478e+00,\n", - " 1.12882789e+01, 2.33571147e+01, 4.83292024e+01, 9.99999000e+01])" + "array([1.00000000e-04, 2.06913808e-04, 4.28133240e-04, 8.85866790e-04,\n", + " 1.83298071e-03, 3.79269019e-03, 7.84759970e-03, 1.62377674e-02,\n", + " 3.35981829e-02, 6.95192796e-02, 1.43844989e-01, 2.97635144e-01,\n", + " 6.15848211e-01, 1.27427499e+00, 2.63665090e+00, 5.45559478e+00,\n", + " 1.12883789e+01, 2.33572147e+01, 4.83293024e+01, 1.00000000e+02])" ] }, - "execution_count": 18, + "execution_count": 20, "metadata": {}, "output_type": "execute_result" } @@ -410,7 +453,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 21, "metadata": {}, "outputs": [], "source": [ @@ -435,7 +478,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 22, "metadata": {}, "outputs": [], "source": [ @@ -453,7 +496,7 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": 23, "metadata": {}, "outputs": [ { @@ -462,7 +505,7 @@ "n_layers = 3, type: " ] }, - "execution_count": 21, + "execution_count": 23, "metadata": {}, "output_type": "execute_result" } @@ -473,7 +516,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": 24, "metadata": {}, "outputs": [ { @@ -509,7 +552,7 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": 25, "metadata": {}, "outputs": [ { @@ -518,7 +561,7 @@ "3" ] }, - "execution_count": 23, + "execution_count": 25, "metadata": {}, "output_type": "execute_result" } @@ -529,7 +572,7 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": 26, "metadata": {}, "outputs": [ { @@ -538,7 +581,7 @@ "True" ] }, - "execution_count": 24, + "execution_count": 26, "metadata": {}, "output_type": "execute_result" } @@ -549,7 +592,7 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": 27, "metadata": {}, "outputs": [ { @@ -558,7 +601,7 @@ "False" ] }, - "execution_count": 25, + "execution_count": 27, "metadata": {}, "output_type": "execute_result" } @@ -569,7 +612,7 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": 28, "metadata": {}, "outputs": [ { @@ -593,7 +636,7 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": 29, "metadata": {}, "outputs": [ { @@ -623,7 +666,7 @@ }, { "cell_type": "code", - "execution_count": 28, + "execution_count": 30, "metadata": {}, "outputs": [ { @@ -653,7 +696,7 @@ }, { "cell_type": "code", - "execution_count": 29, + "execution_count": 31, "metadata": {}, "outputs": [ { @@ -683,7 +726,7 @@ }, { "cell_type": "code", - "execution_count": 30, + "execution_count": 32, "metadata": {}, "outputs": [ { @@ -705,7 +748,7 @@ }, { "cell_type": "code", - "execution_count": 31, + "execution_count": 33, "metadata": {}, "outputs": [ { @@ -714,7 +757,7 @@ "PySeismoSoil.class_parameters.HH_Param_Multi_Layer" ] }, - "execution_count": 31, + "execution_count": 33, "metadata": {}, "output_type": "execute_result" } @@ -732,7 +775,7 @@ }, { "cell_type": "code", - "execution_count": 32, + "execution_count": 34, "metadata": {}, "outputs": [ { @@ -782,7 +825,7 @@ }, { "cell_type": "code", - "execution_count": 33, + "execution_count": 35, "metadata": {}, "outputs": [], "source": [ @@ -791,7 +834,7 @@ }, { "cell_type": "code", - "execution_count": 34, + "execution_count": 36, "metadata": {}, "outputs": [ { @@ -809,7 +852,7 @@ " [ 0.2637, -999. , 0.2637, 0.198 , 0.2637, -999. , 0.2637, 0.1033]])" ] }, - "execution_count": 34, + "execution_count": 36, "metadata": {}, "output_type": "execute_result" } @@ -835,7 +878,7 @@ }, { "cell_type": "code", - "execution_count": 35, + "execution_count": 37, "metadata": {}, "outputs": [ { @@ -872,7 +915,7 @@ }, { "cell_type": "code", - "execution_count": 36, + "execution_count": 38, "metadata": {}, "outputs": [], "source": [ @@ -888,7 +931,7 @@ }, { "cell_type": "code", - "execution_count": 37, + "execution_count": 39, "metadata": {}, "outputs": [ { @@ -924,7 +967,7 @@ }, { "cell_type": "code", - "execution_count": 38, + "execution_count": 40, "metadata": {}, "outputs": [ { @@ -942,7 +985,7 @@ " [ 3. , 0.0078, 3. , -999. , 3. , 0.0138, 3. , -999. ]])" ] }, - "execution_count": 38, + "execution_count": 40, "metadata": {}, "output_type": "execute_result" } @@ -968,7 +1011,7 @@ }, { "cell_type": "code", - "execution_count": 39, + "execution_count": 41, "metadata": {}, "outputs": [], "source": [ @@ -984,7 +1027,7 @@ }, { "cell_type": "code", - "execution_count": 40, + "execution_count": 42, "metadata": {}, "outputs": [], "source": [ @@ -993,7 +1036,7 @@ }, { "cell_type": "code", - "execution_count": 41, + "execution_count": 43, "metadata": {}, "outputs": [ { @@ -1002,7 +1045,7 @@ "5" ] }, - "execution_count": 41, + "execution_count": 43, "metadata": {}, "output_type": "execute_result" } @@ -1020,7 +1063,7 @@ }, { "cell_type": "code", - "execution_count": 42, + "execution_count": 44, "metadata": {}, "outputs": [ { @@ -1063,7 +1106,7 @@ }, { "cell_type": "code", - "execution_count": 43, + "execution_count": 45, "metadata": {}, "outputs": [ { @@ -1081,7 +1124,7 @@ " [ 3. , 0.0078, 3. , 21.052 , 3. , 0.0138, 3. , 20.947 ]])" ] }, - "execution_count": 43, + "execution_count": 45, "metadata": {}, "output_type": "execute_result" } @@ -1100,7 +1143,7 @@ }, { "cell_type": "code", - "execution_count": 44, + "execution_count": 46, "metadata": {}, "outputs": [], "source": [ @@ -1109,7 +1152,7 @@ }, { "cell_type": "code", - "execution_count": 45, + "execution_count": 47, "metadata": {}, "outputs": [ { diff --git a/setup.py b/setup.py index 1cfd719..630b90e 100644 --- a/setup.py +++ b/setup.py @@ -16,7 +16,7 @@ def load_requirements(req_filename): setup( name='PySeismoSoil', - version='v0.5.0', + version='v0.5.1', description='PySeismoSoil', long_description=long_description, # will get passed to PyPI.org long_description_content_type="text/markdown", # otherwise the default is RST