pysampled 1.0.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.
- pysampled-1.0.0/.gitignore +164 -0
- pysampled-1.0.0/.readthedocs.yaml +29 -0
- pysampled-1.0.0/LICENSE +21 -0
- pysampled-1.0.0/PKG-INFO +100 -0
- pysampled-1.0.0/README.md +71 -0
- pysampled-1.0.0/docs/Makefile +20 -0
- pysampled-1.0.0/docs/_static/example_1_plot.png +0 -0
- pysampled-1.0.0/docs/_static/example_2_plot.png +0 -0
- pysampled-1.0.0/docs/_static/example_3_plot.png +0 -0
- pysampled-1.0.0/docs/_static/example_4_plot.png +0 -0
- pysampled-1.0.0/docs/_static/example_5_plot.png +0 -0
- pysampled-1.0.0/docs/api.md +12 -0
- pysampled-1.0.0/docs/conf.py +61 -0
- pysampled-1.0.0/docs/examples.md +107 -0
- pysampled-1.0.0/docs/index.md +14 -0
- pysampled-1.0.0/docs/make.bat +35 -0
- pysampled-1.0.0/docs/requirements.txt +4 -0
- pysampled-1.0.0/pyproject.toml +43 -0
- pysampled-1.0.0/pysampled/__init__.py +55 -0
- pysampled-1.0.0/pysampled/__version__.py +1 -0
- pysampled-1.0.0/pysampled/core.py +1873 -0
- pysampled-1.0.0/requirements.yml +11 -0
- pysampled-1.0.0/scripts/download_airpls.py +16 -0
- pysampled-1.0.0/tests/__init__.py +1 -0
- pysampled-1.0.0/tests/test_data.py +309 -0
- pysampled-1.0.0/tests/test_time_interval.py +109 -0
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
.vscode/*
|
|
2
|
+
|
|
3
|
+
# Byte-compiled / optimized / DLL files
|
|
4
|
+
__pycache__/
|
|
5
|
+
*.py[cod]
|
|
6
|
+
*$py.class
|
|
7
|
+
|
|
8
|
+
# C extensions
|
|
9
|
+
*.so
|
|
10
|
+
|
|
11
|
+
# Distribution / packaging
|
|
12
|
+
.Python
|
|
13
|
+
build/
|
|
14
|
+
develop-eggs/
|
|
15
|
+
dist/
|
|
16
|
+
downloads/
|
|
17
|
+
eggs/
|
|
18
|
+
.eggs/
|
|
19
|
+
lib/
|
|
20
|
+
lib64/
|
|
21
|
+
parts/
|
|
22
|
+
sdist/
|
|
23
|
+
var/
|
|
24
|
+
wheels/
|
|
25
|
+
share/python-wheels/
|
|
26
|
+
*.egg-info/
|
|
27
|
+
.installed.cfg
|
|
28
|
+
*.egg
|
|
29
|
+
MANIFEST
|
|
30
|
+
|
|
31
|
+
# PyInstaller
|
|
32
|
+
# Usually these files are written by a python script from a template
|
|
33
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
34
|
+
*.manifest
|
|
35
|
+
*.spec
|
|
36
|
+
|
|
37
|
+
# Installer logs
|
|
38
|
+
pip-log.txt
|
|
39
|
+
pip-delete-this-directory.txt
|
|
40
|
+
|
|
41
|
+
# Unit test / coverage reports
|
|
42
|
+
htmlcov/
|
|
43
|
+
.tox/
|
|
44
|
+
.nox/
|
|
45
|
+
.coverage
|
|
46
|
+
.coverage.*
|
|
47
|
+
.cache
|
|
48
|
+
nosetests.xml
|
|
49
|
+
coverage.xml
|
|
50
|
+
*.cover
|
|
51
|
+
*.py,cover
|
|
52
|
+
.hypothesis/
|
|
53
|
+
.pytest_cache/
|
|
54
|
+
cover/
|
|
55
|
+
|
|
56
|
+
# Translations
|
|
57
|
+
*.mo
|
|
58
|
+
*.pot
|
|
59
|
+
|
|
60
|
+
# Django stuff:
|
|
61
|
+
*.log
|
|
62
|
+
local_settings.py
|
|
63
|
+
db.sqlite3
|
|
64
|
+
db.sqlite3-journal
|
|
65
|
+
|
|
66
|
+
# Flask stuff:
|
|
67
|
+
instance/
|
|
68
|
+
.webassets-cache
|
|
69
|
+
|
|
70
|
+
# Scrapy stuff:
|
|
71
|
+
.scrapy
|
|
72
|
+
|
|
73
|
+
# Sphinx documentation
|
|
74
|
+
docs/_build/
|
|
75
|
+
|
|
76
|
+
# PyBuilder
|
|
77
|
+
.pybuilder/
|
|
78
|
+
target/
|
|
79
|
+
|
|
80
|
+
# Jupyter Notebook
|
|
81
|
+
.ipynb_checkpoints
|
|
82
|
+
|
|
83
|
+
# IPython
|
|
84
|
+
profile_default/
|
|
85
|
+
ipython_config.py
|
|
86
|
+
|
|
87
|
+
# pyenv
|
|
88
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
89
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
90
|
+
# .python-version
|
|
91
|
+
|
|
92
|
+
# pipenv
|
|
93
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
94
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
95
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
96
|
+
# install all needed dependencies.
|
|
97
|
+
#Pipfile.lock
|
|
98
|
+
|
|
99
|
+
# poetry
|
|
100
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
101
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
102
|
+
# commonly ignored for libraries.
|
|
103
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
104
|
+
#poetry.lock
|
|
105
|
+
|
|
106
|
+
# pdm
|
|
107
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
108
|
+
#pdm.lock
|
|
109
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
110
|
+
# in version control.
|
|
111
|
+
# https://pdm.fming.dev/#use-with-ide
|
|
112
|
+
.pdm.toml
|
|
113
|
+
|
|
114
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
115
|
+
__pypackages__/
|
|
116
|
+
|
|
117
|
+
# Celery stuff
|
|
118
|
+
celerybeat-schedule
|
|
119
|
+
celerybeat.pid
|
|
120
|
+
|
|
121
|
+
# SageMath parsed files
|
|
122
|
+
*.sage.py
|
|
123
|
+
|
|
124
|
+
# Environments
|
|
125
|
+
.env
|
|
126
|
+
.venv
|
|
127
|
+
env/
|
|
128
|
+
venv/
|
|
129
|
+
ENV/
|
|
130
|
+
env.bak/
|
|
131
|
+
venv.bak/
|
|
132
|
+
|
|
133
|
+
# Spyder project settings
|
|
134
|
+
.spyderproject
|
|
135
|
+
.spyproject
|
|
136
|
+
|
|
137
|
+
# Rope project settings
|
|
138
|
+
.ropeproject
|
|
139
|
+
|
|
140
|
+
# mkdocs documentation
|
|
141
|
+
/site
|
|
142
|
+
|
|
143
|
+
# mypy
|
|
144
|
+
.mypy_cache/
|
|
145
|
+
.dmypy.json
|
|
146
|
+
dmypy.json
|
|
147
|
+
|
|
148
|
+
# Pyre type checker
|
|
149
|
+
.pyre/
|
|
150
|
+
|
|
151
|
+
# pytype static type analyzer
|
|
152
|
+
.pytype/
|
|
153
|
+
|
|
154
|
+
# Cython debug symbols
|
|
155
|
+
cython_debug/
|
|
156
|
+
|
|
157
|
+
# PyCharm
|
|
158
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
159
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
160
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
161
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
162
|
+
#.idea/
|
|
163
|
+
|
|
164
|
+
airPLS.py
|
|
@@ -0,0 +1,29 @@
|
|
|
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-22.04
|
|
10
|
+
tools:
|
|
11
|
+
python: "3.12"
|
|
12
|
+
|
|
13
|
+
# Build documentation in the "docs/" directory with Sphinx
|
|
14
|
+
sphinx:
|
|
15
|
+
configuration: docs/conf.py
|
|
16
|
+
|
|
17
|
+
# Optionally build your docs in additional formats such as PDF and ePub
|
|
18
|
+
formats:
|
|
19
|
+
- pdf
|
|
20
|
+
- epub
|
|
21
|
+
|
|
22
|
+
# Optional but recommended, declare the Python requirements required
|
|
23
|
+
# to build your documentation
|
|
24
|
+
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
|
|
25
|
+
python:
|
|
26
|
+
install:
|
|
27
|
+
- requirements: docs/requirements.txt
|
|
28
|
+
- method: pip
|
|
29
|
+
path: .
|
pysampled-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Praneeth Namburi
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
pysampled-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: pysampled
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: :py:mod:`pysampled` provides tools for working with uniformly sampled (time series) data.
|
|
5
|
+
Author-email: Praneeth Namburi <praneeth.namburi@gmail.com>
|
|
6
|
+
Requires-Python: >=3.7
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Topic :: Scientific/Engineering
|
|
11
|
+
Classifier: Programming Language :: Python
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
19
|
+
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
20
|
+
Requires-Dist: numpy
|
|
21
|
+
Requires-Dist: scipy
|
|
22
|
+
Requires-Dist: scikit-learn
|
|
23
|
+
Requires-Dist: matplotlib
|
|
24
|
+
Requires-Dist: numpy ; extra == "minimal"
|
|
25
|
+
Requires-Dist: scipy ; extra == "minimal"
|
|
26
|
+
Project-URL: Home, https://github.com/praneethnamburi/pysampled
|
|
27
|
+
Provides-Extra: minimal
|
|
28
|
+
|
|
29
|
+
# pysampled
|
|
30
|
+
|
|
31
|
+
[](https://github.com/praneethnamburi/pysampled)
|
|
32
|
+
[](https://pypi.org/project/pysampled/)
|
|
33
|
+
[](https://pysampled.readthedocs.io)
|
|
34
|
+
[](https://raw.githubusercontent.com/praneethnamburi/pysampled/main/LICENSE)
|
|
35
|
+
|
|
36
|
+
*A toolkit for working with uniformly sampled time series data.*
|
|
37
|
+
|
|
38
|
+
`pysampled` streamlines the exploration of time series data and the development of signal processing pipelines. It enables researchers and engineers to analyze time series data—including audio signals and physiological data—efficiently and intuitively. With its user-friendly interface and well-documented examples, the package makes signal processing accessible for both basic manipulations and analyses like filtering, resampling, trend extraction, and spectral analysis.
|
|
39
|
+
|
|
40
|
+
## Installation
|
|
41
|
+
|
|
42
|
+
**1. Installing from PyPI (Recommended)**
|
|
43
|
+
|
|
44
|
+
```sh
|
|
45
|
+
pip install pysampled && download-airpls
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
You can optionally use `pip install pysampled[minimal]` to skip installing scikit-learn and matplotlib.
|
|
49
|
+
|
|
50
|
+
> *Note:* The `download-airpls` command is defined in `pyproject.toml` and ensures that the required `airPLS.py` file is properly downloaded. More information on airPLS [here](https://github.com/zmzhang/airPLS/tree/master).
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
**2. Installing from the GitHub Repository**
|
|
55
|
+
|
|
56
|
+
```sh
|
|
57
|
+
pip install git+https://github.com/praneethnamburi/pysampled.git && download-airpls
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Alternatively, you can clone the repository locally and set up your environment using the `requirements.yml` file. If you do this, download `airPLS.py` manually from [here](https://github.com/zmzhang/airPLS/tree/master) and add it to the `pysampled` folder inside the cloned repository.
|
|
61
|
+
|
|
62
|
+
```sh
|
|
63
|
+
git clone https://github.com/praneethnamburi/pysampled.git
|
|
64
|
+
cd pysampled
|
|
65
|
+
conda env create -n pysampled -f requirements.yml
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
## Quickstart
|
|
70
|
+
|
|
71
|
+
```python
|
|
72
|
+
import pysampled as sampled
|
|
73
|
+
|
|
74
|
+
# Generate a 10 Hz signal sampled at 100 Hz. Sum of three sine waves (1, 3, and 5 Hz).
|
|
75
|
+
sig = sampled.generate_signal("three_sine_waves")[:5.0]
|
|
76
|
+
|
|
77
|
+
# Only keep first 5 seconds of the signal
|
|
78
|
+
sig = sig[:5.0]
|
|
79
|
+
|
|
80
|
+
# visualize the signal, before and after applying a bandpass filter between 2 and 4 Hz
|
|
81
|
+
sampled.plot([sig, sig.bandpass(2, 4)])
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
## License
|
|
86
|
+
|
|
87
|
+
This project is licensed under the MIT License. See the `LICENSE` file for details.
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
## Contact
|
|
91
|
+
|
|
92
|
+
[Praneeth Namburi](https://praneethnamburi.com)
|
|
93
|
+
|
|
94
|
+
Project Link: [https://github.com/praneethnamburi/pysampled](https://github.com/praneethnamburi/pysampled)
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
## Acknowledgments
|
|
98
|
+
|
|
99
|
+
This tool was developed as part of the ImmersionToolbox initiative at the [MIT.nano Immersion Lab](https://immersion.mit.edu). Thanks to NCSOFT for supporting this initiative.
|
|
100
|
+
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# pysampled
|
|
2
|
+
|
|
3
|
+
[](https://github.com/praneethnamburi/pysampled)
|
|
4
|
+
[](https://pypi.org/project/pysampled/)
|
|
5
|
+
[](https://pysampled.readthedocs.io)
|
|
6
|
+
[](https://raw.githubusercontent.com/praneethnamburi/pysampled/main/LICENSE)
|
|
7
|
+
|
|
8
|
+
*A toolkit for working with uniformly sampled time series data.*
|
|
9
|
+
|
|
10
|
+
`pysampled` streamlines the exploration of time series data and the development of signal processing pipelines. It enables researchers and engineers to analyze time series data—including audio signals and physiological data—efficiently and intuitively. With its user-friendly interface and well-documented examples, the package makes signal processing accessible for both basic manipulations and analyses like filtering, resampling, trend extraction, and spectral analysis.
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
**1. Installing from PyPI (Recommended)**
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
pip install pysampled && download-airpls
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
You can optionally use `pip install pysampled[minimal]` to skip installing scikit-learn and matplotlib.
|
|
21
|
+
|
|
22
|
+
> *Note:* The `download-airpls` command is defined in `pyproject.toml` and ensures that the required `airPLS.py` file is properly downloaded. More information on airPLS [here](https://github.com/zmzhang/airPLS/tree/master).
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
**2. Installing from the GitHub Repository**
|
|
27
|
+
|
|
28
|
+
```sh
|
|
29
|
+
pip install git+https://github.com/praneethnamburi/pysampled.git && download-airpls
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Alternatively, you can clone the repository locally and set up your environment using the `requirements.yml` file. If you do this, download `airPLS.py` manually from [here](https://github.com/zmzhang/airPLS/tree/master) and add it to the `pysampled` folder inside the cloned repository.
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
git clone https://github.com/praneethnamburi/pysampled.git
|
|
36
|
+
cd pysampled
|
|
37
|
+
conda env create -n pysampled -f requirements.yml
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
## Quickstart
|
|
42
|
+
|
|
43
|
+
```python
|
|
44
|
+
import pysampled as sampled
|
|
45
|
+
|
|
46
|
+
# Generate a 10 Hz signal sampled at 100 Hz. Sum of three sine waves (1, 3, and 5 Hz).
|
|
47
|
+
sig = sampled.generate_signal("three_sine_waves")[:5.0]
|
|
48
|
+
|
|
49
|
+
# Only keep first 5 seconds of the signal
|
|
50
|
+
sig = sig[:5.0]
|
|
51
|
+
|
|
52
|
+
# visualize the signal, before and after applying a bandpass filter between 2 and 4 Hz
|
|
53
|
+
sampled.plot([sig, sig.bandpass(2, 4)])
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
## License
|
|
58
|
+
|
|
59
|
+
This project is licensed under the MIT License. See the `LICENSE` file for details.
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
## Contact
|
|
63
|
+
|
|
64
|
+
[Praneeth Namburi](https://praneethnamburi.com)
|
|
65
|
+
|
|
66
|
+
Project Link: [https://github.com/praneethnamburi/pysampled](https://github.com/praneethnamburi/pysampled)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
## Acknowledgments
|
|
70
|
+
|
|
71
|
+
This tool was developed as part of the ImmersionToolbox initiative at the [MIT.nano Immersion Lab](https://immersion.mit.edu). Thanks to NCSOFT for supporting this initiative.
|
|
@@ -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)
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,61 @@
|
|
|
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
|
+
|
|
9
|
+
import os
|
|
10
|
+
import sys
|
|
11
|
+
sys.path.insert(0, os.path.abspath("../pysampled"))
|
|
12
|
+
|
|
13
|
+
from pysampled.__version__ import __version__
|
|
14
|
+
|
|
15
|
+
project = "pysampled"
|
|
16
|
+
copyright = "2025, Praneeth Namburi"
|
|
17
|
+
author = "Praneeth Namburi"
|
|
18
|
+
version = __version__
|
|
19
|
+
release = __version__
|
|
20
|
+
|
|
21
|
+
# -- General configuration ---------------------------------------------------
|
|
22
|
+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
|
|
23
|
+
|
|
24
|
+
extensions = [
|
|
25
|
+
"myst_parser",
|
|
26
|
+
"sphinx.ext.autodoc",
|
|
27
|
+
"sphinx.ext.duration",
|
|
28
|
+
"sphinx.ext.autosectionlabel",
|
|
29
|
+
"sphinx.ext.napoleon", # if you are using Google or NumPy style docstrings
|
|
30
|
+
"sphinxcontrib.youtube",
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
templates_path = ["_templates"]
|
|
34
|
+
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
|
|
35
|
+
|
|
36
|
+
# -- Options for HTML output -------------------------------------------------
|
|
37
|
+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
|
|
38
|
+
|
|
39
|
+
html_theme = "sphinx_rtd_theme"
|
|
40
|
+
html_theme_options = {
|
|
41
|
+
"collapse_navigation": False,
|
|
42
|
+
}
|
|
43
|
+
html_static_path = []
|
|
44
|
+
|
|
45
|
+
napoleon_use_param = True # Show parameter types in the description instead of the signature
|
|
46
|
+
napoleon_use_rtype = True # Show return type in the description instead of the signature
|
|
47
|
+
|
|
48
|
+
autodoc_member_order = "bysource"
|
|
49
|
+
autodoc_default_options = {"ignore-module-all": True}
|
|
50
|
+
napoleon_use_ivar = True
|
|
51
|
+
# autodoc_typehints_format = "short" # Reduces lengthy type hints to their short forms
|
|
52
|
+
autodoc_typehints = "description" # Moves type hints to the parameter descriptions
|
|
53
|
+
|
|
54
|
+
from sphinx.ext.autodoc import between
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def setup(app):
|
|
58
|
+
# Register a sphinx.ext.autodoc.between listener to ignore everything
|
|
59
|
+
# between lines that contain the word IGNORE
|
|
60
|
+
app.connect("autodoc-process-docstring", between("^.*IGNORE.*$", exclude=True))
|
|
61
|
+
return app
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# Examples
|
|
2
|
+
|
|
3
|
+
This section demonstrates various use cases of the `pysampled` package with visual examples. Each example showcases a specific functionality, and includes plots generated directly from the code. In the plots, the x-axis represents time (in seconds).
|
|
4
|
+
|
|
5
|
+
## 1 - One-liner
|
|
6
|
+
The following example computes the magnitude of a 3-axis accelerometer signal, thresholds the signal, and vidualizes the first two seconds of the result.
|
|
7
|
+
|
|
8
|
+
```python
|
|
9
|
+
(sampled.generate_signal("accelerometer").magnitude() > 1.4)[:2.].plot()
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
**Plot Output:**
|
|
13
|
+
|
|
14
|
+
```{eval-rst}
|
|
15
|
+
.. image:: _static/example_1_plot.png
|
|
16
|
+
:alt: Accelerometer Magnitude Threshold Plot
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## 2 - Compute and Visualize Accelerometer Magnitude
|
|
22
|
+
|
|
23
|
+
A different implementation of example 1.
|
|
24
|
+
|
|
25
|
+
```python
|
|
26
|
+
acc = sampled.generate_signal("accelerometer")[2.5:6.] # 2.5 to 6 s
|
|
27
|
+
ax = sampled.plot([acc.magnitude(), acc.magnitude() > 1.4])
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
**Plot Output:**
|
|
31
|
+
|
|
32
|
+
```{eval-rst}
|
|
33
|
+
.. image:: _static/example_2_plot.png
|
|
34
|
+
:alt: Accelerometer Magnitude Threshold Plot
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Example 3 - Magnitude Calculation with Smoothing
|
|
40
|
+
|
|
41
|
+
In this example, we compute the magnitude, remove the DC offset, and apply a moving average filter.
|
|
42
|
+
|
|
43
|
+
```python
|
|
44
|
+
acc = sampled.generate_signal("accelerometer")
|
|
45
|
+
sampled.plot([
|
|
46
|
+
acc.magnitude(),
|
|
47
|
+
acc.magnitude().shift_baseline(),
|
|
48
|
+
acc.magnitude().shift_baseline().smooth(0.16)
|
|
49
|
+
])
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
**Plot Output:**
|
|
53
|
+
|
|
54
|
+
```{eval-rst}
|
|
55
|
+
.. image:: _static/example_3_plot.png
|
|
56
|
+
:alt: Magnitude Calculation with Smoothing Plot
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## Example 4 - Removing Noise and Interpolating
|
|
62
|
+
|
|
63
|
+
This example generates white noise data, removes data in specified ranges, and interpolates the result.
|
|
64
|
+
|
|
65
|
+
```python
|
|
66
|
+
wn = sampled.generate_signal("white_noise")
|
|
67
|
+
sampled.plot([
|
|
68
|
+
wn,
|
|
69
|
+
wn.remove_and_interpolate([[0.5, 1], [4, 4.2]])
|
|
70
|
+
])
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
**Plot Output:**
|
|
74
|
+
|
|
75
|
+
```{eval-rst}
|
|
76
|
+
.. image:: _static/example_4_plot.png
|
|
77
|
+
:alt: Noise Removal and Interpolation Plot
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## Example 5 - Visualizing the Power spectral density
|
|
83
|
+
|
|
84
|
+
In this example, we generate white noise data, apply a low-pass filter, and visualize both signals in the frequency domain.
|
|
85
|
+
|
|
86
|
+
```python
|
|
87
|
+
import matplotlib.pyplot as plt
|
|
88
|
+
wn = sampled.generate_signal("white_noise")
|
|
89
|
+
wn_lowpass = wn.lowpass(4)
|
|
90
|
+
|
|
91
|
+
figure, (ax1, ax2) = plt.subplots(2, 1)
|
|
92
|
+
sampled.plot([wn, wn_lowpass], ax=ax1)
|
|
93
|
+
ax1.set_xlabel("Time (s)")
|
|
94
|
+
|
|
95
|
+
sampled.plot([wn.psd_as_sampled(), wn_lowpass.psd_as_sampled()], ax=ax2)
|
|
96
|
+
ax2.set_xlabel("Frequency (Hz)")
|
|
97
|
+
figure.tight_layout()
|
|
98
|
+
plt.draw()
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
**Plot Output:**
|
|
102
|
+
|
|
103
|
+
```{eval-rst}
|
|
104
|
+
.. image:: _static/example_5_plot.png
|
|
105
|
+
:alt: Fourier Transform Plot
|
|
106
|
+
```
|
|
107
|
+
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
% pyfilemanager documentation master file, created by
|
|
2
|
+
% sphinx-quickstart on Tue Jan 23 10:31:39 2024.
|
|
3
|
+
% You can adapt this file completely to your liking, but it should at least
|
|
4
|
+
% contain the root `toctree` directive.
|
|
5
|
+
|
|
6
|
+
```{include} ../README.md
|
|
7
|
+
:relative-images:
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
```{toctree}
|
|
11
|
+
:hidden:
|
|
12
|
+
examples
|
|
13
|
+
api
|
|
14
|
+
```
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
@ECHO OFF
|
|
2
|
+
|
|
3
|
+
pushd %~dp0
|
|
4
|
+
|
|
5
|
+
REM Command file for Sphinx documentation
|
|
6
|
+
|
|
7
|
+
if "%SPHINXBUILD%" == "" (
|
|
8
|
+
set SPHINXBUILD=sphinx-build
|
|
9
|
+
)
|
|
10
|
+
set SOURCEDIR=.
|
|
11
|
+
set BUILDDIR=_build
|
|
12
|
+
|
|
13
|
+
%SPHINXBUILD% >NUL 2>NUL
|
|
14
|
+
if errorlevel 9009 (
|
|
15
|
+
echo.
|
|
16
|
+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
|
|
17
|
+
echo.installed, then set the SPHINXBUILD environment variable to point
|
|
18
|
+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
|
|
19
|
+
echo.may add the Sphinx directory to PATH.
|
|
20
|
+
echo.
|
|
21
|
+
echo.If you don't have Sphinx installed, grab it from
|
|
22
|
+
echo.https://www.sphinx-doc.org/
|
|
23
|
+
exit /b 1
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
if "%1" == "" goto help
|
|
27
|
+
|
|
28
|
+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
|
|
29
|
+
goto end
|
|
30
|
+
|
|
31
|
+
:help
|
|
32
|
+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
|
|
33
|
+
|
|
34
|
+
:end
|
|
35
|
+
popd
|