def mge_1d(r_array, flux_r, N=20):
    """

    :param r_array: list or radii (numpy array)
    :param flux_r: list of flux values (numpy array)
    :param N: number of Gaussians
    :return: amplitudes and Gaussian sigmas for the best 1d flux profile
    """
    try:
        amplitudes, sigmas, norm = _mge_1d(r_array, flux_r, N)
    except:
        N_new = N - 1
        if N_new == 0:
            print("WARNING: Number of MGE went down to zero! This should not happen!")
            amplitudes = [1]
            sigmas = [1]
            norm = 0
        else:
            amplitudes, sigmas, norm = mge_1d(r_array, flux_r, N=N_new)
    return amplitudes, sigmas, norm
def mge_1d ( r_array , flux_r , N = 20 ) : try : amplitudes , sigmas , norm = _mge_1d ( r_array , flux_r , N ) except : N_new = N - 1 if N_new == 0 : print ( "WARNING: Number of MGE went down to zero! This should not happen!" ) amplitudes = [ 1 ] sigmas = [ 1 ] norm = 0 else : amplitudes , sigmas , norm = mge_1d ( r_array , flux_r , N = N_new ) return amplitudes , sigmas , norm
:param r_array: list or radii (numpy array)
    :param flux_r: list of flux values (numpy array)
    :param N: number of Gaussians
    :return: amplitudes and Gaussian sigmas for the best 1d flux profile