From d0f29fc5ea0513bdbe7c69e3a43b03ec37992bb2 Mon Sep 17 00:00:00 2001 From: Richard Murray Date: Sat, 9 Jan 2021 19:13:45 -0800 Subject: [PATCH 1/3] Create python-package.yml --- .github/workflows/python-package.yml | 39 ++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/python-package.yml diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml new file mode 100644 index 000000000..3ffd40a8e --- /dev/null +++ b/.github/workflows/python-package.yml @@ -0,0 +1,39 @@ +# This workflow will install Python dependencies, run tests and lint with a variety of Python versions +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions + +name: Python package + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [3.7, 3.8, 3.9] + + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install flake8 pytest + if [ -f requirements.txt ]; then pip install -r requirements.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: Test with pytest + run: | + pytest From a64f7f1f95200376ed9bb11c8d31189dbda3a3ac Mon Sep 17 00:00:00 2001 From: Richard Murray Date: Tue, 12 Jan 2021 17:12:52 -0800 Subject: [PATCH 2/3] Revert "Create python-package.yml" This reverts commit d0f29fc5ea0513bdbe7c69e3a43b03ec37992bb2. --- .github/workflows/python-package.yml | 39 ---------------------------- 1 file changed, 39 deletions(-) delete mode 100644 .github/workflows/python-package.yml diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml deleted file mode 100644 index 3ffd40a8e..000000000 --- a/.github/workflows/python-package.yml +++ /dev/null @@ -1,39 +0,0 @@ -# This workflow will install Python dependencies, run tests and lint with a variety of Python versions -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions - -name: Python package - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -jobs: - build: - - runs-on: ubuntu-latest - strategy: - matrix: - python-version: [3.7, 3.8, 3.9] - - steps: - - uses: actions/checkout@v2 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - python -m pip install flake8 pytest - if [ -f requirements.txt ]; then pip install -r requirements.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: Test with pytest - run: | - pytest From bc79086d616788186115e092b8c8632b15139fc4 Mon Sep 17 00:00:00 2001 From: Richard Murray Date: Wed, 13 Jan 2021 23:21:12 -0800 Subject: [PATCH 3/3] use standard time series convention for markov() input data --- control/modelsimp.py | 14 ++------------ control/tests/modelsimp_test.py | 17 ++++++----------- 2 files changed, 8 insertions(+), 23 deletions(-) diff --git a/control/modelsimp.py b/control/modelsimp.py index 8f6124481..ec015c16b 100644 --- a/control/modelsimp.py +++ b/control/modelsimp.py @@ -395,7 +395,7 @@ def era(YY, m, n, nin, nout, r): raise NotImplementedError('This function is not implemented yet.') -def markov(Y, U, m=None, transpose=None): +def markov(Y, U, m=None, transpose=False): """Calculate the first `m` Markov parameters [D CB CAB ...] from input `U`, output `Y`. @@ -424,8 +424,7 @@ def markov(Y, U, m=None, transpose=None): Number of Markov parameters to output. Defaults to len(U). transpose : bool, optional Assume that input data is transposed relative to the standard - :ref:`time-series-convention`. The default value is true for - backward compatibility with legacy code. + :ref:`time-series-convention`. Default value is False. Returns ------- @@ -456,15 +455,6 @@ def markov(Y, U, m=None, transpose=None): >>> H = markov(Y, U, 3, transpose=False) """ - # Check on the specified format of the input - if transpose is None: - # For backwards compatibility, assume time series in rows but warn user - warnings.warn( - "Time-series data assumed to be in rows. This will change in a " - "future release. Use `transpose=True` to preserve current " - "behavior.") - transpose = True - # Convert input parameters to 2D arrays (if they aren't already) Umat = np.array(U, ndmin=2) Ymat = np.array(Y, ndmin=2) diff --git a/control/tests/modelsimp_test.py b/control/tests/modelsimp_test.py index 1e06cb4b7..4def0b4d7 100644 --- a/control/tests/modelsimp_test.py +++ b/control/tests/modelsimp_test.py @@ -44,13 +44,9 @@ def testMarkovSignature(self, matarrayout, matarrayin): H = markov(np.transpose(Y), np.transpose(U), m, transpose=True) np.testing.assert_array_almost_equal(H, np.transpose(Htrue)) - # Default (in v0.8.4 and below) should be transpose=True (w/ warning) - with pytest.warns(UserWarning, match="assumed to be in rows.*" - "change in a future release"): - # Generate Markov parameters without any arguments - H = markov(np.transpose(Y), np.transpose(U), m) - np.testing.assert_array_almost_equal(H, np.transpose(Htrue)) - + # Generate Markov parameters without any arguments + H = markov(Y, U, m) + np.testing.assert_array_almost_equal(H, Htrue) # Test example from docstring T = np.linspace(0, 10, 100) @@ -65,9 +61,8 @@ def testMarkovSignature(self, matarrayout, matarrayin): # Make sure MIMO generates an error U = np.ones((2, 100)) # 2 inputs (Y unchanged, with 1 output) - with pytest.warns(UserWarning): - with pytest.raises(ControlMIMONotImplemented): - markov(Y, U, m) + with pytest.raises(ControlMIMONotImplemented): + markov(Y, U, m) # Make sure markov() returns the right answer @pytest.mark.parametrize("k, m, n", @@ -108,7 +103,7 @@ def testMarkovResults(self, k, m, n): T = np.array(range(n)) * Ts U = np.cos(T) + np.sin(T/np.pi) _, Y, _ = forced_response(Hd, T, U, squeeze=True) - Mcomp = markov(Y, U, m, transpose=False) + Mcomp = markov(Y, U, m) # Compare to results from markov() np.testing.assert_array_almost_equal(Mtrue, Mcomp) pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy