llsi


Namellsi JSON
Version 0.4.0 PyPI version JSON
download
home_pageNone
SummaryA lightweight linear system identification tool
upload_time2024-09-13 18:53:28
maintainerNone
docs_urlNone
authorArmin Witte
requires_python>=3.8
licenseMIT License Copyright (c) 2022 arminwitte Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords system identification
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # llsi
Lightweight Linear System Identification package.

llsi offers easy acess to system identification algorithms. Currently implemented are *n4sid*, *PO-MOESP* for state space identification, and *arx* for the identification of transfer function models. Additionally, a prediction error method (*pem*) exists for the identification of output-error (*oe*) models or iterative improvement of state-space models. llsi only depeds on numpy, scipy and matplotlib.

To try them out online, you can use [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/arminwitte/llsi/HEAD?labpath=notebooks%2Fexample.ipynb).

[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://pycqa.github.io/isort/)

## Usage
### Identification
1. Load data
start with loading the heated wire dataset (found in the data/ folder at the root of this repo) using numpy
```python
import numpy as np
d = np.load('heated_wire_data.npy')
```
2. Create a SysIdData object
```python
import llsi
data = llsi.SysIdData(t=d[:,0],Re=d[:,1],Nu=d[:,2])
```
the three data series are time (t), Reynolds number (Re) and Nußelt number (Nu). We are going to model the dynamics of the Nußelt number (heat transfer from wire to surrounding fluid) using Reynolds number (velocity of the surrounding fluid) as input.
3. Ensure the time steps are equidistant and the sampling rate is reasonable. Moreover, the beginning of the time series (transient start) is removed and finally the series are centerd around their respective mean value (which is a requirement for linear systems).
```python
data.equidistant()
data.downsample(3)
data.crop(start=100)
data.center()
```
4. Identify a state space model with order 3 using the "PO-MOESP" algorithm.
```python
mod = llsi.sysid(data,'Nu','Re',(3,),method='po-moesp')
```
5. Use it further with scipy by exporting it to a scipy.signal.StateSpace object
```python
ss = mod.to_ss()
```
or to a continuous time transfer function
```python
ss = mod.to_tf(continuous=True)
```

### Plotting
Optionally, if matplotlib is installed, simple plots can be created using the llsi.Figure context manager:
```python
with llsi.Figure() as fig:
    fig.plot(ss,'impulse')
```
will plot the impulse response of the model ss.

## Contribution
Thank you for considering to contribute. Any exchange and help is welcome. However, I have to ask you to be patient with me responding.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "llsi",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "system identification",
    "author": "Armin Witte",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/85/32/b2c5eb80aa7cdf5895d001ab2a1cb87c656bf77e34840cdc364110de8fa1/llsi-0.4.0.tar.gz",
    "platform": null,
    "description": "# llsi\nLightweight Linear System Identification package.\n\nllsi offers easy acess to system identification algorithms. Currently implemented are *n4sid*, *PO-MOESP* for state space identification, and *arx* for the identification of transfer function models. Additionally, a prediction error method (*pem*) exists for the identification of output-error (*oe*) models or iterative improvement of state-space models. llsi only depeds on numpy, scipy and matplotlib.\n\nTo try them out online, you can use [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/arminwitte/llsi/HEAD?labpath=notebooks%2Fexample.ipynb).\n\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://pycqa.github.io/isort/)\n\n## Usage\n### Identification\n1. Load data\nstart with loading the heated wire dataset (found in the data/ folder at the root of this repo) using numpy\n```python\nimport numpy as np\nd = np.load('heated_wire_data.npy')\n```\n2. Create a SysIdData object\n```python\nimport llsi\ndata = llsi.SysIdData(t=d[:,0],Re=d[:,1],Nu=d[:,2])\n```\nthe three data series are time (t), Reynolds number (Re) and Nu\u00dfelt number (Nu). We are going to model the dynamics of the Nu\u00dfelt number (heat transfer from wire to surrounding fluid) using Reynolds number (velocity of the surrounding fluid) as input.\n3. Ensure the time steps are equidistant and the sampling rate is reasonable. Moreover, the beginning of the time series (transient start) is removed and finally the series are centerd around their respective mean value (which is a requirement for linear systems).\n```python\ndata.equidistant()\ndata.downsample(3)\ndata.crop(start=100)\ndata.center()\n```\n4. Identify a state space model with order 3 using the \"PO-MOESP\" algorithm.\n```python\nmod = llsi.sysid(data,'Nu','Re',(3,),method='po-moesp')\n```\n5. Use it further with scipy by exporting it to a scipy.signal.StateSpace object\n```python\nss = mod.to_ss()\n```\nor to a continuous time transfer function\n```python\nss = mod.to_tf(continuous=True)\n```\n\n### Plotting\nOptionally, if matplotlib is installed, simple plots can be created using the llsi.Figure context manager:\n```python\nwith llsi.Figure() as fig:\n    fig.plot(ss,'impulse')\n```\nwill plot the impulse response of the model ss.\n\n## Contribution\nThank you for considering to contribute. Any exchange and help is welcome. However, I have to ask you to be patient with me responding.\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2022 arminwitte  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "A lightweight linear system identification tool",
    "version": "0.4.0",
    "project_urls": {
        "Bug Tracker": "https://github.com/arminwitte/llsi/issues",
        "Homepage": "https://github.com/arminwitte/llsi"
    },
    "split_keywords": [
        "system",
        "identification"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a06931550404b6af72bf73f25cd8a1bc274640b9453ec37926771ffb31f53778",
                "md5": "53b857b5674754f341ba43d616a19dca",
                "sha256": "9664ddf620cc01d6b79bae2087a1cc6a4038b17510d2bf4a46ab49b68ea0a568"
            },
            "downloads": -1,
            "filename": "llsi-0.4.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "53b857b5674754f341ba43d616a19dca",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 20386,
            "upload_time": "2024-09-13T18:53:26",
            "upload_time_iso_8601": "2024-09-13T18:53:26.475570Z",
            "url": "https://files.pythonhosted.org/packages/a0/69/31550404b6af72bf73f25cd8a1bc274640b9453ec37926771ffb31f53778/llsi-0.4.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8532b2c5eb80aa7cdf5895d001ab2a1cb87c656bf77e34840cdc364110de8fa1",
                "md5": "18d20045847d2a5c3d0246c00f11c2d1",
                "sha256": "2573f02a4d5dad72d9d91f70271f9756d41959c4f83fec74c0c296913cda2c1d"
            },
            "downloads": -1,
            "filename": "llsi-0.4.0.tar.gz",
            "has_sig": false,
            "md5_digest": "18d20045847d2a5c3d0246c00f11c2d1",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 6351854,
            "upload_time": "2024-09-13T18:53:28",
            "upload_time_iso_8601": "2024-09-13T18:53:28.581952Z",
            "url": "https://files.pythonhosted.org/packages/85/32/b2c5eb80aa7cdf5895d001ab2a1cb87c656bf77e34840cdc364110de8fa1/llsi-0.4.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-13 18:53:28",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "arminwitte",
    "github_project": "llsi",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "llsi"
}
        
Elapsed time: 0.40225s