sparrowpy 0.1.0__py3-none-any.whl

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 (103) hide show
  1. docs/Makefile +20 -0
  2. docs/_static/logo.png +0 -0
  3. docs/api_reference.rst +25 -0
  4. docs/conf.py +185 -0
  5. docs/contributing.rst +1 -0
  6. docs/history.rst +1 -0
  7. docs/index.rst +4 -0
  8. docs/make.bat +36 -0
  9. docs/modules/sparrowpy.brdf.rst +7 -0
  10. docs/modules/sparrowpy.geometry.rst +7 -0
  11. docs/modules/sparrowpy.radiosity.rst +7 -0
  12. docs/modules/sparrowpy.sound_object.rst +7 -0
  13. docs/readme.rst +1 -0
  14. docs/sparrowpy.rst +69 -0
  15. sparrowpy/__init__.py +38 -0
  16. sparrowpy/brdf.py +303 -0
  17. sparrowpy/form_factor.py +426 -0
  18. sparrowpy/geometry.py +281 -0
  19. sparrowpy/radiosity.py +1208 -0
  20. sparrowpy/radiosity_fast/__init__.py +11 -0
  21. sparrowpy/radiosity_fast/energy_exchange_order.py +216 -0
  22. sparrowpy/radiosity_fast/energy_exchange_recursive.py +185 -0
  23. sparrowpy/radiosity_fast/form_factor.py +311 -0
  24. sparrowpy/radiosity_fast/geometry.py +342 -0
  25. sparrowpy/radiosity_fast/radiosity_class.py +479 -0
  26. sparrowpy/radiosity_fast/receiver_energy.py +43 -0
  27. sparrowpy/radiosity_fast/source_energy.py +159 -0
  28. sparrowpy/radiosity_fast/universal_ff/__init__.py +1 -0
  29. sparrowpy/radiosity_fast/universal_ff/ffhelpers.py +498 -0
  30. sparrowpy/radiosity_fast/universal_ff/univ_form_factor.py +435 -0
  31. sparrowpy/radiosity_fast/visibility_helpers.py +202 -0
  32. sparrowpy/sound_object.py +221 -0
  33. sparrowpy/sparapy.py +1 -0
  34. sparrowpy/testing/__init__.py +6 -0
  35. sparrowpy/testing/exact_ff_solutions.py +119 -0
  36. sparrowpy/testing/stub_utils.py +48 -0
  37. sparrowpy/utils/__init__.py +6 -0
  38. sparrowpy/utils/blender.py +142 -0
  39. sparrowpy-0.1.0.dist-info/LICENSE +22 -0
  40. sparrowpy-0.1.0.dist-info/METADATA +145 -0
  41. sparrowpy-0.1.0.dist-info/RECORD +103 -0
  42. sparrowpy-0.1.0.dist-info/WHEEL +5 -0
  43. sparrowpy-0.1.0.dist-info/top_level.txt +3 -0
  44. tests/__init__.py +1 -0
  45. tests/conftest.py +82 -0
  46. tests/test_DRadiosityFast.py +171 -0
  47. tests/test_DRadiosityFast_infinite_diffuse_plane.py +166 -0
  48. tests/test_DRadiosityFast_order.py +129 -0
  49. tests/test_Radiosity.py +664 -0
  50. tests/test_RadiosityDirectional.py +412 -0
  51. tests/test_blender_import.py +14 -0
  52. tests/test_brdf.py +434 -0
  53. tests/test_conftest.py +16 -0
  54. tests/test_data/ITA_Dodecahedron.sofa +0 -0
  55. tests/test_data/cube.blend +0 -0
  56. tests/test_data/cube.stl +0 -0
  57. tests/test_data/cube_blocked.blend +0 -0
  58. tests/test_data/cube_simple.blend +0 -0
  59. tests/test_data/ihta.E_sec_2.sofa +0 -0
  60. tests/test_data/reference_energy_exchange_size0.5.far +0 -0
  61. tests/test_data/reference_energy_exchange_size1.far +0 -0
  62. tests/test_data/reference_form_factor_parallel_size0.5.far +0 -0
  63. tests/test_data/reference_form_factor_parallel_size1.far +0 -0
  64. tests/test_data/reference_form_factor_perpendicular_0_0_size1.far +0 -0
  65. tests/test_data/reference_form_factor_perpendicular_0_2_size0.5.far +0 -0
  66. tests/test_data/reference_form_factor_perpendicular_0_3_size0.5.far +0 -0
  67. tests/test_data/reference_form_factor_perpendicular_0_4_size0.5.far +0 -0
  68. tests/test_data/reference_form_factor_perpendicular_0_5_size0.5.far +0 -0
  69. tests/test_data/reference_form_factor_perpendicular_1_2_size0.5.far +0 -0
  70. tests/test_data/reference_form_factor_perpendicular_1_3_size0.5.far +0 -0
  71. tests/test_data/reference_form_factor_perpendicular_1_4_size0.5.far +0 -0
  72. tests/test_data/reference_form_factor_perpendicular_1_5_size0.5.far +0 -0
  73. tests/test_data/reference_form_factor_perpendicular_2_0_size0.5.far +0 -0
  74. tests/test_data/reference_form_factor_perpendicular_2_1_size0.5.far +0 -0
  75. tests/test_data/reference_form_factor_perpendicular_2_4_size0.5.far +0 -0
  76. tests/test_data/reference_form_factor_perpendicular_2_5_size0.5.far +0 -0
  77. tests/test_data/reference_form_factor_perpendicular_3_0_size0.5.far +0 -0
  78. tests/test_data/reference_form_factor_perpendicular_3_1_size0.5.far +0 -0
  79. tests/test_data/reference_form_factor_perpendicular_3_4_size0.5.far +0 -0
  80. tests/test_data/reference_form_factor_perpendicular_3_5_size0.5.far +0 -0
  81. tests/test_data/reference_form_factor_perpendicular_4_0_size0.5.far +0 -0
  82. tests/test_data/reference_form_factor_perpendicular_4_1_size0.5.far +0 -0
  83. tests/test_data/reference_form_factor_perpendicular_4_2_size0.5.far +0 -0
  84. tests/test_data/reference_form_factor_perpendicular_4_3_size0.5.far +0 -0
  85. tests/test_data/reference_form_factor_perpendicular_5_0_size0.5.far +0 -0
  86. tests/test_data/reference_form_factor_perpendicular_5_1_size0.5.far +0 -0
  87. tests/test_data/reference_form_factor_perpendicular_5_2_size0.5.far +0 -0
  88. tests/test_data/reference_form_factor_perpendicular_5_3_size0.5.far +0 -0
  89. tests/test_data/reference_form_factor_perpendicular_size0.5.far +0 -0
  90. tests/test_data/reference_matrix_directional_patch_size0.5.far +0 -0
  91. tests/test_data/reference_matrix_directional_patch_size1.far +0 -0
  92. tests/test_data/reference_specular_reflections_0.5.far +0 -0
  93. tests/test_data/reference_specular_reflections_1.far +0 -0
  94. tests/test_data/simulation_X10_k2_5m.far +0 -0
  95. tests/test_data/simulation_X10_k3_5m.far +0 -0
  96. tests/test_data/specular_gaussian5.sofa +0 -0
  97. tests/test_multisource.py +275 -0
  98. tests/test_radiosity_geometry.py +138 -0
  99. tests/test_radiosity_polygon.py +93 -0
  100. tests/test_radiosity_sound_object.py +88 -0
  101. tests/test_sparrowpy.py +10 -0
  102. tests/test_universal_formfactor.py +224 -0
  103. tests/test_visibility.py +201 -0
