@classmethod
def calc_optimal_distance(cls, wavefront):
    """Based on [2], this function calulates the optimal distance of
        propagation:
        :math:`z = \\frac{N\\left( \\Delta x \\right)^2}{\\lambda}`
        for given `wavefront`.

        :return: The optimal distance of propagate
        :rtype: astropy.Quantity of type length

        >>> import astropy.units as u
        >>> import pyoptica as po
        >>>
        >>> wavelength = 633 * u.nm
        >>> pixel_scale = 100 * u.nm
        >>> npix = 2048
        >>> distance = 60 * u.um
        >>> wf = po.Wavefront(wavelength, pixel_scale, npix)
        >>> fs = po.FreeSpace(distance, "ASPW")
        >>> fs.calc_optimal_distance(wf)
        <Quantity 32.35387 um>

        """
    pixel_scale = wavefront.pixel_scale
    wavelength = wavefront.wavelength
    npix = wavefront.npix
    z = (pixel_scale ** 2 * npix / wavelength).decompose()
    return z
