LensForge Icon

Using key paths

The object-oriented foundation that underpins LensForge uses the concepts of 'keys' and 'key paths'. A key is a word that specifies some pararameter that can be queried or varied. For instance, a surface has keys like thickness, curvature, and glass. To get at parameters of parameters, we use a key path, which is a string consisting of a sequence of keys delimited by the period character. For example, the reference index of the glass of a surface can be accessed by glass.referenceIndex.

The lens allows access to any surface via a key that is the letter 's' followed by the number of the surface. For example s5 for surface five. The key path for the thickness of this surface would be s5.thickness.

A partial list of lens keys:

f0, f1, etc. field #0, #1, etc. in the field array
g0, g1, etc. glass #0, #1, etc. in the glass array
s0, s1, etc. surface #0, #1, etc. in the surface array
lagrangeInvariant The Lagrange invariant for the lens
paraxialData A dictionary of paraxial design quantities

A partial list of surface keys:

thicknessthickness of the surface in mm
curvaturecurvature in 1/mm
radiusOfCurvatureradius of curvature in mm
glassglass (an object)

A partial list of ray keys:

x, y, z components of ray position
qx, qy, qz components of ray position (q-notation)
px, py, pz components of ray momentum
M.qxqx, M.qxpx, etc. Components of the ray's transfer matrix

See also