def endx(eta,merger_type):
    """
    Gives ending value/upper boundary for integration of post-Newtonian
    parameter, based on Buskirk et al. (2019) equation 23.
    
    Parameters
    ----------
    eta: float
        Symmetric mass ratio of the binary, can be obtained from
        get_M_and_eta().
    merger_type: string
        'BH' for a BH-BH merger, 'NS' for a BH-NS or NS-NS merger
        
    Returns
    -------
    value: float
        The ending value for the post-Newtonian integration.
    """
    
    #input type checking
    assert type(eta) == float, 'eta should be a float.'
    
    if merger_type == 'BH':
        value = (1/3)*(1 + (7/18)*eta)
        #Buskirk eq. 23, with 1/6 -> 1/3 to ensure overlap with merger portion
        #for the matching script
    elif merger_type == 'NS':
        value = (1/6)*(1 + (7/18)*eta)                  #Buskirk eq. 23
        #1/6 because 3RSch is the ISCO for BH-NS and approx. the touching point
        #for NS-NS, so the end condition for both
    else:
        raise ValueError('merger_type must be either \'BH\' for BH-BH or '
                         '\'NS\' for BH-NS or NS-NS.')
    return value