Skip to content

Commit 11c5bcc

Browse files
Merge pull request #41 from HarrisonKramer/feat/aspheres
Feat/aspheres
2 parents 261860c + 5a97f4e commit 11c5bcc

File tree

20 files changed

+400
-11
lines changed

20 files changed

+400
-11
lines changed

docs/api/api_geometries.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ that require a numerical solution to find the intersection point with a ray.
1414
geometries.base
1515
geometries.chebyshev
1616
geometries.even_asphere
17+
geometries.odd_asphere
1718
geometries.newton_raphson
1819
geometries.plane
1920
geometries.polynomial

docs/developers_guide/geometry_overview.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ Optiland includes a wide range of built-in geometries:
5050
- **Planes**: Flat surfaces with infinite or finite extent.
5151
- **Spheres and Conics**: Defined by radius of curvature and conic constant.
5252
- **Even Aspheres**: Described by polynomial terms for deviations from a sphere.
53+
- **Odd Aspheres**: Similar to even aspheres but with additional terms for odd powers.
5354
- **Polynomial XY and Chebyshev Surfaces**: Useful for advanced freeform optical systems.
5455
- **Custom Geometries**: Users can easily extend the framework by subclassing the `BaseGeometry` (analytical geometries) or `NewtonRaphsonGeometry` (iterative geometries) classes.
5556

docs/gallery/specialized_lenses.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ While these lenses are perhaps more complex, they are built using the same basic
1010
specialized_lenses/objective
1111
specialized_lenses/f_theta_lens
1212
specialized_lenses/f_theta_with_fold_mirror
13+
specialized_lenses/odd_asphere
1314
specialized_lenses/microscope
1415
specialized_lenses/catadioptric
1516
specialized_lenses/endoscope

docs/gallery/specialized_lenses/odd_asphere.ipynb

Lines changed: 103 additions & 0 deletions
Large diffs are not rendered by default.

optiland/fileio/converters.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def _configure_surface_coefficients(self, data):
7373
surf_type = data['type']
7474
if surf_type == 'standard':
7575
return None
76-
elif surf_type == 'even_asphere':
76+
elif surf_type in ['even_asphere', 'odd_asphere']:
7777
coefficients = []
7878
for k in range(8):
7979
coefficients.append(data[f'param_{k}'])

optiland/fileio/zemax_handler.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,8 @@ def _read_surf_type(self, data):
418418
data (list): List of data values extracted from the Zemax file.
419419
"""
420420
type_map = {'STANDARD': 'standard',
421-
'EVENASPH': 'even_asphere'}
421+
'EVENASPH': 'even_asphere',
422+
'ODDASPHE': 'odd_asphere'}
422423
try:
423424
self._current_surf_data['type'] = type_map[data[1]]
424425
except KeyError:

optiland/geometries/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@
55
from .standard import StandardGeometry
66
from .newton_raphson import NewtonRaphsonGeometry
77
from .even_asphere import EvenAsphere
8+
from .odd_asphere import OddAsphere
89
from .polynomial import PolynomialGeometry
910
from .chebyshev import ChebyshevPolynomialGeometry

optiland/geometries/base.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ def __init_subclass__(cls, **kwargs):
2525
super().__init_subclass__(**kwargs)
2626
BaseGeometry._registry[cls.__name__] = cls
2727

28+
def __str__(self):
29+
return f'{self.__class__.__name__}' # pragma: no cover
30+
2831
@abstractmethod
2932
def sag(self, x=0, y=0):
3033
"""Calculate the surface sag of the geometry.

optiland/geometries/chebyshev.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ def __init__(self, coordinate_system, radius, conic=0.0,
6666
self.norm_y = norm_y
6767
self.is_symmetric = False
6868

69+
def __str__(self):
70+
return 'Chebyshev Polynomial'
71+
6972
def sag(self, x=0, y=0):
7073
"""
7174
Calculates the sag of the Chebyshev polynomial surface at the given

optiland/geometries/even_asphere.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ def __init__(self, coordinate_system, radius, conic=0.0,
4949
super().__init__(coordinate_system, radius, conic, tol, max_iter)
5050
self.c = coefficients
5151
self.is_symmetric = True
52+
self.order = 2 # used for optimization scaling
53+
54+
def __str__(self):
55+
return 'Even Asphere'
5256

5357
def sag(self, x=0, y=0):
5458
"""

0 commit comments

Comments
 (0)