def find_omega_min(omega, Nl, detuningsij, i_d, I_nd):
    r"""This function returns a list of length Nl containing the mininmal frequency
    that each laser excites.
    """
    omega_min = []
    omega_min_indices = []
    for l in range(Nl):
        omegas = sorted([(omega[i_d(p[0]+1)-1][i_d(p[1]+1)-1], p)
                         for p in detuningsij[l]])
        omega_min += [omegas[0][0]]
        omega_min_indices += [omegas[0][1]]
    return omega_min, omega_min_indices
r"""This function returns a list of length Nl containing the mininmal frequency
    that each laser excites.