Skip to content

Optics Utility Functions

This module contains a number of common equations used in optics, such as converting between Optical Path Difference (OPD) and phase, and a few functions used to calculate sampling rates in focal planes.


wavenumber

Calculates the wavenumber of a given wavelength.

Parameters:

Name Type Description Default
wavelength (Array, metres)

The wavelength to calculate the wavenumber for.

required

Returns:

Name Type Description
wavenumber (Array, radians / meter)

The wavenumber of the input wavelength.

Source code in src/dLux/utils/optics.py
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
def wavenumber(wavelength: float) -> float:
    """
    Calculates the wavenumber of a given wavelength.

    Parameters
    ----------
    wavelength : Array, metres
        The wavelength to calculate the wavenumber for.

    Returns
    -------
    wavenumber : Array, radians/meter
        The wavenumber of the input wavelength.
    """
    return 2 * np.pi / wavelength
opd2phase

Converts the input Optical Path Difference (opd) in units of meters to phases in units of radians for the given wavelength.

Parameters:

Name Type Description Default
opd (Array, metres)

The Optical Path Difference (opd) to be converted into phase.

required
wavelength (Array, metres)

The wavelength at which to calculate the phase for.

required

Returns:

Name Type Description
phase (Array, radians)

The equivalent phase value for the given opd and wavelength.

Source code in src/dLux/utils/optics.py
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
def opd2phase(opd: Array, wavelength: float) -> Array:
    """
    Converts the input Optical Path Difference (opd) in units of meters to phases in
    units of radians for the given wavelength.

    Parameters
    ----------
    opd : Array, metres
        The Optical Path Difference (opd) to be converted into phase.
    wavelength : Array, metres
        The wavelength at which to calculate the phase for.

    Returns
    -------
    phase : Array, radians
        The equivalent phase value for the given opd and wavelength.
    """
    return wavenumber(wavelength) * opd
phase2opd

Converts the input phase in units of radians to the equivalent Optical Path Difference (OPD) in metres for the given wavelength.

Parameters:

Name Type Description Default
phase (Array, radians)

The phase to be converted into OPD

required
wavelength (Array, metres)

The wavelength at which to calculate the OPD for.

required

Returns:

Name Type Description
opd (Array, metres)

The equivalent opd value for the given phase and wavelength.

Source code in src/dLux/utils/optics.py
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
def phase2opd(phase: Array, wavelength: float) -> Array:
    """
    Converts the input phase in units of radians to the equivalent Optical Path
    Difference (OPD) in metres for the given wavelength.

    Parameters
    ----------
    phase : Array, radians
        The phase to be converted into OPD
    wavelength : Array, metres
        The wavelength at which to calculate the OPD for.

    Returns
    -------
    opd : Array, metres
        The equivalent opd value for the given phase and wavelength.
    """
    return phase / wavenumber(wavelength)
fringe_size

Calculates the linear size of the diffraction fringes.

Parameters:

Name Type Description Default
wavelength (Array, metres)

The wavelength at which to calculate the diffraction fringe for.

required
diameter (Array, metres)

The diameter of the aperture.

required
focal_length Array, float = None

The focal length of the optical system. If none is provided, the fringe size is given in units of radians, else it is given in units of metres.

None

Returns:

Name Type Description
fringe_size (Array, radians, meters)

The fringe size. Has units of radians of focal length is None, else meters.

Source code in src/dLux/utils/optics.py
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
def fringe_size(
    wavelength: float, diameter: float, focal_length: float = None
) -> Array:
    """
    Calculates the linear size of the diffraction fringes.

    Parameters
    ----------
    wavelength : Array, metres
        The wavelength at which to calculate the diffraction fringe for.
    diameter : Array, metres
        The diameter of the aperture.
    focal_length : Array, float = None
        The focal length of the optical system. If none is provided, the fringe
        size is given in units of radians, else it is given in units of metres.

    Returns
    -------
    fringe_size : Array, radians, meters
        The fringe size. Has units of radians of focal length is None, else meters.
    """
    if focal_length is None:
        return wavelength / diameter
    else:
        return wavelength * focal_length / diameter