Optical Prescription Report

Optiland features a powerful, automated Prescription Report Generator that automatically extracts and formats system properties, surface geometry, materials, and aberrations into standard professional reports.

Optional Dependencies

To use all rendering options of the prescription generator, you must install the optional dependencies: - All Features (Console and PDF): pip install optiland[prescription] - Console-only (Requires rich): pip install optiland[prescription-console] - PDF-only (Requires reportlab): pip install optiland[prescription-pdf]

[1]:
from optiland.samples.objectives import CookeTriplet
from optiland.prescription import Prescription

Loading a Sample System

Let’s load the classic Cooke Triplet objective lens sample system.

[2]:
lens = CookeTriplet()

Printing the Prescription to the Console

To view the report instantly inside your console or terminal, use the .view() method. This utilizes the rich library to draw clean, beautifully formatted tables and sections.

[3]:
prescription = Prescription(lens)
prescription.view()
╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
Optical Prescription — Unnamed System
╰──────────────────────────────────────── Generated: 2026-05-20 15:35 UTC ────────────────────────────────────────╯
───────────────────────────────────────────────── System Overview ─────────────────────────────────────────────────
  Name              (unnamed)   
  Surfaces          6           
  Stop Surface      4.0000      
  Aperture Type     EPDAperture 
  Aperture Value    10.0000     
  Object Distance  
  Image Distance    42.2078     

 Wavelengths
  #   Wavelength (µm)   Primary 
 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  1   0.4800
  2   0.5500           
  3   0.6500

 Fields
  #   Type         X        Y         Weight 
 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  1   AngleField   0.0000   0.0000    1.0000
  2   AngleField   0.0000   14.0000   1.0000 
  3   AngleField   0.0000   20.0000   1.0000

───────────────────────────────────────────── First-Order Properties ──────────────────────────────────────────────
  Effective Focal Length (EFL)   49.9998  
  Front Focal Length (FFL)       -49.9998 
  Back Focal Length (BFL)        0.2071   
  Front Principal Plane (P1)     12.6541  
  Back Principal Plane (P2)      -49.7927 
  Front Nodal Plane (N1)         12.6541  
  Back Nodal Plane (N2)          -49.7927 
  Image-Space F/#                5.0000   
  Entrance Pupil Diameter        10.0000  
  Entrance Pupil Location        11.5122  
  Exit Pupil Diameter            10.2337  
  Exit Pupil Location            -50.9613 
  Transverse Magnification       -0.0000  
  Lagrange Invariant             -1.8199  

───────────────────────────────────────────── Surface Data — Geometry ─────────────────────────────────────────────
  S#   Type       Radius (mm)   Thickness (mm)   Conic    Stop   Comment 
 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  0    Plane      ∞             ∞                —
  1    standard   22.0136       3.2590           0.0000                  
  2    standard   -435.7604     6.0076           0.0000
  3    standard   -22.2133      1.0000           0.0000                  
  4    standard   20.2919       4.7504           0.0000   ✓
  5    standard   79.6836       2.9521           0.0000                  
  6    standard   -18.3953      42.2078          0.0000
  7    standard    0.0000                           

──────────────────────────────────────────── Surface Data — Materials ─────────────────────────────────────────────
  S#   Material   nd       Vd        Semi-Diameter (mm)   Coating 
 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  0    Air        1.0000   —         —                    —
  1    SK16       1.6204   60.2809   
  2    Air        1.0000   —         —                    —
  3    F2         1.6200   36.3665   
  4    Air        1.0000   —         —                    —
  5    SK16       1.6204   60.2809   
  6    Air        1.0000   —         —                    —
  7    Air        1.0000    

───────────────────────────────────────── Seidel Aberration Coefficients ──────────────────────────────────────────
  S#      SI (Sph)    SII (Coma)   SIII (Astig)   SIV (Petz)   SV (Dist)   CL (LCA)    CT (TCA)  
 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  1       -0.013855   -0.010591    -0.008096      -0.057727    -0.050318   -0.014412   -0.011017
  2       -0.011256   0.035011     -0.108897      -0.002916    0.347781    -0.010088   0.031376  
  3       0.052115    -0.081389    0.127106       0.057268     -0.287939   0.031745    -0.049577
  4       0.024135    0.043874     0.079756       0.062690     0.258946    0.021172    0.038488  
  5       -0.004080   -0.016132    -0.063784      -0.015948    -0.315255   -0.006189   -0.024472
  6       -0.054020   0.030462     -0.017178      -0.069082    0.048643    -0.017462   0.009847  
  Total   -0.006960   0.001235     0.008907       -0.025716    0.001859    0.004767    -0.005356

Explaining Report Sections

By default, the report generates five standard sections: 1. System Overview: General details, wavelengths, and field definitions. 2. First-Order Properties: Paraxial parameters (EFL, F-Number, magnification, pupil parameters). 3. Surface Data - Geometry: Radii of curvature, thicknesses, stop designations, and conic constants. 4. Surface Data - Materials: Material names and corresponding refractive indices (\(n_d\), \(V_d\)). 5. Seidel Aberration Coefficients: Monochromatic and chromatic Seidel aberrations per surface and system totals.

Customizing Sections

You can customize and re-order the sections included in your report by passing a list of section instances to the Prescription constructor:

[4]:
from optiland.prescription.sections import FirstOrderSection, SurfaceGeometryTableSection

# Create a prescription containing only first-order and surface geometry data
custom_sections = [
    FirstOrderSection(),
    SurfaceGeometryTableSection()
]

custom_prescription = Prescription(lens, sections=custom_sections)
custom_prescription.view()
╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
Optical Prescription — Unnamed System
╰──────────────────────────────────────── Generated: 2026-05-20 15:35 UTC ────────────────────────────────────────╯
───────────────────────────────────────────── First-Order Properties ──────────────────────────────────────────────
  Effective Focal Length (EFL)   49.9998  
  Front Focal Length (FFL)       -49.9998 
  Back Focal Length (BFL)        0.2071   
  Front Principal Plane (P1)     12.6541  
  Back Principal Plane (P2)      -49.7927 
  Front Nodal Plane (N1)         12.6541  
  Back Nodal Plane (N2)          -49.7927 
  Image-Space F/#                5.0000   
  Entrance Pupil Diameter        10.0000  
  Entrance Pupil Location        11.5122  
  Exit Pupil Diameter            10.2337  
  Exit Pupil Location            -50.9613 
  Transverse Magnification       -0.0000  
  Lagrange Invariant             -1.8199  

───────────────────────────────────────────── Surface Data — Geometry ─────────────────────────────────────────────
  S#   Type       Radius (mm)   Thickness (mm)   Conic    Stop   Comment 
 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  0    Plane      ∞             ∞                —
  1    standard   22.0136       3.2590           0.0000                  
  2    standard   -435.7604     6.0076           0.0000
  3    standard   -22.2133      1.0000           0.0000                  
  4    standard   20.2919       4.7504           0.0000   ✓
  5    standard   79.6836       2.9521           0.0000                  
  6    standard   -18.3953      42.2078          0.0000
  7    standard    0.0000                           

Saving and Exporting Reports

You can save the report to a file using the .save(path) method. The file output format is automatically inferred from the file extension: - Plain Text (``.txt``, ``.log``, etc.): Renders standard plain-text tables. - PDF (``.pdf``): Generates a professional PDF document.

[5]:
# Export as plain-text
prescription.save("cooke_triplet_prescription.txt")

# Export as a formatted PDF document
prescription.save("cooke_triplet_prescription.pdf")