optiland-sms
Miñano–Benítez SMS (Simultaneous Multiple Surface) lens surfaces in
Optiland's sequential engine: a spline span of a
ray_tracing_shapely profile.json becomes a
surface of revolution, traced exactly and, under Optiland's torch backend, differentiable with
respect to the spline's points.
The surface type sms_spline is registered through Optiland's optiland.surfaces entry point:
once the package is installed, Optiland finds it without an import and without any change to
Optiland.
Install
pip install optiland-sms # numpy only
pip install "optiland-sms[torch]" # with torch, for gradients
It needs Optiland 0.6.3 or later. It does not need ray_tracing_shapely: it reads that project's
profile files.
Use
from optiland.optic import Optic
from optiland.materials import IdealMaterial
from optiland.physical_apertures import RadialAperture
from optiland_sms import read_meridian
profile = "lens.profile.json" # a revolve profile whose faces are spline spans
front = read_meridian(profile, "N", reverse=True)
back = read_meridian(profile, "X", reverse=True)
op = Optic()
op.surfaces.add(index=0, thickness=10.0)
op.surfaces.add(index=1, surface_type="sms_spline", profile=profile, span="N", reverse=True,
thickness=front.vertex_along_axis - back.vertex_along_axis,
material=IdealMaterial(n=1.5), is_stop=True,
aperture=RadialAperture(front.rim_radius))
op.surfaces.add(index=2, surface_type="sms_spline", profile=profile, span="X", reverse=True,
thickness=5.0, aperture=RadialAperture(back.rim_radius))
op.surfaces.add(index=3)
spanis the span's short label;reversesays that light travels against the profile's axis direction.- Take thicknesses from
vertex_along_axis: a spline's vertex is where the curve meets the axis, between its points, not one of them. - Set each aperture to the surface's
rim_radius. Beyond the rim the surface continues along the rim's tangent, only so that the intersection solve sees a smooth surface.
For gradients, select the torch backend in float64 and make a surface's points a leaf:
import optiland.backend as be
be.set_backend("torch")
be.set_precision("float64")
be.grad_mode.enable()
geometry = op.surfaces.surfaces[1].geometry
geometry.points = geometry.points.detach().clone().requires_grad_(True)
# trace, compute a merit, merit.backward(); geometry.points.grad holds the gradient
What it covers
- Refraction-only lenses whose faces are surfaces of revolution, one spline span per face, from the axis to the rim.
- Not mirrors or total internal reflection, which do not fit a sequential trace; not Optiland's non-sequential engine, which has no plugin hook; not faces made of several spans.
The reader refuses what it cannot represent, and says why.
How it is checked
On the RR lens of Chaves, Introduction to Nonimaging Optics, Example 9.1 (tests/fixtures/):
- the surface reproduces the profile's samples (sag to 1e-15, normals to 1e-13 rad) and its curve between them;
- numpy and torch trace the same rays to 1e-11 (Optiland's solve stops at its own tolerance);
- the gradient agrees with a central finite difference to 1e-5 relative (1e-6 measured).
pip install -e ".[dev]"
pytest
Citing
If you use this software, please cite it, and the ray-tracing-shapely project whose profiles it
reads. CITATION.cff carries the metadata for both; GitHub formats it from the Cite this
repository link.
This project: doi:10.5281/zenodo.24416270. That is the concept DOI, which always resolves to the latest release. Each release also has its own DOI, to cite when a result must be pinned to the exact version it came from.
ray-tracing-shapely: doi:10.5281/zenodo.23991020.
Licence
Apache-2.0. See NOTICE.txt.
Metadata
Release files for optiland-sms 0.1.1
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 | Actions |
|---|---|---|---|---|
| optiland_sms-0.1.1.tar.gz | 17.6 kB | With provenance | Details for optiland_sms-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| optiland_sms-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for optiland_sms-0.1.1-py3-none-any.whl |
Total release size: 32.9 kB
Release files / optiland_sms-0.1.1.tar.gz
| Download URL | optiland_sms-0.1.1.tar.gz |
|---|---|
| Size | 17.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d9d4b3d27be5be23c4d20fbce25b26102c7740f070c76744faad4ff4716d6086
|
|
BLAKE2b-256 checksum How to use checksums |
1c974e887ab89a5e0eb7531bff54dcd5c66724602646d9aa4b845faa15c2734d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 21, 2026.
Transparency logRelease files / optiland_sms-0.1.1-py3-none-any.whl
| Download URL | optiland_sms-0.1.1-py3-none-any.whl |
|---|---|
| Size | 15.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4f94b5a94f956700083aab6b2c4e7fcfa80593ef862d36e3b75c9ae761fdfe63
|
|
BLAKE2b-256 checksum How to use checksums |
512b20bebd0320e81259adb22f0544bb52f6a2fd9a000423b5caf88351067200
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 21, 2026.
Transparency logSecurity for optiland-sms 0.1.1
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for optiland_sms-0.1.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 21, 2026.
Transparency logA 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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.