Skip to content

Commit

Permalink
Merge branch 'trapping_extended-jake' into trapping_extended
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacob-Stevens-Haas committed Jul 23, 2024
2 parents 11dcb02 + 263dea1 commit 45754aa
Show file tree
Hide file tree
Showing 299 changed files with 18,726 additions and 8,667 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
12 changes: 9 additions & 3 deletions .github/workflows/draft-pdf.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@
on: [push]
on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
paper:
runs-on: ubuntu-latest
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: 39 additions & 0 deletions .github/workflows/notebooks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
on:
schedule:
# run twice a month during times when hopefully few other jobs are scheduled
- cron: '0 12 6,21 * *'

jobs:
find-notebooks:
runs-on: ubuntu-latest
outputs:
paths: ${{ steps.find-notebooks.outputs.paths }}
steps:
- name: List Files
id: find-notebooks
uses: mirko-felice/[email protected]
with:
repo: ${{ github.repository }}
ref: ${{ github.ref }}
path: "examples"
ext: ".ipynb"

run-notebooks:
needs: find-notebooks
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
files: ${{ fromJson(needs.find-notebooks.outputs.paths) }}
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: "3.9"
- name: Install dependencies
run: |
pip install .[cvxpy,miosr] sympy nbconvert jupyter matplotlib seaborn pandas dysts
- name: Run Notebook
run: |
jupyter nbconvert --execute --to notebook --inplace ${{ matrix.files }}
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 }}
5 changes: 5 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 All @@ -12,6 +16,7 @@ venv/
ENV/
env.bak/
venv.bak/
env8

# automatically generated by setuptools-scm
pysindy/version.py
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
Loading

0 comments on commit 45754aa

Please sign in to comment.