def remnant_mass(eta, ns_g_mass, ns_sequence, chi, incl, shift):
    """
    Function that determines the remnant disk mass of
    an NS-BH system using the fit to numerical-relativity
    results discussed in Foucart PRD 86, 124007 (2012).

    Parameters
    -----------
    eta: float
        the symmetric mass ratio of the binary
    ns_g_mass: float
        NS gravitational mass (in solar masses)
    ns_sequence: 3D-array
        contains the sequence data in the form NS gravitational
         mass (in solar masses), NS baryonic mass (in solar
         masses), NS compactness (dimensionless)
    chi: float
        the BH dimensionless spin parameter
    incl: float
        the inclination angle between the BH spin and the orbital
        angular momentum in radians
    shift: float
        an amount to be subtracted to the remnant mass predicted
        by the model (in solar masses)

    Returns
    ----------
    remnant_mass: float
        The remnant mass in solar masses
    """
    # Sanity checks
    if not (eta>0. and eta<=0.25 and abs(chi)<=1):
        print('The BH spin magnitude must be <=1 and eta must be between 0 and 0.25')
        print('This script was launched with ns_mass={0}, eta={1}, chi={2}, inclination={3}\n'.format(ns_g_mass, eta, chi, incl))
        raise Exception('Unphysical parameters!')

    # Binary mass ratio define to be > 1
    q = (1+math.sqrt(1-4*eta)-2*eta)/eta*0.5

    # NS compactness and rest mass
    ns_compactness = ns_g_mass_to_ns_compactness(ns_g_mass, ns_sequence)
    ns_b_mass = ns_g_mass_to_ns_b_mass(ns_g_mass, ns_sequence)

    # Sanity checks
    if not (ns_compactness>0 and q>=1):
        print('A positive NS compactness and a mass ratio that is >1 must be obtained.')
        print('This script was launched with ns_mass={0}, eta={1}, chi={2}, inclination={3}'.format(ns_b_mass, eta, chi, incl))
        print('and obtained ns_compactness={0} and q={1}.'.format(ns_compactness, q))
        print('SOMETHING WENT WRONG!!\n')
        raise Exception('Unphysical parameters!')

    # Calculate the dimensionless parameter kappa
    kappa = q*ns_compactness

    # Effective equatorial spin parameter needed to determine the torus mass*)
    chi_eff = bh_effective_spin(chi, incl)

    #Sanity checks
    if not abs(chi_eff)<=1:
        print('The effective BH spin magnitude must be <=1')
        print('This script was launched with ns_mass={0}, eta={1}, chi={2}, inclination={3}'.format(ns_b_mass, eta, chi, incl))
        print('and obtained chi_eff={0}.'.format(chi_eff))
        print('SOMETHING WENT WRONG!!\n')
        raise Exception('Unphysical parameters!')

    # Taking the 1st element with full_output=1 avoids some annoying messages on stdout
    xi = scipy.optimize.fsolve(xi_eq, 100., args=(kappa,chi_eff,q), full_output=1)[0]

    # Fit parameters and tidal correction
    alpha = 0.296 # +/- 0.011
    beta  = 0.171 # +/- 0.008
    # The remnant mass over the NS rest mass
    remnant_mass = alpha*xi*(1-2*ns_compactness)-beta*kappa*PG_ISSO_solver(chi_eff,0)

    # The remnant mass in the same units as the NS rest mass (presumably solar masses)
    remnant_mass = remnant_mass*ns_b_mass - shift

    return remnant_mass
Function that determines the remnant disk mass of
    an NS-BH system using the fit to numerical-relativity
    results discussed in Foucart PRD 86, 124007 (2012).

    Parameters
    -----------
    eta: float
        the symmetric mass ratio of the binary
    ns_g_mass: float
        NS gravitational mass (in solar masses)
    ns_sequence: 3D-array
        contains the sequence data in the form NS gravitational
         mass (in solar masses), NS baryonic mass (in solar
         masses), NS compactness (dimensionless)
    chi: float
        the BH dimensionless spin parameter
    incl: float
        the inclination angle between the BH spin and the orbital
        angular momentum in radians
    shift: float
        an amount to be subtracted to the remnant mass predicted
        by the model (in solar masses)

    Returns
    ----------
    remnant_mass: float
        The remnant mass in solar masses