docs/Makefile ADDED
@@ -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)
docs/_static/logo.png ADDED
Binary file
docs/api_reference.rst ADDED
@@ -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
docs/conf.py ADDED
@@ -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')
docs/contributing.rst ADDED
@@ -0,0 +1 @@
1
+ .. include:: ../CONTRIBUTING.rst
docs/history.rst ADDED
@@ -0,0 +1 @@
1
+ .. include:: ../HISTORY.rst
docs/index.rst ADDED
@@ -0,0 +1,4 @@
1
+ sparrowpy
2
+ =========
3
+
4
+ .. include:: header.rst
docs/make.bat ADDED
@@ -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:
docs/readme.rst ADDED
@@ -0,0 +1 @@
1
+ .. mdinclude:: ../README.md
docs/sparrowpy.rst ADDED
@@ -0,0 +1,69 @@
1
+ sparrowpy
2
+ =========
3
+
4
+ .. toctree::
5
+ :maxdepth: 3
6
+ :hidden:
7
+
8
+ readme
9
+ api_reference
10
+ contributing
11
+ history
12
+
13
+
14
+ Python Boilerplate contains all the boilerplate you need to create a Python package.
15
+
16
+ .. grid:: 1 2 2 2
17
+ :gutter: 4
18
+
19
+ .. grid-item-card::
20
+ :link: readme.html
21
+ :text-align: center
22
+ :padding: 0 0 3 3
23
+
24
+ **Getting Started**
25
+ ^^^^
26
+
27
+ .. raw:: html
28
+
29
+ <i class="fa-solid fa-rocket icon-style"></i>
30
+
31
+
32
+ .. grid-item-card::
33
+ :link: api_reference
34
+ :link-type: ref
35
+ :text-align: center
36
+ :padding: 0 0 3 3
37
+
38
+ **API Reference**
39
+ ^^^^
40
+
41
+ .. raw:: html
42
+
43
+ <i class="fa-solid fa-file-lines icon-style"></i>
44
+
45
+
46
+ .. grid-item-card::
47
+ :link: contributing.html
48
+ :text-align: center
49
+ :padding: 0 0 3 3
50
+
51
+ **Contributing**
52
+ ^^^^
53
+
54
+ .. raw:: html
55
+
56
+ <i class="fa-solid fa-pen icon-style"></i>
57
+
58
+ .. grid-item-card::
59
+ :link: history.html
60
+ :text-align: center
61
+ :padding: 0 0 3 3
62
+
63
+ **History**
64
+ ^^^^
65
+
66
+ .. raw:: html
67
+
68
+ <i class="fa-solid fa-clock-rotate-left icon-style">
69
+ </i>
sparrowpy/__init__.py ADDED
@@ -0,0 +1,38 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ """Top-level package for sparrowpy."""
4
+
5
+ __author__ = """The pyfar developers"""
6
+ __email__ = ''
7
+ __version__ = '0.1.0'
8
+
9
+
10
+ from . import geometry
11
+ from . import radiosity
12
+ from . import sound_object
13
+ from .radiosity_fast.radiosity_class import DirectionalRadiosityFast
14
+ from .radiosity import (
15
+ RadiosityKang,
16
+ DirectionalRadiosityKang,
17
+ PatchesKang,
18
+ PatchesDirectionalKang)
19
+ from . import testing
20
+ from . import radiosity_fast
21
+ from . import brdf
22
+ from . import utils
23
+
24
+
25
+ __all__ = [
26
+ 'RadiosityKang',
27
+ 'DirectionalRadiosityKang',
28
+ 'PatchesKang',
29
+ 'PatchesDirectionalKang',
30
+ 'geometry',
31
+ 'radiosity',
32
+ 'sound_object',
33
+ 'DirectionalRadiosityFast',
34
+ 'radiosity_fast',
35
+ 'testing',
36
+ 'brdf',
37
+ 'utils',
38
+ ]