diff --git a/.github/workflows/asv.yml b/.github/workflows/asv.yml index 89fb921..875ae67 100644 --- a/.github/workflows/asv.yml +++ b/.github/workflows/asv.yml @@ -18,7 +18,7 @@ jobs: os: [ubuntu-latest, windows-latest, macos-latest, ubuntu-24.04-arm] steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 with: fetch-depth: 0 @@ -61,7 +61,7 @@ jobs: url: ${{ steps.deployment.outputs.page_url }} steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 with: fetch-depth: 0 @@ -70,7 +70,7 @@ jobs: run: git branch main origin/main - name: Prepare previous ASV results - uses: actions/checkout@v5 + uses: actions/checkout@v6 continue-on-error: true with: ref: gh-pages diff --git a/.github/workflows/emscripten.yml b/.github/workflows/emscripten.yml index 3cb6852..bca977b 100644 --- a/.github/workflows/emscripten.yml +++ b/.github/workflows/emscripten.yml @@ -7,7 +7,7 @@ jobs: build-wasm-wheel: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - name: Build WASM wheel uses: pypa/cibuildwheel@v3.3.0 env: diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml index 98e3c8d..f1e50bc 100644 --- a/.github/workflows/static.yml +++ b/.github/workflows/static.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - uses: prefix-dev/setup-pixi@v0.9.3 with: environments: static diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c5d1b3f..f39223f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,7 +15,7 @@ jobs: runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - uses: prefix-dev/setup-pixi@v0.9.3 with: environments: >- @@ -39,8 +39,8 @@ jobs: - name: Test with doctest if: matrix.os == 'ubuntu-latest' run: | - pixi run -e docs doc - pixi run -e docs doc sphinx-build doctest + pixi run -e docs doc-build + pixi run -e docs doc-build sphinx-build doctest - name: Test nogil run: | pixi run -e nogil nogil-eta diff --git a/.github/workflows/wheel.yml b/.github/workflows/wheel.yml index 457d38d..52a022f 100644 --- a/.github/workflows/wheel.yml +++ b/.github/workflows/wheel.yml @@ -7,7 +7,7 @@ jobs: build-sdist: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - uses: prefix-dev/setup-pixi@v0.9.3 with: environments: dev @@ -31,7 +31,7 @@ jobs: os: [ubuntu-latest, windows-latest, macos-latest, ubuntu-24.04-arm] runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - name: Build wheels uses: pypa/cibuildwheel@v3.3.0 env: diff --git a/examples/plot_narx_msa.py b/examples/plot_narx_msa.py index 75b085e..c9dbf7f 100644 --- a/examples/plot_narx_msa.py +++ b/examples/plot_narx_msa.py @@ -24,7 +24,7 @@ # where :math:`y` is the output signal and :math:`u` is the input signal, which is # :math:`u(t) = 2.5\cos(2\pi t)`. # -# The phase portraits of the Duffing equation are shown below. +# The phase portraits and the vector field of the Duffing equation are shown below. import matplotlib.pyplot as plt import numpy as np @@ -67,10 +67,35 @@ def auto_duffing_equation(y, t): for i in range(n_init): sol[i] = odeint(auto_duffing_equation, y0[i], t) +# Phase portraits for i in range(n_init): plt.plot(sol[i, :, 0], sol[i, :, 1], c="tab:blue") -plt.title("Phase portraits of Duffing equation") +# Vector field +y_min = np.min(sol[:, :, 0])-0.2 +y_max = np.max(sol[:, :, 0])+0.2 +dot_y_min = np.min(sol[:, :, 1])-0.2 +dot_y_max = np.max(sol[:, :, 1])+0.2 +y, dot_y = np.meshgrid( + np.linspace(y_min, y_max, 30), np.linspace(dot_y_min, dot_y_max, 30) +) +ddot_y = auto_duffing_equation([y, dot_y], 0)[1] +plt.streamplot( + y, + dot_y, + dot_y, + ddot_y, + color=(0.5, 0.5, 0.5, 0.3), + density=1.5, + minlength=0.02, + maxlength=0.1, + linewidth=0.5, + arrowsize=0.5, +) + +plt.xlim(y_min, y_max) +plt.ylim(dot_y_min, dot_y_max) +plt.title("Phase portraits and vector field of Duffing equation") plt.xlabel("y(t)") plt.ylabel("dy/dt(t)") plt.show() diff --git a/pixi.toml b/pixi.toml index d424c74..42e77dc 100644 --- a/pixi.toml +++ b/pixi.toml @@ -113,7 +113,7 @@ type = { cmd = "mypy . --ignore-missing-imports", cwd = "fastcan" } spell = "codespell fastcan" [feature.docs.tasks] -doc = { cmd = "{{ SPHINXBUILD }} -M {{ CMD }} {{ SOURCEDIR }} {{ BUILDDIR }} {{ SPHINXOPTS }} --fail-on-warning", cwd = "doc", args = [{ arg = "SPHINXBUILD", default = "sphinx-build" }, { arg = "CMD", default = "html" }, { arg = "SOURCEDIR", default = "." }, { arg = "BUILDDIR", default = "_build" }, { arg = "SPHINXOPTS", default = "" }] } +doc-build = { cmd = "{{ SPHINXBUILD }} -M {{ CMD }} {{ SOURCEDIR }} {{ BUILDDIR }} {{ SPHINXOPTS }} --fail-on-warning", cwd = "doc", args = [{ arg = "SPHINXBUILD", default = "sphinx-build" }, { arg = "CMD", default = "html" }, { arg = "SOURCEDIR", default = "." }, { arg = "BUILDDIR", default = "_build" }, { arg = "SPHINXOPTS", default = "" }] } doc-clean = { cmd = "rm -rf {{ BUILDDIR }} generated auto_examples jupyterlite_contents .jupyterlite.doit.db _contents _output .cache", cwd = "doc", args = [{ arg = "BUILDDIR", default = "_build" }] } doc-deploy = { cmd = "python -m http.server" , cwd = "doc/_build/html" } doc-plantuml = { cmd = "plantuml -tsvg {{ SOURCE }} -o {{ OUTPUT }}", cwd = "doc", args = [{ arg = "SOURCE", default = "diagram.puml" }, { arg = "OUTPUT", default = "_build" }] }