OpenIRF 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- openirf-0.1.0/.gitignore +25 -0
- openirf-0.1.0/.gitlab-ci.yml +56 -0
- openirf-0.1.0/.readthedocs.yaml +23 -0
- openirf-0.1.0/.vscode/settings.json +12 -0
- openirf-0.1.0/LICENSE +10 -0
- openirf-0.1.0/PKG-INFO +35 -0
- openirf-0.1.0/README.md +14 -0
- openirf-0.1.0/docs/Makefile +20 -0
- openirf-0.1.0/docs/conf.py +21 -0
- openirf-0.1.0/docs/experimental_irf.rst +1 -0
- openirf-0.1.0/docs/index.rst +6 -0
- openirf-0.1.0/docs/make.bat +33 -0
- openirf-0.1.0/docs/numerical_irf.rst +1 -0
- openirf-0.1.0/docs/requirements.in +1 -0
- openirf-0.1.0/docs/requirements.txt +61 -0
- openirf-0.1.0/pyproject.toml +36 -0
- openirf-0.1.0/requirements.txt +4 -0
- openirf-0.1.0/requirements_dev.txt +11 -0
- openirf-0.1.0/ruff.toml +1 -0
- openirf-0.1.0/setup.cfg +4 -0
- openirf-0.1.0/src/OpenIRF.egg-info/PKG-INFO +35 -0
- openirf-0.1.0/src/OpenIRF.egg-info/SOURCES.txt +30 -0
- openirf-0.1.0/src/OpenIRF.egg-info/dependency_links.txt +1 -0
- openirf-0.1.0/src/OpenIRF.egg-info/requires.txt +3 -0
- openirf-0.1.0/src/OpenIRF.egg-info/top_level.txt +1 -0
- openirf-0.1.0/src/openirf/__init__.py +3 -0
- openirf-0.1.0/src/openirf/experimental_irf.py +153 -0
- openirf-0.1.0/src/openirf/numerical_irf.py +204 -0
- openirf-0.1.0/src/openirf/utils.py +94 -0
- openirf-0.1.0/tests/mck_import_test.py +205 -0
- openirf-0.1.0/tests/string_print_test.py +47 -0
- openirf-0.1.0/tests/time_series_import_test.py +324 -0
openirf-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# OS files
|
|
2
|
+
*.DS_Store
|
|
3
|
+
thumbs.db
|
|
4
|
+
|
|
5
|
+
# Python cache
|
|
6
|
+
**/__pycache__/*
|
|
7
|
+
|
|
8
|
+
# Matlab files
|
|
9
|
+
*.mat
|
|
10
|
+
|
|
11
|
+
# Build files
|
|
12
|
+
**/dist/*
|
|
13
|
+
*.egg-info
|
|
14
|
+
|
|
15
|
+
# Pytest
|
|
16
|
+
*.xml
|
|
17
|
+
|
|
18
|
+
# Coverage
|
|
19
|
+
.coverage
|
|
20
|
+
|
|
21
|
+
# Sphinx
|
|
22
|
+
**/_build/*
|
|
23
|
+
**/_static/*
|
|
24
|
+
**/_templates/*
|
|
25
|
+
docs/generated/*
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
build-job:
|
|
2
|
+
stage: build
|
|
3
|
+
image: python:3.14
|
|
4
|
+
script:
|
|
5
|
+
# Build Python package
|
|
6
|
+
- python -m pip install -U build
|
|
7
|
+
- python -m build
|
|
8
|
+
artifacts:
|
|
9
|
+
paths:
|
|
10
|
+
- "dist/"
|
|
11
|
+
|
|
12
|
+
pytest:
|
|
13
|
+
stage: test
|
|
14
|
+
image: python:3.14-slim
|
|
15
|
+
before_script:
|
|
16
|
+
- pip install .
|
|
17
|
+
script:
|
|
18
|
+
- pip install -r requirements_dev.txt
|
|
19
|
+
- coverage run --source=openirf -m pytest --junitxml=junit.xml
|
|
20
|
+
- coverage report
|
|
21
|
+
- coverage xml
|
|
22
|
+
coverage: '/TOTAL.*\s+(\d+%)$/'
|
|
23
|
+
artifacts:
|
|
24
|
+
reports:
|
|
25
|
+
junit: junit.xml
|
|
26
|
+
coverage_report:
|
|
27
|
+
coverage_format: cobertura
|
|
28
|
+
path: coverage.xml
|
|
29
|
+
|
|
30
|
+
publish-job:
|
|
31
|
+
stage: deploy
|
|
32
|
+
image: python:3.14-slim
|
|
33
|
+
dependencies:
|
|
34
|
+
- build-job
|
|
35
|
+
- pytest
|
|
36
|
+
environment:
|
|
37
|
+
name: release
|
|
38
|
+
only:
|
|
39
|
+
- tags
|
|
40
|
+
except:
|
|
41
|
+
- branches
|
|
42
|
+
id_tokens:
|
|
43
|
+
PYPI_ID_TOKEN:
|
|
44
|
+
aud: pypi
|
|
45
|
+
script:
|
|
46
|
+
# Install dependencies
|
|
47
|
+
- apt update && apt install -y jq curl
|
|
48
|
+
- python -m pip install -U twine id
|
|
49
|
+
|
|
50
|
+
# Retrieve the OIDC token from GitLab CI/CD, and exchange it for a PyPI API token
|
|
51
|
+
- oidc_token=$(python -m id pypi)
|
|
52
|
+
- resp=$(curl -X POST https://pypi.org/_/oidc/mint-token -d "{\"token\":\"${oidc_token}\"}")
|
|
53
|
+
- api_token=$(jq --raw-output '.token' <<< "${resp}")
|
|
54
|
+
|
|
55
|
+
# Upload to PyPI authenticating via the newly-minted token
|
|
56
|
+
- twine upload -u __token__ -p "${api_token}" dist/*
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Read the Docs configuration file for Sphinx projects
|
|
2
|
+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
|
|
3
|
+
|
|
4
|
+
# Required
|
|
5
|
+
version: 2
|
|
6
|
+
|
|
7
|
+
# Set the OS, Python version and other tools you might need
|
|
8
|
+
build:
|
|
9
|
+
os: ubuntu-24.04
|
|
10
|
+
tools:
|
|
11
|
+
python: "3.14"
|
|
12
|
+
|
|
13
|
+
# Build documentation in the "docs/" directory with Sphinx
|
|
14
|
+
sphinx:
|
|
15
|
+
configuration: docs/conf.py
|
|
16
|
+
|
|
17
|
+
# Python requirements
|
|
18
|
+
python:
|
|
19
|
+
install:
|
|
20
|
+
- method: pip
|
|
21
|
+
path: .
|
|
22
|
+
- requirements: docs/requirements.txt
|
|
23
|
+
- requirements: requirements.txt
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"python.testing.pytestArgs": [
|
|
3
|
+
"tests"
|
|
4
|
+
],
|
|
5
|
+
"python.testing.unittestEnabled": false,
|
|
6
|
+
"python.testing.pytestEnabled": true,
|
|
7
|
+
"[python]": {
|
|
8
|
+
"editor.formatOnSave": true,
|
|
9
|
+
"editor.defaultFormatter": "charliermarsh.ruff"
|
|
10
|
+
},
|
|
11
|
+
"notebook.formatOnSave.enabled": true,
|
|
12
|
+
}
|
openirf-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Oliver Maximilian Zobel
|
|
4
|
+
|
|
5
|
+
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
|
|
6
|
+
copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
7
|
+
|
|
8
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
9
|
+
|
|
10
|
+
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.
|
openirf-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: OpenIRF
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: An Open-Source Package for Impulse Response Function Estimation
|
|
5
|
+
Author-email: Oliver Maximilian Zobel <oliver.zobel@tum.de>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://gitlab.com/openirf/openirf
|
|
8
|
+
Classifier: Development Status :: 3 - Alpha
|
|
9
|
+
Classifier: Intended Audience :: Science/Research
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Topic :: Scientific/Engineering
|
|
14
|
+
Requires-Python: >=3.11
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
License-File: LICENSE
|
|
17
|
+
Requires-Dist: numpy
|
|
18
|
+
Requires-Dist: scipy
|
|
19
|
+
Requires-Dist: matplotlib
|
|
20
|
+
Dynamic: license-file
|
|
21
|
+
|
|
22
|
+

|
|
23
|
+
|
|
24
|
+
# OpenIRF: An Open-Source Package for Impulse Response Function Estimation
|
|
25
|
+
|
|
26
|
+

|
|
27
|
+
[](https://openirf.readthedocs.io/)
|
|
28
|
+
|
|
29
|
+
A collection of tools for the time domain analysis of mechanical systems.
|
|
30
|
+
|
|
31
|
+
## Installation
|
|
32
|
+
|
|
33
|
+
To install OpenIRF through pip, use the following command:
|
|
34
|
+
|
|
35
|
+
`pip install openirf`
|
openirf-0.1.0/README.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
3
|
+
# OpenIRF: An Open-Source Package for Impulse Response Function Estimation
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+
[](https://openirf.readthedocs.io/)
|
|
7
|
+
|
|
8
|
+
A collection of tools for the time domain analysis of mechanical systems.
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
To install OpenIRF through pip, use the following command:
|
|
13
|
+
|
|
14
|
+
`pip install openirf`
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Minimal makefile for Sphinx documentation
|
|
2
|
+
#
|
|
3
|
+
|
|
4
|
+
# You can set these variables from the command line, and also
|
|
5
|
+
# from the environment for the first two.
|
|
6
|
+
SPHINXOPTS ?=
|
|
7
|
+
SPHINXBUILD ?= sphinx-build
|
|
8
|
+
SOURCEDIR = .
|
|
9
|
+
BUILDDIR = _build
|
|
10
|
+
|
|
11
|
+
# Put it first so that "make" without argument is like "make help".
|
|
12
|
+
help:
|
|
13
|
+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
|
14
|
+
|
|
15
|
+
.PHONY: help Makefile
|
|
16
|
+
|
|
17
|
+
# Catch-all target: route all unknown targets to Sphinx using the new
|
|
18
|
+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
|
|
19
|
+
%: Makefile
|
|
20
|
+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Configuration file for the Sphinx documentation builder.
|
|
2
|
+
#
|
|
3
|
+
# For the full list of built-in configuration values, see the documentation:
|
|
4
|
+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
|
|
5
|
+
|
|
6
|
+
# -- Project information -----------------------------------------------------
|
|
7
|
+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
|
|
8
|
+
project = 'OpenIRF'
|
|
9
|
+
copyright = '2026, Oliver Maximilian Zobel'
|
|
10
|
+
author = 'Oliver Maximilian Zobel'
|
|
11
|
+
|
|
12
|
+
# -- General configuration ---------------------------------------------------
|
|
13
|
+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
|
|
14
|
+
extensions = ['sphinx.ext.autodoc','sphinx.ext.autosummary',]
|
|
15
|
+
templates_path = ['_templates']
|
|
16
|
+
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
|
|
17
|
+
autosummary_generate = True
|
|
18
|
+
|
|
19
|
+
# -- Options for HTML output -------------------------------------------------
|
|
20
|
+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
|
|
21
|
+
html_theme = "sphinx_rtd_theme"
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
@ECHO OFF
|
|
2
|
+
|
|
3
|
+
pushd %~dp0
|
|
4
|
+
|
|
5
|
+
if "%SPHINXBUILD%" == "" (
|
|
6
|
+
set SPHINXBUILD=sphinx-build
|
|
7
|
+
)
|
|
8
|
+
set SOURCEDIR=.
|
|
9
|
+
set BUILDDIR=_build
|
|
10
|
+
|
|
11
|
+
%SPHINXBUILD% >NUL 2>NUL
|
|
12
|
+
if errorlevel 9009 (
|
|
13
|
+
echo.
|
|
14
|
+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
|
|
15
|
+
echo.installed, then set the SPHINXBUILD environment variable to point
|
|
16
|
+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
|
|
17
|
+
echo.may add the Sphinx directory to PATH.
|
|
18
|
+
echo.
|
|
19
|
+
echo.If you don't have Sphinx installed, grab it from
|
|
20
|
+
echo.https://www.sphinx-doc.org/
|
|
21
|
+
exit /b 1
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
if "%1" == "" goto help
|
|
25
|
+
|
|
26
|
+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
|
|
27
|
+
goto end
|
|
28
|
+
|
|
29
|
+
:help
|
|
30
|
+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
|
|
31
|
+
|
|
32
|
+
:end
|
|
33
|
+
popd
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
sphinx>=9.0
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
#
|
|
2
|
+
# This file is autogenerated by pip-compile with Python 3.14
|
|
3
|
+
# by the following command:
|
|
4
|
+
#
|
|
5
|
+
# pip-compile docs/requirements.in
|
|
6
|
+
#
|
|
7
|
+
alabaster==1.0.0
|
|
8
|
+
# via sphinx
|
|
9
|
+
babel==2.18.0
|
|
10
|
+
# via sphinx
|
|
11
|
+
certifi==2026.2.25
|
|
12
|
+
# via requests
|
|
13
|
+
charset-normalizer==3.4.6
|
|
14
|
+
# via requests
|
|
15
|
+
colorama==0.4.6
|
|
16
|
+
# via sphinx
|
|
17
|
+
docutils==0.22.4
|
|
18
|
+
# via
|
|
19
|
+
# sphinx
|
|
20
|
+
# sphinx-rtd-theme
|
|
21
|
+
idna==3.11
|
|
22
|
+
# via requests
|
|
23
|
+
imagesize==2.0.0
|
|
24
|
+
# via sphinx
|
|
25
|
+
jinja2==3.1.6
|
|
26
|
+
# via sphinx
|
|
27
|
+
markupsafe==3.0.3
|
|
28
|
+
# via jinja2
|
|
29
|
+
packaging==26.0
|
|
30
|
+
# via sphinx
|
|
31
|
+
pygments==2.19.2
|
|
32
|
+
# via sphinx
|
|
33
|
+
requests==2.32.5
|
|
34
|
+
# via sphinx
|
|
35
|
+
roman-numerals==4.1.0
|
|
36
|
+
# via sphinx
|
|
37
|
+
snowballstemmer==3.0.1
|
|
38
|
+
# via sphinx
|
|
39
|
+
sphinx==9.1.0
|
|
40
|
+
# via
|
|
41
|
+
# -r docs/requirements.in
|
|
42
|
+
# sphinx-rtd-theme
|
|
43
|
+
# sphinxcontrib-jquery
|
|
44
|
+
sphinx-rtd-theme==3.1.0
|
|
45
|
+
# via -r docs/requirements.in
|
|
46
|
+
sphinxcontrib-applehelp==2.0.0
|
|
47
|
+
# via sphinx
|
|
48
|
+
sphinxcontrib-devhelp==2.0.0
|
|
49
|
+
# via sphinx
|
|
50
|
+
sphinxcontrib-htmlhelp==2.1.0
|
|
51
|
+
# via sphinx
|
|
52
|
+
sphinxcontrib-jquery==4.1
|
|
53
|
+
# via sphinx-rtd-theme
|
|
54
|
+
sphinxcontrib-jsmath==1.0.1
|
|
55
|
+
# via sphinx
|
|
56
|
+
sphinxcontrib-qthelp==2.0.0
|
|
57
|
+
# via sphinx
|
|
58
|
+
sphinxcontrib-serializinghtml==2.0.0
|
|
59
|
+
# via sphinx
|
|
60
|
+
urllib3==2.6.3
|
|
61
|
+
# via requests
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61", "setuptools-scm"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "OpenIRF"
|
|
7
|
+
dynamic = ["version"]
|
|
8
|
+
description = "An Open-Source Package for Impulse Response Function Estimation"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
authors = [
|
|
11
|
+
{name = "Oliver Maximilian Zobel", email = "oliver.zobel@tum.de"},
|
|
12
|
+
]
|
|
13
|
+
dependencies = [
|
|
14
|
+
"numpy",
|
|
15
|
+
"scipy",
|
|
16
|
+
"matplotlib",
|
|
17
|
+
]
|
|
18
|
+
requires-python = ">=3.11"
|
|
19
|
+
license = "MIT"
|
|
20
|
+
|
|
21
|
+
classifiers = [
|
|
22
|
+
"Development Status :: 3 - Alpha",
|
|
23
|
+
"Intended Audience :: Science/Research",
|
|
24
|
+
"Intended Audience :: Developers",
|
|
25
|
+
"Operating System :: OS Independent",
|
|
26
|
+
"Programming Language :: Python :: 3",
|
|
27
|
+
"Topic :: Scientific/Engineering",
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
[project.urls]
|
|
31
|
+
Homepage = "https://gitlab.com/openirf/openirf"
|
|
32
|
+
|
|
33
|
+
[tool.setuptools_scm]
|
|
34
|
+
version_scheme = "post-release"
|
|
35
|
+
local_scheme = "node-and-date"
|
|
36
|
+
fallback_version = "0.0.0"
|
openirf-0.1.0/ruff.toml
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
line-length = 160
|
openirf-0.1.0/setup.cfg
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: OpenIRF
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: An Open-Source Package for Impulse Response Function Estimation
|
|
5
|
+
Author-email: Oliver Maximilian Zobel <oliver.zobel@tum.de>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://gitlab.com/openirf/openirf
|
|
8
|
+
Classifier: Development Status :: 3 - Alpha
|
|
9
|
+
Classifier: Intended Audience :: Science/Research
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Topic :: Scientific/Engineering
|
|
14
|
+
Requires-Python: >=3.11
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
License-File: LICENSE
|
|
17
|
+
Requires-Dist: numpy
|
|
18
|
+
Requires-Dist: scipy
|
|
19
|
+
Requires-Dist: matplotlib
|
|
20
|
+
Dynamic: license-file
|
|
21
|
+
|
|
22
|
+

|
|
23
|
+
|
|
24
|
+
# OpenIRF: An Open-Source Package for Impulse Response Function Estimation
|
|
25
|
+
|
|
26
|
+

|
|
27
|
+
[](https://openirf.readthedocs.io/)
|
|
28
|
+
|
|
29
|
+
A collection of tools for the time domain analysis of mechanical systems.
|
|
30
|
+
|
|
31
|
+
## Installation
|
|
32
|
+
|
|
33
|
+
To install OpenIRF through pip, use the following command:
|
|
34
|
+
|
|
35
|
+
`pip install openirf`
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
.gitignore
|
|
2
|
+
.gitlab-ci.yml
|
|
3
|
+
.readthedocs.yaml
|
|
4
|
+
LICENSE
|
|
5
|
+
README.md
|
|
6
|
+
pyproject.toml
|
|
7
|
+
requirements.txt
|
|
8
|
+
requirements_dev.txt
|
|
9
|
+
ruff.toml
|
|
10
|
+
.vscode/settings.json
|
|
11
|
+
docs/Makefile
|
|
12
|
+
docs/conf.py
|
|
13
|
+
docs/experimental_irf.rst
|
|
14
|
+
docs/index.rst
|
|
15
|
+
docs/make.bat
|
|
16
|
+
docs/numerical_irf.rst
|
|
17
|
+
docs/requirements.in
|
|
18
|
+
docs/requirements.txt
|
|
19
|
+
src/OpenIRF.egg-info/PKG-INFO
|
|
20
|
+
src/OpenIRF.egg-info/SOURCES.txt
|
|
21
|
+
src/OpenIRF.egg-info/dependency_links.txt
|
|
22
|
+
src/OpenIRF.egg-info/requires.txt
|
|
23
|
+
src/OpenIRF.egg-info/top_level.txt
|
|
24
|
+
src/openirf/__init__.py
|
|
25
|
+
src/openirf/experimental_irf.py
|
|
26
|
+
src/openirf/numerical_irf.py
|
|
27
|
+
src/openirf/utils.py
|
|
28
|
+
tests/mck_import_test.py
|
|
29
|
+
tests/string_print_test.py
|
|
30
|
+
tests/time_series_import_test.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
openirf
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import numpy as np
|
|
2
|
+
import scipy as sp
|
|
3
|
+
from .utils import *
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class ExperimentalIRF:
|
|
7
|
+
"""
|
|
8
|
+
OpenIRF Experimental IRF Class
|
|
9
|
+
------------------------------
|
|
10
|
+
|
|
11
|
+
Stores time series (t_vec,y_vec_,f_vec) for IRF calculation.
|
|
12
|
+
|
|
13
|
+
Shape of time series arrays
|
|
14
|
+
---------------------------
|
|
15
|
+
- 3D: Multiple dofs, multiple measurements (dof,number_of_measurements,points)
|
|
16
|
+
- 2D: Single dof, multiple measurements (number_of_measurements,points)
|
|
17
|
+
- 1D: Single dof, one measurement (points)
|
|
18
|
+
|
|
19
|
+
Constraints
|
|
20
|
+
-----------
|
|
21
|
+
- t_vec must matched stored t_vec (if already stored)
|
|
22
|
+
- All data must share the same t_vec
|
|
23
|
+
- Data cannot be added without a specified or already stored t_vec
|
|
24
|
+
|
|
25
|
+
Attributes
|
|
26
|
+
----------
|
|
27
|
+
:param t_vec: Time vector of time series y_vec and f_vec.
|
|
28
|
+
:type t_vec: ndarray
|
|
29
|
+
:param y_vec: Time series of system responses.
|
|
30
|
+
:type y_vec: ndarray
|
|
31
|
+
:param f_vec: Time series of applied forces.
|
|
32
|
+
:type f_vec: ndarray
|
|
33
|
+
|
|
34
|
+
"""
|
|
35
|
+
|
|
36
|
+
# Declare parameters as attributes
|
|
37
|
+
t_vec = np.empty((0))
|
|
38
|
+
y_vec = np.empty((0, 0, 0))
|
|
39
|
+
f_vec = np.empty((0, 0, 0))
|
|
40
|
+
|
|
41
|
+
def __init__(self, t_vec=np.empty((0)), y_vec=np.empty((0, 0, 0)), f_vec=np.empty((0, 0, 0))):
|
|
42
|
+
# Initialize ExperimentalIRF class with provided data
|
|
43
|
+
if t_vec.size != 0:
|
|
44
|
+
self.t_vec = self._convert_to_1d_array(t_vec)
|
|
45
|
+
|
|
46
|
+
if y_vec.size != 0 or f_vec.size != 0:
|
|
47
|
+
self.add_time_series(y_vec, f_vec, t_vec=self.t_vec)
|
|
48
|
+
|
|
49
|
+
# Trim unnecessary dimensions from array
|
|
50
|
+
def _convert_to_1d_array(self, array):
|
|
51
|
+
array = np.squeeze(array)
|
|
52
|
+
|
|
53
|
+
if array.ndim != 1:
|
|
54
|
+
raise ValueError(f"Expected 1D array. Got {array.ndim}D.")
|
|
55
|
+
|
|
56
|
+
return array
|
|
57
|
+
|
|
58
|
+
# Convert any array passed to ExperimentalIRF into a 3D array for concise internal storage.
|
|
59
|
+
def _convert_to_3d_array(self, array):
|
|
60
|
+
# Input convention:
|
|
61
|
+
# 3D: Multiple dofs, multiple measurements (dof,number_of_measurements,points)
|
|
62
|
+
# 2D: Single dof, multiple measurements (number_of_measurements,points)
|
|
63
|
+
# 1D: Single dof, one measurement (points)
|
|
64
|
+
|
|
65
|
+
if array.ndim == 1:
|
|
66
|
+
array = array[np.newaxis, np.newaxis, :]
|
|
67
|
+
elif array.ndim == 2:
|
|
68
|
+
array = array[np.newaxis, :, :]
|
|
69
|
+
elif array.ndim == 3:
|
|
70
|
+
pass
|
|
71
|
+
else:
|
|
72
|
+
raise ValueError(f"Expected 1D, 2D, or 3D array. Got {array.ndim}D.")
|
|
73
|
+
|
|
74
|
+
return array
|
|
75
|
+
|
|
76
|
+
def __str__(self):
|
|
77
|
+
# Prints a formatted object summary of the ExperimentalIRF object
|
|
78
|
+
def print_array(arr):
|
|
79
|
+
if arr is None or arr.size == 0:
|
|
80
|
+
return "None"
|
|
81
|
+
else:
|
|
82
|
+
return str(arr.shape)
|
|
83
|
+
|
|
84
|
+
return (
|
|
85
|
+
"==== OpenIRF Experimental IRF Object Summary ====\n"
|
|
86
|
+
f"t_vec: {print_array(self.t_vec)}\n"
|
|
87
|
+
f"y_vec: {print_array(self.y_vec)}\n"
|
|
88
|
+
f"f_vec: {print_array(self.f_vec)}"
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
def __repr__(self):
|
|
92
|
+
# Return the same output as __str__ for IPython outputs
|
|
93
|
+
return self.__str__()
|
|
94
|
+
|
|
95
|
+
def add_time_series(self, y_vec, f_vec, t_vec=None):
|
|
96
|
+
"""
|
|
97
|
+
Add Time Series
|
|
98
|
+
---------------
|
|
99
|
+
|
|
100
|
+
This method allows to add time series to the class istance.
|
|
101
|
+
|
|
102
|
+
Shape of time series arrays
|
|
103
|
+
---------------------------
|
|
104
|
+
- 3D: Multiple dofs, multiple measurements (dof,number_of_measurements,points)
|
|
105
|
+
- 2D: Single dof, multiple measurements (number_of_measurements,points)
|
|
106
|
+
- 1D: Single dof, one measurement (points)
|
|
107
|
+
|
|
108
|
+
Constraints
|
|
109
|
+
-----------
|
|
110
|
+
- t_vec must matched stored t_vec (if already stored)
|
|
111
|
+
- All data must share the same t_vec
|
|
112
|
+
- Data cannot be added without a specified or already stored t_vec
|
|
113
|
+
|
|
114
|
+
Parameters
|
|
115
|
+
----------
|
|
116
|
+
:param t_vec: Time vector of time series y_vec and f_vec.
|
|
117
|
+
:type t_vec: ndarray
|
|
118
|
+
:param y_vec: Time series of system responses.
|
|
119
|
+
:type y_vec: ndarray
|
|
120
|
+
:param f_vec: Time series of applied forces.
|
|
121
|
+
:type f_vec: ndarray, optional
|
|
122
|
+
|
|
123
|
+
"""
|
|
124
|
+
# Shape input data
|
|
125
|
+
if t_vec is not None:
|
|
126
|
+
t_vec = self._convert_to_1d_array(t_vec)
|
|
127
|
+
y_vec = self._convert_to_3d_array(y_vec)
|
|
128
|
+
f_vec = self._convert_to_3d_array(f_vec)
|
|
129
|
+
|
|
130
|
+
# Input check - Time Vector
|
|
131
|
+
if self.t_vec.size != 0 and t_vec is not None:
|
|
132
|
+
if not np.array_equal(self.t_vec, t_vec):
|
|
133
|
+
raise Exception("Provided t_vec does not match stored t_vec.")
|
|
134
|
+
if self.t_vec.size == 0: # Assign provided time vector if previously self.t_vec was empty
|
|
135
|
+
if t_vec is None or t_vec.size == 0: # No t_vec provided for data
|
|
136
|
+
raise Exception("No t_vec provided for data.")
|
|
137
|
+
self.t_vec = t_vec
|
|
138
|
+
|
|
139
|
+
# Input check - Data
|
|
140
|
+
if y_vec.shape[-1] != len(self.t_vec):
|
|
141
|
+
raise Exception("Provided y_vec does not match length of stored t_vec.")
|
|
142
|
+
if f_vec.shape[-1] != len(self.t_vec):
|
|
143
|
+
raise Exception("Provided f_vec does not match length of stored t_vec.")
|
|
144
|
+
|
|
145
|
+
if self.y_vec.size != 0: # Only y_vec or f_vec must be checked here, since they can only be initialized in pairs.
|
|
146
|
+
y_vec_new = np.append(self.y_vec, y_vec, axis=0)
|
|
147
|
+
f_vec_new = np.append(self.f_vec, f_vec, axis=0)
|
|
148
|
+
else:
|
|
149
|
+
y_vec_new = y_vec
|
|
150
|
+
f_vec_new = f_vec
|
|
151
|
+
|
|
152
|
+
self.y_vec = y_vec_new
|
|
153
|
+
self.f_vec = f_vec_new
|