Skip to content

Abcd Matrices¤

abcd_surface_power

abcdlux_patch.abcd_surface_power(power) ¤

Source code in abcdlux_patch.py
17
18
19
20
21
def abcd_surface_power(power: float | Array) -> Array:
    p = np.asarray(power).reshape(())
    M = np.eye(2, dtype=p.dtype)
    M = M.at[1, 0].set(-p)
    return M
abcd_lens

abcdlux_patch.abcd_lens(focal_length) ¤

Source code in abcdlux_patch.py
24
25
26
def abcd_lens(focal_length: float | Array) -> Array:
    f = np.asarray(focal_length).reshape(())
    return abcd_surface_power(1.0 / f)
abcd_mirror

abcdlux_patch.abcd_mirror(radius) ¤

Source code in abcdlux_patch.py
29
30
def abcd_mirror(radius: float) -> Array:
    return abcd_surface_power(2.0 / radius)
abcd_free_space

abcdlux_patch.abcd_free_space(z) ¤

Source code in abcdlux_patch.py
33
34
35
36
37
def abcd_free_space(z: float | Array) -> Array:
    z = np.asarray(z).reshape(())  # force scalar (0-d)
    M = np.eye(2, dtype=z.dtype)
    M = M.at[0, 1].set(z)
    return M
abcd_fraunhofer

abcdlux_patch.abcd_fraunhofer(focal_length) ¤

Source code in abcdlux_patch.py
40
41
def abcd_fraunhofer(focal_length: float) -> Array:
    return np.array([[0.0, focal_length], [-1.0 / focal_length, 0.0]])
compose_abcd

abcdlux_patch.compose_abcd(matrices) ¤

Source code in abcdlux_patch.py
44
45
46
47
48
def compose_abcd(matrices: list | tuple) -> Array:
    M = np.eye(2)
    for Mi in matrices:
        M = Mi @ M
    return M