goad-py 1.1.2__cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.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.
goad/bar.py ADDED
@@ -0,0 +1,64 @@
1
+ import numpy as np
2
+
3
+ import goad
4
+
5
+ euler = goad.Euler(0, 45, 0)
6
+ euler.alpha = 3
7
+ print(euler)
8
+
9
+ convention = goad.EulerConvention("xyz")
10
+ print(convention)
11
+
12
+ scheme = goad.Orientation.uniform(19)
13
+ binning = goad.BinningScheme.simple(num_theta=100, num_phi=100)
14
+ binning = goad.BinningScheme.interval(
15
+ thetas=[0, 1, 180], theta_spacings=[0.1, 1], phis=[0, 360], phi_spacings=[2]
16
+ )
17
+ print(binning.thetas())
18
+ print(binning.phis())
19
+
20
+ orientation = goad.Orientation.discrete([euler, euler])
21
+ orientation = goad.Orientation.uniform(1)
22
+ settings = goad.Settings(
23
+ geom_path="../../examples/data/hex.obj", orientation=orientation
24
+ )
25
+ print(settings)
26
+ mp = goad.MultiProblem(settings)
27
+ mp.solve()
28
+ print(mp.results.asymmetry)
29
+
30
+ mueller = mp.results.mueller
31
+ mueller_1d = mp.results.mueller_1d
32
+
33
+ if mueller_1d is not None:
34
+ print(mueller_1d[:, 0])
35
+
36
+ # Test setter functionality
37
+
38
+ # Cache the results object to avoid getting fresh clones
39
+ results = mp.results
40
+
41
+ # Extract first row
42
+ first_row = mueller[0]
43
+ print(f"\nOriginal first row: {first_row}")
44
+
45
+ # Null test - set it to itself
46
+ results.mueller = mueller
47
+ mueller_copy = results.mueller
48
+ assert np.allclose(mueller, mueller_copy), "Null test failed!"
49
+ print("Null test passed ✓")
50
+
51
+ # Modify a value (change s11 of first bin)
52
+ mueller_modified = mueller.copy()
53
+ original_s11 = mueller_modified[0, 0]
54
+ mueller_modified[0, 0] = 999.0
55
+
56
+ # Set the modified array
57
+ results.mueller = mueller_modified
58
+
59
+ # Get it back and check
60
+ mueller_retrieved = results.mueller
61
+ print(f"Original s11: {original_s11}")
62
+ print(f"Modified s11: {mueller_retrieved[0, 0]}")
63
+ assert mueller_retrieved[0, 0] == 999.0, "Modification test failed!"
64
+ print("Modification test passed ✓")
goad/py.typed ADDED
File without changes
@@ -0,0 +1,280 @@
1
+ Metadata-Version: 2.4
2
+ Name: goad-py
3
+ Version: 1.1.2
4
+ Classifier: Development Status :: 4 - Beta
5
+ Classifier: Intended Audience :: Science/Research
6
+ Classifier: Topic :: Scientific/Engineering :: Physics
7
+ Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
8
+ Classifier: Programming Language :: Rust
9
+ Classifier: Programming Language :: Python :: Implementation :: CPython
10
+ Classifier: Programming Language :: Python :: Implementation :: PyPy
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.8
13
+ Classifier: Programming Language :: Python :: 3.9
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Operating System :: OS Independent
18
+ Requires-Dist: numpy
19
+ Requires-Dist: pyy
20
+ Requires-Dist: rich
21
+ Requires-Dist: mkdocs>=1.6.1 ; extra == 'docs'
22
+ Requires-Dist: mkdocs-material>=9.7.0 ; extra == 'docs'
23
+ Requires-Dist: mkdocs-macros-plugin>=1.5.0 ; extra == 'docs'
24
+ Requires-Dist: pymdown-extensions>=10.17.1 ; extra == 'docs'
25
+ Requires-Dist: goad ; extra == 'keywords'
26
+ Requires-Dist: light-scattering ; extra == 'keywords'
27
+ Requires-Dist: optics ; extra == 'keywords'
28
+ Requires-Dist: simulation ; extra == 'keywords'
29
+ Requires-Dist: scientific-computing ; extra == 'keywords'
30
+ Requires-Dist: physics ; extra == 'keywords'
31
+ Provides-Extra: docs
32
+ Provides-Extra: keywords
33
+ License-File: LICENSE
34
+ Summary: Physical optics light scattering computation
35
+ Author-email: Harry Ballington <ballington@uni-wuppertal.de>
36
+ Requires-Python: >=3.11
37
+ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
38
+ Project-URL: Homepage, https://github.com/hballington12/goad
39
+ Project-URL: Documentation, https://docs.rs/goad/0.1.0/goad/index.html
40
+ Project-URL: Repository, https://github.com/hballington12/goad
41
+ Project-URL: Rust Crate, https://crates.io/crates/goad
42
+
43
+ <div align="center">
44
+
45
+ <!-- badges: start -->
46
+ ![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)
47
+ ![minimum rustc 1.85](https://img.shields.io/badge/rustc-1.85+-red.svg)
48
+ [![Rust](https://github.com/hballington12/goad/actions/workflows/rust.yml/badge.svg)](https://github.com/hballington12/goad/actions/workflows/rust.yml)
49
+ <!-- badges: end -->
50
+
51
+ </div>
52
+
53
+ # GOAD - Geometric Optics with Aperture Diffraction
54
+
55
+ GOAD is a Rust-based physical-optics hybrid light scattering model based on geometric optics with aperture diffraction. It computes the 2D Mueller matrix by using geometric optics and a polygon clipping algorithm to compute the electric field on the particle surface. The surface field is then mapped to the far-field on the basis of the electromagnetic equivalence theorem, which takes the form of a vector surface integral diffraction equation. Green's theorem is used to reduce the surface integral to a line integral around the contours of outgoing beam cross sections, which leads to fast computations compared to some other methods. Compared to the [PBT](https://github.com/hballington12/pbt) method, GOAD uses a beam clipping algorithm instead of ray backtracing on a meshed geometry, which makes the computation more accurate and faster if the particle has smooth planar surfaces.
56
+
57
+ <div align="center">
58
+
59
+ > **📖 Reference Paper**
60
+ > If you use this code in your work, please cite:
61
+ > [A Light Scattering Model for Large Particles with Surface Roughness](https://doi.org/10.1016/j.jqsrt.2024.109054)
62
+ > *H. Ballington, E. Hesse*
63
+ > [JQSRT, 2024](https://www.journals.elsevier.com/journal-of-quantitative-spectroscopy-and-radiative-transfer)
64
+
65
+ </div>
66
+
67
+ ---
68
+
69
+ ## 📚 Contents
70
+
71
+ - [GOAD - Geometric Optics with Aperture Diffraction](#goad---geometric-optics-with-aperture-diffraction)
72
+ - [📚 Contents](#-contents)
73
+ - [🚀 Quickstart](#-quickstart)
74
+ - [✨ Features](#-features)
75
+ - [🛠️ Installation](#️-installation)
76
+ - [⚙️ Usage](#️-usage)
77
+ - [Configuration](#configuration)
78
+ - [Command-Line Arguments](#command-line-arguments)
79
+ - [▶️ Running the Simulation](#️-running-the-simulation)
80
+ - [🛠️ Testing](#️-testing)
81
+ - [🤝 Contributing](#-contributing)
82
+ - [📜 License](#-license)
83
+
84
+ ---
85
+
86
+ ## 🚀 Quickstart
87
+
88
+ 1. Run the `setup.sh` script from the project root to compile the code and initialise settings:
89
+
90
+ ```sh
91
+ ./setup.sh
92
+ ```
93
+
94
+ 2. Execute the binary located at `./target/release/goad`:
95
+
96
+ ```sh
97
+ ./target/release/goad [OPTIONS]
98
+ ```
99
+
100
+ For more information, see the [quickstart guide](https://docs.rs/goad/0.1.0/goad/_quickstart/index.html) in the docs.
101
+
102
+ ---
103
+
104
+ ## ✨ Features
105
+
106
+ - **Full Mueller Matrix Output**: Rigorous vector diffraction theory for computation of all Mueller matrix elements.
107
+ - **Extensive Geometry Possibilities**: GOAD is built with the flexibility to extend beyond simple convex polyhedral geometries, such as concavities, inclusions, layered media, negative refractive indices, and surrounding mediums other than air.
108
+ - **Fixed and Multiple Orientation Scattering**: Rapid computation of 2D scattering patterns in fixed orientation at arbitrary scattering angles, as well as fast orientation-averaged scattering computations for radiative transfer and remote sensing applications.
109
+
110
+ ---
111
+
112
+ ## 🛠️ Installation
113
+
114
+ Before building the project, ensure you have Rust's package manager, Cargo, installed.
115
+ You can install Rust and Cargo by following the instructions on the [official Rust website](https://doc.rust-lang.org/cargo/getting-started/installation.html).
116
+
117
+ On Linux and macOS:
118
+
119
+ ```sh
120
+ curl https://sh.rustup.rs -sSf | sh
121
+ ```
122
+
123
+ Clone the repository and build the project:
124
+
125
+ ```sh
126
+ git clone git@github.com:hballington12/goad.git
127
+ cd goad
128
+ cargo build --release
129
+ ```
130
+
131
+ After building, the binary will be in the `target/release` directory.
132
+
133
+ ---
134
+
135
+ ## ⚙️ Usage
136
+
137
+ ### Configuration
138
+
139
+ The application uses a default configuration file (`config/default.toml`).
140
+ **To customise:**
141
+
142
+ - Copy it to `config/local.toml` and edit as needed.
143
+ - Options in config files are overridden by command line arguments, which are in turn overridden by environment variables.
144
+
145
+ **Example ways to set the wavelength:**
146
+
147
+ 1. Edit `config/local.toml`:
148
+
149
+ ```toml
150
+ wavelength = 0.532
151
+ ```
152
+
153
+ 2. Use a command line argument:
154
+
155
+ ```sh
156
+ goad -- -wavelength 0.532
157
+ ```
158
+
159
+ 3. Use an environment variable:
160
+
161
+ ```sh
162
+ export GOAD_wavelength=0.532
163
+ goad
164
+ ```
165
+
166
+ ### Command-Line Arguments
167
+
168
+ ```sh
169
+ GOAD - Geometric Optics with Aperture Diffraction
170
+ Harry Ballington
171
+
172
+ Usage: goad [OPTIONS]
173
+
174
+ Options:
175
+ -w, --w <W>
176
+ Wavelength in units of the geometry. Should be larger than the smallest feature in the geometry
177
+ --bp <BP>
178
+ Minimum beam power threshold for propagation. Beams with less power than this will be truncated
179
+ --baf <BAF>
180
+ Minimum area factor threshold for beam propagation. The actual area threshold is wavelength² × factor. Prevents geometric optics from modeling sub-wavelength beams
181
+ --cop <COP>
182
+ Total power cutoff fraction (0.0-1.0). Simulation stops when this fraction of input power is accounted for. Set to 1.0 to disable and trace all beams to completion
183
+ --rec <REC>
184
+ Maximum recursion depth for beam tracing. Typical values: 8-15. Higher values rarely improve results when reasonable beam power thresholds are set
185
+ --tir <TIR>
186
+ Maximum allowed total internal reflections. Prevents infinite TIR loops by truncating beams after this many TIR events
187
+ -g, --geo <GEO>
188
+ Path to geometry file (.obj format). Contains all input shapes for the simulation
189
+ --ri0 <RI0>
190
+ Surrounding medium refractive index. Format: "re+im" (e.g., "1.3117+0.0001i")
191
+ -r, --ri <RI>...
192
+ Particle refractive indices, space-separated. Each shape in the geometry is assigned a refractive index. If fewer values than shapes are provided, the first value is reused
193
+ --distortion <DISTORTION>
194
+ Distortion factor for the geometry. Applies distortion sampled from a Gaussian distribution. Default: sigma = 0.0 (no distortion). Sigma is the standard deviation of the facet theta tilt (in radians)
195
+ --geom-scale <GEOM_SCALE>...
196
+ Geometry scale factors for each axis (x, y, z). Format: "x y z" (e.g., "1.0 1.0 1.0"). Default: "1.0 1.0 1.0" (no scaling)
197
+ --uniform <UNIFORM>
198
+ Use uniform random orientation scheme. The value specifies the number of random orientations
199
+ --discrete <DISCRETE>...
200
+ Use discrete orientation scheme with specified Euler angles (degrees). Format: alpha1,beta1,gamma1 alpha2,beta2,gamma2 ...
201
+ --euler <EULER>
202
+ Specify Euler angle convention for orientation. Valid values: XYZ, XZY, YXZ, YZX, ZXY, ZYX, etc. Default: ZYZ
203
+ --simple <SIMPLE> <SIMPLE>
204
+ Use simple equal-spacing binning scheme. Format: <num_theta_bins> <num_phi_bins>
205
+ --interval
206
+ Enable interval binning scheme with variable spacing. Allows fine binning in regions of interest like forward/backward scattering
207
+ --theta <THETA> <THETA> <THETA>...
208
+ Theta angle bins for interval binning (degrees). Format: start step1 mid1 step2 mid2 ... stepN end Example: 0 1 10 2 180 = 0° to 10° in 1° steps, then 10° to 180° in 2° steps
209
+ --phi <PHI> <PHI> <PHI>...
210
+ Phi angle bins for interval binning (degrees). Format: start step1 mid1 step2 mid2 ... stepN end Example: 0 2 180 = 0° to 180° in 2° steps
211
+ --custom <CUSTOM>
212
+ Path to custom binning scheme file. Contains a list of (theta, phi) bin pairs in TOML format. Overrides other binning parameters
213
+ -s, --seed <SEED>
214
+ Random seed for reproducibility. Omit for a randomized seed
215
+ --dir <DIR>
216
+ Output directory for simulation results. If not specified, a directory in the format 'run00001' will be created automatically
217
+ -h, --help
218
+ Print help
219
+ -V, --version
220
+ Print version
221
+
222
+ EXAMPLES:
223
+ # Run with a specific wavelength and geometry file
224
+ goad -w 0.5 --geo geometry.obj
225
+
226
+ # Run with a specific refractive index and random orientations
227
+ goad --ri 1.31+0.01i --uniform 100
228
+
229
+ # Run over discrete orientations with an interval binning scheme
230
+ goad --discrete="-30.0,20.0,1.0 -40.0,13.0,12.1" --interval \
231
+ --theta 0 1 10 2 180 --phi 0 2 180
232
+
233
+ # Run inside a medium other than air
234
+ goad --ri0 1.5+0.0i
235
+
236
+ # Run with multiple shapes with different refractive indices
237
+ goad --ri 1.31+0.0i 1.5+0.1i --geo geometries.obj
238
+
239
+ # Save output to a specific directory
240
+ goad --dir /path/to/output
241
+ ```
242
+
243
+ ---
244
+
245
+ ## ▶️ Running the Simulation
246
+
247
+ ```sh
248
+ cargo run --release -- [OPTIONS]
249
+ ```
250
+
251
+ or
252
+
253
+ ```sh
254
+ ./target/release/goad -w 0.532 --geo ./examples/data/cube.obj
255
+ ```
256
+
257
+ ---
258
+
259
+ ## 🛠️ Testing
260
+
261
+ To run the tests:
262
+
263
+ ```sh
264
+ cargo test
265
+ ```
266
+
267
+ ---
268
+
269
+ ## 🤝 Contributing
270
+
271
+ Contributions are welcome!
272
+ Please open an issue or submit a pull request on [GitHub](https://github.com/hballington12/goad).
273
+
274
+ ---
275
+
276
+ ## 📜 License
277
+
278
+ This project is licensed under the GNU General Public License.
279
+ See the [LICENSE](LICENSE) file for details.
280
+
@@ -0,0 +1,9 @@
1
+ goad/__init__.py,sha256=EDeLEq29BY67fM0qCpFMpGTuufiMFoTNFPRWv3pYCGA,21
2
+ goad/_goad.cpython-312-s390x-linux-gnu.so,sha256=QFQjtv74AWbM61bVP2NJecF7m0JsU2ryuBgb2Gvlxqo,6186464
3
+ goad/_goad.pyi,sha256=Gpl8J1oDOpDMtuICCIL2wPvBxE6eEa9BjThJSoa7voo,22232
4
+ goad/bar.py,sha256=F20ZBth4bxE70x8R5xWJ949HF5oY-F40rm23IHkx2Bg,1670
5
+ goad/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
+ goad_py-1.1.2.dist-info/METADATA,sha256=GdWP1oIW8fwzKGJekwo0JY-z5tMHkyy2KncoYocJgCY,11038
7
+ goad_py-1.1.2.dist-info/WHEEL,sha256=-9NESnTmGm8me38zfLsw11bDxTI77TqMtPKBBikMT0I,145
8
+ goad_py-1.1.2.dist-info/licenses/LICENSE,sha256=IwGE9guuL-ryRPEKi6wFPI_zOhg7zDZbTYuHbSt_SAk,35823
9
+ goad_py-1.1.2.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: maturin (1.10.2)
3
+ Root-Is-Purelib: false
4
+ Tag: cp312-cp312-manylinux_2_17_s390x
5
+ Tag: cp312-cp312-manylinux2014_s390x