OSLO (.len) File Import Demo

This notebook demonstrates how to import an OSLO (.len) file into Optiland using the load_oslo_file function.

[1]:
from optiland.fileio import load_oslo_file
from optiland import analysis

Loading a sample file

We will load a sample OSLO file from the Optiland test suite. This file includes an explicit aperture stop (AST).

[7]:
# Path to the sample OSLO file
file_path = '../../../tests/test_fileio/oslo/cox3_07.len'  # located in test directory

# Load the lens
lens = load_oslo_file(file_path)

lens.set_aperture("EPD", 0.2)
lens.updater.image_solve()

# Display lens info
lens.info()
╒════╤═══════════════╤═══════════╤════════════╤═════════════╤═══════════════╤═════════╤═════════════════╕
│    │ Type          │ Comment   │     Radius │   Thickness │ Material      │   Conic │   Semi-aperture │
╞════╪═══════════════╪═══════════╪════════════╪═════════════╪═══════════════╪═════════╪═════════════════╡
│  0 │ Planar        │           │ inf        │  inf        │ Air           │       0 │       0.329883  │
│  1 │ Standard      │           │   1        │    0.165    │ 1.5640, 55.80 │       0 │       0.33      │
│  2 │ Standard      │           │  -0.580686 │    0.035    │ SF5           │       0 │       0.33      │
│  3 │ Standard      │           │  -2.31481  │    0.002    │ Air           │       0 │       0.33      │
│  4 │ Standard      │           │   0.3306   │    0.172    │ F7            │       0 │       0.260264  │
│  5 │ Standard      │           │   0.224502 │    0.132    │ Air           │       0 │       0.147163  │
│  6 │ Stop - Planar │           │ inf        │    0.13     │ Air           │       0 │       0.0601927 │
│  7 │ Standard      │           │  -0.3111   │    0.052    │ F8            │       0 │       0.255     │
│  8 │ Standard      │           │   1.72117  │    0.124    │ SK16          │       0 │       0.255     │
│  9 │ Standard      │           │  -0.387597 │    0.002    │ Air           │       0 │       0.255     │
│ 10 │ Standard      │           │   2.62467  │    0.083    │ SK16          │       0 │       0.3       │
│ 11 │ Standard      │           │  -0.865127 │    0.552114 │ Air           │       0 │       0.3       │
│ 12 │ Planar        │           │ inf        │  nan        │ Air           │       0 │       0.364743  │
╘════╧═══════════════╧═══════════╧════════════╧═════════════╧═══════════════╧═════════╧═════════════════╛

C:\Users\kdani\Documents\Python_Scripts\optiland\optiland\fileio\oslo\reader\converter.py:203: FutureWarning: The default model for AbbeMaterial will change from 'polynomial' to 'buchdahl' in v0.7.0. The 'buchdahl' model offers improved accuracy. To silence this warning, specify `model='polynomial'` explicitly if you intended to use the legacy model, or switch to `model='buchdahl'`.
  return AbbeMaterial(nd, vd)

Visualizing the Lens

We can draw the lens layout to verify the import.

[8]:
_ = lens.draw()
../../_images/gallery_miscellaneous_oslo_import_demo_5_0.png

Analysis

Generate a spot diagram to assessment performance.

[9]:
spot = analysis.SpotDiagram(lens)
_ = spot.view()
../../_images/gallery_miscellaneous_oslo_import_demo_7_0.png
[ ]: