<jupyter_start><jupyter_text>Example 5: Simulated nonlinear propertyGenerate simulated nonlinear properties. This example just shows an example of generating the simulated profiles.<jupyter_code>import matplotlib.pyplot as plt
import numpy as np

import pysra

%matplotlib inline
# Increased figure sizes
plt.rcParams["figure.dpi"] = 120<jupyter_output><empty_output><jupyter_text>Create a soil layer, which defines the median value.<jupyter_code>soil_type = pysra.site.DarendeliSoilType(18.0, plas_index=0, ocr=1, stress_mean=50)<jupyter_output><empty_output><jupyter_text>Create the simulated nonlinear curves<jupyter_code>n = 10
correlation = 0
simulated = []

for name, model in zip(
    ["Darendeli (2001)", "EPRI SPID (2014)"],
    [
        pysra.variation.DarendeliVariation(correlation),
        pysra.variation.SpidVariation(correlation),
    ],
):
    simulated.append((name, [model(soil_type) for _ in range(n)]))<jupyter_output><empty_output><jupyter_text>Compare the uncertainty models.<jupyter_code>fig, axes = plt.subplots(2, 2, sharex=True, sharey="row", subplot_kw={"xscale": "log"})

for i, (name, sims) in enumerate(simulated):
    for j, prop in enumerate(["mod_reduc", "damping"]):
        axes[j, i].plot(
            getattr(soil_type, prop).strains,
            np.transpose([getattr(s, prop).values for s in sims]),
            linewidth=0.5,
            color="C0",
            alpha=0.8,
        )
        if j == 0:
            axes[j, i].set_title(name)

axes[0, 0].set_ylabel("$G/G_{max}$")
axes[1, 0].set_ylabel("$D$ (%)")
plt.setp(axes[1, :], xlabel="Strain, $\gamma$ (%)")

fig.tight_layout();<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14182257091128544, 'fraction_numerical': 0.02112251056125528, 'mean_word_length': 4.453947368421052, 'pattern_counts': {'":': 1, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '120782', 'license': 'MIT', 'n_tokens_mistral': 632, 'n_tokens_neox': 582, 'n_words': 120, 'path': 'examples/example-05.ipynb', 'repo_name': 'geosharma/pysra', 'size': '1657'}