Catalog PyPI
PACKAGE EXPLORERView in registry

abbeflow

PyPI

A learned prior over the optical glass manifold for realistic glass selection in lens design.

Versions collected1
Direct dependencies6From release 0.2.0
Last observed20 Oct, 17:11 UTC

README

Version 0.2.0 documentation

AbbeFlow Diagram

AbbeFlow

PyPI version CI PyTorch Python License: MIT Prior: Neural Spline Flow

AbbeFlow is a differentiable, normalizing-flow-based learned prior over the optical glass catalog manifold. Trained on approximately 1,700 real glasses from major manufacturers (including Schott, Ohara, Hoya, and others), AbbeFlow models the distribution of physical glasses in a 4D Buchdahl dispersion coefficient space. It enables continuous, gradient-based lens optimization while ensuring that glass choices remain on or near the realizable manifold.

For details on the mathematical modeling and formulation, see the Theoretical Background documentation.


Installation

Install AbbeFlow via pip:

pip install abbeflow

Core Optimization Paradigms

AbbeFlow supports two main paradigms for continuous glass optimization:

  1. Manifold Penalty Mode: Optimize refractive index $n_d$ and Abbe number $V_d$ directly, adding a regularizing penalty based on the negative log-probability under the learned prior to the optical merit function: $$\mathcal{L} = \mathcal{L}{\text{aberration}} - \lambda{\text{glass}} \log p(n_d, V_d)$$
  2. Latent Space Optimization: Optimize directly in the unconstrained 4D latent space $\mathbf{z} \in \mathbb{R}^4$, mapping back to the physical glass manifold via the decoder $\mathbf{x} = f^{-1}(\mathbf{z})$, which guarantees physically realistic glass parameters.

Quick Start

AbbeFlow provides a pretrained GlassFlow model ready for inference:

from abbeflow import GlassFlow

# Load the pretrained model
gf = GlassFlow.pretrained()

# Compute the log-probability of a glass (manifold prior penalty)
logp = gf.log_prob(nd=1.517, vd=64.2)
print(f"Log probability: {logp.item():.4f}")

# Encode to and decode from the latent space
z = gf.encode(nd=1.517, vd=64.2)
glass = gf.decode(z)
print(f"Decoded glass: nd={glass.nd:.4f}, vd={glass.vd:.2f}")

# Snap to the nearest real catalog glasses
matches = gf.nearest_real(nd=1.517, vd=64.2, k=3)
print("\nNearest catalog glasses:")
for match in matches:
    print(f" - {match.manufacturer} {match.name} (Distance: {match.distance:.4f})")

Examples

The following examples are located in the examples/ directory and demonstrate how to integrate AbbeFlow into various workflows:


API Reference

A detailed overview of all modules, classes, and methods is available in the API Reference documentation.


License

AbbeFlow is released under the MIT License.

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 1

Collected releases
VersionPublishedDirect dependenciesOpen version
0.2.02 Jul 20266

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Repository

PENDING
harrisonkramer/abbeflow

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 17:11 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:590c02342a9e9fcf19a7ed36fc0f6711c1fc995604ef7cc81de7bb58b96426a3