diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index 915c353..65185cf 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -3,49 +3,49 @@ name: Python application on: [push, pull_request] jobs: - build: + build: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.10", "3.11", "3.12"] - runs-on: ubuntu-latest - strategy: - matrix: - python-version: [3.8, 3.9, '3.10'] - - steps: - - uses: actions/checkout@main - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@main - with: - python-version: ${{ matrix.python-version }} - - name: Cache pip - uses: actions/cache@main - with: - # This path is specific to Ubuntu - path: ~/.cache/pip - # Look to see if there is a cache hit for the corresponding requirements file - key: ${{ runner.os }}-pip-${{ hashFiles('requirements_dev.txt') }} - restore-keys: | - ${{ runner.os }}-pip- - ${{ runner.os }}- - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install wheel - if [ -f requirements_dev.txt ]; then pip install -r requirements_dev.txt; fi - - name: Lint with flake8 - run: | - # stop the build if there are Python syntax errors or undefined names - flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - - name: Install - run: | - pip install -e . - - name: Test with pytest - run: | - make test - coverage xml - - name: Run codacy-coverage-reporter - uses: codacy/codacy-coverage-reporter-action@v1 - with: - project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} - coverage-reports: coverage.xml + steps: + - uses: actions/checkout@main + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@main + with: + python-version: ${{ matrix.python-version }} + - name: Cache pip + uses: actions/cache@main + with: + # This path is specific to Ubuntu + path: + ~/.cache/pip + # Look to see if there is a cache hit for the corresponding requirements file + key: ${{ runner.os }}-pip-${{ hashFiles('requirements_dev.txt') }} + restore-keys: | + ${{ runner.os }}-pip- + ${{ runner.os }}- + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install wheel + if [ -f requirements_dev.txt ]; then pip install -r requirements_dev.txt; fi + - name: Lint with flake8 + run: | + # stop the build if there are Python syntax errors or undefined names + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + - name: Install + run: | + pip install -e . + - name: Test with pytest + run: | + make test + coverage xml + - name: Run codacy-coverage-reporter + uses: codacy/codacy-coverage-reporter-action@v1 + with: + project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} + coverage-reports: coverage.xml diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index ce66c98..e477cc4 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -4,36 +4,35 @@ name: Upload Python Package on: - release: - types: [published] + release: + types: [published] jobs: - deploy: + deploy: + runs-on: ubuntu-latest - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@main - - name: Set up Python - uses: actions/setup-python@main - with: - python-version: '3.x' - - name: Install dependencies - run: >- - python -m - pip install - build - wheel - --user - - name: Build a binary wheel and a source tarball - run: >- - python -m - build - --sdist - --wheel - --outdir dist/ - . - - name: Publish distribution package to PyPI - uses: pypa/gh-action-pypi-publish@master - with: - password: ${{ secrets.PYPI_API_TOKEN }} + steps: + - uses: actions/checkout@main + - name: Set up Python + uses: actions/setup-python@main + with: + python-version: "3.x" + - name: Install dependencies + run: >- + python -m + pip install + build + wheel + --user + - name: Build a binary wheel and a source tarball + run: >- + python -m + build + --sdist + --wheel + --outdir dist/ + . + - name: Publish distribution package to PyPI + uses: pypa/gh-action-pypi-publish@master + with: + password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.travis.yml b/.travis.yml index 4d85b59..b644bdc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,22 +1,22 @@ language: python cache: pip python: - - '3.7' + - "3.7" install: - - pip install -r requirements_dev.txt - - python setup.py install + - pip install -r requirements_dev.txt + - python setup.py install script: - - make test + - make test after_success: - - coverage xml - - python-codacy-coverage -r coverage.xml + - coverage xml + - python-codacy-coverage -r coverage.xml deploy: - provider: pypi - user: arkottke - password: - secure: FfmTw7ima0b3hjHe3tamYGzYvdPAY2qDiLcwJezfT7422ECARQolcC0Zl6QTAyGJWlYHwDb77F1R/QoZf9DMViN8uOXItV3IHP2nAkr+MxcAdcrHaUJyxQ45jC297siA8YxK9MrTQOGgVL2Hdu7UOOF85BUT6D9JIx9vcgH0jUg= - skip_existing: true - distributions: sdist bdist_wheel - on: - repo: arkottke/pystrata - tags: true + provider: pypi + user: arkottke + password: + secure: FfmTw7ima0b3hjHe3tamYGzYvdPAY2qDiLcwJezfT7422ECARQolcC0Zl6QTAyGJWlYHwDb77F1R/QoZf9DMViN8uOXItV3IHP2nAkr+MxcAdcrHaUJyxQ45jC297siA8YxK9MrTQOGgVL2Hdu7UOOF85BUT6D9JIx9vcgH0jUg= + skip_existing: true + distributions: sdist bdist_wheel + on: + repo: arkottke/pystrata + tags: true diff --git a/AUTHORS.md b/AUTHORS.md index 21948d0..d5e4b7b 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -2,8 +2,8 @@ ## Development Lead -- Albert Kottke \<\> +- Albert Kottke \<\> ## Contributors -- Maxim Millen +- Maxim Millen diff --git a/README.md b/README.md index ee64c2b..8065fd8 100644 --- a/README.md +++ b/README.md @@ -16,34 +16,35 @@ Docs](https://img.shields.io/readthedocs/pystrata)](https://pystrata.readthedocs Site response analyses implemented in Python. This Python packages aims to implement many of the features found in [Strata](https://github.com/arkottke/strata). These features include: -- Input motion characterization: - - Time series - - Random vibration theory -- Wave propagation or site amplification: - - linear - - equivalent-linear - - equivalent-linear with frequency dependent properties - - quarter wavelength -- Nonlinear curve models: - - Predictive models: - - Darendeli (2001) - - Menq (2004) - - Kishida (2012) - - Curves: - - Vucetic & Dobry (1991) - - EPRI (1993) - - GEI (1983) - - GeoMatrix (1990) - - Idriss (1990) - - Imperial Valley Soils - - Iwasaki - - Peninsular Range - - Seed & Idriss -- Site and soil property uncertainty: - - Toro (1994) Vs correlation model - - G/Gmax and D uncertainty: - - Darendeli (2001) - - EPRI SPID (2013) + +- Input motion characterization: + - Time series + - Random vibration theory +- Wave propagation or site amplification: + - linear + - equivalent-linear + - equivalent-linear with frequency dependent properties + - quarter wavelength +- Nonlinear curve models: + - Predictive models: + - Darendeli (2001) + - Menq (2004) + - Kishida (2012) + - Curves: + - Vucetic & Dobry (1991) + - EPRI (1993) + - GEI (1983) + - GeoMatrix (1990) + - Idriss (1990) + - Imperial Valley Soils + - Iwasaki + - Peninsular Range + - Seed & Idriss +- Site and soil property uncertainty: + - Toro (1994) Vs correlation model + - G/Gmax and D uncertainty: + - Darendeli (2001) + - EPRI SPID (2013) Development of this software is on-going and any contributions are encouraged. Previously named `pysra`, but renamed after some sage and diff --git a/docs/conf.py b/docs/conf.py index f27a9e0..e0808cf 100755 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# -*- coding: utf-8 -*- # # pyStrata documentation build configuration file, created by # sphinx-quickstart on Mon Nov 2 15:41:52 2015. diff --git a/examples/README.md b/examples/README.md index 0176530..65f8fc5 100644 --- a/examples/README.md +++ b/examples/README.md @@ -23,4 +23,5 @@ The examples included here are used to demonstrate the capabilities of 15. List of provided nonlinear curves. To be added: -- Impact of peak factor on site reponse transfer function + +- Impact of peak factor on site reponse transfer function diff --git a/examples/data/NIS090.AT2 b/examples/data/NIS090.AT2 index 7b58a12..972a0d4 100644 --- a/examples/data/NIS090.AT2 +++ b/examples/data/NIS090.AT2 @@ -1,5 +1,5 @@ PEER NGA STRONG MOTION DATABASE RECORD -KOBE 01/16/95 2046, NISHI-AKASHI, 090 (CUE) +KOBE 01/16/95 2046, NISHI-AKASHI, 090 (CUE) ACCELERATION TIME HISTORY IN UNITS OF G 4096 0.0100 NPTS, DT 0.233833E-06 0.299033E-06 0.515835E-06 0.667785E-06 0.490847E-06 diff --git a/examples/example-01.ipynb b/examples/example-01.ipynb index 5da1b08..85beb0a 100644 --- a/examples/example-01.ipynb +++ b/examples/example-01.ipynb @@ -12,15 +12,8 @@ }, { "cell_type": "code", - "execution_count": 1, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:09:08.942000Z", - "iopub.status.busy": "2024-05-15T22:09:08.941788Z", - "iopub.status.idle": "2024-05-15T22:09:10.840182Z", - "shell.execute_reply": "2024-05-15T22:09:10.839505Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "import matplotlib.pyplot as plt\n", @@ -33,15 +26,8 @@ }, { "cell_type": "code", - "execution_count": 2, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:09:10.844542Z", - "iopub.status.busy": "2024-05-15T22:09:10.843976Z", - "iopub.status.idle": "2024-05-15T22:09:10.847815Z", - "shell.execute_reply": "2024-05-15T22:09:10.846987Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "# Increased figure sizes\n", @@ -57,15 +43,8 @@ }, { "cell_type": "code", - "execution_count": 3, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:09:10.851228Z", - "iopub.status.busy": "2024-05-15T22:09:10.851033Z", - "iopub.status.idle": "2024-05-15T22:09:10.864817Z", - "shell.execute_reply": "2024-05-15T22:09:10.864307Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "fname = \"data/NIS090.AT2\"\n", @@ -83,15 +62,8 @@ }, { "cell_type": "code", - "execution_count": 4, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:09:10.868232Z", - "iopub.status.busy": "2024-05-15T22:09:10.868011Z", - "iopub.status.idle": "2024-05-15T22:09:10.873128Z", - "shell.execute_reply": "2024-05-15T22:09:10.872630Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [ { "data": { @@ -118,15 +90,8 @@ }, { "cell_type": "code", - "execution_count": 5, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:09:10.929035Z", - "iopub.status.busy": "2024-05-15T22:09:10.928775Z", - "iopub.status.idle": "2024-05-15T22:09:10.937386Z", - "shell.execute_reply": "2024-05-15T22:09:10.936661Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [ { "data": { @@ -147,15 +112,8 @@ }, { "cell_type": "code", - "execution_count": 6, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:09:10.941529Z", - "iopub.status.busy": "2024-05-15T22:09:10.941237Z", - "iopub.status.idle": "2024-05-15T22:09:11.103793Z", - "shell.execute_reply": "2024-05-15T22:09:11.103239Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [ { "data": { @@ -186,15 +144,8 @@ }, { "cell_type": "code", - "execution_count": 7, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:09:11.108674Z", - "iopub.status.busy": "2024-05-15T22:09:11.108437Z", - "iopub.status.idle": "2024-05-15T22:09:11.112162Z", - "shell.execute_reply": "2024-05-15T22:09:11.111652Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "profile = pystrata.site.Profile(\n", @@ -207,15 +158,8 @@ }, { "cell_type": "code", - "execution_count": 8, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:09:11.115488Z", - "iopub.status.busy": "2024-05-15T22:09:11.115262Z", - "iopub.status.idle": "2024-05-15T22:09:11.480058Z", - "shell.execute_reply": "2024-05-15T22:09:11.479190Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [ { "data": { @@ -251,15 +195,8 @@ }, { "cell_type": "code", - "execution_count": 9, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:09:11.483692Z", - "iopub.status.busy": "2024-05-15T22:09:11.483022Z", - "iopub.status.idle": "2024-05-15T22:09:11.487226Z", - "shell.execute_reply": "2024-05-15T22:09:11.486394Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "calc = pystrata.propagation.LinearElasticCalculator()" @@ -274,15 +211,8 @@ }, { "cell_type": "code", - "execution_count": 10, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:09:11.490601Z", - "iopub.status.busy": "2024-05-15T22:09:11.490085Z", - "iopub.status.idle": "2024-05-15T22:09:11.496838Z", - "shell.execute_reply": "2024-05-15T22:09:11.496183Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "freqs = np.logspace(-1, 2, num=500)\n", @@ -335,15 +265,8 @@ }, { "cell_type": "code", - "execution_count": 11, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:09:11.500013Z", - "iopub.status.busy": "2024-05-15T22:09:11.499530Z", - "iopub.status.idle": "2024-05-15T22:09:11.503927Z", - "shell.execute_reply": "2024-05-15T22:09:11.503215Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "calc(ts, profile, profile.location(\"outcrop\", index=-1))" @@ -358,15 +281,8 @@ }, { "cell_type": "code", - "execution_count": 12, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:09:11.507703Z", - "iopub.status.busy": "2024-05-15T22:09:11.507173Z", - "iopub.status.idle": "2024-05-15T22:09:11.944867Z", - "shell.execute_reply": "2024-05-15T22:09:11.944161Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "outputs(calc)" @@ -383,15 +299,8 @@ }, { "cell_type": "code", - "execution_count": 13, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:09:11.947758Z", - "iopub.status.busy": "2024-05-15T22:09:11.947556Z", - "iopub.status.idle": "2024-05-15T22:09:13.424857Z", - "shell.execute_reply": "2024-05-15T22:09:13.424008Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [ { "data": { @@ -437,38 +346,7 @@ "source": [] } ], - "metadata": { - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.11.8" - }, - "toc": { - "base_numbering": 1, - "nav_menu": {}, - "number_sections": true, - "sideBar": true, - "skip_h1_title": false, - "title_cell": "Table of Contents", - "title_sidebar": "Contents", - "toc_cell": false, - "toc_position": {}, - "toc_section_display": true, - "toc_window_display": false - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 4 } diff --git a/examples/example-02.ipynb b/examples/example-02.ipynb index 373fe72..7a56c32 100644 --- a/examples/example-02.ipynb +++ b/examples/example-02.ipynb @@ -12,15 +12,8 @@ }, { "cell_type": "code", - "execution_count": 1, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:09:14.685326Z", - "iopub.status.busy": "2024-05-15T22:09:14.684922Z", - "iopub.status.idle": "2024-05-15T22:09:16.619866Z", - "shell.execute_reply": "2024-05-15T22:09:16.619092Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "import matplotlib.pyplot as plt\n", @@ -33,15 +26,8 @@ }, { "cell_type": "code", - "execution_count": 2, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:09:16.623339Z", - "iopub.status.busy": "2024-05-15T22:09:16.623036Z", - "iopub.status.idle": "2024-05-15T22:09:16.626534Z", - "shell.execute_reply": "2024-05-15T22:09:16.625859Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "# Increased figure sizes\n", @@ -57,15 +43,8 @@ }, { "cell_type": "code", - "execution_count": 3, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:09:16.628775Z", - "iopub.status.busy": "2024-05-15T22:09:16.628581Z", - "iopub.status.idle": "2024-05-15T22:09:16.632922Z", - "shell.execute_reply": "2024-05-15T22:09:16.632238Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "m = pystrata.motion.SourceTheoryRvtMotion(6.0, 30, \"wna\")\n", @@ -74,15 +53,8 @@ }, { "cell_type": "code", - "execution_count": 4, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:09:16.636010Z", - "iopub.status.busy": "2024-05-15T22:09:16.635665Z", - "iopub.status.idle": "2024-05-15T22:09:17.311112Z", - "shell.execute_reply": "2024-05-15T22:09:17.310377Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [ { "data": { @@ -113,15 +85,8 @@ }, { "cell_type": "code", - "execution_count": 5, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:09:17.314217Z", - "iopub.status.busy": "2024-05-15T22:09:17.313855Z", - "iopub.status.idle": "2024-05-15T22:09:17.318111Z", - "shell.execute_reply": "2024-05-15T22:09:17.317398Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "profile = pystrata.site.Profile(\n", @@ -141,15 +106,8 @@ }, { "cell_type": "code", - "execution_count": 6, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:09:17.320380Z", - "iopub.status.busy": "2024-05-15T22:09:17.320179Z", - "iopub.status.idle": "2024-05-15T22:09:17.323575Z", - "shell.execute_reply": "2024-05-15T22:09:17.322918Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "calc = pystrata.propagation.LinearElasticCalculator()" @@ -164,15 +122,8 @@ }, { "cell_type": "code", - "execution_count": 7, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:09:17.325843Z", - "iopub.status.busy": "2024-05-15T22:09:17.325516Z", - "iopub.status.idle": "2024-05-15T22:09:17.330074Z", - "shell.execute_reply": "2024-05-15T22:09:17.329394Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "freqs = np.logspace(-1, 2, num=500)\n", @@ -217,15 +168,8 @@ }, { "cell_type": "code", - "execution_count": 8, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:09:17.332691Z", - "iopub.status.busy": "2024-05-15T22:09:17.332187Z", - "iopub.status.idle": "2024-05-15T22:09:17.336178Z", - "shell.execute_reply": "2024-05-15T22:09:17.335516Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "calc(m, profile, profile.location(\"outcrop\", index=-1))" @@ -240,15 +184,8 @@ }, { "cell_type": "code", - "execution_count": 9, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:09:17.338412Z", - "iopub.status.busy": "2024-05-15T22:09:17.338090Z", - "iopub.status.idle": "2024-05-15T22:09:17.664185Z", - "shell.execute_reply": "2024-05-15T22:09:17.663383Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "outputs(calc)" @@ -265,15 +202,8 @@ }, { "cell_type": "code", - "execution_count": 10, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:09:17.668399Z", - "iopub.status.busy": "2024-05-15T22:09:17.668185Z", - "iopub.status.idle": "2024-05-15T22:09:18.644761Z", - "shell.execute_reply": "2024-05-15T22:09:18.644022Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [ { "data": { @@ -309,38 +239,7 @@ "source": [] } ], - "metadata": { - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.11.8" - }, - "toc": { - "base_numbering": 1, - "nav_menu": {}, - "number_sections": true, - "sideBar": true, - "skip_h1_title": false, - "title_cell": "Table of Contents", - "title_sidebar": "Contents", - "toc_cell": false, - "toc_position": {}, - "toc_section_display": true, - "toc_window_display": false - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 4 } diff --git a/examples/example-03.ipynb b/examples/example-03.ipynb index 341680b..0dce963 100644 --- a/examples/example-03.ipynb +++ b/examples/example-03.ipynb @@ -14,15 +14,8 @@ }, { "cell_type": "code", - "execution_count": 1, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:09:19.872921Z", - "iopub.status.busy": "2024-05-15T22:09:19.872704Z", - "iopub.status.idle": "2024-05-15T22:09:21.836640Z", - "shell.execute_reply": "2024-05-15T22:09:21.836047Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "import matplotlib.pyplot as plt\n", @@ -35,15 +28,8 @@ }, { "cell_type": "code", - "execution_count": 2, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:09:21.839500Z", - "iopub.status.busy": "2024-05-15T22:09:21.839204Z", - "iopub.status.idle": "2024-05-15T22:09:21.842599Z", - "shell.execute_reply": "2024-05-15T22:09:21.841956Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "# Increased figure sizes\n", @@ -59,15 +45,8 @@ }, { "cell_type": "code", - "execution_count": 3, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:09:21.846480Z", - "iopub.status.busy": "2024-05-15T22:09:21.846280Z", - "iopub.status.idle": "2024-05-15T22:09:21.850200Z", - "shell.execute_reply": "2024-05-15T22:09:21.849585Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "motion = pystrata.motion.SourceTheoryRvtMotion(7.0, 30, \"wna\")\n", @@ -85,15 +64,8 @@ }, { "cell_type": "code", - "execution_count": 4, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:09:21.854676Z", - "iopub.status.busy": "2024-05-15T22:09:21.854472Z", - "iopub.status.idle": "2024-05-15T22:09:21.859060Z", - "shell.execute_reply": "2024-05-15T22:09:21.858460Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "profile = pystrata.site.Profile(\n", @@ -117,15 +89,8 @@ }, { "cell_type": "code", - "execution_count": 5, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:09:21.862639Z", - "iopub.status.busy": "2024-05-15T22:09:21.862310Z", - "iopub.status.idle": "2024-05-15T22:09:21.865801Z", - "shell.execute_reply": "2024-05-15T22:09:21.865213Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "calcs = [\n", @@ -147,15 +112,8 @@ }, { "cell_type": "code", - "execution_count": 6, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:09:21.869376Z", - "iopub.status.busy": "2024-05-15T22:09:21.869035Z", - "iopub.status.idle": "2024-05-15T22:09:21.874400Z", - "shell.execute_reply": "2024-05-15T22:09:21.873810Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "freqs = np.logspace(-1, 2, num=500)\n", @@ -211,15 +169,8 @@ }, { "cell_type": "code", - "execution_count": 7, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:09:21.877731Z", - "iopub.status.busy": "2024-05-15T22:09:21.877545Z", - "iopub.status.idle": "2024-05-15T22:09:21.882258Z", - "shell.execute_reply": "2024-05-15T22:09:21.881765Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [ { "data": { @@ -241,15 +192,8 @@ }, { "cell_type": "code", - "execution_count": 8, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:09:21.887108Z", - "iopub.status.busy": "2024-05-15T22:09:21.886910Z", - "iopub.status.idle": "2024-05-15T22:09:21.890588Z", - "shell.execute_reply": "2024-05-15T22:09:21.890081Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [ { "data": { @@ -268,15 +212,8 @@ }, { "cell_type": "code", - "execution_count": 9, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:09:21.895263Z", - "iopub.status.busy": "2024-05-15T22:09:21.894980Z", - "iopub.status.idle": "2024-05-15T22:09:23.025988Z", - "shell.execute_reply": "2024-05-15T22:09:23.025171Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "properties = {}\n", @@ -296,15 +233,8 @@ }, { "cell_type": "code", - "execution_count": 10, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:09:23.030151Z", - "iopub.status.busy": "2024-05-15T22:09:23.029948Z", - "iopub.status.idle": "2024-05-15T22:09:24.006680Z", - "shell.execute_reply": "2024-05-15T22:09:24.006008Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [ { "data": { @@ -353,15 +283,8 @@ }, { "cell_type": "code", - "execution_count": 11, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:09:24.010935Z", - "iopub.status.busy": "2024-05-15T22:09:24.010732Z", - "iopub.status.idle": "2024-05-15T22:09:26.198074Z", - "shell.execute_reply": "2024-05-15T22:09:26.197437Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [ { "data": { @@ -438,15 +361,8 @@ }, { "cell_type": "code", - "execution_count": 12, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:09:26.201995Z", - "iopub.status.busy": "2024-05-15T22:09:26.201788Z", - "iopub.status.idle": "2024-05-15T22:09:26.477276Z", - "shell.execute_reply": "2024-05-15T22:09:26.476636Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [ { "data": { @@ -483,38 +399,7 @@ "source": [] } ], - "metadata": { - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.11.8" - }, - "toc": { - "base_numbering": 1, - "nav_menu": {}, - "number_sections": true, - "sideBar": true, - "skip_h1_title": false, - "title_cell": "Table of Contents", - "title_sidebar": "Contents", - "toc_cell": false, - "toc_position": {}, - "toc_section_display": true, - "toc_window_display": false - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 4 } diff --git a/examples/example-04.ipynb b/examples/example-04.ipynb index aaa8c15..9569e2b 100644 --- a/examples/example-04.ipynb +++ b/examples/example-04.ipynb @@ -11,15 +11,8 @@ }, { "cell_type": "code", - "execution_count": 1, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:09:27.964299Z", - "iopub.status.busy": "2024-05-15T22:09:27.963892Z", - "iopub.status.idle": "2024-05-15T22:09:29.882403Z", - "shell.execute_reply": "2024-05-15T22:09:29.881740Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "import matplotlib.pyplot as plt\n", @@ -32,15 +25,8 @@ }, { "cell_type": "code", - "execution_count": 2, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:09:29.886391Z", - "iopub.status.busy": "2024-05-15T22:09:29.886106Z", - "iopub.status.idle": "2024-05-15T22:09:29.889141Z", - "shell.execute_reply": "2024-05-15T22:09:29.888628Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "# Increased figure sizes\n", @@ -56,15 +42,8 @@ }, { "cell_type": "code", - "execution_count": 3, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:09:29.892536Z", - "iopub.status.busy": "2024-05-15T22:09:29.892221Z", - "iopub.status.idle": "2024-05-15T22:09:29.896210Z", - "shell.execute_reply": "2024-05-15T22:09:29.895606Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "profile = pystrata.site.Profile(\n", @@ -85,15 +64,8 @@ }, { "cell_type": "code", - "execution_count": 4, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:09:29.899426Z", - "iopub.status.busy": "2024-05-15T22:09:29.899215Z", - "iopub.status.idle": "2024-05-15T22:09:29.902483Z", - "shell.execute_reply": "2024-05-15T22:09:29.901885Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "toro_thickness = pystrata.variation.ToroThicknessVariation()\n", @@ -109,15 +81,8 @@ }, { "cell_type": "code", - "execution_count": 5, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:09:29.905686Z", - "iopub.status.busy": "2024-05-15T22:09:29.905471Z", - "iopub.status.idle": "2024-05-15T22:09:29.909392Z", - "shell.execute_reply": "2024-05-15T22:09:29.908794Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -133,15 +98,8 @@ }, { "cell_type": "code", - "execution_count": 6, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:09:29.913369Z", - "iopub.status.busy": "2024-05-15T22:09:29.913183Z", - "iopub.status.idle": "2024-05-15T22:09:29.925315Z", - "shell.execute_reply": "2024-05-15T22:09:29.924653Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "count = 10\n", @@ -161,16 +119,8 @@ }, { "cell_type": "code", - "execution_count": 7, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:09:29.928876Z", - "iopub.status.busy": "2024-05-15T22:09:29.928534Z", - "iopub.status.idle": "2024-05-15T22:09:30.472459Z", - "shell.execute_reply": "2024-05-15T22:09:30.471823Z" - }, - "tags": [] - }, + "execution_count": null, + "metadata": {}, "outputs": [ { "data": { @@ -196,38 +146,7 @@ ] } ], - "metadata": { - "kernelspec": { - "display_name": "py39", - "language": "python", - "name": "py39" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.11.8" - }, - "toc": { - "base_numbering": 1, - "nav_menu": {}, - "number_sections": true, - "sideBar": true, - "skip_h1_title": false, - "title_cell": "Table of Contents", - "title_sidebar": "Contents", - "toc_cell": false, - "toc_position": {}, - "toc_section_display": true, - "toc_window_display": false - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 4 } diff --git a/examples/example-05.ipynb b/examples/example-05.ipynb index 640773f..b924206 100644 --- a/examples/example-05.ipynb +++ b/examples/example-05.ipynb @@ -11,15 +11,8 @@ }, { "cell_type": "code", - "execution_count": 1, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:09:31.917698Z", - "iopub.status.busy": "2024-05-15T22:09:31.917077Z", - "iopub.status.idle": "2024-05-15T22:09:33.862652Z", - "shell.execute_reply": "2024-05-15T22:09:33.861897Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "import matplotlib.pyplot as plt\n", @@ -32,15 +25,8 @@ }, { "cell_type": "code", - "execution_count": 2, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:09:33.866769Z", - "iopub.status.busy": "2024-05-15T22:09:33.866458Z", - "iopub.status.idle": "2024-05-15T22:09:33.870442Z", - "shell.execute_reply": "2024-05-15T22:09:33.869490Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "# Increased figure sizes\n", @@ -56,15 +42,8 @@ }, { "cell_type": "code", - "execution_count": 3, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:09:33.874049Z", - "iopub.status.busy": "2024-05-15T22:09:33.873853Z", - "iopub.status.idle": "2024-05-15T22:09:33.878351Z", - "shell.execute_reply": "2024-05-15T22:09:33.877408Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "soil_type = pystrata.site.DarendeliSoilType(18.0, plas_index=0, ocr=1, stress_mean=50)" @@ -79,15 +58,8 @@ }, { "cell_type": "code", - "execution_count": 4, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:09:33.881912Z", - "iopub.status.busy": "2024-05-15T22:09:33.881690Z", - "iopub.status.idle": "2024-05-15T22:09:33.897333Z", - "shell.execute_reply": "2024-05-15T22:09:33.896644Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "n = 10\n", @@ -113,15 +85,8 @@ }, { "cell_type": "code", - "execution_count": 5, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:09:33.900894Z", - "iopub.status.busy": "2024-05-15T22:09:33.900672Z", - "iopub.status.idle": "2024-05-15T22:09:35.916537Z", - "shell.execute_reply": "2024-05-15T22:09:35.915586Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [ { "data": { @@ -164,38 +129,7 @@ "source": [] } ], - "metadata": { - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.11.8" - }, - "toc": { - "base_numbering": 1, - "nav_menu": {}, - "number_sections": true, - "sideBar": true, - "skip_h1_title": false, - "title_cell": "Table of Contents", - "title_sidebar": "Contents", - "toc_cell": false, - "toc_position": {}, - "toc_section_display": true, - "toc_window_display": false - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 4 } diff --git a/examples/example-06.ipynb b/examples/example-06.ipynb index af8c353..d5dcc01 100644 --- a/examples/example-06.ipynb +++ b/examples/example-06.ipynb @@ -12,15 +12,8 @@ }, { "cell_type": "code", - "execution_count": 1, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:09:37.353823Z", - "iopub.status.busy": "2024-05-15T22:09:37.353362Z", - "iopub.status.idle": "2024-05-15T22:09:39.288593Z", - "shell.execute_reply": "2024-05-15T22:09:39.287915Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "import re\n", @@ -35,15 +28,8 @@ }, { "cell_type": "code", - "execution_count": 2, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:09:39.291549Z", - "iopub.status.busy": "2024-05-15T22:09:39.291256Z", - "iopub.status.idle": "2024-05-15T22:09:39.294711Z", - "shell.execute_reply": "2024-05-15T22:09:39.294110Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "# Increased figure sizes\n", @@ -59,15 +45,8 @@ }, { "cell_type": "code", - "execution_count": 3, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:09:39.297007Z", - "iopub.status.busy": "2024-05-15T22:09:39.296818Z", - "iopub.status.idle": "2024-05-15T22:09:39.302530Z", - "shell.execute_reply": "2024-05-15T22:09:39.301909Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "def iter_geopsy_profiles(fname):\n", @@ -105,16 +84,8 @@ }, { "cell_type": "code", - "execution_count": 4, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:09:39.304898Z", - "iopub.status.busy": "2024-05-15T22:09:39.304698Z", - "iopub.status.idle": "2024-05-15T22:09:39.312447Z", - "shell.execute_reply": "2024-05-15T22:09:39.311768Z" - }, - "scrolled": true - }, + "execution_count": null, + "metadata": {}, "outputs": [ { "data": { @@ -143,15 +114,8 @@ }, { "cell_type": "code", - "execution_count": 5, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:09:39.314847Z", - "iopub.status.busy": "2024-05-15T22:09:39.314653Z", - "iopub.status.idle": "2024-05-15T22:09:39.318007Z", - "shell.execute_reply": "2024-05-15T22:09:39.317395Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "calc = pystrata.propagation.LinearElasticCalculator()" @@ -166,15 +130,8 @@ }, { "cell_type": "code", - "execution_count": 6, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:09:39.320388Z", - "iopub.status.busy": "2024-05-15T22:09:39.320194Z", - "iopub.status.idle": "2024-05-15T22:09:39.324771Z", - "shell.execute_reply": "2024-05-15T22:09:39.324164Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "freqs = np.logspace(-1, 2, num=500)\n", @@ -214,15 +171,8 @@ }, { "cell_type": "code", - "execution_count": 7, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:09:39.327146Z", - "iopub.status.busy": "2024-05-15T22:09:39.326956Z", - "iopub.status.idle": "2024-05-15T22:09:50.201502Z", - "shell.execute_reply": "2024-05-15T22:09:50.200720Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "fname = \"data/best100_GM_linux.txt\"\n", @@ -259,15 +209,8 @@ }, { "cell_type": "code", - "execution_count": 8, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:09:50.205459Z", - "iopub.status.busy": "2024-05-15T22:09:50.205250Z", - "iopub.status.idle": "2024-05-15T22:09:51.894087Z", - "shell.execute_reply": "2024-05-15T22:09:51.893423Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [ { "data": { @@ -303,38 +246,7 @@ "source": [] } ], - "metadata": { - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.11.8" - }, - "toc": { - "base_numbering": 1, - "nav_menu": {}, - "number_sections": true, - "sideBar": true, - "skip_h1_title": false, - "title_cell": "Table of Contents", - "title_sidebar": "Contents", - "toc_cell": false, - "toc_position": {}, - "toc_section_display": true, - "toc_window_display": true - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 4 } diff --git a/examples/example-07.ipynb b/examples/example-07.ipynb index f23998f..1242824 100644 --- a/examples/example-07.ipynb +++ b/examples/example-07.ipynb @@ -14,15 +14,8 @@ }, { "cell_type": "code", - "execution_count": 1, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:09:53.318398Z", - "iopub.status.busy": "2024-05-15T22:09:53.318021Z", - "iopub.status.idle": "2024-05-15T22:09:55.247178Z", - "shell.execute_reply": "2024-05-15T22:09:55.246491Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "import matplotlib.pyplot as plt\n", @@ -35,15 +28,8 @@ }, { "cell_type": "code", - "execution_count": 2, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:09:55.250267Z", - "iopub.status.busy": "2024-05-15T22:09:55.249973Z", - "iopub.status.idle": "2024-05-15T22:09:55.253299Z", - "shell.execute_reply": "2024-05-15T22:09:55.252707Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "# Increased figure sizes\n", @@ -59,15 +45,8 @@ }, { "cell_type": "code", - "execution_count": 3, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:09:55.256756Z", - "iopub.status.busy": "2024-05-15T22:09:55.256537Z", - "iopub.status.idle": "2024-05-15T22:09:55.262674Z", - "shell.execute_reply": "2024-05-15T22:09:55.262150Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "def create_motion(calculator):\n", @@ -95,15 +74,8 @@ }, { "cell_type": "code", - "execution_count": 4, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:09:55.265848Z", - "iopub.status.busy": "2024-05-15T22:09:55.265646Z", - "iopub.status.idle": "2024-05-15T22:09:55.269419Z", - "shell.execute_reply": "2024-05-15T22:09:55.268903Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "for m in motions:\n", @@ -121,15 +93,8 @@ }, { "cell_type": "code", - "execution_count": 5, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:09:55.272371Z", - "iopub.status.busy": "2024-05-15T22:09:55.272171Z", - "iopub.status.idle": "2024-05-15T22:09:55.275578Z", - "shell.execute_reply": "2024-05-15T22:09:55.275074Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "profile = pystrata.site.Profile(\n", @@ -149,15 +114,8 @@ }, { "cell_type": "code", - "execution_count": 6, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:09:55.277803Z", - "iopub.status.busy": "2024-05-15T22:09:55.277559Z", - "iopub.status.idle": "2024-05-15T22:09:55.280396Z", - "shell.execute_reply": "2024-05-15T22:09:55.279925Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "calc = pystrata.propagation.LinearElasticCalculator()" @@ -172,15 +130,8 @@ }, { "cell_type": "code", - "execution_count": 7, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:09:55.282940Z", - "iopub.status.busy": "2024-05-15T22:09:55.282745Z", - "iopub.status.idle": "2024-05-15T22:09:55.286944Z", - "shell.execute_reply": "2024-05-15T22:09:55.286452Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "freqs = np.logspace(-1, 2, num=500)\n", @@ -224,15 +175,8 @@ }, { "cell_type": "code", - "execution_count": 8, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:09:55.289149Z", - "iopub.status.busy": "2024-05-15T22:09:55.288946Z", - "iopub.status.idle": "2024-05-15T22:09:56.251644Z", - "shell.execute_reply": "2024-05-15T22:09:56.250743Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "for m in motions:\n", @@ -251,15 +195,8 @@ }, { "cell_type": "code", - "execution_count": 9, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:09:56.255353Z", - "iopub.status.busy": "2024-05-15T22:09:56.255149Z", - "iopub.status.idle": "2024-05-15T22:09:57.486439Z", - "shell.execute_reply": "2024-05-15T22:09:57.485884Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [ { "data": { @@ -288,38 +225,7 @@ ] } ], - "metadata": { - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.11.8" - }, - "toc": { - "base_numbering": 1, - "nav_menu": {}, - "number_sections": true, - "sideBar": true, - "skip_h1_title": false, - "title_cell": "Table of Contents", - "title_sidebar": "Contents", - "toc_cell": false, - "toc_position": {}, - "toc_section_display": true, - "toc_window_display": false - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 4 } diff --git a/examples/example-08.ipynb b/examples/example-08.ipynb index bd4eefd..dd3f824 100644 --- a/examples/example-08.ipynb +++ b/examples/example-08.ipynb @@ -11,15 +11,8 @@ }, { "cell_type": "code", - "execution_count": 1, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:09:58.967964Z", - "iopub.status.busy": "2024-05-15T22:09:58.967300Z", - "iopub.status.idle": "2024-05-15T22:10:00.871925Z", - "shell.execute_reply": "2024-05-15T22:10:00.871263Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "import matplotlib.pyplot as plt\n", @@ -32,15 +25,8 @@ }, { "cell_type": "code", - "execution_count": 2, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:10:00.875634Z", - "iopub.status.busy": "2024-05-15T22:10:00.875326Z", - "iopub.status.idle": "2024-05-15T22:10:00.878519Z", - "shell.execute_reply": "2024-05-15T22:10:00.877909Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "# Increased figure sizes\n", @@ -56,15 +42,8 @@ }, { "cell_type": "code", - "execution_count": 3, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:10:00.881430Z", - "iopub.status.busy": "2024-05-15T22:10:00.881207Z", - "iopub.status.idle": "2024-05-15T22:10:00.885049Z", - "shell.execute_reply": "2024-05-15T22:10:00.884438Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "m = pystrata.motion.SourceTheoryRvtMotion(6.0, 30, \"wna\")\n", @@ -82,15 +61,8 @@ }, { "cell_type": "code", - "execution_count": 4, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:10:00.887879Z", - "iopub.status.busy": "2024-05-15T22:10:00.887656Z", - "iopub.status.idle": "2024-05-15T22:10:00.893392Z", - "shell.execute_reply": "2024-05-15T22:10:00.892792Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "profile = pystrata.site.Profile(\n", @@ -124,15 +96,8 @@ }, { "cell_type": "code", - "execution_count": 5, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:10:00.896102Z", - "iopub.status.busy": "2024-05-15T22:10:00.895906Z", - "iopub.status.idle": "2024-05-15T22:10:00.898976Z", - "shell.execute_reply": "2024-05-15T22:10:00.898364Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "calc = pystrata.propagation.EquivalentLinearCalculator()" @@ -147,20 +112,8 @@ }, { "cell_type": "code", - "execution_count": 6, - "metadata": { - "editable": true, - "execution": { - "iopub.execute_input": "2024-05-15T22:10:00.901786Z", - "iopub.status.busy": "2024-05-15T22:10:00.901565Z", - "iopub.status.idle": "2024-05-15T22:10:00.905007Z", - "shell.execute_reply": "2024-05-15T22:10:00.904421Z" - }, - "slideshow": { - "slide_type": "" - }, - "tags": [] - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "var_thickness = pystrata.variation.ToroThicknessVariation()\n", @@ -177,15 +130,8 @@ }, { "cell_type": "code", - "execution_count": 7, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:10:00.908426Z", - "iopub.status.busy": "2024-05-15T22:10:00.908089Z", - "iopub.status.idle": "2024-05-15T22:10:00.912574Z", - "shell.execute_reply": "2024-05-15T22:10:00.911963Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "freqs = np.logspace(-1, 2, num=500)\n", @@ -224,15 +170,8 @@ }, { "cell_type": "code", - "execution_count": 8, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:10:00.915916Z", - "iopub.status.busy": "2024-05-15T22:10:00.915695Z", - "iopub.status.idle": "2024-05-15T22:10:08.605712Z", - "shell.execute_reply": "2024-05-15T22:10:08.604777Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "count = 20\n", @@ -260,15 +199,8 @@ }, { "cell_type": "code", - "execution_count": 9, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:10:08.609994Z", - "iopub.status.busy": "2024-05-15T22:10:08.609792Z", - "iopub.status.idle": "2024-05-15T22:10:09.928983Z", - "shell.execute_reply": "2024-05-15T22:10:09.928339Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [ { "data": { @@ -298,15 +230,8 @@ }, { "cell_type": "code", - "execution_count": 10, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:10:09.933721Z", - "iopub.status.busy": "2024-05-15T22:10:09.933519Z", - "iopub.status.idle": "2024-05-15T22:10:10.243295Z", - "shell.execute_reply": "2024-05-15T22:10:10.242663Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [ { "data": { @@ -332,15 +257,8 @@ }, { "cell_type": "code", - "execution_count": 11, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:10:10.247397Z", - "iopub.status.busy": "2024-05-15T22:10:10.247196Z", - "iopub.status.idle": "2024-05-15T22:10:10.266403Z", - "shell.execute_reply": "2024-05-15T22:10:10.265798Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [ { "data": { @@ -692,15 +610,8 @@ }, { "cell_type": "code", - "execution_count": 12, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:10:10.269782Z", - "iopub.status.busy": "2024-05-15T22:10:10.269557Z", - "iopub.status.idle": "2024-05-15T22:10:10.292638Z", - "shell.execute_reply": "2024-05-15T22:10:10.292000Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [ { "data": { @@ -836,15 +747,8 @@ }, { "cell_type": "code", - "execution_count": 13, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:10:10.296030Z", - "iopub.status.busy": "2024-05-15T22:10:10.295815Z", - "iopub.status.idle": "2024-05-15T22:10:10.298953Z", - "shell.execute_reply": "2024-05-15T22:10:10.298360Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "var_velocity_dd = pystrata.variation.DepthDependToroVelVariation.generic_model(\"USGS C\")" @@ -852,15 +756,8 @@ }, { "cell_type": "code", - "execution_count": 14, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:10:10.302175Z", - "iopub.status.busy": "2024-05-15T22:10:10.301979Z", - "iopub.status.idle": "2024-05-15T22:10:17.366211Z", - "shell.execute_reply": "2024-05-15T22:10:17.365523Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "outputs.reset()\n", @@ -879,15 +776,8 @@ }, { "cell_type": "code", - "execution_count": 15, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:10:17.370169Z", - "iopub.status.busy": "2024-05-15T22:10:17.369969Z", - "iopub.status.idle": "2024-05-15T22:10:18.354101Z", - "shell.execute_reply": "2024-05-15T22:10:18.353462Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [ { "data": { @@ -917,15 +807,8 @@ }, { "cell_type": "code", - "execution_count": 16, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:10:18.358504Z", - "iopub.status.busy": "2024-05-15T22:10:18.358285Z", - "iopub.status.idle": "2024-05-15T22:10:18.637579Z", - "shell.execute_reply": "2024-05-15T22:10:18.636942Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [ { "data": { @@ -944,15 +827,8 @@ }, { "cell_type": "code", - "execution_count": 17, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:10:18.641600Z", - "iopub.status.busy": "2024-05-15T22:10:18.641393Z", - "iopub.status.idle": "2024-05-15T22:10:18.652768Z", - "shell.execute_reply": "2024-05-15T22:10:18.652163Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [ { "data": { @@ -1081,15 +957,8 @@ }, { "cell_type": "code", - "execution_count": 18, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:10:18.656077Z", - "iopub.status.busy": "2024-05-15T22:10:18.655876Z", - "iopub.status.idle": "2024-05-15T22:10:18.659179Z", - "shell.execute_reply": "2024-05-15T22:10:18.658601Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "var_velocity_dd = pystrata.variation.DepthDependToroVelVariation.generic_model(\n", @@ -1099,15 +968,8 @@ }, { "cell_type": "code", - "execution_count": 19, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:10:18.662378Z", - "iopub.status.busy": "2024-05-15T22:10:18.662186Z", - "iopub.status.idle": "2024-05-15T22:10:25.721949Z", - "shell.execute_reply": "2024-05-15T22:10:25.721088Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "outputs.reset()\n", @@ -1126,15 +988,8 @@ }, { "cell_type": "code", - "execution_count": 20, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:10:25.725891Z", - "iopub.status.busy": "2024-05-15T22:10:25.725662Z", - "iopub.status.idle": "2024-05-15T22:10:26.815394Z", - "shell.execute_reply": "2024-05-15T22:10:26.814830Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [ { "data": { @@ -1164,15 +1019,8 @@ }, { "cell_type": "code", - "execution_count": 21, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:10:26.820396Z", - "iopub.status.busy": "2024-05-15T22:10:26.820159Z", - "iopub.status.idle": "2024-05-15T22:10:27.091914Z", - "shell.execute_reply": "2024-05-15T22:10:27.091195Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [ { "data": { @@ -1191,15 +1039,8 @@ }, { "cell_type": "code", - "execution_count": 22, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:10:27.097096Z", - "iopub.status.busy": "2024-05-15T22:10:27.096881Z", - "iopub.status.idle": "2024-05-15T22:10:27.108109Z", - "shell.execute_reply": "2024-05-15T22:10:27.107591Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [ { "data": { @@ -1320,38 +1161,7 @@ ] } ], - "metadata": { - "kernelspec": { - "display_name": "py311", - "language": "python", - "name": "py311" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.11.8" - }, - "toc": { - "base_numbering": 1, - "nav_menu": {}, - "number_sections": true, - "sideBar": true, - "skip_h1_title": false, - "title_cell": "Table of Contents", - "title_sidebar": "Contents", - "toc_cell": false, - "toc_position": {}, - "toc_section_display": true, - "toc_window_display": true - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 4 } diff --git a/examples/example-09.ipynb b/examples/example-09.ipynb index a5f8a5a..27a047c 100644 --- a/examples/example-09.ipynb +++ b/examples/example-09.ipynb @@ -11,15 +11,8 @@ }, { "cell_type": "code", - "execution_count": 1, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:10:28.389479Z", - "iopub.status.busy": "2024-05-15T22:10:28.389180Z", - "iopub.status.idle": "2024-05-15T22:10:30.279548Z", - "shell.execute_reply": "2024-05-15T22:10:30.278765Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "import json\n", @@ -34,15 +27,8 @@ }, { "cell_type": "code", - "execution_count": 2, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:10:30.282735Z", - "iopub.status.busy": "2024-05-15T22:10:30.282422Z", - "iopub.status.idle": "2024-05-15T22:10:30.285983Z", - "shell.execute_reply": "2024-05-15T22:10:30.285286Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "# Increased figure sizes\n", @@ -58,15 +44,8 @@ }, { "cell_type": "code", - "execution_count": 3, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:10:30.288204Z", - "iopub.status.busy": "2024-05-15T22:10:30.288008Z", - "iopub.status.idle": "2024-05-15T22:10:30.294727Z", - "shell.execute_reply": "2024-05-15T22:10:30.294058Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "with open(\"../tests/data/qwl_tests.json\") as fp:\n", @@ -98,15 +77,8 @@ }, { "cell_type": "code", - "execution_count": 4, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:10:30.296855Z", - "iopub.status.busy": "2024-05-15T22:10:30.296660Z", - "iopub.status.idle": "2024-05-15T22:10:30.300471Z", - "shell.execute_reply": "2024-05-15T22:10:30.299799Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "motion = pystrata.motion.SourceTheoryRvtMotion(magnitude=6.5, distance=20, region=\"cena\")\n", @@ -115,15 +87,8 @@ }, { "cell_type": "code", - "execution_count": 5, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:10:30.302526Z", - "iopub.status.busy": "2024-05-15T22:10:30.302326Z", - "iopub.status.idle": "2024-05-15T22:10:30.305956Z", - "shell.execute_reply": "2024-05-15T22:10:30.305283Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "calc = pystrata.propagation.QuarterWaveLenCalculator(site_atten=0.04)\n", @@ -132,15 +97,8 @@ }, { "cell_type": "code", - "execution_count": 6, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:10:30.308014Z", - "iopub.status.busy": "2024-05-15T22:10:30.307820Z", - "iopub.status.idle": "2024-05-15T22:10:30.435216Z", - "shell.execute_reply": "2024-05-15T22:10:30.434439Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "calc(motion, profile, input_loc)" @@ -148,15 +106,8 @@ }, { "cell_type": "code", - "execution_count": 7, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:10:30.437928Z", - "iopub.status.busy": "2024-05-15T22:10:30.437723Z", - "iopub.status.idle": "2024-05-15T22:10:31.082921Z", - "shell.execute_reply": "2024-05-15T22:10:31.082077Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [ { "data": { @@ -192,15 +143,8 @@ }, { "cell_type": "code", - "execution_count": 8, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:10:31.086235Z", - "iopub.status.busy": "2024-05-15T22:10:31.086029Z", - "iopub.status.idle": "2024-05-15T22:10:31.480312Z", - "shell.execute_reply": "2024-05-15T22:10:31.479516Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [ { "data": { @@ -236,15 +180,8 @@ }, { "cell_type": "code", - "execution_count": 9, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:10:31.484192Z", - "iopub.status.busy": "2024-05-15T22:10:31.483983Z", - "iopub.status.idle": "2024-05-15T22:10:35.333319Z", - "shell.execute_reply": "2024-05-15T22:10:35.332516Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [ { "data": { @@ -362,41 +299,7 @@ "source": [] } ], - "metadata": { - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.11.8" - }, - "toc": { - "base_numbering": 1, - "nav_menu": { - "height": "12px", - "width": "160px" - }, - "number_sections": true, - "sideBar": true, - "skip_h1_title": false, - "title_cell": "Table of Contents", - "title_sidebar": "Contents", - "toc_cell": false, - "toc_position": {}, - "toc_section_display": true, - "toc_window_display": false - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 4 } diff --git a/examples/example-10.ipynb b/examples/example-10.ipynb index 29498b4..12820be 100644 --- a/examples/example-10.ipynb +++ b/examples/example-10.ipynb @@ -9,15 +9,8 @@ }, { "cell_type": "code", - "execution_count": 1, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:10:36.764059Z", - "iopub.status.busy": "2024-05-15T22:10:36.763260Z", - "iopub.status.idle": "2024-05-15T22:10:38.595887Z", - "shell.execute_reply": "2024-05-15T22:10:38.595124Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "import itertools\n", @@ -34,15 +27,8 @@ }, { "cell_type": "code", - "execution_count": 2, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:10:38.599978Z", - "iopub.status.busy": "2024-05-15T22:10:38.599685Z", - "iopub.status.idle": "2024-05-15T22:10:38.603795Z", - "shell.execute_reply": "2024-05-15T22:10:38.602843Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "# Increased figure sizes\n", @@ -51,15 +37,8 @@ }, { "cell_type": "code", - "execution_count": 3, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:10:38.607121Z", - "iopub.status.busy": "2024-05-15T22:10:38.606925Z", - "iopub.status.idle": "2024-05-15T22:10:38.611057Z", - "shell.execute_reply": "2024-05-15T22:10:38.610104Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "osc_freqs = np.logspace(-1, 2, num=91)" @@ -67,15 +46,8 @@ }, { "cell_type": "code", - "execution_count": 4, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:10:38.614442Z", - "iopub.status.busy": "2024-05-15T22:10:38.614223Z", - "iopub.status.idle": "2024-05-15T22:10:38.621368Z", - "shell.execute_reply": "2024-05-15T22:10:38.620710Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "peak_calcs = [\n", @@ -108,15 +80,8 @@ }, { "cell_type": "code", - "execution_count": 5, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:10:38.624691Z", - "iopub.status.busy": "2024-05-15T22:10:38.624483Z", - "iopub.status.idle": "2024-05-15T22:10:38.630049Z", - "shell.execute_reply": "2024-05-15T22:10:38.629361Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "for m in motions:\n", @@ -125,15 +90,8 @@ }, { "cell_type": "code", - "execution_count": 6, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:10:38.633478Z", - "iopub.status.busy": "2024-05-15T22:10:38.633237Z", - "iopub.status.idle": "2024-05-15T22:10:40.133973Z", - "shell.execute_reply": "2024-05-15T22:10:40.133287Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [ { "data": { @@ -176,38 +134,7 @@ "source": [] } ], - "metadata": { - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.11.8" - }, - "toc": { - "base_numbering": 1, - "nav_menu": {}, - "number_sections": true, - "sideBar": true, - "skip_h1_title": false, - "title_cell": "Table of Contents", - "title_sidebar": "Contents", - "toc_cell": false, - "toc_position": {}, - "toc_section_display": true, - "toc_window_display": false - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 4 } diff --git a/examples/example-11.ipynb b/examples/example-11.ipynb index 1b30123..f911f6c 100644 --- a/examples/example-11.ipynb +++ b/examples/example-11.ipynb @@ -11,15 +11,8 @@ }, { "cell_type": "code", - "execution_count": 1, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:10:41.358964Z", - "iopub.status.busy": "2024-05-15T22:10:41.358757Z", - "iopub.status.idle": "2024-05-15T22:10:43.271860Z", - "shell.execute_reply": "2024-05-15T22:10:43.271177Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "import matplotlib.pyplot as plt\n", @@ -32,15 +25,8 @@ }, { "cell_type": "code", - "execution_count": 2, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:10:43.274744Z", - "iopub.status.busy": "2024-05-15T22:10:43.274440Z", - "iopub.status.idle": "2024-05-15T22:10:43.277808Z", - "shell.execute_reply": "2024-05-15T22:10:43.277202Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "# Increased figure sizes\n", @@ -56,15 +42,8 @@ }, { "cell_type": "code", - "execution_count": 3, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:10:43.280092Z", - "iopub.status.busy": "2024-05-15T22:10:43.279902Z", - "iopub.status.idle": "2024-05-15T22:10:43.285819Z", - "shell.execute_reply": "2024-05-15T22:10:43.285209Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "fname = \"data/NIS090.AT2\"\n", @@ -82,15 +61,8 @@ }, { "cell_type": "code", - "execution_count": 4, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:10:43.288120Z", - "iopub.status.busy": "2024-05-15T22:10:43.287923Z", - "iopub.status.idle": "2024-05-15T22:10:43.293525Z", - "shell.execute_reply": "2024-05-15T22:10:43.292843Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [ { "data": { @@ -117,15 +89,8 @@ }, { "cell_type": "code", - "execution_count": 5, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:10:43.295834Z", - "iopub.status.busy": "2024-05-15T22:10:43.295642Z", - "iopub.status.idle": "2024-05-15T22:10:43.301278Z", - "shell.execute_reply": "2024-05-15T22:10:43.300782Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [ { "data": { @@ -146,15 +111,8 @@ }, { "cell_type": "code", - "execution_count": 6, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:10:43.304655Z", - "iopub.status.busy": "2024-05-15T22:10:43.304423Z", - "iopub.status.idle": "2024-05-15T22:10:43.448133Z", - "shell.execute_reply": "2024-05-15T22:10:43.447577Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [ { "data": { @@ -185,15 +143,8 @@ }, { "cell_type": "code", - "execution_count": 7, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:10:43.452532Z", - "iopub.status.busy": "2024-05-15T22:10:43.452317Z", - "iopub.status.idle": "2024-05-15T22:10:43.456645Z", - "shell.execute_reply": "2024-05-15T22:10:43.456115Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "profile = pystrata.site.Profile(\n", @@ -217,15 +168,8 @@ }, { "cell_type": "code", - "execution_count": 8, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:10:43.460164Z", - "iopub.status.busy": "2024-05-15T22:10:43.459935Z", - "iopub.status.idle": "2024-05-15T22:10:43.463405Z", - "shell.execute_reply": "2024-05-15T22:10:43.462896Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "calcs = [\n", @@ -250,15 +194,8 @@ }, { "cell_type": "code", - "execution_count": 9, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:10:43.467010Z", - "iopub.status.busy": "2024-05-15T22:10:43.466784Z", - "iopub.status.idle": "2024-05-15T22:10:43.473268Z", - "shell.execute_reply": "2024-05-15T22:10:43.472759Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "freqs = np.logspace(-1, np.log10(50.0), num=500)\n", @@ -320,15 +257,8 @@ }, { "cell_type": "code", - "execution_count": 10, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:10:43.476861Z", - "iopub.status.busy": "2024-05-15T22:10:43.476627Z", - "iopub.status.idle": "2024-05-15T22:10:44.186035Z", - "shell.execute_reply": "2024-05-15T22:10:44.185409Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "properties = {}\n", @@ -348,15 +278,8 @@ }, { "cell_type": "code", - "execution_count": 11, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:10:44.190320Z", - "iopub.status.busy": "2024-05-15T22:10:44.190111Z", - "iopub.status.idle": "2024-05-15T22:10:45.167314Z", - "shell.execute_reply": "2024-05-15T22:10:45.166768Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [ { "data": { @@ -408,15 +331,8 @@ }, { "cell_type": "code", - "execution_count": 12, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:10:45.171848Z", - "iopub.status.busy": "2024-05-15T22:10:45.171635Z", - "iopub.status.idle": "2024-05-15T22:10:46.593072Z", - "shell.execute_reply": "2024-05-15T22:10:46.592517Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [ { "data": { @@ -478,38 +394,7 @@ "source": [] } ], - "metadata": { - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.11.8" - }, - "toc": { - "base_numbering": 1, - "nav_menu": {}, - "number_sections": true, - "sideBar": true, - "skip_h1_title": false, - "title_cell": "Table of Contents", - "title_sidebar": "Contents", - "toc_cell": false, - "toc_position": {}, - "toc_section_display": true, - "toc_window_display": false - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 4 } diff --git a/examples/example-12.ipynb b/examples/example-12.ipynb index 21e5f7e..90df5e0 100644 --- a/examples/example-12.ipynb +++ b/examples/example-12.ipynb @@ -9,15 +9,8 @@ }, { "cell_type": "code", - "execution_count": 1, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:10:48.092423Z", - "iopub.status.busy": "2024-05-15T22:10:48.091768Z", - "iopub.status.idle": "2024-05-15T22:10:50.007307Z", - "shell.execute_reply": "2024-05-15T22:10:50.006543Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "import itertools\n", @@ -33,15 +26,8 @@ }, { "cell_type": "code", - "execution_count": 2, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:10:50.011418Z", - "iopub.status.busy": "2024-05-15T22:10:50.011093Z", - "iopub.status.idle": "2024-05-15T22:10:50.014790Z", - "shell.execute_reply": "2024-05-15T22:10:50.014109Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "plt.rcParams[\"figure.dpi\"] = 150" @@ -56,15 +42,8 @@ }, { "cell_type": "code", - "execution_count": 3, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:10:50.018391Z", - "iopub.status.busy": "2024-05-15T22:10:50.018019Z", - "iopub.status.idle": "2024-05-15T22:10:50.023874Z", - "shell.execute_reply": "2024-05-15T22:10:50.023194Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "plast_indices = [0, 20, 50, 100]\n", @@ -80,15 +59,8 @@ }, { "cell_type": "code", - "execution_count": 4, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:10:50.027128Z", - "iopub.status.busy": "2024-05-15T22:10:50.026933Z", - "iopub.status.idle": "2024-05-15T22:10:50.290298Z", - "shell.execute_reply": "2024-05-15T22:10:50.289528Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "def calc_damp_min(row):\n", @@ -105,15 +77,8 @@ }, { "cell_type": "code", - "execution_count": 5, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:10:50.294254Z", - "iopub.status.busy": "2024-05-15T22:10:50.294020Z", - "iopub.status.idle": "2024-05-15T22:10:50.304960Z", - "shell.execute_reply": "2024-05-15T22:10:50.304405Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [ { "data": { @@ -208,15 +173,8 @@ }, { "cell_type": "code", - "execution_count": 6, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:10:50.308344Z", - "iopub.status.busy": "2024-05-15T22:10:50.308141Z", - "iopub.status.idle": "2024-05-15T22:10:50.311376Z", - "shell.execute_reply": "2024-05-15T22:10:50.310796Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "centers = {\"plast_ind\": 20, \"stress_mean\": 101.3, \"ocr\": 1}" @@ -224,15 +182,8 @@ }, { "cell_type": "code", - "execution_count": 7, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:10:50.314658Z", - "iopub.status.busy": "2024-05-15T22:10:50.314460Z", - "iopub.status.idle": "2024-05-15T22:10:51.710614Z", - "shell.execute_reply": "2024-05-15T22:10:51.709873Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [ { "data": { @@ -299,15 +250,8 @@ }, { "cell_type": "code", - "execution_count": 8, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:10:51.714882Z", - "iopub.status.busy": "2024-05-15T22:10:51.714669Z", - "iopub.status.idle": "2024-05-15T22:10:51.718783Z", - "shell.execute_reply": "2024-05-15T22:10:51.718108Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "motion = pystrata.motion.SourceTheoryRvtMotion(7.0, 30, \"wna\")\n", @@ -323,15 +267,8 @@ }, { "cell_type": "code", - "execution_count": 9, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:10:51.722377Z", - "iopub.status.busy": "2024-05-15T22:10:51.722176Z", - "iopub.status.idle": "2024-05-15T22:10:51.788941Z", - "shell.execute_reply": "2024-05-15T22:10:51.788175Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "profiles = [\n", @@ -366,15 +303,8 @@ }, { "cell_type": "code", - "execution_count": 10, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:10:51.792613Z", - "iopub.status.busy": "2024-05-15T22:10:51.792394Z", - "iopub.status.idle": "2024-05-15T22:10:51.795934Z", - "shell.execute_reply": "2024-05-15T22:10:51.795252Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "calc_fdm = pystrata.propagation.FrequencyDependentEqlCalculator(use_smooth_spectrum=False)\n", @@ -383,15 +313,8 @@ }, { "cell_type": "code", - "execution_count": 11, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:10:51.799250Z", - "iopub.status.busy": "2024-05-15T22:10:51.799041Z", - "iopub.status.idle": "2024-05-15T22:10:51.803781Z", - "shell.execute_reply": "2024-05-15T22:10:51.803098Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "freqs = np.logspace(-1, 2, num=500)\n", @@ -427,15 +350,8 @@ }, { "cell_type": "code", - "execution_count": 12, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:10:51.807178Z", - "iopub.status.busy": "2024-05-15T22:10:51.806972Z", - "iopub.status.idle": "2024-05-15T22:10:58.741400Z", - "shell.execute_reply": "2024-05-15T22:10:58.740533Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "for name, profile in zip([\"FDM - Constant $D_{min}$\", \"FDM - Variable $D_{min}$\"], profiles):\n", @@ -455,15 +371,8 @@ }, { "cell_type": "code", - "execution_count": 13, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:10:58.744439Z", - "iopub.status.busy": "2024-05-15T22:10:58.744225Z", - "iopub.status.idle": "2024-05-15T22:10:59.696937Z", - "shell.execute_reply": "2024-05-15T22:10:59.696276Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [ { "data": { @@ -499,38 +408,7 @@ "source": [] } ], - "metadata": { - "kernelspec": { - "display_name": "py310", - "language": "python", - "name": "py310" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.11.8" - }, - "toc": { - "base_numbering": 1, - "nav_menu": {}, - "number_sections": true, - "sideBar": true, - "skip_h1_title": false, - "title_cell": "Table of Contents", - "title_sidebar": "Contents", - "toc_cell": false, - "toc_position": {}, - "toc_section_display": true, - "toc_window_display": true - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 4 } diff --git a/examples/example-13.ipynb b/examples/example-13.ipynb index f643e0e..6bc8d34 100644 --- a/examples/example-13.ipynb +++ b/examples/example-13.ipynb @@ -11,15 +11,8 @@ }, { "cell_type": "code", - "execution_count": 1, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:11:01.195362Z", - "iopub.status.busy": "2024-05-15T22:11:01.194984Z", - "iopub.status.idle": "2024-05-15T22:11:03.088348Z", - "shell.execute_reply": "2024-05-15T22:11:03.087598Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "import matplotlib.pyplot as plt\n", @@ -32,15 +25,8 @@ }, { "cell_type": "code", - "execution_count": 2, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:11:03.092592Z", - "iopub.status.busy": "2024-05-15T22:11:03.092223Z", - "iopub.status.idle": "2024-05-15T22:11:03.095766Z", - "shell.execute_reply": "2024-05-15T22:11:03.095095Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "# Increased figure sizes\n", @@ -56,15 +42,8 @@ }, { "cell_type": "code", - "execution_count": 3, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:11:03.099072Z", - "iopub.status.busy": "2024-05-15T22:11:03.098873Z", - "iopub.status.idle": "2024-05-15T22:11:03.106349Z", - "shell.execute_reply": "2024-05-15T22:11:03.105691Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [ { "data": { @@ -84,15 +63,8 @@ }, { "cell_type": "code", - "execution_count": 4, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:11:03.110811Z", - "iopub.status.busy": "2024-05-15T22:11:03.110589Z", - "iopub.status.idle": "2024-05-15T22:11:03.116897Z", - "shell.execute_reply": "2024-05-15T22:11:03.116196Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "profile = pystrata.site.Profile(\n", @@ -121,15 +93,8 @@ }, { "cell_type": "code", - "execution_count": 5, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:11:03.120526Z", - "iopub.status.busy": "2024-05-15T22:11:03.120307Z", - "iopub.status.idle": "2024-05-15T22:11:03.123790Z", - "shell.execute_reply": "2024-05-15T22:11:03.123119Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "calcs = [\n", @@ -139,15 +104,8 @@ }, { "cell_type": "code", - "execution_count": 6, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:11:03.127060Z", - "iopub.status.busy": "2024-05-15T22:11:03.126869Z", - "iopub.status.idle": "2024-05-15T22:11:03.131526Z", - "shell.execute_reply": "2024-05-15T22:11:03.130871Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "freqs = np.logspace(-1, 2, num=500)\n", @@ -186,15 +144,8 @@ }, { "cell_type": "code", - "execution_count": 7, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:11:03.134920Z", - "iopub.status.busy": "2024-05-15T22:11:03.134714Z", - "iopub.status.idle": "2024-05-15T22:11:03.918405Z", - "shell.execute_reply": "2024-05-15T22:11:03.917728Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "for c in calcs:\n", @@ -211,15 +162,8 @@ }, { "cell_type": "code", - "execution_count": 8, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:11:03.922326Z", - "iopub.status.busy": "2024-05-15T22:11:03.922122Z", - "iopub.status.idle": "2024-05-15T22:11:05.029981Z", - "shell.execute_reply": "2024-05-15T22:11:05.029515Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [ { "data": { @@ -250,15 +194,8 @@ }, { "cell_type": "code", - "execution_count": 9, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:11:05.034418Z", - "iopub.status.busy": "2024-05-15T22:11:05.034213Z", - "iopub.status.idle": "2024-05-15T22:11:05.465231Z", - "shell.execute_reply": "2024-05-15T22:11:05.464517Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [ { "data": { @@ -285,38 +222,7 @@ "source": [] } ], - "metadata": { - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.11.8" - }, - "toc": { - "base_numbering": 1, - "nav_menu": {}, - "number_sections": true, - "sideBar": true, - "skip_h1_title": false, - "title_cell": "Table of Contents", - "title_sidebar": "Contents", - "toc_cell": false, - "toc_position": {}, - "toc_section_display": true, - "toc_window_display": false - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 4 } diff --git a/examples/example-14.ipynb b/examples/example-14.ipynb index 4db34d0..99c360e 100644 --- a/examples/example-14.ipynb +++ b/examples/example-14.ipynb @@ -11,15 +11,8 @@ }, { "cell_type": "code", - "execution_count": 1, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:11:06.969813Z", - "iopub.status.busy": "2024-05-15T22:11:06.969428Z", - "iopub.status.idle": "2024-05-15T22:11:08.866789Z", - "shell.execute_reply": "2024-05-15T22:11:08.866123Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "import matplotlib.pyplot as plt\n", @@ -33,15 +26,8 @@ }, { "cell_type": "code", - "execution_count": 2, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:11:08.870458Z", - "iopub.status.busy": "2024-05-15T22:11:08.870163Z", - "iopub.status.idle": "2024-05-15T22:11:08.873142Z", - "shell.execute_reply": "2024-05-15T22:11:08.872635Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "# Increased figure sizes\n", @@ -57,15 +43,8 @@ }, { "cell_type": "code", - "execution_count": 3, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:11:08.876271Z", - "iopub.status.busy": "2024-05-15T22:11:08.876048Z", - "iopub.status.idle": "2024-05-15T22:11:08.880927Z", - "shell.execute_reply": "2024-05-15T22:11:08.880411Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "motions = [\n", @@ -89,15 +68,8 @@ }, { "cell_type": "code", - "execution_count": 4, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:11:08.883700Z", - "iopub.status.busy": "2024-05-15T22:11:08.883501Z", - "iopub.status.idle": "2024-05-15T22:11:08.888798Z", - "shell.execute_reply": "2024-05-15T22:11:08.888288Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "profile = pystrata.site.Profile(\n", @@ -131,15 +103,8 @@ }, { "cell_type": "code", - "execution_count": 5, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:11:08.890943Z", - "iopub.status.busy": "2024-05-15T22:11:08.890747Z", - "iopub.status.idle": "2024-05-15T22:11:08.893595Z", - "shell.execute_reply": "2024-05-15T22:11:08.893085Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "calc = pystrata.propagation.EquivalentLinearCalculator()" @@ -154,15 +119,8 @@ }, { "cell_type": "code", - "execution_count": 6, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:11:08.895729Z", - "iopub.status.busy": "2024-05-15T22:11:08.895529Z", - "iopub.status.idle": "2024-05-15T22:11:08.898704Z", - "shell.execute_reply": "2024-05-15T22:11:08.898195Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "var_thickness = pystrata.variation.ToroThicknessVariation()\n", @@ -179,15 +137,8 @@ }, { "cell_type": "code", - "execution_count": 7, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:11:08.900865Z", - "iopub.status.busy": "2024-05-15T22:11:08.900665Z", - "iopub.status.idle": "2024-05-15T22:11:08.904978Z", - "shell.execute_reply": "2024-05-15T22:11:08.904470Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "freqs = np.logspace(-1, 2, num=500)\n", @@ -227,15 +178,8 @@ }, { "cell_type": "code", - "execution_count": 8, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:11:08.907888Z", - "iopub.status.busy": "2024-05-15T22:11:08.907666Z", - "iopub.status.idle": "2024-05-15T22:11:30.375399Z", - "shell.execute_reply": "2024-05-15T22:11:30.374704Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [], "source": [ "count = 20\n", @@ -268,15 +212,8 @@ }, { "cell_type": "code", - "execution_count": 9, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:11:30.379828Z", - "iopub.status.busy": "2024-05-15T22:11:30.379418Z", - "iopub.status.idle": "2024-05-15T22:11:32.666008Z", - "shell.execute_reply": "2024-05-15T22:11:32.665299Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [ { "data": { @@ -340,15 +277,8 @@ }, { "cell_type": "code", - "execution_count": 10, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:11:32.669187Z", - "iopub.status.busy": "2024-05-15T22:11:32.668978Z", - "iopub.status.idle": "2024-05-15T22:11:32.705649Z", - "shell.execute_reply": "2024-05-15T22:11:32.704955Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [ { "data": { @@ -755,15 +685,8 @@ }, { "cell_type": "code", - "execution_count": 11, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:11:32.709684Z", - "iopub.status.busy": "2024-05-15T22:11:32.709479Z", - "iopub.status.idle": "2024-05-15T22:11:32.733033Z", - "shell.execute_reply": "2024-05-15T22:11:32.732421Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [ { "data": { @@ -903,15 +826,8 @@ }, { "cell_type": "code", - "execution_count": 12, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:11:32.736540Z", - "iopub.status.busy": "2024-05-15T22:11:32.736331Z", - "iopub.status.idle": "2024-05-15T22:11:33.306023Z", - "shell.execute_reply": "2024-05-15T22:11:33.305387Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [ { "data": { @@ -1050,15 +966,8 @@ }, { "cell_type": "code", - "execution_count": 13, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:11:33.310224Z", - "iopub.status.busy": "2024-05-15T22:11:33.310024Z", - "iopub.status.idle": "2024-05-15T22:11:33.347518Z", - "shell.execute_reply": "2024-05-15T22:11:33.346898Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [ { "data": { @@ -1253,15 +1162,8 @@ }, { "cell_type": "code", - "execution_count": 14, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:11:33.351257Z", - "iopub.status.busy": "2024-05-15T22:11:33.351037Z", - "iopub.status.idle": "2024-05-15T22:11:33.359656Z", - "shell.execute_reply": "2024-05-15T22:11:33.359044Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [ { "data": { @@ -1383,15 +1285,8 @@ }, { "cell_type": "code", - "execution_count": 15, - "metadata": { - "execution": { - "iopub.execute_input": "2024-05-15T22:11:33.363270Z", - "iopub.status.busy": "2024-05-15T22:11:33.363074Z", - "iopub.status.idle": "2024-05-15T22:11:34.051571Z", - "shell.execute_reply": "2024-05-15T22:11:34.050913Z" - } - }, + "execution_count": null, + "metadata": {}, "outputs": [ { "data": { @@ -1421,38 +1316,7 @@ ] } ], - "metadata": { - "kernelspec": { - "display_name": "py311", - "language": "python", - "name": "py311" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.11.8" - }, - "toc": { - "base_numbering": 1, - "nav_menu": {}, - "number_sections": true, - "sideBar": true, - "skip_h1_title": false, - "title_cell": "Table of Contents", - "title_sidebar": "Contents", - "toc_cell": false, - "toc_position": {}, - "toc_section_display": true, - "toc_window_display": true - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 4 } diff --git a/pyproject.toml b/pyproject.toml index 7107a7b..e49dea2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -70,7 +70,6 @@ dependencies = [ "pytest-runner", "pyexcel", "pyexcel-xls", - "pyexcel-xlsx", # FIXME: Add as dependency of pystrata "matplotlib", "pykooh", diff --git a/setup.py b/setup.py index 2058d3a..c5a4a56 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,4 @@ #!/usr/bin/python3 -# -*- coding: utf-8 -*- from setuptools import setup if __name__ == "__main__": diff --git a/src/pystrata/__init__.py b/src/pystrata/__init__.py index 4d0c5fe..8b263e4 100644 --- a/src/pystrata/__init__.py +++ b/src/pystrata/__init__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # The MIT License (MIT) # # Copyright (c) 2016-2022 Albert Kottke @@ -22,12 +21,7 @@ # SOFTWARE. from importlib.metadata import version -from . import motion -from . import output -from . import propagation -from . import site -from . import tools -from . import variation +from . import motion, output, propagation, site, tools, variation __all__ = ["motion", "propagation", "output", "site", "tools", "variation"] diff --git a/src/pystrata/motion.py b/src/pystrata/motion.py index 4b075bd..f894548 100644 --- a/src/pystrata/motion.py +++ b/src/pystrata/motion.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # The MIT License (MIT) # # Copyright (c) 2016-2018 Albert Kottke @@ -21,6 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. """Classes used to define input motions.""" + import enum import re @@ -77,10 +77,13 @@ def pga(self): class TimeSeriesMotion(Motion): """Time-series motion for time series based site response analysis.""" - def __init__(self, filename: str, description: str, time_step: float, accels, fa_length=None): + def __init__( + self, filename: str, description: str, time_step: float, accels, fa_length=None + ): """Initialize the class from specified acceleration values. - The *filename* and *description* parameters are only used to help track the motion. + The *filename* and *description* parameters are only used to help track the + motion. Parameters ---------- @@ -93,7 +96,8 @@ def __init__(self, filename: str, description: str, time_step: float, accels, fa accels: array_like Accelerations in units of *g* fa_length: optional int - Length to use for the Fourier amplitude spectrum. If not provided, will be automatically computed to the next power of 2. + Length to use for the Fourier amplitude spectrum. If not provided, will be + automatically computed to the next power of 2. """ Motion.__init__(self) @@ -178,7 +182,10 @@ def calc_osc_accels(self, osc_freqs, osc_damping=0.05, tf=None): tf = np.asarray(tf).astype(complex) resp = np.array( - [self.calc_peak(tf * self._calc_sdof_tf(of, osc_damping)) for of in osc_freqs] + [ + self.calc_peak(tf * self._calc_sdof_tf(of, osc_damping)) + for of in osc_freqs + ] ) return resp @@ -218,7 +225,9 @@ def _calc_sdof_tf(self, osc_freq, damping=0.05): Complex-valued transfer function with length equal to `self.freq`. """ return -(osc_freq**2.0) / ( - np.square(self.freqs) - np.square(osc_freq) - 2.0j * damping * osc_freq * self.freqs + np.square(self.freqs) + - np.square(osc_freq) + - 2.0j * damping * osc_freq * self.freqs ) @classmethod @@ -239,7 +248,7 @@ def load_at2_file(cls, filename, scale=1.0): parts = next(fp).split() time_step = float(parts[1]) - accels = np.array([float(p) for l in fp for p in l.split()]) + accels = np.array([float(part) for line in fp for part in line.split()]) accels *= scale return cls(filename, description, time_step, accels) @@ -273,12 +282,16 @@ def load_smc_file(cls, filename, scale=1.0): description = "; ".join([g.strip() for g in m.groups()]) # 6 lines of (8i10) formatted integers - values_int = parse_fixed_width(48 * [(10, int)], [lines.pop(0) for _ in range(6)]) + values_int = parse_fixed_width( + 48 * [(10, int)], [lines.pop(0) for _ in range(6)] + ) count_comment = values_int[15] count = values_int[16] # 10 lines of (5e15.7) formatted floats - values_float = parse_fixed_width(50 * [(15, float)], [lines.pop(0) for _ in range(10)]) + values_float = parse_fixed_width( + 50 * [(15, float)], [lines.pop(0) for _ in range(10)] + ) time_step = 1 / values_float[1] # Skip comments @@ -298,10 +311,13 @@ def load_smc_file(cls, filename, scale=1.0): return TimeSeriesMotion(filename, description, time_step, accels) +# FIXME: How do multiple inheritence properly? class RvtMotion(pyrvt.motions.RvtMotion, Motion): """RVT motion based on user specified Fourier amplitude spectrum and duration.""" - def __init__(self, freqs, fourier_amps, duration=None, peak_calculator=None, calc_kwds=None): + def __init__( + self, freqs, fourier_amps, duration=None, peak_calculator=None, calc_kwds=None + ): Motion.__init__(self) pyrvt.motions.RvtMotion.__init__( self, @@ -314,7 +330,8 @@ def __init__(self, freqs, fourier_amps, duration=None, peak_calculator=None, cal class CompatibleRvtMotion(pyrvt.motions.CompatibleRvtMotion, Motion): - """RVT motion based on user specified acceleration response spectrum and duration.""" + """RVT motion based on user specified acceleration response spectrum and + duration.""" def __init__( self, @@ -342,7 +359,8 @@ def __init__( class SourceTheoryRvtMotion(pyrvt.motions.SourceTheoryMotion, Motion): - """RVT motion based on seismological point source model and earthquake scenario parameters.""" + """RVT motion based on seismological point source model and earthquake scenario + parameters.""" def __init__( self, diff --git a/src/pystrata/output.py b/src/pystrata/output.py index e92afa7..0c085ac 100644 --- a/src/pystrata/output.py +++ b/src/pystrata/output.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # The MIT License (MIT) # # Copyright (c) 2016-2021 Albert Kottke @@ -25,8 +24,7 @@ import matplotlib.pyplot as plt import numpy as np import scipy.integrate -from matplotlib.colors import LogNorm -from matplotlib.colors import TwoSlopeNorm +from matplotlib.colors import LogNorm, TwoSlopeNorm from scipy.interpolate import interp1d try: @@ -568,7 +566,9 @@ class AccelTransferFunctionOutput(RatioBasedOutput): ref_name = "freq" - def __init__(self, refs, location_in, location_out, ko_bandwidth=None, absolute=True): + def __init__( + self, refs, location_in, location_out, ko_bandwidth=None, absolute=True + ): super().__init__(refs, location_in, location_out) self._ko_bandwidth = ko_bandwidth self._absolute = absolute @@ -828,5 +828,7 @@ def __call__(self, calc, name=None): def _calc_accel(self, calc, depth): return calc.motion.calc_peak( - calc.calc_accel_tf(calc.loc_input, calc.profile.location("within", depth=depth)) + calc.calc_accel_tf( + calc.loc_input, calc.profile.location("within", depth=depth) + ) ) diff --git a/src/pystrata/propagation.py b/src/pystrata/propagation.py index 292d666..1336e60 100644 --- a/src/pystrata/propagation.py +++ b/src/pystrata/propagation.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # The MIT License (MIT) # # Copyright (c) 2016-2018 Albert Kottke @@ -24,11 +23,8 @@ import numpy as np from scipy.optimize import minimize -from .motion import GRAVITY -from .motion import WaveField -from .site import Layer -from .site import Location -from .site import Profile +from .motion import GRAVITY, WaveField +from .site import Layer, Location, Profile class AbstractCalculator: @@ -146,7 +142,9 @@ def qwl_average(param): # FIXME return an error if not converged? qwl_density = qwl_average(density) - crustal_amp = np.sqrt((density[-1] / slowness[-1]) / (qwl_density / qwl_slowness)) + crustal_amp = np.sqrt( + (density[-1] / slowness[-1]) / (qwl_density / qwl_slowness) + ) site_term = np.array(crustal_amp) if self._site_atten: site_term *= np.exp(-np.pi * self.site_atten * freqs) @@ -244,7 +242,10 @@ def err(x): thickness = res.x[nl : (2 * nl)] profile = Profile( - [Layer(l.soil_type, t, 1 / s) for l, t, s in zip(self.profile, thickness, slowness)], + [ + Layer(layer.soil_type, thick, 1 / slow) + for layer, thick, slow in zip(self.profile, thickness, slowness) + ], self.profile.wt_depth, ) # Update the calculated amplificaiton @@ -280,10 +281,10 @@ def __call__(self, motion, profile, loc_input): super().__call__(motion, profile, loc_input) # Set initial properties - for l in profile: - l.reset() - if l.strain is None: - l.strain = 0.0 + for layer in profile: + layer.reset() + if layer.strain is None: + layer.strain = 0.0 self._calc_waves(motion.angular_freqs, profile) @@ -301,31 +302,31 @@ def _calc_waves(self, angular_freqs, profile): # Compute the complex wave numbers of the system wave_nums = np.empty((len(profile), len(angular_freqs)), complex) - for i, l in enumerate(profile): - wave_nums[i, :] = angular_freqs / l.comp_shear_vel + for i, layer in enumerate(profile): + wave_nums[i, :] = angular_freqs / layer.comp_shear_vel # Compute the waves. In the top surface layer, the up-going and # down-going waves have an amplitude of 1 as they are completely # reflected at the surface. waves_a = np.ones_like(wave_nums, complex) waves_b = np.ones_like(wave_nums, complex) - for i, l in enumerate(profile[:-1]): + for i, layer in enumerate(profile[:-1]): # Complex impedance -- wave number can be zero which causes an # error. with np.errstate(invalid="ignore"): - cimped = (wave_nums[i] * l.comp_shear_mod) / ( + cimped = (wave_nums[i] * layer.comp_shear_mod) / ( wave_nums[i + 1] * profile[i + 1].comp_shear_mod ) # Complex term to simplify equations -- uses full layer height - cterm = 1j * wave_nums[i, :] * l.thickness + cterm = 1j * wave_nums[i, :] * layer.thickness - waves_a[i + 1, :] = 0.5 * waves_a[i] * (1 + cimped) * np.exp(cterm) + 0.5 * waves_b[ - i - ] * (1 - cimped) * np.exp(-cterm) - waves_b[i + 1, :] = 0.5 * waves_a[i] * (1 - cimped) * np.exp(cterm) + 0.5 * waves_b[ - i - ] * (1 + cimped) * np.exp(-cterm) + waves_a[i + 1, :] = 0.5 * waves_a[i] * (1 + cimped) * np.exp( + cterm + ) + 0.5 * waves_b[i] * (1 - cimped) * np.exp(-cterm) + waves_b[i + 1, :] = 0.5 * waves_a[i] * (1 - cimped) * np.exp( + cterm + ) + 0.5 * waves_b[i] * (1 + cimped) * np.exp(-cterm) # Set wave amplitudes with zero frequency to 1 mask = ~np.isfinite(cimped) @@ -342,12 +343,12 @@ def _calc_waves(self, angular_freqs, profile): self._waves_b = waves_b self._wave_nums = wave_nums - def wave_at_location(self, l): + def wave_at_location(self, loc: Location) -> np.ndarray: """Compute the wave field at specific location. Parameters ---------- - l : site.Location + loc : site.Location :class:`site.Location` of the input Returns @@ -355,14 +356,16 @@ def wave_at_location(self, l): `np.ndarray` Amplitude and phase of waves """ - cterm = 1j * self._wave_nums[l.index] * l.depth_within - - if l.wave_field == WaveField.within: - return self._waves_a[l.index] * np.exp(cterm) + self._waves_b[l.index] * np.exp(-cterm) - elif l.wave_field == WaveField.outcrop: - return 2 * self._waves_a[l.index] * np.exp(cterm) - elif l.wave_field == WaveField.incoming_only: - return self._waves_a[l.index] * np.exp(cterm) + cterm = 1j * self._wave_nums[loc.index] * loc.depth_within + + if loc.wave_field == WaveField.within: + return self._waves_a[loc.index] * np.exp(cterm) + self._waves_b[ + loc.index + ] * np.exp(-cterm) + elif loc.wave_field == WaveField.outcrop: + return 2 * self._waves_a[loc.index] * np.exp(cterm) + elif loc.wave_field == WaveField.incoming_only: + return self._waves_a[loc.index] * np.exp(cterm) else: raise NotImplementedError @@ -462,7 +465,9 @@ class EquivalentLinearCalculator(LinearElasticCalculator): name = "EQL" - def __init__(self, strain_ratio=0.65, tolerance=0.01, max_iterations=15, strain_limit=0.05): + def __init__( + self, strain_ratio=0.65, tolerance=0.01, max_iterations=15, strain_limit=0.05 + ): """Initialize the class. Parameters @@ -548,9 +553,9 @@ def __call__(self, motion, profile, loc_input): def _estimate_strains(self): """Compute an estimate of the strains.""" # Estimate the strain based on the PGV and shear-wave velocity - for l in self._profile: - l.reset() - l.strain = self._motion.pgv / l.initial_shear_vel + for layer in self._profile: + layer.reset() + layer.strain = self._motion.pgv / layer.initial_shear_vel @property def strain_ratio(self): @@ -683,7 +688,8 @@ def _calc_strain(self, loc_input, loc_layer, motion, *args): # smooth transition in the strain. Make sure the frequencies are zero. shape = np.minimum( 1, - np.exp(-a * freqs) / np.maximum(np.finfo(float).eps, np.power(freqs, b)), + np.exp(-a * freqs) + / np.maximum(np.finfo(float).eps, np.power(freqs, b)), ) strains = strain_eff * shape else: diff --git a/src/pystrata/site.py b/src/pystrata/site.py index ade66c8..e50802e 100644 --- a/src/pystrata/site.py +++ b/src/pystrata/site.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # The MIT License (MIT) # # Copyright (c) 2016-2018 Albert Kottke @@ -24,14 +23,10 @@ import collections import warnings -from abc import ABC -from abc import abstractmethod +from abc import ABC, abstractmethod from dataclasses import dataclass from functools import wraps from pathlib import Path -from typing import List -from typing import Optional -from typing import Tuple import matplotlib.pyplot as plt import numpy as np @@ -40,8 +35,7 @@ import tomli from scipy.interpolate import interp1d -from .motion import GRAVITY -from .motion import WaveField +from .motion import GRAVITY, WaveField COMP_MODULUS_MODEL = "dormieux" @@ -67,7 +61,7 @@ def _load_published_curves(): PUBLISHED_CURVES = {m["name"]: m for m in models} -def known_published_curves() -> List[dict]: +def known_published_curves() -> list[dict]: """List of published curves in the database.""" if not PUBLISHED_CURVES: _load_published_curves() @@ -118,7 +112,9 @@ def from_published(cls, name, param): selected = PUBLISHED_CURVES[name][param] - return cls(name, strains=selected["strains"], values=selected["values"], param=param) + return cls( + name, strains=selected["strains"], values=selected["values"], param=param + ) def __call__(self, strains): """Return the nonlinear property at a specific strain. @@ -242,7 +238,7 @@ def from_published( name: str = "", unit_wt: float = 0.0, model: str = "", - model_damping: Optional[str] = None, + model_damping: str | None = None, ) -> SoilType: if not PUBLISHED_CURVES: _load_published_curves() @@ -284,7 +280,9 @@ def unit_wt(self) -> float: @property def is_nonlinear(self) -> bool: """If nonlinear properties are specified.""" - return any(isinstance(p, NonlinearProperty) for p in [self.mod_reduc, self.damping]) + return any( + isinstance(p, NonlinearProperty) for p in [self.mod_reduc, self.damping] + ) def __eq__(self, other) -> bool: # return all( @@ -341,7 +339,9 @@ def __init__(self, name, unit_wt, damping_min, strains=None): c2 = 0.0805 * self.curvature**2 - 0.0710 * self.curvature - 0.0095 c3 = -0.0005 * self.curvature**2 + 0.0002 * self.curvature + 0.0003 damping_masing = ( - c1 * damping_masing_a1 + c2 * damping_masing_a1**2 + c3 * damping_masing_a1**3 + c1 * damping_masing_a1 + + c2 * damping_masing_a1**2 + + c3 * damping_masing_a1**3 ) # Compute the damping correction in percent @@ -400,8 +400,8 @@ def __init__( name: str = "", unit_wt: float = 0, stress_mean: float = 101.3, - strains: Optional[npt.ArrayLike] = None, - coeffs: Optional[TwoParamModifiedHyperbolicCoeffs] = None, + strains: npt.ArrayLike | None = None, + coeffs: TwoParamModifiedHyperbolicCoeffs | None = None, ): """ @@ -694,7 +694,12 @@ class WangSoilType(SoilType): "void_ratio", "diam_50", ], - "nonplastic_silty_sand": ["stress_mean", "void_ratio", "fines_cont", "water_cont"], + "nonplastic_silty_sand": [ + "stress_mean", + "void_ratio", + "fines_cont", + "water_cont", + ], "clayey_soil": [ "stress_mean", "void_ratio", @@ -707,9 +712,21 @@ class WangSoilType(SoilType): LEVELS = { "clean_sand_and_gravel": { - "gmax_model": ["stress_mean", "void_ratio", "diam_50", "coef_unif", "fines_cont"], + "gmax_model": [ + "stress_mean", + "void_ratio", + "diam_50", + "coef_unif", + "fines_cont", + ], "ggmax_model": ["stress_mean", "void_ratio", "coef_unif", "fines_cont"], - "dmin_model": ["stress_mean", "fines_cont", "water_cont", "void_ratio", "diam_50"], + "dmin_model": [ + "stress_mean", + "fines_cont", + "water_cont", + "void_ratio", + "diam_50", + ], "damping_model": ["stress_mean", "void_ratio", "fines_cont", "coef_unif"], }, "nonplastic_silty_sand": { @@ -719,8 +736,20 @@ class WangSoilType(SoilType): "damping_model": ["stress_mean", "void_ratio", "fines_cont"], }, "clayey_soil": { - "gmax_model": ["stress_mean", "void_ratio", "ocr", "fines_cont", "plas_index"], - "ggmax_model": ["stress_mean", "void_ratio", "fines_cont", "ocr", "plas_index"], + "gmax_model": [ + "stress_mean", + "void_ratio", + "ocr", + "fines_cont", + "plas_index", + ], + "ggmax_model": [ + "stress_mean", + "void_ratio", + "fines_cont", + "ocr", + "plas_index", + ], "dmin_model": ["stress_mean", "void_ratio", "plas_index", "fines_cont"], "damping_model": ["stress_mean", "water_cont", "plas_index", "fines_cont"], }, @@ -746,7 +775,9 @@ def __init__( # - fines_cont # - water_cont self._index_params = { - p: kwds[p] for p in self.params(soil_group, damping_min is not None) if p in kwds + p: kwds[p] + for p in self.params(soil_group, damping_min is not None) + if p in kwds } if strains is None: @@ -766,7 +797,9 @@ def __init__( if damping_min is None: damping_min = self.calc_damping_min(soil_group, **self._index_params) - damping = self.calc_damping(strains, soil_group, damping_min, **self._index_params) + damping = self.calc_damping( + strains, soil_group, damping_min, **self._index_params + ) super().__init__( name, @@ -781,7 +814,9 @@ def params(cls, soil_group: str, specified_dmin: bool): if not specified_dmin: models += ["dmin_model"] - return list({param for model in models for param in cls.LEVELS[soil_group][model]}) + return list( + {param for model in models for param in cls.LEVELS[soil_group][model]} + ) def _create_name(self) -> str: FACTORS_FORMAT = { @@ -795,7 +830,10 @@ def _create_name(self) -> str: "water_cont": "w_c={:.1f}%", } - parts = [FACTORS_FORMAT[key].format(self.index_params[key]) for key in self.index_params] + parts = [ + FACTORS_FORMAT[key].format(self.index_params[key]) + for key in self.index_params + ] suffix = ", ".join(parts) return f"Wang & Stokoe ({suffix})" @@ -815,7 +853,8 @@ def get_level(cls, model: str, soil_group: str, **kwds: dict[str, float]) -> int Parameters ---------- model : str - element. Potential options: 'gmax_model', 'ggmax_model', 'dmin_model', or 'damping_model' + element. Potential options: 'gmax_model', 'ggmax_model', 'dmin_model', or + 'damping_model' soil_group : str soil group. Potential options: 'clean_sand_and_gravel', 'nonplastic_silty_sand', or 'clayey_soil'. @@ -848,7 +887,9 @@ def calc_shear_mod(cls, soil_group, **kwds): return 108.4 * (kwds["stress_mean"] * KPA_TO_ATM) ** 0.51 elif level == 1: return ( - 67.5 * kwds["void_ratio"] ** -0.86 * (kwds["stress_mean"] * KPA_TO_ATM) ** 0.5 + 67.5 + * kwds["void_ratio"] ** -0.86 + * (kwds["stress_mean"] * KPA_TO_ATM) ** 0.5 ) elif level == 2: return ( @@ -861,7 +902,8 @@ def calc_shear_mod(cls, soil_group, **kwds): 64.3 * kwds["coef_unif"] ** -0.21 * kwds["void_ratio"] ** (-1.08 - (0.09 * kwds["diam_50"]) ** 0.51) - * (kwds["stress_mean"] * KPA_TO_ATM) ** (0.47 * kwds["coef_unif"] ** 0.06) + * (kwds["stress_mean"] * KPA_TO_ATM) + ** (0.47 * kwds["coef_unif"] ** 0.06) ) else: return ( @@ -876,7 +918,9 @@ def calc_shear_mod(cls, soil_group, **kwds): return 89.1 * (kwds["stress_mean"] * KPA_TO_ATM) ** 0.51 elif level == 1: return ( - 59.2 * kwds["void_ratio"] ** -0.74 * (kwds["stress_mean"] * KPA_TO_ATM) ** 0.51 + 59.2 + * kwds["void_ratio"] ** -0.74 + * (kwds["stress_mean"] * KPA_TO_ATM) ** 0.51 ) else: return ( @@ -890,7 +934,9 @@ def calc_shear_mod(cls, soil_group, **kwds): return 77.2 * (kwds["stress_mean"] * KPA_TO_ATM) ** 0.48 elif level == 1: return ( - 52.3 * kwds["void_ratio"] ** -1.08 * (kwds["stress_mean"] * KPA_TO_ATM) ** 0.4 + 52.3 + * kwds["void_ratio"] ** -1.08 + * (kwds["stress_mean"] * KPA_TO_ATM) ** 0.4 ) elif level == 2: return ( @@ -921,7 +967,9 @@ def calc_shear_mod(cls, soil_group, **kwds): @classmethod @to_decimal("fines_cont", "plas_index", "water_cont") - def calc_mod_reduc(cls, strains: npt.ArrayLike, soil_group: str, **kwds) -> np.ndarray: + def calc_mod_reduc( + cls, strains: npt.ArrayLike, soil_group: str, **kwds + ) -> np.ndarray: level = cls.get_level("ggmax_model", soil_group, **kwds) if soil_group == "clean_sand_and_gravel": @@ -938,15 +986,15 @@ def calc_mod_reduc(cls, strains: npt.ArrayLike, soil_group: str, **kwds) -> np.n elif level == 2: a = 0.834 b = 0.839 - gamma_mr = (0.05 * kwds["void_ratio"] ** (0.1 * kwds["coef_unif"]) + 0.011) * ( - kwds["stress_mean"] * KPA_TO_ATM - ) ** 0.45 + gamma_mr = ( + 0.05 * kwds["void_ratio"] ** (0.1 * kwds["coef_unif"]) + 0.011 + ) * (kwds["stress_mean"] * KPA_TO_ATM) ** 0.45 else: a = 0.834 + kwds["fines_cont"] b = 0.844 - 1.897 * kwds["fines_cont"] - gamma_mr = (0.048 * kwds["void_ratio"] ** (0.089 * kwds["coef_unif"]) + 0.008) * ( - kwds["stress_mean"] * KPA_TO_ATM - ) ** 0.4 + gamma_mr = ( + 0.048 * kwds["void_ratio"] ** (0.089 * kwds["coef_unif"]) + 0.008 + ) * (kwds["stress_mean"] * KPA_TO_ATM) ** 0.4 elif soil_group == "nonplastic_silty_sand": if level == 0: @@ -974,7 +1022,11 @@ def calc_mod_reduc(cls, strains: npt.ArrayLike, soil_group: str, **kwds) -> np.n elif level == 1: a = 1.185 b = 0.475 - gamma_mr = 0.035 * kwds["void_ratio"] * (kwds["stress_mean"] * KPA_TO_ATM) ** 0.276 + gamma_mr = ( + 0.035 + * kwds["void_ratio"] + * (kwds["stress_mean"] * KPA_TO_ATM) ** 0.276 + ) elif level == 2: a = 0.966 + 0.378 * kwds["fines_cont"] b = 0.596 - 0.207 * kwds["fines_cont"] @@ -984,9 +1036,9 @@ def calc_mod_reduc(cls, strains: npt.ArrayLike, soil_group: str, **kwds) -> np.n elif level == 3: a = 0.972 + 0.419 * kwds["fines_cont"] b = 0.571 - 0.2 * kwds["fines_cont"] - gamma_mr = (0.025 * kwds["void_ratio"] + 0.0015 * kwds["fines_cont"]) * ( - kwds["stress_mean"] * KPA_TO_ATM + 0.375 * kwds["ocr"] - ) ** 0.358 + gamma_mr = ( + 0.025 * kwds["void_ratio"] + 0.0015 * kwds["fines_cont"] + ) * (kwds["stress_mean"] * KPA_TO_ATM + 0.375 * kwds["ocr"]) ** 0.358 else: a = 0.896 + 0.412 * kwds["fines_cont"] + 0.534 * kwds["plas_index"] b = 0.586 - 0.098 * kwds["void_ratio"] - 0.135 * kwds["fines_cont"] @@ -1063,9 +1115,11 @@ def calc_damping_min(cls, soil_group: str, **kwds) -> float: + 0.72 ** -kwds["void_ratio"] ) elif level == 2: - d_min = 7.29 * 8 ** (-kwds["void_ratio"] - 3.31 * kwds["plas_index"]) * ( - 1 + 148 * kwds["plas_index"] ** 1.95 - ) * (kwds["stress_mean"] * KPA_TO_ATM) ** -0.2 + (0.5 * kwds["plas_index"]) ** ( + d_min = 7.29 * 8 ** ( + -kwds["void_ratio"] - 3.31 * kwds["plas_index"] + ) * (1 + 148 * kwds["plas_index"] ** 1.95) * ( + kwds["stress_mean"] * KPA_TO_ATM + ) ** -0.2 + (0.5 * kwds["plas_index"]) ** ( 2.54 - 1.8 * kwds["void_ratio"] ) else: @@ -1073,9 +1127,7 @@ def calc_damping_min(cls, soil_group: str, **kwds) -> float: -1.91 * kwds["void_ratio"] - 6.5 * kwds["plas_index"] ) * (1 + 106.75 * kwds["plas_index"] ** 1.64) * ( kwds["stress_mean"] * KPA_TO_ATM - ) ** -0.19 + ( - 0.46 * kwds["plas_index"] - ) ** ( + ) ** -0.19 + (0.46 * kwds["plas_index"]) ** ( 1.73 - 1.34 * kwds["void_ratio"] ) @@ -1124,7 +1176,9 @@ def calc_damping( c = 1.38 * np.exp(0.25 * kwds["void_ratio"]) d = 12.09 gamma_d = ( - 0.0066 * (kwds["stress_mean"] * KPA_TO_ATM + 5.79 * kwds["void_ratio"]) ** 1.01 + 0.0066 + * (kwds["stress_mean"] * KPA_TO_ATM + 5.79 * kwds["void_ratio"]) + ** 1.01 ) else: c = 1.39 * np.exp(0.27 * kwds["void_ratio"]) @@ -1159,7 +1213,12 @@ def calc_damping( 0.12 * kwds["stress_mean"] * KPA_TO_ATM + 5.29 * kwds["water_cont"] - kwds["fines_cont"] - ) ** (1.45 - kwds["plas_index"] + kwds["water_cont"] - 1.09 * kwds["fines_cont"]) + ) ** ( + 1.45 + - kwds["plas_index"] + + kwds["water_cont"] + - 1.09 * kwds["fines_cont"] + ) else: raise ValueError("Invalid soil group") @@ -1272,7 +1331,9 @@ def _calc_strain_ref(x_3, x_3_mean): b_10 = -0.950 return np.exp(b_9 + b_10 * (x_3 - x_3_mean)) / 100 - def _calc_mod_reduc(self, strains, strain_ref, x_1, x_1_mean, x_2, x_2_mean, x_3, x_3_mean): + def _calc_mod_reduc( + self, strains, strain_ref, x_1, x_1_mean, x_2, x_2_mean, x_3, x_3_mean + ): """Compute the shear modulus reduction using Equation (1).""" ones = np.ones_like(strains) @@ -1290,7 +1351,9 @@ def _calc_mod_reduc(self, strains, strain_ref, x_1, x_1_mean, x_2, x_2_mean, x_3 (x_1 - x_1_mean) * (x_2 - x_2_mean) * (x_3 - x_3_mean), ] # Coefficients - denom = np.log(1 / strain_ref + strains / strain_ref) # TODO: is this percent or decimal? + denom = np.log( + 1 / strain_ref + strains / strain_ref + ) # TODO: is this percent or decimal? b = np.c_[ 5.11 * ones, -0.729 * ones, @@ -1338,7 +1401,10 @@ def _calc_unit_wt(x_1, x_2): return unit_wt def _create_name(self): - return f"Kishida (σᵥ'={self._stress_vert:.1f} kN/m², OC={self._organic_content:.0f} %)" + return ( + f"Kishida (σᵥ'={self._stress_vert:.1f} kN/m²," + f" OC={self._organic_content:.0f} %)" + ) # TODO: for nonlinear site response this class wouldn't be used. Better way @@ -1608,7 +1674,9 @@ def stress_mean(self, depth_within=0, effective=False, k0=0.5): @property def incr_site_atten(self): - return (2 * self.soil_type.damping_min * self._thickness) / self.initial_shear_vel + return ( + 2 * self.soil_type.damping_min * self._thickness + ) / self.initial_shear_vel class Location: @@ -1771,15 +1839,15 @@ def auto_discretize( A new profile with modified layer thicknesses """ layers = [] - for l in self[:-1]: - if not nonlinear_only or l.soil_type.is_nonlinear: - opt_thickness = l.shear_vel / max_freq * wave_frac - count = max(np.ceil(l.thickness / opt_thickness).astype(int), 1) - thickness = l.thickness / count + for layer in self[:-1]: + if not nonlinear_only or layer.soil_type.is_nonlinear: + opt_thickness = layer.shear_vel / max_freq * wave_frac + count = max(np.ceil(layer.thickness / opt_thickness).astype(int), 1) + thickness = layer.thickness / count for _ in range(count): - layers.append(Layer(l.soil_type, thickness, l.shear_vel)) + layers.append(Layer(layer.soil_type, thickness, layer.shear_vel)) else: - layers.append(l) + layers.append(layer) # Add the halfspace layers.append(self[-1]) @@ -1801,7 +1869,7 @@ def pore_pressure(self, depth): def site_attenuation(self): return sum(layer.incr_site_atten for layer in self) - def lookup_depth(self, depth: float) -> Tuple[int, float]: + def lookup_depth(self, depth: float) -> tuple[int, float]: """Look up the layer and the depth within the layer for a specific depth. Parameters @@ -1886,7 +1954,9 @@ def time_average_vel(self, depth): # If needed, add the final layer to the required depth if depths[-1] < depth: depths = np.r_[depths, depth] - travel_times = np.r_[travel_times, (depth - self[-1].depth) / self[-1].shear_vel] + travel_times = np.r_[ + travel_times, (depth - self[-1].depth) / self[-1].shear_vel + ] total_travel_times = np.cumsum(travel_times) # Interpolate the travel time to the depth of interest @@ -1919,7 +1989,9 @@ def simplified_rayliegh_vel(self): freq_fund = np.sqrt( 4 * np.sum(thicks * depths_mid**2 / shear_vels**2) - / np.sum(thicks * np.sum(np.c_[shape, np.roll(shape, -1)], axis=1)[:-1] ** 2) + / np.sum( + thicks * np.sum(np.c_[shape, np.roll(shape, -1)], axis=1)[:-1] ** 2 + ) ) period_fun = 2 * np.pi / freq_fund rayleigh_vel = 4 * thicks.sum() / period_fun @@ -1948,7 +2020,7 @@ def plot(self, prop, ax=None, plot_kwds=None, axis_kwds=None): axis_kwds = {**_axis_kwds, **(axis_kwds or dict())} if ax is None: - fig, ax = plt.subplots() + _, ax = plt.subplots() ax.step(getattr(self, prop), self.depth, where="pre", **plot_kwds) ax.set(**axis_kwds) diff --git a/src/pystrata/tools.py b/src/pystrata/tools.py index 96c8ccd..4e5893e 100644 --- a/src/pystrata/tools.py +++ b/src/pystrata/tools.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # The MIT License (MIT) # # Copyright (c) 2016-2018 Albert Kottke @@ -23,20 +22,14 @@ import collections import os import re -from typing import Callable -from typing import List -from typing import Optional -from typing import Tuple -from typing import Union +from collections.abc import Callable import numpy as np import numpy.typing as npt import pandas as pd import scipy.constants as C -from . import motion -from . import propagation -from . import site +from . import motion, propagation, site def to_str(s): @@ -78,7 +71,7 @@ def _parse_curves(block, **kwargs): count = int(block.pop(0)) curves = [] - for i in range(count): + for _ in range(count): for param in ["mod_reduc", "damping"]: length, name = parse_fixed_width([(5, int), (65, to_str)], block) curves.append( @@ -99,11 +92,13 @@ def _parse_curves(block, **kwargs): def _parse_soil_profile(block, units, curves, **kwargs): """Parse soil profile block.""" - wt_layer, length, _, name = parse_fixed_width(3 * [(5, int)] + [(55, to_str)], block) + wt_layer, length, _, name = parse_fixed_width( + 3 * [(5, int)] + [(55, to_str)], block + ) layers = [] soil_types = [] - for i in range(length): + for _ in range(length): ( index, soil_idx, @@ -112,7 +107,9 @@ def _parse_soil_profile(block, units, curves, **kwargs): damping, unit_wt, shear_vel, - ) = parse_fixed_width([(5, int), (5, int), (15, to_float)] + 4 * [(10, to_float)], block) + ) = parse_fixed_width( + [(5, int), (5, int), (15, to_float)] + 4 * [(10, to_float)], block + ) st = site.SoilType( soil_idx, @@ -133,9 +130,9 @@ def _parse_soil_profile(block, units, curves, **kwargs): for st in soil_types: st.unit_wt *= 0.00015708746 - for l in layers: - l.thickness *= 0.3048 - l.shear_vel *= 0.3048 + for layer in layers: + layer.thickness *= 0.3048 + layer.shear_vel *= 0.3048 p = site.Profile(layers) p.update_layers() @@ -194,7 +191,9 @@ def _parse_run_control(block): 2 * [(5, int)] + [(10, float)] + 2 * [(5, int)], block ) - return propagation.EquivalentLinearCalculation(strain_ratio, max_iterations, tolerance=10.0) + return propagation.EquivalentLinearCalculation( + strain_ratio, max_iterations, tolerance=10.0 + ) def _parse_output_accel(block): @@ -219,12 +218,12 @@ def load_shake_inp(fname): # Parse the option blocks option, block = None, [] options = [] - for l in lines: - m = re.match(r"^\s+(\d+)$", l) + for line in lines: + m = re.match(r"^\s+(\d+)$", line) if m: if option and not block: - block.append(l) + block.append(line) else: if option and block: # Save the previous block @@ -232,7 +231,7 @@ def load_shake_inp(fname): block = [] option = int(m.group(1)) else: - block.append(l) + block.append(line) parsers = { 1: ("curves", _parse_curves), @@ -279,7 +278,9 @@ def read_nrattle_ctl(fpath): except ValueError: break - d["profile"] = np.rec.fromrecords(profile, names="layer,thickness,vel_shear,density,inv_qual") + d["profile"] = np.rec.fromrecords( + profile, names="layer,thickness,vel_shear,density,inv_qual" + ) d["hs_vel_shear"], d["hs_density"] = split_line(line, [float, float]) d["hs_layer"], d["inci_angle"] = split_line(lines.pop(0), [int, float]) @@ -305,7 +306,9 @@ def profile_from_nrattle_ctl(ctl): return site.Profile.from_dataframe(df, 0) -def calc_atten_scatter(profile: site.Profile, freqs: Optional[npt.ArrayLike] = None) -> float: +def calc_atten_scatter( + profile: site.Profile, freqs: npt.ArrayLike | None = None +) -> float: """ Compute the attenuation due to impedance (scattering) effects of the profile. @@ -407,10 +410,16 @@ def adjust_damping_values( elif isinstance(exclude, Callable): layers = [layer for layer in profile[:-1] if not exclude(layer)] elif isinstance(exclude, str): - layers = [layer for layer in profile[:-1] if not re.match(exclude, layer.soil_type.name)] + layers = [ + layer + for layer in profile[:-1] + if not re.match(exclude, layer.soil_type.name) + ] elif isinstance(exclude, list): layers = [ - layer for layer in profile[:-1] if not any(e in layer.soil_type.name for e in exclude) + layer + for layer in profile[:-1] + if not any(e in layer.soil_type.name for e in exclude) ] else: raise ValueError("Invalid value of `verbose`") diff --git a/src/pystrata/variation.py b/src/pystrata/variation.py index 1971b4d..44a73b7 100644 --- a/src/pystrata/variation.py +++ b/src/pystrata/variation.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # The MIT License (MIT) # # Copyright (c) 2016-2018 Albert Kottke @@ -22,10 +21,6 @@ # SOFTWARE. import copy from abc import abstractmethod -from typing import Dict -from typing import List -from typing import Optional -from typing import Union import numpy as np import numpy.typing as npt @@ -90,7 +85,9 @@ def __call__(self, size=1): rvs : ndarray or scalar Random variates of given `size`. """ - return stats.truncnorm.rvs(-self.limit, self.limit, scale=self._scale, size=size) + return stats.truncnorm.rvs( + -self.limit, self.limit, scale=self._scale, size=size + ) def correlated(self, correl): # Acceptance proportion @@ -226,9 +223,11 @@ def __call__(self, profile): layers = [] for thick, depth_mid in self.iter_thickness(profile[-2].depth_base): # Locate the proper layer and add it to the model - for l in profile: - if l.depth < depth_mid <= l.depth_base: - layers.append(site.Layer(l.soil_type, thick, l.initial_shear_vel)) + for layer in profile: + if layer.depth < depth_mid <= layer.depth_base: + layers.append( + site.Layer(layer.soil_type, thick, layer.initial_shear_vel) + ) break else: raise LookupError @@ -282,8 +281,8 @@ def __call__(self, profile: site.Profile) -> site.Profile: class LayerThicknessVariation: def __init__( self, - models: Union[List[stats.rv_continuous], Dict[int, stats.rv_continuous]], - discretize_kwds: Optional[Dict[str, float]] = None, + models: list[stats.rv_continuous] | dict[int, stats.rv_continuous], + discretize_kwds: dict[str, float] | None = None, ) -> None: self._models = models self._discretize_kwds = discretize_kwds @@ -525,7 +524,9 @@ def _calc_corr(self, profile: site.Profile) -> np.ndarray: depth = depth[:-1] # Depth dependent correlation - corr_depth = self.rho_200 * np.power((depth + self.h_0) / (200 + self.h_0), self.b) + corr_depth = self.rho_200 * np.power( + (depth + self.h_0) / (200 + self.h_0), self.b + ) corr_depth[depth > 200] = self.rho_200 # Thickness dependent correlation @@ -651,10 +652,12 @@ def __init__( h_0: float, b: float, vary_bedrock: bool = False, - ln_std_map: Optional[Dict[str, float]] = None, + ln_std_map: dict[str, float] | None = None, ): """Initialize the model.""" - super().__init__(ln_std, rho_0, delta, rho_200, h_0, b, vary_bedrock=vary_bedrock) + super().__init__( + ln_std, rho_0, delta, rho_200, h_0, b, vary_bedrock=vary_bedrock + ) self.depth = depth self.ln_std_map = ln_std_map or dict() @@ -670,8 +673,8 @@ def _calc_ln_std(self, profile): # Update based on soil_type name for name, value in self.ln_std_map.items(): - for i, l in enumerate(profile): - if name in l.soil_type.name: + for i, layer in enumerate(profile): + if name in layer.soil_type.name: ln_std[i] = value return ln_std @@ -756,11 +759,15 @@ def get_values(nlp): varied_mod_reduc = np.clip( varied_mod_reduc, self.limits_mod_reduc[0], self.limits_mod_reduc[1] ) - varied_damping = np.clip(varied_damping, self.limits_damping[0], self.limits_damping[1]) + varied_damping = np.clip( + varied_damping, self.limits_damping[0], self.limits_damping[1] + ) # Set the values realization = copy.deepcopy(soil_type) - for attr_name, values in zip(["mod_reduc", "damping"], [varied_mod_reduc, varied_damping]): + for attr_name, values in zip( + ["mod_reduc", "damping"], [varied_mod_reduc, varied_damping] + ): try: getattr(realization, attr_name).values = values except AttributeError: @@ -816,7 +823,9 @@ def calc_std_mod_reduc(mod_reduc): Standard deviation. """ mod_reduc = np.asarray(mod_reduc).astype(float) - std = np.exp(-4.23) + np.sqrt(0.25 / np.exp(3.62) - (mod_reduc - 0.5) ** 2 / np.exp(3.62)) + std = np.exp(-4.23) + np.sqrt( + 0.25 / np.exp(3.62) - (mod_reduc - 0.5) ** 2 / np.exp(3.62) + ) return std @staticmethod @@ -901,28 +910,32 @@ def iter_varied_profiles( ): for _ in range(count): # Copy the profile to form the realization - p = site.Profile.copy_of(profile) + _profile = site.Profile.copy_of(profile) if var_thickness: - p = var_thickness(p) + _profile = var_thickness(_profile) if var_velocity: - p = var_velocity(p) + _profile = var_velocity(_profile) if var_soiltypes: # Map of varied soil types - varied = {str(st): var_soiltypes(st) for st in p.iter_soil_types()} + varied = {str(st): var_soiltypes(st) for st in _profile.iter_soil_types()} # Create new layers end = None if var_soiltypes.vary_bedrock else -1 layers = [ - site.Layer(varied[str(l.soil_type)], l.thickness, l.initial_shear_vel) - for l in p[:end] + site.Layer( + varied[str(layer.soil_type)], + layer.thickness, + layer.initial_shear_vel, + ) + for layer in profile[:end] ] # Add the unrandomized bedrock if not var_soiltypes.vary_bedrock: - layers.append(p[-1]) + layers.append(_profile[-1]) # Create a new profile - p = site.Profile(layers, p.wt_depth) + _profile = site.Profile(layers, _profile.wt_depth) - yield p + yield _profile diff --git a/tests/data/2516b_a.smc b/tests/data/2516b_a.smc index efe8b7a..4afc1a1 100644 --- a/tests/data/2516b_a.smc +++ b/tests/data/2516b_a.smc @@ -1,11 +1,11 @@ -2 CORRECTED ACCELEROGRAM +2 CORRECTED ACCELEROGRAM * -2555b +2555b 2011 08 23 1751 MINERAL, VA -Moment Mag= 5.80 Ms= Ml= -station = VA: Reston; Fire Station #25 component= 360 +Moment Mag= 5.80 Ms= Ml= +station = VA: Reston; Fire Station #25 component= 360 epicentral dist = 121.4 pk acc = 3.91E+1 -inst type=K2 data source = USGS +inst type=K2 data source = USGS * * * @@ -25,14 +25,14 @@ inst type=K2 data source = USGS 8.0000000E+01 3.9133476E+01 1.7000000E+38 1.7000000E+38 1.7000000E+38 1.7000000E+38 1.7000000E+38 1.7000000E+38 1.7000000E+38 1.7000000E+38 1.7000000E+38 1.7000000E+38 1.7000000E+38 1.7000000E+38 1.7000000E+38 -| -| Converted using program evt2smc 2011/08/25 15:28:20 -| Input file: 20110823_175126_2555-02516_AW256.EVT -| EventID: se082311a -| Event source: Southeast U.U Seismic Network -| EventID: se082311a -| Event source: Southeast U.S. Seismic Array -| Seismic moment source: USGS/SLU +| +| Converted using program evt2smc 2011/08/25 15:28:20 +| Input file: 20110823_175126_2555-02516_AW256.EVT +| EventID: se082311a +| Event source: Southeast U.U Seismic Network +| EventID: se082311a +| Event source: Southeast U.S. Seismic Array +| Seismic moment source: USGS/SLU 2.3489E-2-1.6646E-2 7.7538E-3 4.5976E-2-2.0830E-2 4.9540E-3 3.5287E-2-4.6692E-2 -4.3649E-2 1.2602E-2 1.5667E-2-6.8732E-5 2.8507E-3 4.4044E-2 2.7958E-2-1.3630E-2 1.0709E-2-2.2262E-2-5.8025E-2-2.5673E-3 1.9533E-3-1.0128E-2 3.1064E-2 4.0388E-2 diff --git a/tests/data/NIS090.AT2 b/tests/data/NIS090.AT2 index 7b58a12..972a0d4 100644 --- a/tests/data/NIS090.AT2 +++ b/tests/data/NIS090.AT2 @@ -1,5 +1,5 @@ PEER NGA STRONG MOTION DATABASE RECORD -KOBE 01/16/95 2046, NISHI-AKASHI, 090 (CUE) +KOBE 01/16/95 2046, NISHI-AKASHI, 090 (CUE) ACCELERATION TIME HISTORY IN UNITS OF G 4096 0.0100 NPTS, DT 0.233833E-06 0.299033E-06 0.515835E-06 0.667785E-06 0.490847E-06 diff --git a/tests/motion_test.py b/tests/motion_test.py index 6ca24b6..d45ea14 100644 --- a/tests/motion_test.py +++ b/tests/motion_test.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or @@ -16,8 +15,7 @@ # Copyright (C) Albert Kottke, 2013-2015 import numpy as np import pytest -from numpy.testing import assert_allclose -from numpy.testing import assert_equal +from numpy.testing import assert_allclose, assert_equal from pystrata import motion from . import FPATH_DATA diff --git a/tests/notebooks_test.py b/tests/notebooks_test.py index 3838557..0abda43 100644 --- a/tests/notebooks_test.py +++ b/tests/notebooks_test.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or @@ -18,8 +17,7 @@ import nbformat import pytest -from nbconvert.preprocessors import CellExecutionError -from nbconvert.preprocessors import ExecutePreprocessor +from nbconvert.preprocessors import CellExecutionError, ExecutePreprocessor root = pathlib.Path(__file__).parent / "../examples" fpaths = sorted(root.glob("*.ipynb")) diff --git a/tests/output_test.py b/tests/output_test.py index 72dd453..7fb6218 100644 --- a/tests/output_test.py +++ b/tests/output_test.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# -*- coding: utf-8 -*- # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or diff --git a/tests/propagation_test.py b/tests/propagation_test.py index eee6059..81cfb6d 100644 --- a/tests/propagation_test.py +++ b/tests/propagation_test.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or @@ -40,7 +39,10 @@ def read_deepsoil_results(name): records = np.rec.fromrecords(data, names=names) def extract_cols(records, cols, first, last, names): - return {name: records[col][first:last].astype(float) for col, name in zip(cols, names)} + return { + name: records[col][first:last].astype(float) + for col, name in zip(cols, names) + } d = dict() # Read the time series @@ -50,7 +52,9 @@ def extract_cols(records, cols, first, last, names): # Read the response spectrum d["resp_spec"] = extract_cols(records, "GH", 1, 114, ["period", "psa"]) # Read the Fourier amplitude - d["fourier_spec"] = extract_cols(records, "JKL", 1, 16384, ["freq", "ampl", "ratio"]) + d["fourier_spec"] = extract_cols( + records, "JKL", 1, 16384, ["freq", "ampl", "ratio"] + ) return d @@ -220,27 +224,37 @@ def setup_class(cls): def test_times(self): ref = self.ref["time_series"]["time"] n = len(ref) - np.testing.assert_allclose(self.outputs[0].refs[:n], ref, rtol=self.rtol, atol=self.atol) + np.testing.assert_allclose( + self.outputs[0].refs[:n], ref, rtol=self.rtol, atol=self.atol + ) def test_accels(self): ref = self.ref["time_series"]["time"] n = len(ref) - np.testing.assert_allclose(self.outputs[0].refs[:n], ref, rtol=self.rtol, atol=self.atol) + np.testing.assert_allclose( + self.outputs[0].refs[:n], ref, rtol=self.rtol, atol=self.atol + ) def test_arias_ints(self): ref = self.ref["time_series"]["arias_int"] n = len(ref) - np.testing.assert_allclose(self.outputs[1].values[:n], ref, rtol=self.rtol, atol=self.atol) + np.testing.assert_allclose( + self.outputs[1].values[:n], ref, rtol=self.rtol, atol=self.atol + ) def test_strains(self): ref = self.ref["time_series"]["strain"] n = len(ref) - np.testing.assert_allclose(self.outputs[2].values[:n], ref, rtol=self.rtol, atol=self.atol) + np.testing.assert_allclose( + self.outputs[2].values[:n], ref, rtol=self.rtol, atol=self.atol + ) def test_stresses(self): ref = self.ref["time_series"]["stress"] n = len(ref) - np.testing.assert_allclose(self.outputs[3].values[:n], ref, rtol=self.rtol, atol=self.atol) + np.testing.assert_allclose( + self.outputs[3].values[:n], ref, rtol=self.rtol, atol=self.atol + ) def test_periods(self): np.testing.assert_allclose( @@ -368,11 +382,15 @@ def setup_class(cls): def test_crustal_amp(self): ref = self.data["crustal_amp"] - np.testing.assert_allclose(self.calc.crustal_amp, ref, rtol=self.rtol, atol=self.atol) + np.testing.assert_allclose( + self.calc.crustal_amp, ref, rtol=self.rtol, atol=self.atol + ) def test_site_term(self): ref = self.data["site_term"] - np.testing.assert_allclose(self.calc.site_term, ref, rtol=self.rtol, atol=self.atol) + np.testing.assert_allclose( + self.calc.site_term, ref, rtol=self.rtol, atol=self.atol + ) class TestQwl0(QWLComparison): @@ -411,12 +429,16 @@ def test_quarter_wavelength_fit(): profile.update_layers() motion = pystrata.motion.Motion(data["freqs"]) - calc = pystrata.propagation.QuarterWaveLenCalculator(site_atten=data["site"]["site_atten"]) + calc = pystrata.propagation.QuarterWaveLenCalculator( + site_atten=data["site"]["site_atten"] + ) calc(motion, profile, profile.location("outcrop", index=-1)) calc.fit("crustal_amp", data["crustal_amp"]) - np.testing.assert_allclose(profile.initial_shear_vel, calc.profile.initial_shear_vel, rtol=0.2) + np.testing.assert_allclose( + profile.initial_shear_vel, calc.profile.initial_shear_vel, rtol=0.2 + ) def test_linear_elastic_nrattle(): diff --git a/tests/site_test.py b/tests/site_test.py index 848da6c..97e8e65 100644 --- a/tests/site_test.py +++ b/tests/site_test.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -# -*- coding: utf-8 -*- """Test site module.""" + # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or @@ -31,13 +31,6 @@ def test_published_nonlinear_property(): site.NonlinearProperty.from_published("Vucetic & Dobry (91), PI=0", "damping") -def test_published_soiltype_same(): - model = "Vucetic & Dobry (91), PI=0" - - st = site.SoilType.from_published("test", 14, model) - assert st.mod_reduc.name == model - - def test_published_soiltype_same(): model_mr = "Vucetic & Dobry (91), PI=0" model_d = "Vucetic & Dobry (91), PI=15" @@ -228,7 +221,9 @@ def test_kishida_nlc(case, curve, attr, key): # Decimal damping used inside PYSRA scale = 100 if key == "dampings" else 1 scale = 1 - assert_allclose(scale * getattr(getattr(st, curve), attr), case[key], rtol=0.005, atol=0.0005) + assert_allclose( + scale * getattr(getattr(st, curve), attr), case[key], rtol=0.005, atol=0.0005 + ) @pytest.mark.parametrize("depth,expected", [(10, 300), (20, 400), (30, 490.909)]) @@ -263,7 +258,10 @@ def test_simplified_rayleigh_vel(): (25, 2777, 140), ] p = site.Profile( - [site.Layer(site.SoilType(unit_wt=unit_wt), thick, vs) for thick, vs, unit_wt in layers] + [ + site.Layer(site.SoilType(unit_wt=unit_wt), thick, vs) + for thick, vs, unit_wt in layers + ] ) assert_allclose( diff --git a/tests/variation_test.py b/tests/variation_test.py index 1b14227..949ba8c 100644 --- a/tests/variation_test.py +++ b/tests/variation_test.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# -*- coding: utf-8 -*- # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or @@ -18,14 +17,8 @@ import numpy as np import pytest from numpy.testing import assert_allclose -from pystrata import motion -from pystrata import output -from pystrata import propagation -from pystrata import site -from pystrata import variation -from scipy.stats import lognorm -from scipy.stats import norm -from scipy.stats import pearsonr +from pystrata import motion, output, propagation, site, variation +from scipy.stats import lognorm, norm, pearsonr def test_randnorm(): @@ -131,7 +124,9 @@ def setup_class(cls): cls.dampings = np.array([r.damping for r in realizations]) def test_sample_std_mod_reduc(self): - assert_allclose(np.std(np.log(self.mod_reducs)), self.svar.std_mod_reduc, rtol=0.2) + assert_allclose( + np.std(np.log(self.mod_reducs)), self.svar.std_mod_reduc, rtol=0.2 + ) def test_sample_std_damping(self): assert_allclose(np.std(np.log(self.dampings)), self.svar.std_damping, rtol=0.2) @@ -203,7 +198,9 @@ def test_iter_variations(profile): calc = propagation.EquivalentLinearCalculator() var_thickness = variation.ToroThicknessVariation() var_velocity = variation.ToroVelocityVariation.generic_model("USGS C") - var_soiltypes = variation.SpidVariation(-0.5, std_mod_reduc=0.15, std_damping=0.0030) + var_soiltypes = variation.SpidVariation( + -0.5, std_mod_reduc=0.15, std_damping=0.0030 + ) freqs = np.logspace(-1, 2, num=500)