sparrowpy 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.
Files changed (111) hide show
  1. sparrowpy-0.1.0/CONTRIBUTING.rst +74 -0
  2. sparrowpy-0.1.0/HISTORY.rst +8 -0
  3. sparrowpy-0.1.0/LICENSE +22 -0
  4. sparrowpy-0.1.0/MANIFEST.in +10 -0
  5. sparrowpy-0.1.0/PKG-INFO +145 -0
  6. sparrowpy-0.1.0/README.md +59 -0
  7. sparrowpy-0.1.0/docs/Makefile +20 -0
  8. sparrowpy-0.1.0/docs/_static/logo.png +0 -0
  9. sparrowpy-0.1.0/docs/api_reference.rst +25 -0
  10. sparrowpy-0.1.0/docs/conf.py +185 -0
  11. sparrowpy-0.1.0/docs/contributing.rst +1 -0
  12. sparrowpy-0.1.0/docs/history.rst +1 -0
  13. sparrowpy-0.1.0/docs/index.rst +4 -0
  14. sparrowpy-0.1.0/docs/make.bat +36 -0
  15. sparrowpy-0.1.0/docs/modules/sparrowpy.brdf.rst +7 -0
  16. sparrowpy-0.1.0/docs/modules/sparrowpy.geometry.rst +7 -0
  17. sparrowpy-0.1.0/docs/modules/sparrowpy.radiosity.rst +7 -0
  18. sparrowpy-0.1.0/docs/modules/sparrowpy.sound_object.rst +7 -0
  19. sparrowpy-0.1.0/docs/readme.rst +1 -0
  20. sparrowpy-0.1.0/docs/sparrowpy.rst +69 -0
  21. sparrowpy-0.1.0/pyproject.toml +164 -0
  22. sparrowpy-0.1.0/setup.cfg +4 -0
  23. sparrowpy-0.1.0/sparrowpy/__init__.py +38 -0
  24. sparrowpy-0.1.0/sparrowpy/brdf.py +303 -0
  25. sparrowpy-0.1.0/sparrowpy/form_factor.py +426 -0
  26. sparrowpy-0.1.0/sparrowpy/geometry.py +281 -0
  27. sparrowpy-0.1.0/sparrowpy/radiosity.py +1208 -0
  28. sparrowpy-0.1.0/sparrowpy/radiosity_fast/__init__.py +11 -0
  29. sparrowpy-0.1.0/sparrowpy/radiosity_fast/energy_exchange_order.py +216 -0
  30. sparrowpy-0.1.0/sparrowpy/radiosity_fast/energy_exchange_recursive.py +185 -0
  31. sparrowpy-0.1.0/sparrowpy/radiosity_fast/form_factor.py +311 -0
  32. sparrowpy-0.1.0/sparrowpy/radiosity_fast/geometry.py +342 -0
  33. sparrowpy-0.1.0/sparrowpy/radiosity_fast/radiosity_class.py +479 -0
  34. sparrowpy-0.1.0/sparrowpy/radiosity_fast/receiver_energy.py +43 -0
  35. sparrowpy-0.1.0/sparrowpy/radiosity_fast/source_energy.py +159 -0
  36. sparrowpy-0.1.0/sparrowpy/radiosity_fast/universal_ff/__init__.py +1 -0
  37. sparrowpy-0.1.0/sparrowpy/radiosity_fast/universal_ff/ffhelpers.py +498 -0
  38. sparrowpy-0.1.0/sparrowpy/radiosity_fast/universal_ff/univ_form_factor.py +435 -0
  39. sparrowpy-0.1.0/sparrowpy/radiosity_fast/visibility_helpers.py +202 -0
  40. sparrowpy-0.1.0/sparrowpy/sound_object.py +221 -0
  41. sparrowpy-0.1.0/sparrowpy/sparapy.py +1 -0
  42. sparrowpy-0.1.0/sparrowpy/testing/__init__.py +6 -0
  43. sparrowpy-0.1.0/sparrowpy/testing/exact_ff_solutions.py +119 -0
  44. sparrowpy-0.1.0/sparrowpy/testing/stub_utils.py +48 -0
  45. sparrowpy-0.1.0/sparrowpy/utils/__init__.py +6 -0
  46. sparrowpy-0.1.0/sparrowpy/utils/blender.py +142 -0
  47. sparrowpy-0.1.0/sparrowpy.egg-info/PKG-INFO +145 -0
  48. sparrowpy-0.1.0/sparrowpy.egg-info/SOURCES.txt +109 -0
  49. sparrowpy-0.1.0/sparrowpy.egg-info/dependency_links.txt +1 -0
  50. sparrowpy-0.1.0/sparrowpy.egg-info/requires.txt +44 -0
  51. sparrowpy-0.1.0/sparrowpy.egg-info/top_level.txt +5 -0
  52. sparrowpy-0.1.0/tests/__init__.py +1 -0
  53. sparrowpy-0.1.0/tests/conftest.py +82 -0
  54. sparrowpy-0.1.0/tests/test_DRadiosityFast.py +171 -0
  55. sparrowpy-0.1.0/tests/test_DRadiosityFast_infinite_diffuse_plane.py +166 -0
  56. sparrowpy-0.1.0/tests/test_DRadiosityFast_order.py +129 -0
  57. sparrowpy-0.1.0/tests/test_Radiosity.py +664 -0
  58. sparrowpy-0.1.0/tests/test_RadiosityDirectional.py +412 -0
  59. sparrowpy-0.1.0/tests/test_blender_import.py +14 -0
  60. sparrowpy-0.1.0/tests/test_brdf.py +434 -0
  61. sparrowpy-0.1.0/tests/test_conftest.py +16 -0
  62. sparrowpy-0.1.0/tests/test_data/ITA_Dodecahedron.sofa +0 -0
  63. sparrowpy-0.1.0/tests/test_data/cube.blend +0 -0
  64. sparrowpy-0.1.0/tests/test_data/cube.stl +0 -0
  65. sparrowpy-0.1.0/tests/test_data/cube_blocked.blend +0 -0
  66. sparrowpy-0.1.0/tests/test_data/cube_simple.blend +0 -0
  67. sparrowpy-0.1.0/tests/test_data/ihta.E_sec_2.sofa +0 -0
  68. sparrowpy-0.1.0/tests/test_data/reference_energy_exchange_size0.5.far +0 -0
  69. sparrowpy-0.1.0/tests/test_data/reference_energy_exchange_size1.far +0 -0
  70. sparrowpy-0.1.0/tests/test_data/reference_form_factor_parallel_size0.5.far +0 -0
  71. sparrowpy-0.1.0/tests/test_data/reference_form_factor_parallel_size1.far +0 -0
  72. sparrowpy-0.1.0/tests/test_data/reference_form_factor_perpendicular_0_0_size1.far +0 -0
  73. sparrowpy-0.1.0/tests/test_data/reference_form_factor_perpendicular_0_2_size0.5.far +0 -0
  74. sparrowpy-0.1.0/tests/test_data/reference_form_factor_perpendicular_0_3_size0.5.far +0 -0
  75. sparrowpy-0.1.0/tests/test_data/reference_form_factor_perpendicular_0_4_size0.5.far +0 -0
  76. sparrowpy-0.1.0/tests/test_data/reference_form_factor_perpendicular_0_5_size0.5.far +0 -0
  77. sparrowpy-0.1.0/tests/test_data/reference_form_factor_perpendicular_1_2_size0.5.far +0 -0
  78. sparrowpy-0.1.0/tests/test_data/reference_form_factor_perpendicular_1_3_size0.5.far +0 -0
  79. sparrowpy-0.1.0/tests/test_data/reference_form_factor_perpendicular_1_4_size0.5.far +0 -0
  80. sparrowpy-0.1.0/tests/test_data/reference_form_factor_perpendicular_1_5_size0.5.far +0 -0
  81. sparrowpy-0.1.0/tests/test_data/reference_form_factor_perpendicular_2_0_size0.5.far +0 -0
  82. sparrowpy-0.1.0/tests/test_data/reference_form_factor_perpendicular_2_1_size0.5.far +0 -0
  83. sparrowpy-0.1.0/tests/test_data/reference_form_factor_perpendicular_2_4_size0.5.far +0 -0
  84. sparrowpy-0.1.0/tests/test_data/reference_form_factor_perpendicular_2_5_size0.5.far +0 -0
  85. sparrowpy-0.1.0/tests/test_data/reference_form_factor_perpendicular_3_0_size0.5.far +0 -0
  86. sparrowpy-0.1.0/tests/test_data/reference_form_factor_perpendicular_3_1_size0.5.far +0 -0
  87. sparrowpy-0.1.0/tests/test_data/reference_form_factor_perpendicular_3_4_size0.5.far +0 -0
  88. sparrowpy-0.1.0/tests/test_data/reference_form_factor_perpendicular_3_5_size0.5.far +0 -0
  89. sparrowpy-0.1.0/tests/test_data/reference_form_factor_perpendicular_4_0_size0.5.far +0 -0
  90. sparrowpy-0.1.0/tests/test_data/reference_form_factor_perpendicular_4_1_size0.5.far +0 -0
  91. sparrowpy-0.1.0/tests/test_data/reference_form_factor_perpendicular_4_2_size0.5.far +0 -0
  92. sparrowpy-0.1.0/tests/test_data/reference_form_factor_perpendicular_4_3_size0.5.far +0 -0
  93. sparrowpy-0.1.0/tests/test_data/reference_form_factor_perpendicular_5_0_size0.5.far +0 -0
  94. sparrowpy-0.1.0/tests/test_data/reference_form_factor_perpendicular_5_1_size0.5.far +0 -0
  95. sparrowpy-0.1.0/tests/test_data/reference_form_factor_perpendicular_5_2_size0.5.far +0 -0
  96. sparrowpy-0.1.0/tests/test_data/reference_form_factor_perpendicular_5_3_size0.5.far +0 -0
  97. sparrowpy-0.1.0/tests/test_data/reference_form_factor_perpendicular_size0.5.far +0 -0
  98. sparrowpy-0.1.0/tests/test_data/reference_matrix_directional_patch_size0.5.far +0 -0
  99. sparrowpy-0.1.0/tests/test_data/reference_matrix_directional_patch_size1.far +0 -0
  100. sparrowpy-0.1.0/tests/test_data/reference_specular_reflections_0.5.far +0 -0
  101. sparrowpy-0.1.0/tests/test_data/reference_specular_reflections_1.far +0 -0
  102. sparrowpy-0.1.0/tests/test_data/simulation_X10_k2_5m.far +0 -0
  103. sparrowpy-0.1.0/tests/test_data/simulation_X10_k3_5m.far +0 -0
  104. sparrowpy-0.1.0/tests/test_data/specular_gaussian5.sofa +0 -0
  105. sparrowpy-0.1.0/tests/test_multisource.py +275 -0
  106. sparrowpy-0.1.0/tests/test_radiosity_geometry.py +138 -0
  107. sparrowpy-0.1.0/tests/test_radiosity_polygon.py +93 -0
  108. sparrowpy-0.1.0/tests/test_radiosity_sound_object.py +88 -0
  109. sparrowpy-0.1.0/tests/test_sparrowpy.py +10 -0
  110. sparrowpy-0.1.0/tests/test_universal_formfactor.py +224 -0
  111. sparrowpy-0.1.0/tests/test_visibility.py +201 -0
@@ -0,0 +1,74 @@
1
+ .. highlight:: shell
2
+
3
+ ============
4
+ Contributing
5
+ ============
6
+
7
+ Contributions are welcome, and they are greatly appreciated! Every little bit
8
+ helps, and credit will always be given. The following helps you to start
9
+ contributing specifically to sparrowpy. Please also consider the
10
+ `general contributing guidelines`_ for example regarding the style
11
+ of code and documentation and some helpful hints.
12
+
13
+ Types of Contributions
14
+ ----------------------
15
+
16
+ Report Bugs or Suggest Features
17
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
18
+
19
+ The best place for this is https://github.com/ahms5/sparrowpy/issues.
20
+
21
+ Fix Bugs or Implement Features
22
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
23
+
24
+ Look through https://github.com/ahms5/sparrowpy/issues for bugs or feature request
25
+ and contact us or comment if you are interested in implementing.
26
+
27
+ Write Documentation
28
+ ~~~~~~~~~~~~~~~~~~~
29
+
30
+ sparrowpy could always use more documentation, whether as part of the
31
+ official sparrowpy docs, in docstrings, or even on the web in blog posts,
32
+ articles, and such.
33
+
34
+ Get Started!
35
+ ------------
36
+
37
+ Ready to contribute? Here's how to set up `sparrowpy` for local development using the command-line interface. Note that several alternative user interfaces exist, e.g., the Git GUI, `GitHub Desktop <https://desktop.github.com/>`_, extensions in `Visual Studio Code <https://code.visualstudio.com/>`_ ...
38
+
39
+ 1. `Fork <https://docs.github.com/en/get-started/quickstart/fork-a-repo/>`_ the `sparrowpy` repo on GitHub.
40
+ 2. Clone your fork locally and cd into the sparrowpy directory::
41
+
42
+ $ git clone https://github.com/YOUR_USERNAME/sparrowpy.git
43
+ $ cd sparrowpy
44
+
45
+ 3. Install your local copy into a virtualenv. Assuming you have Anaconda or Miniconda installed, this is how you set up your fork for local development::
46
+
47
+ $ conda create --name sparrowpy python=3.11
48
+ $ conda activate sparrowpy
49
+ $ pip install -e ".[dev]"
50
+
51
+ 4. Create a branch for local development. Indicate the intention of your branch in its respective name (i.e. `feature/branch-name` or `bugfix/branch-name`)::
52
+
53
+ $ git checkout -b name-of-your-bugfix-or-feature
54
+
55
+ Now you can make your changes locally.
56
+
57
+ 5. When you're done making changes, check that your changes pass ruff and the
58
+ tests::
59
+
60
+ $ ruff check
61
+ $ pytest
62
+
63
+ ruff must pass without any warnings for `./sparrowpy` and `./tests` using the default or a stricter configuration. Ruff ignores a couple of PEP Errors (see `./pyproject.toml`). If necessary, adjust your linting configuration in your IDE accordingly.
64
+
65
+ 6. Commit your changes and push your branch to GitHub::
66
+
67
+ $ git add .
68
+ $ git commit -m "Your detailed description of your changes."
69
+ $ git push origin name-of-your-bugfix-or-feature
70
+
71
+ 7. Submit a pull request on the develop branch through the GitHub website.
72
+
73
+
74
+ .. _general contributing guidelines: https://pyfar-gallery.readthedocs.io/en/latest/contribute/index.html
@@ -0,0 +1,8 @@
1
+ =======
2
+ History
3
+ =======
4
+
5
+ 0.1.0 (2025-03-18)
6
+ ------------------
7
+
8
+ * First release on PyPI.
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024, The pyfar developers
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 all
13
+ 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 THE
21
+ SOFTWARE.
22
+
@@ -0,0 +1,10 @@
1
+ include CONTRIBUTING.rst
2
+ include HISTORY.rst
3
+ include LICENSE
4
+ include README.md
5
+
6
+ recursive-include tests *
7
+ recursive-exclude * __pycache__
8
+ recursive-exclude * *.py[co]
9
+
10
+ recursive-include docs *.rst conf.py Makefile make.bat *.jpg *.png *.gif
@@ -0,0 +1,145 @@
1
+ Metadata-Version: 2.2
2
+ Name: sparrowpy
3
+ Version: 0.1.0
4
+ Summary: Project for data formats in acoustics.
5
+ Author-email: The pyfar developers <info@pyfar.org>
6
+ License: MIT License
7
+
8
+ Copyright (c) 2024, The pyfar developers
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+
29
+ Project-URL: Tracker, https://github.com/ahms5/sparrowpy/issues
30
+ Project-URL: Documentation, https://sparrowpy.readthedocs.io/
31
+ Project-URL: Download, https://pypi.org/project/sparrowpy/
32
+ Project-URL: Homepage, https://pyfar.org/
33
+ Project-URL: Source, https://github.com/ahms5/sparrowpy
34
+ Project-URL: Changelog, https://github.com/ahms5/sparrowpy/blob/main/HISTORY.rst
35
+ Keywords: acoustics,pyfar
36
+ Classifier: Development Status :: 4 - Beta
37
+ Classifier: Intended Audience :: Science/Research
38
+ Classifier: License :: OSI Approved :: MIT License
39
+ Classifier: Natural Language :: English
40
+ Classifier: Programming Language :: Python :: 3
41
+ Classifier: Programming Language :: Python :: 3.9
42
+ Classifier: Programming Language :: Python :: 3.10
43
+ Classifier: Programming Language :: Python :: 3.11
44
+ Classifier: Programming Language :: Python :: 3.12
45
+ Classifier: Programming Language :: Python :: 3.13
46
+ Requires-Python: >=3.9
47
+ Description-Content-Type: text/markdown
48
+ License-File: LICENSE
49
+ Requires-Dist: numpy<2
50
+ Requires-Dist: scipy
51
+ Requires-Dist: matplotlib
52
+ Requires-Dist: pyfar
53
+ Requires-Dist: sofar
54
+ Provides-Extra: blender
55
+ Requires-Dist: bpy; extra == "blender"
56
+ Provides-Extra: fast
57
+ Requires-Dist: numba; extra == "fast"
58
+ Provides-Extra: progress
59
+ Requires-Dist: tqdm; extra == "progress"
60
+ Provides-Extra: deploy
61
+ Requires-Dist: twine; extra == "deploy"
62
+ Requires-Dist: wheel; extra == "deploy"
63
+ Requires-Dist: build; extra == "deploy"
64
+ Requires-Dist: setuptools; extra == "deploy"
65
+ Requires-Dist: bump-my-version; extra == "deploy"
66
+ Provides-Extra: tests
67
+ Requires-Dist: pytest; extra == "tests"
68
+ Requires-Dist: pytest-cov; extra == "tests"
69
+ Requires-Dist: watchdog; extra == "tests"
70
+ Requires-Dist: ruff==0.9.*; extra == "tests"
71
+ Requires-Dist: coverage; extra == "tests"
72
+ Requires-Dist: watermark; extra == "tests"
73
+ Requires-Dist: ipykernel; extra == "tests"
74
+ Requires-Dist: sparrowpy[fast]; extra == "tests"
75
+ Requires-Dist: sparrowpy[blender]; extra == "tests"
76
+ Provides-Extra: docs
77
+ Requires-Dist: sphinx; extra == "docs"
78
+ Requires-Dist: autodocsumm>=0.2.14; extra == "docs"
79
+ Requires-Dist: pydata-sphinx-theme; extra == "docs"
80
+ Requires-Dist: sphinx_mdinclude; extra == "docs"
81
+ Requires-Dist: sphinx-design; extra == "docs"
82
+ Requires-Dist: sphinx-favicon; extra == "docs"
83
+ Requires-Dist: sphinx-reredirects; extra == "docs"
84
+ Provides-Extra: dev
85
+ Requires-Dist: sparrowpy[deploy,docs,tests]; extra == "dev"
86
+
87
+ <h1 align="center">
88
+ <img src="https://github.com/sparrow-acoustics/sparrowpy/raw/main/docs/_static/logo.png" width="300">
89
+ </h1><br>
90
+
91
+
92
+ [![PyPI version](https://badge.fury.io/py/sparrowpy.svg)](https://badge.fury.io/py/sparrowpy)
93
+ [![Documentation Status](https://readthedocs.org/projects/sparrowpy/badge/?version=latest)](https://sparrowpy.readthedocs.io/en/latest/?badge=latest)
94
+ [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/pyfar/gallery/main?labpath=docs/gallery/interactive/pyfar_introduction.ipynb)
95
+ Python Boilerplate contains all the boilerplate you need to create a Python package.
96
+
97
+ Getting Started
98
+ ===============
99
+
100
+ The [pyfar workshop](https://mybinder.org/v2/gh/pyfar/gallery/main?labpath=docs/gallery/interactive/pyfar_introduction.ipynb)
101
+ gives an overview of the most important pyfar functionality and is a good
102
+ starting point. It is part of the [pyfar example gallery](https://pyfar-gallery.readthedocs.io/en/latest/examples_gallery.html)
103
+ that also contains more specific and in-depth
104
+ examples that can be executed interactively without a local installation by
105
+ clicking the mybinder.org button on the respective example. The
106
+ [pyfar documentation](https://pyfar.readthedocs.io) gives a detailed and complete overview of pyfar. All
107
+ these information are available from [pyfar.org](https://pyfar.org).
108
+
109
+ Installation
110
+ ============
111
+
112
+ Use pip to install sparrowpy
113
+
114
+ pip install sparrowpy
115
+
116
+ (Requires Python >= 3.9)
117
+
118
+ if numba is installed the code will be precompiled and will run faster. We strongly recommend to use numba to accelerate the simulations significantly
119
+
120
+ pip install sparrowpy[fast]
121
+
122
+ or
123
+
124
+ pip install sparrowpy
125
+ pip install numba
126
+
127
+ you can also use blender for geometry import. Note that blender has strong requirements on the python version, see [pypi](https://pypi.org/project/bpy/). You can install it via pip
128
+
129
+ pip install bpy
130
+
131
+ to show progress bars install tqdm
132
+
133
+ pip install tqdm
134
+
135
+ by default these packages are not installed
136
+
137
+ Audio file reading/writing is supported through [SoundFile](https://python-soundfile.readthedocs.io), which is based on
138
+ [libsndfile](http://www.mega-nerd.com/libsndfile/). On Windows and OS X, it will be installed automatically.
139
+ On Linux, you need to install libsndfile using your distribution’s package manager, for example ``sudo apt-get install libsndfile1``.
140
+ If the installation fails, please check out the [help section](https://pyfar-gallery.readthedocs.io/en/latest/help).
141
+
142
+ Contributing
143
+ ============
144
+
145
+ Check out the [contributing guidelines](https://pyfar.readthedocs.io/en/stable/contributing.html) if you want to become part of pyfar.
@@ -0,0 +1,59 @@
1
+ <h1 align="center">
2
+ <img src="https://github.com/sparrow-acoustics/sparrowpy/raw/main/docs/_static/logo.png" width="300">
3
+ </h1><br>
4
+
5
+
6
+ [![PyPI version](https://badge.fury.io/py/sparrowpy.svg)](https://badge.fury.io/py/sparrowpy)
7
+ [![Documentation Status](https://readthedocs.org/projects/sparrowpy/badge/?version=latest)](https://sparrowpy.readthedocs.io/en/latest/?badge=latest)
8
+ [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/pyfar/gallery/main?labpath=docs/gallery/interactive/pyfar_introduction.ipynb)
9
+ Python Boilerplate contains all the boilerplate you need to create a Python package.
10
+
11
+ Getting Started
12
+ ===============
13
+
14
+ The [pyfar workshop](https://mybinder.org/v2/gh/pyfar/gallery/main?labpath=docs/gallery/interactive/pyfar_introduction.ipynb)
15
+ gives an overview of the most important pyfar functionality and is a good
16
+ starting point. It is part of the [pyfar example gallery](https://pyfar-gallery.readthedocs.io/en/latest/examples_gallery.html)
17
+ that also contains more specific and in-depth
18
+ examples that can be executed interactively without a local installation by
19
+ clicking the mybinder.org button on the respective example. The
20
+ [pyfar documentation](https://pyfar.readthedocs.io) gives a detailed and complete overview of pyfar. All
21
+ these information are available from [pyfar.org](https://pyfar.org).
22
+
23
+ Installation
24
+ ============
25
+
26
+ Use pip to install sparrowpy
27
+
28
+ pip install sparrowpy
29
+
30
+ (Requires Python >= 3.9)
31
+
32
+ if numba is installed the code will be precompiled and will run faster. We strongly recommend to use numba to accelerate the simulations significantly
33
+
34
+ pip install sparrowpy[fast]
35
+
36
+ or
37
+
38
+ pip install sparrowpy
39
+ pip install numba
40
+
41
+ you can also use blender for geometry import. Note that blender has strong requirements on the python version, see [pypi](https://pypi.org/project/bpy/). You can install it via pip
42
+
43
+ pip install bpy
44
+
45
+ to show progress bars install tqdm
46
+
47
+ pip install tqdm
48
+
49
+ by default these packages are not installed
50
+
51
+ Audio file reading/writing is supported through [SoundFile](https://python-soundfile.readthedocs.io), which is based on
52
+ [libsndfile](http://www.mega-nerd.com/libsndfile/). On Windows and OS X, it will be installed automatically.
53
+ On Linux, you need to install libsndfile using your distribution’s package manager, for example ``sudo apt-get install libsndfile1``.
54
+ If the installation fails, please check out the [help section](https://pyfar-gallery.readthedocs.io/en/latest/help).
55
+
56
+ Contributing
57
+ ============
58
+
59
+ Check out the [contributing guidelines](https://pyfar.readthedocs.io/en/stable/contributing.html) if you want to become part of pyfar.
@@ -0,0 +1,20 @@
1
+ # Minimal makefile for Sphinx documentation
2
+ #
3
+
4
+ # You can set these variables from the command line.
5
+ SPHINXOPTS =
6
+ SPHINXBUILD = python -msphinx
7
+ SPHINXPROJ = sparrowpy
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
@@ -0,0 +1,25 @@
1
+ .. _api_reference:
2
+
3
+ API Reference
4
+ =============
5
+
6
+ The following gives detailed information about all sparrowpy functions sorted
7
+ according to their modules.
8
+
9
+ For examples on how to use sparrowpy refer to the notebooks in the
10
+ `examples gallery`_ and the documentation on classes and modules below.
11
+
12
+
13
+ Modules
14
+ -------
15
+
16
+ .. toctree::
17
+ :maxdepth: 1
18
+
19
+ modules/sparrowpy.radiosity
20
+ modules/sparrowpy.geometry
21
+ modules/sparrowpy.sound_object
22
+ modules/sparrowpy.brdf
23
+
24
+
25
+ .. _examples gallery: https://pyfar-gallery.readthedocs.io/en/latest/examples_gallery.html
@@ -0,0 +1,185 @@
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
+ import urllib3
12
+ import shutil
13
+ sys.path.insert(0, os.path.abspath('..'))
14
+
15
+ import sparrowpy # noqa
16
+
17
+ # -- General configuration ---------------------------------------------------
18
+ # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
19
+
20
+ extensions = [
21
+ 'sphinx.ext.autodoc',
22
+ 'sphinx.ext.viewcode',
23
+ 'sphinx.ext.napoleon',
24
+ 'sphinx.ext.autosummary',
25
+ 'matplotlib.sphinxext.plot_directive',
26
+ 'sphinx.ext.mathjax',
27
+ 'sphinx.ext.intersphinx',
28
+ 'autodocsumm',
29
+ 'sphinx_design',
30
+ 'sphinx_favicon',
31
+ 'sphinx_reredirects',
32
+ 'sphinx_mdinclude',
33
+ ]
34
+
35
+ # show tocs for classes and functions of modules using the autodocsumm
36
+ # package
37
+ autodoc_default_options = {'autosummary': True}
38
+
39
+ # show the code of plots that follows the command .. plot:: based on the
40
+ # package matplotlib.sphinxext.plot_directive
41
+ plot_include_source = True
42
+
43
+ # Add any paths that contain templates here, relative to this directory.
44
+ templates_path = ['_templates']
45
+
46
+ # The suffix(es) of source filenames.
47
+ # You can specify multiple suffix as a list of string:
48
+ source_suffix = {
49
+ '.rst': 'restructuredtext',
50
+ '.md': 'markdown',
51
+ }
52
+
53
+ # The master toctree document.
54
+ master_doc = 'index'
55
+
56
+ # General information about the project.
57
+ project = 'sparrowpy'
58
+ copyright = "2024, The pyfar developers"
59
+ author = "The pyfar developers"
60
+
61
+ # The version info for the project you're documenting, acts as replacement
62
+ # for |version| and |release|, also used in various other places throughout
63
+ # the built documents.
64
+ #
65
+ # The short X.Y version.
66
+ version = sparrowpy.__version__
67
+ # The full version, including alpha/beta/rc tags.
68
+ release = sparrowpy.__version__
69
+
70
+ # This is also used if you do content translation via gettext catalogs.
71
+ # Usually you set "language" from the command line for these cases.
72
+ language = 'en'
73
+
74
+ # List of patterns, relative to source directory, that match files and
75
+ # directories to ignore when looking for source files.
76
+ # This patterns also effect to html_static_path and html_extra_path
77
+ exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
78
+
79
+ # The name of the Pygments (syntax highlighting) style to use (Not defining
80
+ # uses the default style of the html_theme).
81
+ # pygments_style = 'sphinx'
82
+
83
+ # If true, '()' will be appended to :func: etc. cross-reference text.
84
+ add_function_parentheses = False
85
+
86
+ # If true, `todo` and `todoList` produce output, else they produce nothing.
87
+ todo_include_todos = False
88
+
89
+ # default language for highlighting in source code
90
+ highlight_language = "python3"
91
+
92
+ # intersphinx mapping
93
+ intersphinx_mapping = {
94
+ 'numpy': ('https://numpy.org/doc/stable/', None),
95
+ 'scipy': ('https://docs.scipy.org/doc/scipy/', None),
96
+ 'matplotlib': ('https://matplotlib.org/stable/', None),
97
+ 'pyfar': ('https://pyfar.readthedocs.io/en/stable/', None),
98
+ }
99
+
100
+ # -- Options for HTML output -------------------------------------------------
101
+ # https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
102
+
103
+ html_theme = 'pydata_sphinx_theme'
104
+ html_static_path = ['_static']
105
+ html_css_files = ['css/custom.css']
106
+ html_logo = 'resources/logos/pyfar_logos_fixed_size_sparrowpy.png'
107
+ html_title = "sparrowpy"
108
+ html_favicon = '_static/favicon.ico'
109
+
110
+ # -- HTML theme options
111
+ # https://pydata-sphinx-theme.readthedocs.io/en/stable/user_guide/layout.html
112
+ html_sidebars = {
113
+ "sparrowpy": []
114
+ }
115
+
116
+ html_theme_options = {
117
+ "navbar_start": ["navbar-logo"],
118
+ "navbar_end": ["navbar-icon-links", "theme-switcher"],
119
+ "navbar_align": "content",
120
+ "header_links_before_dropdown": 8,
121
+ "icon_links": [
122
+ {
123
+ "name": "GitHub",
124
+ "url": "https://github.com/pyfar",
125
+ "icon": "fa-brands fa-square-github",
126
+ "type": "fontawesome",
127
+ },
128
+ ],
129
+ # Configure secondary (right) side bar
130
+ "show_toc_level": 3, # Show all subsections of notebooks
131
+ "secondary_sidebar_items": ["page-toc"], # Omit 'show source' link that that shows notebook in json format
132
+ "navigation_with_keys": True,
133
+ # Configure navigation depth for section navigation
134
+ "navigation_depth": 1,
135
+ }
136
+
137
+ html_context = {
138
+ "default_mode": "light"
139
+ }
140
+
141
+ # redirect index to pyfar.html
142
+ redirects = {
143
+ "index": "sparrowpy.html"
144
+ }
145
+
146
+ # -- download navbar and style files from gallery -----------------------------
147
+ branch = 'main'
148
+ link = f'https://github.com/pyfar/gallery/raw/{branch}/docs/'
149
+ folders_in = [
150
+ '_static/css/custom.css',
151
+ '_static/favicon.ico',
152
+ '_static/header.rst',
153
+ 'resources/logos/pyfar_logos_fixed_size_sparrowpy.png',
154
+ ]
155
+
156
+ def download_files_from_gallery(link, folders_in):
157
+ c = urllib3.PoolManager()
158
+ for file in folders_in:
159
+ url = link + file
160
+ filename = file
161
+ os.makedirs(os.path.dirname(filename), exist_ok=True)
162
+ with c.request('GET', url, preload_content=False) as res:
163
+ if res.status == 200:
164
+ with open(filename, 'wb') as out_file:
165
+ shutil.copyfileobj(res, out_file)
166
+
167
+ download_files_from_gallery(link, folders_in)
168
+ # if logo does not exist, use pyfar logo
169
+ if not os.path.exists(html_logo):
170
+ download_files_from_gallery(
171
+ link, ['resources/logos/pyfar_logos_fixed_size_pyfar.png'])
172
+ shutil.copyfile(
173
+ 'resources/logos/pyfar_logos_fixed_size_pyfar.png', html_logo)
174
+
175
+ # replace sparrowpy hard link to internal link
176
+ with open("_static/header.rst", "rt") as fin:
177
+ with open("header.rst", "wt") as fout:
178
+ lines = [line.replace(f'https://{project}.readthedocs.io', project) for line in fin]
179
+ contains_project = any(project in line for line in lines)
180
+
181
+ fout.writelines(lines)
182
+
183
+ # add project to the list of projects if not in header
184
+ if not contains_project:
185
+ fout.write(f' {project} <{project}>\n')
@@ -0,0 +1 @@
1
+ .. include:: ../CONTRIBUTING.rst
@@ -0,0 +1 @@
1
+ .. include:: ../HISTORY.rst
@@ -0,0 +1,4 @@
1
+ sparrowpy
2
+ =========
3
+
4
+ .. include:: header.rst
@@ -0,0 +1,36 @@
1
+ @ECHO OFF
2
+
3
+ pushd %~dp0
4
+
5
+ REM Command file for Sphinx documentation
6
+
7
+ if "%SPHINXBUILD%" == "" (
8
+ set SPHINXBUILD=python -msphinx
9
+ )
10
+ set SOURCEDIR=.
11
+ set BUILDDIR=_build
12
+ set SPHINXPROJ=sparrowpy
13
+
14
+ if "%1" == "" goto help
15
+
16
+ %SPHINXBUILD% >NUL 2>NUL
17
+ if errorlevel 9009 (
18
+ echo.
19
+ echo.The Sphinx module was not found. Make sure you have Sphinx installed,
20
+ echo.then set the SPHINXBUILD environment variable to point to the full
21
+ echo.path of the 'sphinx-build' executable. Alternatively you may add the
22
+ echo.Sphinx directory to PATH.
23
+ echo.
24
+ echo.If you don't have Sphinx installed, grab it from
25
+ echo.http://sphinx-doc.org/
26
+ exit /b 1
27
+ )
28
+
29
+ %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
30
+ goto end
31
+
32
+ :help
33
+ %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
34
+
35
+ :end
36
+ popd
@@ -0,0 +1,7 @@
1
+ sparrowpy.brdf
2
+ ==============
3
+
4
+ .. automodule:: sparrowpy.brdf
5
+ :members:
6
+ :undoc-members:
7
+ :show-inheritance:
@@ -0,0 +1,7 @@
1
+ sparrowpy.geometry
2
+ ==================
3
+
4
+ .. automodule:: sparrowpy.geometry
5
+ :members:
6
+ :undoc-members:
7
+ :show-inheritance:
@@ -0,0 +1,7 @@
1
+ sparrowpy.radiosity
2
+ ===================
3
+
4
+ .. automodule:: sparrowpy.radiosity
5
+ :members:
6
+ :undoc-members:
7
+ :show-inheritance:
@@ -0,0 +1,7 @@
1
+ sparrowpy.sound_object
2
+ ======================
3
+
4
+ .. automodule:: sparrowpy.sound_object
5
+ :members:
6
+ :undoc-members:
7
+ :show-inheritance:
@@ -0,0 +1 @@
1
+ .. mdinclude:: ../README.md