def lin_interp(df, val):
    """Linerarly interpolates between two points.

    Specifically designed to find the relp corresponding to some value of n.

    Parameters
    ----------
    df : dataframe
        Contains raw data, realtaive pressure (relp) and amount adsorbed (n).

    Returns
    -------
    interp_val : float
        The relp corresponding to some n, between two (n, relp) points.

    """
    hindex = len(df[df["n"] <= val])
    if hindex == len(df):
        hindex = hindex - 1
    lindex = hindex - 1
    if hindex == 0:
        lindex = 0
        m = 0
    else:
        m = (df.loc[hindex, "relp"] - df.loc[lindex, "relp"]) / (
            df.loc[hindex, "n"] - df.loc[lindex, "n"]
        )

    b = df.loc[hindex, "relp"] - df.loc[hindex, "n"] * m

    interp_val = m * val + b
    return interp_val