def mag_to_fno(mag, infinite_fno, pupil_mag=1):
    """Compute the working f/# from the magnification and infinite f/#.

    Parameters
    ----------
    mag : `float` or `numpy.ndarray`
        linear or lateral magnification
    infinite_fno : `float`
        f/# as defined by EFL/EPD
    pupil_mag : `float`
        pupil magnification

    Returns
    -------
    `float`
        working f/number

    """
    return (1 + abs(mag) / pupil_mag) * infinite_fno