smpl 1.4.0rc2.dev0__tar.gz → 1.4.2__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.
- {smpl-1.4.0rc2.dev0 → smpl-1.4.2}/.github/workflows/ci.yml +2 -2
- {smpl-1.4.0rc2.dev0 → smpl-1.4.2}/.readthedocs.yml +1 -1
- {smpl-1.4.0rc2.dev0 → smpl-1.4.2}/Makefile +3 -4
- {smpl-1.4.0rc2.dev0 → smpl-1.4.2}/PKG-INFO +27 -33
- {smpl-1.4.0rc2.dev0 → smpl-1.4.2}/README.md +1 -8
- {smpl-1.4.0rc2.dev0 → smpl-1.4.2}/debug/func_range.ipynb +2 -2
- {smpl-1.4.0rc2.dev0 → smpl-1.4.2}/docs/source/conf.py +1 -1
- smpl-1.4.2/docs/source/example/animations/histogram/histogram.ipynb +140 -0
- smpl-1.4.2/docs/source/example/animations/index.rst +36 -0
- smpl-1.4.2/docs/source/example/animations/interactive/binomial_gauss_poisson.ipynb +2422 -0
- smpl-1.4.2/docs/source/example/animations/interactive/interactive.ipynb +388 -0
- smpl-1.4.2/docs/source/example/animations/render/Animation.ipynb +164 -0
- smpl-1.4.2/docs/source/example/animations/subplots/SubplotAnimation.ipynb +138 -0
- {smpl-1.4.0rc2.dev0 → smpl-1.4.2}/docs/source/example/index.rst +2 -0
- smpl-1.4.2/docs/source/example/parallel/index.rst +8 -0
- smpl-1.4.2/docs/source/example/parallel/parallel/parallel.ipynb +218 -0
- {smpl-1.4.0rc2.dev0 → smpl-1.4.2}/docs/source/index.rst +0 -24
- {smpl-1.4.0rc2.dev0 → smpl-1.4.2}/pyproject.toml +18 -14
- {smpl-1.4.0rc2.dev0 → smpl-1.4.2}/smpl/_version.py +2 -2
- smpl-1.4.2/smpl/animation/__init__.py +1 -0
- smpl-1.4.2/smpl/animation/animation.py +248 -0
- smpl-1.4.2/smpl/debug/__init__.py +1 -0
- smpl-1.4.2/smpl/debug/debug.py +529 -0
- smpl-1.4.0rc2.dev0/smpl/doc.py → smpl-1.4.2/smpl/doc/__init__.py +2 -3
- smpl-1.4.2/smpl/doc/doc.py +394 -0
- {smpl-1.4.0rc2.dev0 → smpl-1.4.2}/smpl/fit.py +9 -4
- {smpl-1.4.0rc2.dev0 → smpl-1.4.2}/smpl/functions.py +7 -0
- smpl-1.4.2/smpl/io/__init__.py +1 -0
- smpl-1.4.2/smpl/io/cat.py +32 -0
- smpl-1.4.2/smpl/io/grep.py +71 -0
- smpl-1.4.2/smpl/io/head.py +50 -0
- smpl-1.4.2/smpl/io/io.py +446 -0
- smpl-1.4.2/smpl/io/read_buffer.py +19 -0
- smpl-1.4.2/smpl/io/sed.py +23 -0
- smpl-1.4.2/smpl/io/tail.py +51 -0
- smpl-1.4.2/smpl/parallel/__init__.py +1 -0
- smpl-1.4.2/smpl/parallel/parallel.py +99 -0
- {smpl-1.4.0rc2.dev0 → smpl-1.4.2}/smpl/plot.py +10 -29
- {smpl-1.4.0rc2.dev0 → smpl-1.4.2}/smpl/plot2d.py +40 -25
- smpl-1.4.2/smpl/util/__init__.py +3 -0
- smpl-1.4.2/smpl/util/util.py +200 -0
- {smpl-1.4.0rc2.dev0 → smpl-1.4.2}/tests/fit/test_fit_algos.py +4 -3
- smpl-1.4.2/tests/mpl/baseline/test_data.png +0 -0
- smpl-1.4.2/tests/mpl/baseline/test_fit.png +0 -0
- smpl-1.4.2/tests/mpl/baseline/test_fit_lambda.png +0 -0
- smpl-1.4.2/tests/mpl/baseline/test_fit_str.png +0 -0
- smpl-1.4.2/tests/mpl/baseline/test_grid.png +0 -0
- smpl-1.4.2/tests/mpl/baseline/test_style_image.png +0 -0
- smpl-1.4.2/tests/mpl/baseline/test_style_pcolormesh.png +0 -0
- smpl-1.4.2/tests/mpl/baseline/test_style_scatter.png +0 -0
- smpl-1.4.2/tests/mpl/baseline/test_xscale.png +0 -0
- smpl-1.4.2/tests/mpl/baseline/test_yscale.png +0 -0
- smpl-1.4.2/tests/mpl/test_mpl_fit.py +22 -0
- smpl-1.4.2/tests/mpl/test_mpl_plot2d.py +32 -0
- smpl-1.4.2/tests/mpl/test_mpl_smplr.py +37 -0
- smpl-1.4.2/tests/test_animation.py +126 -0
- smpl-1.4.0rc2.dev0/debug/Untitled.ipynb +0 -33
- smpl-1.4.0rc2.dev0/docs/source/performance/index.rst +0 -10
- smpl-1.4.0rc2.dev0/docs/source/performance/line.rst +0 -6
- smpl-1.4.0rc2.dev0/smpl/debug.py +0 -2
- smpl-1.4.0rc2.dev0/smpl/io.py +0 -2
- smpl-1.4.0rc2.dev0/smpl/parallel.py +0 -2
- smpl-1.4.0rc2.dev0/smpl/util.py +0 -2
- {smpl-1.4.0rc2.dev0 → smpl-1.4.2}/.github/dependabot.yml +0 -0
- {smpl-1.4.0rc2.dev0 → smpl-1.4.2}/.gitignore +0 -0
- {smpl-1.4.0rc2.dev0 → smpl-1.4.2}/.pre-commit-config.yaml +0 -0
- {smpl-1.4.0rc2.dev0 → smpl-1.4.2}/LICENSE +0 -0
- {smpl-1.4.0rc2.dev0 → smpl-1.4.2}/docs/Makefile +0 -0
- {smpl-1.4.0rc2.dev0 → smpl-1.4.2}/docs/make.bat +0 -0
- {smpl-1.4.0rc2.dev0 → smpl-1.4.2}/docs/source/_static/style.css +0 -0
- {smpl-1.4.0rc2.dev0 → smpl-1.4.2}/docs/source/_templates/as_module.rst +0 -0
- {smpl-1.4.0rc2.dev0 → smpl-1.4.2}/docs/source/_templates/custom-class-template.rst +0 -0
- {smpl-1.4.0rc2.dev0 → smpl-1.4.2}/docs/source/_templates/custom-module-template.rst +0 -0
- {smpl-1.4.0rc2.dev0 → smpl-1.4.2}/docs/source/example/fit/auto/test_auto.ipynb +0 -0
- {smpl-1.4.0rc2.dev0 → smpl-1.4.2}/docs/source/example/fit/auto/test_linear_data.txt +0 -0
- {smpl-1.4.0rc2.dev0 → smpl-1.4.2}/docs/source/example/fit/auto/test_quad_data.txt +0 -0
- {smpl-1.4.0rc2.dev0 → smpl-1.4.2}/docs/source/example/fit/custom/test_custom.ipynb +0 -0
- {smpl-1.4.0rc2.dev0 → smpl-1.4.2}/docs/source/example/fit/custom/test_custom_data.csv +0 -0
- {smpl-1.4.0rc2.dev0 → smpl-1.4.2}/docs/source/example/fit/fixed_fit/test_fixed.ipynb +0 -0
- {smpl-1.4.0rc2.dev0 → smpl-1.4.2}/docs/source/example/fit/fixed_fit/test_linear_data.txt +0 -0
- {smpl-1.4.0rc2.dev0 → smpl-1.4.2}/docs/source/example/fit/index.rst +0 -0
- {smpl-1.4.0rc2.dev0 → smpl-1.4.2}/docs/source/example/fit/lambda/test_lambda.ipynb +0 -0
- {smpl-1.4.0rc2.dev0 → smpl-1.4.2}/docs/source/example/fit/lambda/test_linear_data.txt +0 -0
- {smpl-1.4.0rc2.dev0 → smpl-1.4.2}/docs/source/example/fit/lambda/test_quad_data.txt +0 -0
- {smpl-1.4.0rc2.dev0 → smpl-1.4.2}/docs/source/example/fit/linear/test_linear.ipynb +0 -0
- {smpl-1.4.0rc2.dev0 → smpl-1.4.2}/docs/source/example/fit/linear/test_linear_data.txt +0 -0
- {smpl-1.4.0rc2.dev0 → smpl-1.4.2}/docs/source/example/fit/minuit/minuit.ipynb +0 -0
- {smpl-1.4.0rc2.dev0 → smpl-1.4.2}/docs/source/example/fit/selective_fit/test_data.txt +0 -0
- {smpl-1.4.0rc2.dev0 → smpl-1.4.2}/docs/source/example/fit/selective_fit/test_selective_fit.ipynb +0 -0
- {smpl-1.4.0rc2.dev0 → smpl-1.4.2}/docs/source/example/interpolate/Interpolate.ipynb +0 -0
- {smpl-1.4.0rc2.dev0 → smpl-1.4.2}/docs/source/example/latex/latex.ipynb +0 -0
- {smpl-1.4.0rc2.dev0 → smpl-1.4.2}/docs/source/example/latex/test_linear_data.txt +0 -0
- {smpl-1.4.0rc2.dev0 → smpl-1.4.2}/docs/source/example/pandas/demo_pandas.ipynb +0 -0
- {smpl-1.4.0rc2.dev0 → smpl-1.4.2}/docs/source/example/pandas/test_linear_data2.txt +0 -0
- {smpl-1.4.0rc2.dev0 → smpl-1.4.2}/docs/source/example/plot/2d/plot2d.ipynb +0 -0
- {smpl-1.4.0rc2.dev0 → smpl-1.4.2}/docs/source/example/plot/functions/funcs.ipynb +0 -0
- {smpl-1.4.0rc2.dev0 → smpl-1.4.2}/docs/source/example/plot/histogram/plot_histogram.ipynb +0 -0
- {smpl-1.4.0rc2.dev0 → smpl-1.4.2}/docs/source/example/plot/index.rst +0 -0
- {smpl-1.4.0rc2.dev0 → smpl-1.4.2}/docs/source/example/plot/legend/legend.ipynb +0 -0
- {smpl-1.4.0rc2.dev0 → smpl-1.4.2}/docs/source/example/plot/legend/test_linear_data.txt +0 -0
- {smpl-1.4.0rc2.dev0 → smpl-1.4.2}/docs/source/example/plot/multiplot/multi.ipynb +0 -0
- {smpl-1.4.0rc2.dev0 → smpl-1.4.2}/docs/source/example/plot/residue/dat.dat +0 -0
- {smpl-1.4.0rc2.dev0 → smpl-1.4.2}/docs/source/example/plot/residue/residue.ipynb +0 -0
- {smpl-1.4.0rc2.dev0 → smpl-1.4.2}/docs/source/example/plot/residue/test_linear_data.txt +0 -0
- {smpl-1.4.0rc2.dev0 → smpl-1.4.2}/docs/source/example/plot/subplot/subplot.ipynb +0 -0
- {smpl-1.4.0rc2.dev0 → smpl-1.4.2}/docs/source/example/plot/uncertainties/plot_uncertainties.ipynb +0 -0
- {smpl-1.4.0rc2.dev0 → smpl-1.4.2}/docs/source/example/plot/uncertainties/test_linear_data.txt +0 -0
- {smpl-1.4.0rc2.dev0 → smpl-1.4.2}/docs/source/example/uncertainties/demo_uncertainties.ipynb +0 -0
- {smpl-1.4.0rc2.dev0 → smpl-1.4.2}/docs/source/example/uncertainties/test_linear_data.txt +0 -0
- {smpl-1.4.0rc2.dev0 → smpl-1.4.2}/smpl/__init__.py +0 -0
- {smpl-1.4.0rc2.dev0 → smpl-1.4.2}/smpl/data.py +0 -0
- {smpl-1.4.0rc2.dev0 → smpl-1.4.2}/smpl/interpolate.py +0 -0
- {smpl-1.4.0rc2.dev0 → smpl-1.4.2}/smpl/latex.py +0 -0
- {smpl-1.4.0rc2.dev0 → smpl-1.4.2}/smpl/stat.py +0 -0
- {smpl-1.4.0rc2.dev0 → smpl-1.4.2}/smpl/wrap.py +0 -0
- {smpl-1.4.0rc2.dev0 → smpl-1.4.2}/tests/plot/test_fit.py +0 -0
- {smpl-1.4.0rc2.dev0 → smpl-1.4.2}/tests/plot/test_plot.py +0 -0
- {smpl-1.4.0rc2.dev0 → smpl-1.4.2}/tests/test_linear.txt +0 -0
- {smpl-1.4.0rc2.dev0 → smpl-1.4.2}/tests/test_wrap.py +0 -0
- {smpl-1.4.0rc2.dev0 → smpl-1.4.2}/tests/tests/test_line_profiling.py +0 -0
- {smpl-1.4.0rc2.dev0 → smpl-1.4.2}/tests/tests/test_line_profiling_doctests.py +0 -0
|
@@ -40,7 +40,7 @@ jobs:
|
|
|
40
40
|
|
|
41
41
|
- name: Install dependencies
|
|
42
42
|
run: |
|
|
43
|
-
uv pip install --system '.[
|
|
43
|
+
uv pip install --system '.[test]'
|
|
44
44
|
uv pip list
|
|
45
45
|
|
|
46
46
|
# - name: Install external packages
|
|
@@ -54,7 +54,7 @@ jobs:
|
|
|
54
54
|
|
|
55
55
|
- name: Test with pytest
|
|
56
56
|
run: |
|
|
57
|
-
pytest -r sx
|
|
57
|
+
MPLBACKEND=Agg pytest -r sx
|
|
58
58
|
|
|
59
59
|
- name: Report Coveralls
|
|
60
60
|
uses: AndreMiras/coveralls-python-action@develop
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
livehtml:
|
|
2
|
-
hatch run
|
|
2
|
+
hatch run docs:$(MAKE) -C docs livehtml
|
|
3
3
|
|
|
4
4
|
html:
|
|
5
|
-
hatch run
|
|
5
|
+
hatch run docs:$(MAKE) -C docs html
|
|
6
6
|
|
|
7
7
|
doc: html
|
|
8
8
|
|
|
@@ -14,8 +14,7 @@ build:
|
|
|
14
14
|
|
|
15
15
|
test:
|
|
16
16
|
rm -f .coverage coverage.xml
|
|
17
|
-
|
|
18
|
-
MPLBACKEND=Agg hatch run dev:pytest
|
|
17
|
+
MPLBACKEND=Agg hatch run test:pytest
|
|
19
18
|
|
|
20
19
|
commit:
|
|
21
20
|
-git add .
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: smpl
|
|
3
|
-
Version: 1.4.
|
|
3
|
+
Version: 1.4.2
|
|
4
4
|
Summary: SiMPLe plotting and fitting
|
|
5
5
|
Project-URL: Documentation, https://smpl.readthedocs.io/
|
|
6
6
|
Project-URL: Issues, https://github.com/APN-Pucky/smpl/issues
|
|
@@ -20,17 +20,16 @@ Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
|
20
20
|
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
21
21
|
Classifier: Topic :: Scientific/Engineering
|
|
22
22
|
Requires-Python: >=3.9
|
|
23
|
+
Requires-Dist: deprecation
|
|
23
24
|
Requires-Dist: iminuit
|
|
25
|
+
Requires-Dist: ipywidgets
|
|
24
26
|
Requires-Dist: matplotlib
|
|
25
27
|
Requires-Dist: numpy
|
|
26
28
|
Requires-Dist: pandas>=1.0.0
|
|
29
|
+
Requires-Dist: pillow
|
|
30
|
+
Requires-Dist: requests
|
|
27
31
|
Requires-Dist: scipy>=1.7.0
|
|
28
|
-
Requires-Dist:
|
|
29
|
-
Requires-Dist: smpl-debug>=1.0.5
|
|
30
|
-
Requires-Dist: smpl-doc>=1.0.5
|
|
31
|
-
Requires-Dist: smpl-io>=1.0.5
|
|
32
|
-
Requires-Dist: smpl-parallel>=1.0.5
|
|
33
|
-
Requires-Dist: smpl-util>=1.0.5
|
|
32
|
+
Requires-Dist: smplr
|
|
34
33
|
Requires-Dist: sympy
|
|
35
34
|
Requires-Dist: tqdm
|
|
36
35
|
Requires-Dist: uncertainties
|
|
@@ -38,25 +37,27 @@ Provides-Extra: dev
|
|
|
38
37
|
Requires-Dist: ipython; extra == 'dev'
|
|
39
38
|
Requires-Dist: jupyter; extra == 'dev'
|
|
40
39
|
Requires-Dist: jupyterlab; extra == 'dev'
|
|
41
|
-
Requires-Dist: nbval; extra == 'dev'
|
|
42
40
|
Requires-Dist: pre-commit<4.0,>=2.20; extra == 'dev'
|
|
43
|
-
|
|
44
|
-
Requires-Dist:
|
|
45
|
-
Requires-Dist:
|
|
46
|
-
Requires-Dist:
|
|
47
|
-
|
|
48
|
-
Requires-Dist:
|
|
49
|
-
Requires-Dist:
|
|
50
|
-
Requires-Dist:
|
|
51
|
-
Requires-Dist:
|
|
52
|
-
Requires-Dist:
|
|
53
|
-
Requires-Dist: sphinx
|
|
54
|
-
Requires-Dist:
|
|
55
|
-
Requires-Dist:
|
|
56
|
-
|
|
57
|
-
Requires-Dist:
|
|
58
|
-
Requires-Dist:
|
|
59
|
-
Requires-Dist:
|
|
41
|
+
Provides-Extra: docs
|
|
42
|
+
Requires-Dist: jupyter-sphinx; extra == 'docs'
|
|
43
|
+
Requires-Dist: myst-parser; extra == 'docs'
|
|
44
|
+
Requires-Dist: nbsphinx; extra == 'docs'
|
|
45
|
+
Requires-Dist: numpydoc; extra == 'docs'
|
|
46
|
+
Requires-Dist: pandoc; extra == 'docs'
|
|
47
|
+
Requires-Dist: sphinx-autoapi; extra == 'docs'
|
|
48
|
+
Requires-Dist: sphinx-autobuild; extra == 'docs'
|
|
49
|
+
Requires-Dist: sphinx-math-dollar; extra == 'docs'
|
|
50
|
+
Requires-Dist: sphinx-rtd-theme; extra == 'docs'
|
|
51
|
+
Requires-Dist: sphinx<8.0.0; extra == 'docs'
|
|
52
|
+
Requires-Dist: sphinxcontrib-napoleon; extra == 'docs'
|
|
53
|
+
Requires-Dist: toml; extra == 'docs'
|
|
54
|
+
Provides-Extra: test
|
|
55
|
+
Requires-Dist: nbval; extra == 'test'
|
|
56
|
+
Requires-Dist: pytest; extra == 'test'
|
|
57
|
+
Requires-Dist: pytest-cov; extra == 'test'
|
|
58
|
+
Requires-Dist: pytest-line-profiler-apn>=0.1.5; extra == 'test'
|
|
59
|
+
Requires-Dist: pytest-mpl; extra == 'test'
|
|
60
|
+
Requires-Dist: pytest-profiling; extra == 'test'
|
|
60
61
|
Description-Content-Type: text/markdown
|
|
61
62
|
|
|
62
63
|
# smpl
|
|
@@ -73,8 +74,7 @@ Simplified plotting and fitting in python.
|
|
|
73
74
|
|
|
74
75
|
## Documentation
|
|
75
76
|
|
|
76
|
-
- <https://smpl.readthedocs.io/en/
|
|
77
|
-
- <https://apn-pucky.github.io/smpl/index.html>
|
|
77
|
+
- <https://smpl.readthedocs.io/en/latest/>
|
|
78
78
|
|
|
79
79
|
## Versions
|
|
80
80
|
|
|
@@ -86,12 +86,6 @@ pip install smpl
|
|
|
86
86
|
|
|
87
87
|
Optional: --user or --upgrade
|
|
88
88
|
|
|
89
|
-
### Dev
|
|
90
|
-
|
|
91
|
-
```sh
|
|
92
|
-
pip install --index-url https://test.pypi.org/simple/ smpl
|
|
93
|
-
```
|
|
94
|
-
|
|
95
89
|
[doc stable]: https://apn-pucky.github.io/smpl/index.html
|
|
96
90
|
[doc test]: https://apn-pucky.github.io/smpl/test/index.html
|
|
97
91
|
|
|
@@ -12,8 +12,7 @@ Simplified plotting and fitting in python.
|
|
|
12
12
|
|
|
13
13
|
## Documentation
|
|
14
14
|
|
|
15
|
-
- <https://smpl.readthedocs.io/en/
|
|
16
|
-
- <https://apn-pucky.github.io/smpl/index.html>
|
|
15
|
+
- <https://smpl.readthedocs.io/en/latest/>
|
|
17
16
|
|
|
18
17
|
## Versions
|
|
19
18
|
|
|
@@ -25,12 +24,6 @@ pip install smpl
|
|
|
25
24
|
|
|
26
25
|
Optional: --user or --upgrade
|
|
27
26
|
|
|
28
|
-
### Dev
|
|
29
|
-
|
|
30
|
-
```sh
|
|
31
|
-
pip install --index-url https://test.pypi.org/simple/ smpl
|
|
32
|
-
```
|
|
33
|
-
|
|
34
27
|
[doc stable]: https://apn-pucky.github.io/smpl/index.html
|
|
35
28
|
[doc test]: https://apn-pucky.github.io/smpl/test/index.html
|
|
36
29
|
|
|
@@ -687,7 +687,7 @@
|
|
|
687
687
|
],
|
|
688
688
|
"metadata": {
|
|
689
689
|
"kernelspec": {
|
|
690
|
-
"display_name": "Python 3
|
|
690
|
+
"display_name": "Python 3",
|
|
691
691
|
"language": "python",
|
|
692
692
|
"name": "python3"
|
|
693
693
|
},
|
|
@@ -701,7 +701,7 @@
|
|
|
701
701
|
"name": "python",
|
|
702
702
|
"nbconvert_exporter": "python",
|
|
703
703
|
"pygments_lexer": "ipython3",
|
|
704
|
-
"version": "3.13
|
|
704
|
+
"version": "3.9.13"
|
|
705
705
|
}
|
|
706
706
|
},
|
|
707
707
|
"nbformat": 4,
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
{
|
|
2
|
+
"cells": [
|
|
3
|
+
{
|
|
4
|
+
"cell_type": "markdown",
|
|
5
|
+
"id": "0213f008",
|
|
6
|
+
"metadata": {},
|
|
7
|
+
"source": [
|
|
8
|
+
"# Histogram"
|
|
9
|
+
]
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"cell_type": "code",
|
|
13
|
+
"execution_count": null,
|
|
14
|
+
"id": "eadf8523",
|
|
15
|
+
"metadata": {},
|
|
16
|
+
"outputs": [],
|
|
17
|
+
"source": [
|
|
18
|
+
"import matplotlib.pyplot as plt\n",
|
|
19
|
+
"import numpy as np\n",
|
|
20
|
+
"import scipy\n",
|
|
21
|
+
"\n",
|
|
22
|
+
"from smpl import animation, plot, stat"
|
|
23
|
+
]
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"cell_type": "code",
|
|
27
|
+
"execution_count": null,
|
|
28
|
+
"id": "d706684b",
|
|
29
|
+
"metadata": {},
|
|
30
|
+
"outputs": [],
|
|
31
|
+
"source": [
|
|
32
|
+
"%matplotlib notebook \n",
|
|
33
|
+
"# plt.ioff()\n",
|
|
34
|
+
"# Parameter\n",
|
|
35
|
+
"n = 13\n",
|
|
36
|
+
"bahnhs = 13\n",
|
|
37
|
+
"p = 1.0 / bahnhs\n",
|
|
38
|
+
"\n",
|
|
39
|
+
"bahnh = np.array(range(bahnhs)) * 0\n",
|
|
40
|
+
"datax = np.array(range(1, 14))\n",
|
|
41
|
+
"datay = datax * 0\n",
|
|
42
|
+
"c = 0\n",
|
|
43
|
+
"\n",
|
|
44
|
+
"\n",
|
|
45
|
+
"# Approximate factorial by gamma\n",
|
|
46
|
+
"def fac(n):\n",
|
|
47
|
+
" return scipy.special.gamma(n + 1)\n",
|
|
48
|
+
"\n",
|
|
49
|
+
"\n",
|
|
50
|
+
"def update(a):\n",
|
|
51
|
+
" global bahnh, datax, datay, c, bahnhs\n",
|
|
52
|
+
" c += 1\n",
|
|
53
|
+
" bahnh = bahnh * 0\n",
|
|
54
|
+
" for i in range(n):\n",
|
|
55
|
+
" bahnh[np.random.randint(0, bahnhs)] += 1\n",
|
|
56
|
+
" if np.any(np.greater(bahnh, 1)):\n",
|
|
57
|
+
" datay[i] += 1\n",
|
|
58
|
+
" plot.data(\n",
|
|
59
|
+
" datax,\n",
|
|
60
|
+
" stat.poisson_dist(datay) / c,\n",
|
|
61
|
+
" init=True,\n",
|
|
62
|
+
" tight=False,\n",
|
|
63
|
+
" fmt=\"hist\",\n",
|
|
64
|
+
" ylabel=\"P(>1 Gäste bei beliebigem Bahnhof)\",\n",
|
|
65
|
+
" xlabel=\"$n$ Gäste\",\n",
|
|
66
|
+
" capsize=0,\n",
|
|
67
|
+
" )\n",
|
|
68
|
+
" plot.function(\n",
|
|
69
|
+
" lambda ni: 1.0 - fac(bahnhs) / (fac(bahnhs - ni) * bahnhs**ni),\n",
|
|
70
|
+
" xmin=0,\n",
|
|
71
|
+
" xmax=13,\n",
|
|
72
|
+
" label=\"$\\\\frac{b!}{(b-n)!b^n}$\",\n",
|
|
73
|
+
" function_color=\"orange\",\n",
|
|
74
|
+
" )\n",
|
|
75
|
+
"\n",
|
|
76
|
+
"\n",
|
|
77
|
+
"def init():\n",
|
|
78
|
+
" global datay, bahnh, c\n",
|
|
79
|
+
" datay = datay * 0\n",
|
|
80
|
+
" bahnh = bahnh * 0\n",
|
|
81
|
+
" c = 0\n",
|
|
82
|
+
"\n",
|
|
83
|
+
"\n",
|
|
84
|
+
"ani = animation.animate(\n",
|
|
85
|
+
" update=update, frames=np.linspace(0, 20, 2000), interval=10, blit=False\n",
|
|
86
|
+
")\n",
|
|
87
|
+
"plt.show()"
|
|
88
|
+
]
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"cell_type": "code",
|
|
92
|
+
"execution_count": null,
|
|
93
|
+
"id": "094ffe22",
|
|
94
|
+
"metadata": {},
|
|
95
|
+
"outputs": [],
|
|
96
|
+
"source": []
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"cell_type": "code",
|
|
100
|
+
"execution_count": null,
|
|
101
|
+
"id": "6168f906",
|
|
102
|
+
"metadata": {},
|
|
103
|
+
"outputs": [],
|
|
104
|
+
"source": []
|
|
105
|
+
}
|
|
106
|
+
],
|
|
107
|
+
"metadata": {
|
|
108
|
+
"kernelspec": {
|
|
109
|
+
"display_name": "Python 3.9.16 64-bit",
|
|
110
|
+
"language": "python",
|
|
111
|
+
"name": "python3"
|
|
112
|
+
},
|
|
113
|
+
"language_info": {
|
|
114
|
+
"codemirror_mode": {
|
|
115
|
+
"name": "ipython",
|
|
116
|
+
"version": 3
|
|
117
|
+
},
|
|
118
|
+
"file_extension": ".py",
|
|
119
|
+
"mimetype": "text/x-python",
|
|
120
|
+
"name": "python",
|
|
121
|
+
"nbconvert_exporter": "python",
|
|
122
|
+
"pygments_lexer": "ipython3",
|
|
123
|
+
"version": "3.9.16"
|
|
124
|
+
},
|
|
125
|
+
"vscode": {
|
|
126
|
+
"interpreter": {
|
|
127
|
+
"hash": "31f2aee4e71d21fbe5cf8b01ff0e069b9275f58929596ceb00d14d90e3e16cd6"
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
"widgets": {
|
|
131
|
+
"application/vnd.jupyter.widget-state+json": {
|
|
132
|
+
"state": {},
|
|
133
|
+
"version_major": 2,
|
|
134
|
+
"version_minor": 0
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
"nbformat": 4,
|
|
139
|
+
"nbformat_minor": 5
|
|
140
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
|
|
2
|
+
Animations
|
|
3
|
+
================================
|
|
4
|
+
|
|
5
|
+
.. jupyter-execute::
|
|
6
|
+
|
|
7
|
+
from smpl import animation
|
|
8
|
+
from smpl import plot
|
|
9
|
+
from ipywidgets import widgets
|
|
10
|
+
import numpy as np
|
|
11
|
+
|
|
12
|
+
def fta(n = 1.0):
|
|
13
|
+
plot.function(lambda x : np.exp(n*np.log(x)-x),xmin = 0.1,xmax=100,tight=False,init=False)
|
|
14
|
+
|
|
15
|
+
animation.interactive(fta,widgets.IntSlider(value=0,min=0,max=100),prerender=True)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
.. jupyter-execute::
|
|
19
|
+
|
|
20
|
+
from smpl import animation
|
|
21
|
+
from smpl import plot
|
|
22
|
+
import numpy as np
|
|
23
|
+
|
|
24
|
+
for a in np.linspace(0,10,200):
|
|
25
|
+
plot.function(lambda x : a*x**2,xmin=0,xmax=5,init=True,tight=False)
|
|
26
|
+
animation.frame()
|
|
27
|
+
|
|
28
|
+
ani = animation.animate(interval=10,blit=True)
|
|
29
|
+
ani.widget_gif()
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
.. toctree::
|
|
33
|
+
:glob:
|
|
34
|
+
:maxdepth: 2
|
|
35
|
+
|
|
36
|
+
**
|