diff --git a/.github/workflows/draft-pdf.yml b/.github/workflows/draft-pdf.yml index 8e7fde16b..0dec7ffe3 100644 --- a/.github/workflows/draft-pdf.yml +++ b/.github/workflows/draft-pdf.yml @@ -6,7 +6,7 @@ jobs: name: Paper Draft steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Build draft PDF uses: openjournals/openjournals-draft-action@master with: @@ -14,7 +14,7 @@ jobs: # This should be the path to the paper within your repo. paper-path: docs/JOSS2/paper.md - name: Upload - uses: actions/upload-artifact@v1 + uses: actions/upload-artifact@v3 with: name: paper # This is the output path where Pandoc will write the compiled diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6302b39ee..c2270519d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -7,11 +7,11 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 - - name: Set up Python 3.7 - uses: actions/setup-python@v1 + - uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v3 with: - python-version: 3.7 + python-version: "3.8" - name: Linting run: | pip install pre-commit @@ -23,12 +23,12 @@ jobs: strategy: max-parallel: 4 matrix: - python-version: [3.7, 3.8] + python-version: ["3.8", "3.9", "3.10"] steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v1 + uses: actions/setup-python@v3 with: python-version: ${{ matrix.python-version }} - name: Install dependencies @@ -46,7 +46,7 @@ jobs: run: | pytest test --cov=pysindy --cov-report=xml - name: Upload coverage to Codecov - uses: codecov/codecov-action@v1 + uses: codecov/codecov-action@v3 with: token: ${{ secrets.CODECOV_TOKEN }} file: ./coverage.xml @@ -55,7 +55,7 @@ jobs: pip install papermill cd examples papermill --report-mode 1_feature_overview.ipynb out.json - - uses: actions/cache@v1 + - uses: actions/cache@v3 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements-dev.txt') }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 94631af07..f8df6e4cb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,17 +10,17 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout source - uses: actions/checkout@v1 + uses: actions/checkout@v3 - name: Set up Python - uses: actions/setup-python@v1 + uses: actions/setup-python@v3 with: - python-version: 3.7 + python-version: "3.8" - name: Install dependencies run: pip install wheel - name: Build package run: python setup.py sdist bdist_wheel - name: Upload package - uses: pypa/gh-action-pypi-publish@master + uses: pypa/gh-action-pypi-publish@v1.8.5 with: user: __token__ password: ${{ secrets.PYPI_TOKEN }} diff --git a/.readthedocs.yml b/.readthedocs.yml index ba75fe2e1..0c16f2be0 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -4,6 +4,6 @@ sphinx: configuration: docs/conf.py python: - version: 3.7 + version: 3.8 install: - requirements: requirements-dev.txt diff --git a/README.rst b/README.rst index d796946f9..5d4ae5b79 100644 --- a/README.rst +++ b/README.rst @@ -204,6 +204,14 @@ you can run the following to automatically reformat your staged code Note that you will then need to re-stage any changes ``pre-commit`` made to your code. +Building documentation requires [pandoc](https://pandoc.org/installing.html) as a separate install. Once installed, run + +.. code-block:: bash + + python -m sphinx -TEb html -d _build/doctrees -D language=en . ./build + +Or check the build step in the most recent CI run or [RTD build](https://readthedocs.org/projects/pysindy/builds/). + There are a number of SINDy variants and advanced functionality that would be great to implement in future releases: 1. Bayesian SINDy, for instance that from Hirsh, Seth M., David A. Barajas-Solano, and J. Nathan Kutz. "Sparsifying Priors for Bayesian Uncertainty Quantification in Model Discovery." arXiv preprint arXiv:2107.02107 (2021). diff --git a/examples/README.rst b/examples/README.rst index 7d9831a95..fdbe68683 100644 --- a/examples/README.rst +++ b/examples/README.rst @@ -3,7 +3,7 @@ PySINDy Examples This directory showcases the following examples of PySINDy in action. -`Feature overview <./1_feature_overview.ipynb>`_ +`Feature overview <./1_feature_overview/example.html>`_ ----------------------------------------------------------------------------------------------------------- This notebook gives an almost exhaustive overview of the different features available in PySINDy. It's a good reference for how to set various options and work with different types of datasets. @@ -11,7 +11,7 @@ This notebook gives an almost exhaustive overview of the different features avai --------------------------------------------------------------------------------------------------------------------- We recommend that people new to SINDy start here. We give a gentle introduction to the SINDy method and how different steps in the algorithm are represented in PySINDy. We also show how to use PySINDy to learn a model for a simple linear differential equation. -`Original paper <./3_original_paper.ipynb>`_ +`Original paper <./3_original_paper/example.html>`_ ------------------------------------------------------------------------------------------------------- This notebook uses PySINDy to reproduce the examples in the `original SINDy paper `_. Namely, it applies PySINDy to the following problems: @@ -23,7 +23,7 @@ This notebook uses PySINDy to reproduce the examples in the `original SINDy pape * Logistic map * Hopf system -`Scikit-learn compatibility <./4_scikit_learn_compatibility.ipynb>`_ +`Scikit-learn compatibility <./4_scikit_learn_compatibility/example.html>`_ ------------------------------------------------------------------------------------------------------------------------------- Shows how PySINDy interfaces with various Scikit-learn objects. @@ -34,40 +34,40 @@ Shows how PySINDy interfaces with various Scikit-learn objects. --------------------------------------------------------------------------------------------------------- Explore the differentiation methods available in PySINDy on pure differentiation problems and as components in the SINDy algorithm. -`Deeptime compatibility <./6_deeptime_compatibility.ipynb>`_ +`Deeptime compatibility <./6_deeptime_compatibility/example.html>`_ ------------------------------------------------------------------------------------------------------------------------ See a demonstration of PySINDy objects designed to conform to the `Deeptime `_ API. -`Plasma physics <./7_plasma_example.ipynb>`_ +`Plasma physics <./7_plasma_example/example.html>`_ ---------------------------------------------------------------------------------------------- Use the ``ConstrainedSR3`` optimizer to build a constrained model for the temporal POD modes of a plasma simulation. -`Trapping SINDy <./8_trapping_sindy_paper_examples.ipynb>`_ +`Trapping SINDy <./8_trapping_sindy_paper_examples/example.html>`_ ----------------------------------------------------------------------------------------------------------- This notebook applies the ``TrappingSR3`` optimizer to various canonical fluid systems., proposed in this paper: Kaptanoglu, Alan A., et al. "Promoting global stability in data-driven models of quadratic nonlinear dynamics." Physical Review Fluids 6.9 (2021): 094401. A preprint is found here ``_. -`SINDyPI <./9_sindypi_with_sympy.ipynb>`_ +`SINDyPI <./9_sindypi_with_sympy/example.html>`_ ---------------------------------------------------------------------------------------------- This notebook applies the ``SINDyPI`` optimizer to a simple implicit ODE and was originally proposed in this paper: Kaheman, Kadierdan, J. Nathan Kutz, and Steven L. Brunton. "SINDy-PI: a robust algorithm for parallel implicit sparse identification of nonlinear dynamics." Proceedings of the Royal Society A 476.2242 (2020): 20200279. -`PDEFIND <./10_PDEFIND_examples.ipynb>`_ +`PDEFIND <./10_PDEFIND_examples/example.html>`_ ---------------------------------------------------------------------------------------------- This notebook applies the PDEFIND algorithm (SINDy for PDE identification) to a number of PDEs, and was originally proposed in this paper: Rudy, Samuel H., et al. "Data-driven discovery of partial differential equations." Science Advances 3.4 (2017): e1602614. -`Greedy Algorithms <./11_SSR_FROLS_examples.ipynb>`_ +`Greedy Algorithms <./11_SSR_FROLS_examples/example.html>`_ ----------------------------------------------------------------------------------------------------- This notebook uses the step-wise sparse regression (SSR) and forward-regression orthogonal least-squares (FROLS) algorithms, which are greedy algorithms that iteratively truncate (or add) one nonzero coefficient at each algorithm iteration. -`Weak formulation SINDy <./12_weakform_SINDy_examples.ipynb>`_ +`Weak formulation SINDy <./12_weakform_SINDy_examples/example.html>`_ -------------------------------------------------------------------------------------------------------------- This notebook uses SINDy to identify the weak-formulation of a system of ODEs or PDEs, adding significant robustness against noise in the data. -`Model ensembles <./13_ensembling.ipynb>`_ +`Model ensembles <./13_ensembling/example.html>`_ ---------------------------------------------------------------------------------------------- This notebook uses sub-sampling of the data and sub-sampling of the SINDy library to generate many models, and the user can choose how to average or otherwise combine these models together. This tends to make SINDy more robust against noisy data. -`Cavity flow <./14_cavity_flow.ipynb>`_ +`Cavity flow <./14_cavity_flow/example.html>`_ ---------------------------------------------------------------------------------------------- Demonstrates the use of SINDy to learn a model for the quasiperiodic dynamics in a shear-driven cavity at Re=7500, following Callaham, Brunton, and Loiseau (2021), preprint available here ``_. diff --git a/requirements-dev.txt b/requirements-dev.txt index e8b14221e..08defeea5 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,6 +1,6 @@ -e . -r requirements.txt -pytest~=6.0.0 +pytest>=6.2.4 black pytest-cov pytest-lazy-fixture @@ -12,7 +12,7 @@ setuptools_scm_git_archive jupyter jupytext notebook -sphinx >= 2 +sphinx==5.3.0 sphinxcontrib-apidoc sphinx_rtd_theme pre-commit @@ -20,7 +20,7 @@ hypothesis nbsphinx jupyter_contrib_nbextensions pandas +pandoc seaborn ipython -scs<=2.1.4 gurobipy>=9.5.1,<10.0 diff --git a/requirements.txt b/requirements.txt index 8d4a756ce..7bf0e0c95 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,3 +4,4 @@ scipy derivative matplotlib cmake +scs>=2.1,!=2.1.4 diff --git a/setup.py b/setup.py index f881007cb..9b11dffc7 100644 --- a/setup.py +++ b/setup.py @@ -18,6 +18,8 @@ "Programming Language :: Python", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", "Development Status :: 5 - Production/Stable", "Intended Audience :: Science/Research", "License :: OSI Approved :: MIT License",