Skip to content

Commit

Permalink
Merge branch 'master' into prediction_error_jax
Browse files Browse the repository at this point in the history
  • Loading branch information
akaptano committed Dec 1, 2023
2 parents b95341e + 638e4bb commit 82be3e5
Show file tree
Hide file tree
Showing 291 changed files with 12,462 additions and 7,862 deletions.
4 changes: 0 additions & 4 deletions setup.cfg → .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,3 @@ import-order-style = smarkets
statistics = True
count = True
verbose = 1
# format = [%(code)s] %(text)s @ %(path)s:%(row)d:%(col)d

[codespell]
ignore-words-list = pres,nd
4 changes: 2 additions & 2 deletions .github/workflows/draft-pdf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ 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:
journal: joss
# 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
Expand Down
39 changes: 21 additions & 18 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
name: Tests

on: [push, pull_request]
on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
Linting:
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.9"
- name: Linting
run: |
pip install pre-commit
Expand All @@ -23,39 +29,36 @@ jobs:
strategy:
max-parallel: 4
matrix:
python-version: [3.7, 3.8]
python-version: ["3.8", "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
run: |
pip install -r requirements-dev.txt
pip install sympy # needed for notebook 9, but not required for pysindy
pip install --upgrade pip
pip install .[dev,miosr,cvxpy]
- name: Build the docs
# Not exactly how RTD does it, but close.
run: |
sudo apt-get update -y
sudo apt-get install pandoc
pip install .[docs]
cd docs
python -m sphinx -T -E -W -b html -d _build/doctrees . _build/html
cd ..
- name: Test with pytest
run: |
pytest test --cov=pysindy --cov-report=xml
coverage run --source=pysindy -m pytest test -m "not slow" && coverage xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
- name: Execute feature notebook with papermill
run: |
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') }}
Expand Down
16 changes: 9 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,19 @@ 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
- name: Install dependencies
run: pip install wheel
python-version: "3.9"
- name: Install Build
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python setup.py sdist bdist_wheel
run: python -m build .
- 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 }}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ dist
*.egg-info
commit-msg
todo
poetry.lock

# profiling
prof/

# Environments
.env
Expand Down
7 changes: 4 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ repos:
rev: 5.0.4
hooks:
- id: flake8
args: ["--config=setup.cfg"]
args: ["--config=.flake8"]
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.9.0
hooks:
Expand All @@ -34,11 +34,12 @@ repos:
hooks:
- id: sphinx-lint
- repo: https://github.com/codespell-project/codespell
rev: v2.1.0
rev: v2.2.4
hooks:
- id: codespell
types_or: [python, rst, markdown]
args: ["-L hist"]
additional_dependencies: [tomli]
args: ["--toml", "pyproject.toml"]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
Expand Down
14 changes: 12 additions & 2 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,17 @@ version: 2
sphinx:
configuration: docs/conf.py

build:
os: "ubuntu-22.04"
tools:
python: "3.8"

python:
version: 3.7
install:
- requirements: requirements-dev.txt
- method: pip
path: .
extra_requirements:
- docs
- cvxpy
- miosr
- dev
76 changes: 60 additions & 16 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ The approximation problem to be solved can then be compactly written as
Each row of this matrix equation corresponds to one coordinate function of ``f(x)``.
SINDy employs sparse regression techniques to find a solution ``Xi`` with sparse column vectors.
For a more in-depth look at the mathematical foundations of SINDy, please see our `introduction to SINDy <https://pysindy.readthedocs.io/en/latest/examples/2_introduction_to_sindy.html>`__.
For a more in-depth look at the mathematical foundations of SINDy, please see our `introduction to SINDy <https://pysindy.readthedocs.io/en/latest/examples/2_introduction_to_sindy/example.html>`__.

Relation to PySINDy
^^^^^^^^^^^^^^^^^^^
Expand Down Expand Up @@ -93,7 +93,7 @@ which prints the following
x' = -2.000 x
y' = 1.000 y
PySINDy provides numerous other features not shown here. We recommend the `feature overview <https://pysindy.readthedocs.io/en/latest/examples/1_feature_overview.html>`__ section of the documentation for a more exhaustive summary of additional features.
PySINDy provides numerous other features not shown here. We recommend the `feature overview <https://pysindy.readthedocs.io/en/latest/examples/1_feature_overview/example.html>`__ section of the documentation for a more exhaustive summary of additional features.

Installation
------------
Expand Down Expand Up @@ -121,23 +121,41 @@ Then, to install the package, run
pip install .
If you do not have pip you can instead use
If you do not have root access, you should add the ``--user`` option to the above lines.

Caveats
^^^^^^^

To run the unit tests, or example notebooks, you should install the dev-dependencies with:

.. code-block:: bash
python setup.py install
pip install pysindy[dev]
If you do not have root access, you should add the ``--user`` option to the above lines.
or if you are installing from a local copy

Caveats
^^^^^^^
If you would like to use the ``SINDy-PI`` optimizer, the ``Trapping SINDy`` optimizer (TrappingSR3), or the other SR3 optimizations with inequality constraints, you will also need to install the cvxpy package, e.g. with ``pip install cvxpy``.
.. code-block:: bash
pip install .[dev]
To build a local copy of the documentation, you should install the docs-dependencies with:

.. code-block:: bash
pip install pysindy[docs]
If you are looking to use convex optimization provided by `cvxpy <https://github.com/cvxpy/cvxpy>`__, then you have to install

.. code-block:: bash
pip install pysindy[cvxpy]
To run the unit tests, example notebooks, or build a local copy of the documentation, you should install the additional dependencies in ``requirements-dev.txt``
to utilize Mixed-Integer Optimized Sparse Regression (MIOSR) via `GurobiPy <https://pypi.org/project/gurobipy/>`__, you
require

.. code-block:: bash
pip install -r requirements-dev.txt
pip install pysindy[miosr]
Documentation
Expand Down Expand Up @@ -178,32 +196,58 @@ You can optimize your notebook for testing by checking ``__name__``. When our t
Contributing code
^^^^^^^^^^^^^^^^^
We welcome contributions to PySINDy. To contribute a new feature please submit a pull request. To get started we recommend installing the packages in ``requirements-dev.txt`` via
We welcome contributions to PySINDy. To contribute a new feature please submit a pull request. To get started we recommend installing an editable ``dev`` version from a local clone via

.. code-block:: bash
pip install -r requirements-dev.txt
pip install -e .[dev]
This will allow you to run unit tests and automatically format your code. To be accepted your code should conform to PEP8 and pass all unit tests. Code can be tested by invoking

.. code-block:: bash
pytest
We recommend using ``pre-commit`` to format your code. Once you have staged changes to commit
We recommend using ``pre-commit`` to format your code. The easiest approach is to install pre-commit via

.. code-block:: bash
pre-commit install
After which pre-commit will automatically check all future commits. Once you have staged changes to commit

.. code-block:: bash
git add path/to/changed/file.py
you can run the following to automatically reformat your staged code
Pre-commit will then automatically run all checks against your committed code. If you want to trigger this manually, you can run the following to automatically reformat your staged code

.. code-block:: bash
pre-commit
Note that you will then need to re-stage any changes ``pre-commit`` made to your code.

Building documentation requires the ``docs`` dependencies, which can be installed with either

.. code-block:: bash
pip install pysindy[docs]
or with

.. code-block:: bash
pip install .[docs]
for a local clone of the repository. 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).
Expand Down Expand Up @@ -335,8 +379,8 @@ Thanks to the members of the community who have contributed to PySINDy!
| `andgoldschmidt <https://github.com/andgoldschmidt>`_ | `derivative <https://derivative.readthedocs.io/en/latest/>`_ package for numerical differentiation `#85 <https://github.com/dynamicslab/pysindy/pull/85>`_ |
+-------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+

.. |BuildCI| image:: https://github.com/dynamicslab/pysindy/workflows/Build%20CI/badge.svg
:target: https://github.com/dynamicslab/pysindy/actions?query=workflow%3A%22Build+CI%22
.. |BuildCI| image:: https://github.com/dynamicslab/pysindy/actions/workflows/main.yml/badge.svg
:target: https://github.com/dynamicslab/pysindy/actions/workflows/main.yml?query=branch%3Amaster

.. |RTD| image:: https://readthedocs.org/projects/pysindy/badge/?version=latest
:target: https://pysindy.readthedocs.io/en/latest/?badge=latest
Expand Down
3 changes: 2 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@
html_sourcelink_suffix = ""

intersphinx_mapping = {
"derivative": ("https://derivative.readthedocs.io/en/latest/", None)
"derivative": ("https://derivative.readthedocs.io/en/latest/", None),
"sklearn": ("https://scikit-learn.org/stable/", None),
}

# -- Extensions to the Napoleon GoogleDocstring class ---------------------
Expand Down
146 changes: 73 additions & 73 deletions examples/10_PDEFIND_examples.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion examples/11_SSR_FROLS_examples.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"Jupyter notebook written by Alan Kaptanoglu and Jared Callaham.\n",
"\n",
"An interactive version of this notebook is available on binder\n",
"[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/dynamicslab/pysindy/v1.7?filepath=examples/11_SSR_FROLS_examples.ipynb)"
"[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/dynamicslab/pysindy/v1.7.3?filepath=examples/11_SSR_FROLS_examples.ipynb)"
]
},
{
Expand Down
Loading

0 comments on commit 82be3e5

Please sign in to comment.