BornSim
Vector Born-series scattering from continuous, isotropic random media.
Python |
|
Documentation |
|
Tests |
|
Quality |
|
Coverage |
|
Release |
|
License |
BornSim models how light scatters from three-dimensional refractive-index fluctuations. Build a random or structured medium, solve its coherent Born series, and inspect angular scattering, phase functions, \(\mu_s\), anisotropy \(g\), and reduced scattering \(\mu_s'\).
3D medium opacity |
3D SPF surface |
The left view shows the simulated refractive-index volume; opacity is a visual encoding, not absorption. The right view shows the normalized scattering phase function in direction space. Both figures are generated from the same BornSim-style workflow below.
Quick start
from bornsim import EnsembleSampling, Grid, Solver, Source
from bornsim.medium.random_medium import GaussianMedium
from bornsim.units import ureg
grid = Grid(shape=(16, 16, 16), spacing=50 * ureg.nanometer)
medium = GaussianMedium(
background_refractive_index=1.33,
refractive_index_std=0.01,
correlation_length=100 * ureg.nanometer,
)
solver = Solver(
source=Source(wavelength=633 * ureg.nanometer),
order=3,
)
result = solver.ensemble(
medium=medium,
grid=grid,
ensemble_sampling=EnsembleSampling(realizations=4, seed=42),
)
print(result.mu_s.to("1 / millimeter"))
print(result.g)
print(result.mu_s_prime.to("1 / millimeter"))
result.plot()
For one fixed structured sample, use solver.solve(target=volume). The result can also be visualized directly:
volume = medium.to_volume(grid=grid, seed=42)
medium_figure = volume.plot_3d(
field="refractive_index",
opacity_scale="increasing",
)
phase_figure = solver.solve(target=volume).plot_phase_function(view="3d")
medium_figure.write_html("medium.html", include_plotlyjs=True)
phase_figure.write_html("phase_function.html", include_plotlyjs=True)
What BornSim models
Media: Gaussian, exponential, and Whittle–Matérn random fields, seeded random spheres, and composable structured geometry.
Numerics: vector volume-integral propagation with configurable Born order, angular quadrature, grid spacing, and ensemble sampling.
Results: differential scattering, full directional phase functions, cross sections, uncertainty estimates, saved provenance, and Matplotlib or Plotly visualizations.
Units: explicit physical units for wavelengths, lengths, angles, and scattering coefficients through bornsim.units.ureg.
Installation
BornSim requires Python 3.11 or newer.
$ python -m pip install BornSim
For development:
$ git clone https://github.com/MartinPdeS/BornSim.git
$ cd BornSim
$ python -m pip install -e ".[testing,documentation]"
$ python -m pytest tests
Learn more
Documentation — theory, API reference, numerical conventions, and visualization guidance.
Examples — random media, structured samples, Born orders, validation, and result plots.
Medium visualization guide — interactive 3D volume and phase-function views.
Repository — issues and contributions.
Scientific scope
BornSim uses the linearized dielectric contrast \(\delta\varepsilon \approx 2 n_0 \delta n\). Its coefficients describe finite numerical samples and are not automatically intrinsic infinite-medium transport coefficients. Check grid, angular, sample-size, synthesis-box, and ensemble convergence before interpreting results quantitatively.
License
BornSim is released under the MIT License. See LICENSE.
Metadata
Release files for BornSim 0.5.11
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| bornsim-0.5.11.tar.gz | 1.6 MB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| bornsim-0.5.11-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 1.7 MB
Release files / bornsim-0.5.11.tar.gz
| Download URL | bornsim-0.5.11.tar.gz |
|---|---|
| Size | 1.6 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
df05c6c02b9e434c504f3a7bff82728f5d5ebb36a76a82894979ca7bc44ce5a3
|
|
BLAKE2b-256 checksum How to use checksums |
66bb26254b3f856223c6d37b24bd7f19db224db5a04014a904a5dd105d344b7c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.17
|
Release files / bornsim-0.5.11-py3-none-any.whl
| Download URL | bornsim-0.5.11-py3-none-any.whl |
|---|---|
| Size | 69.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ec7da67b0852b856d4ab6e663b605699b7bc7a7d9246fc971fa4f635bf6d0d89
|
|
BLAKE2b-256 checksum How to use checksums |
2a054fdce5610f45251cb94d698ce0db23d4820b0821249b7756b129ad4c7d96
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.17
|
Security for BornSim 0.5.11
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.