import pickle


def load_dubm(fpath):
    """Load diagonal UBM parameters.

    Parameters
    ----------
    fpath : Path
        Path to pickled UBM model.

    Returns
    -------
    m
    iE
    w
    """
    with open(fpath, "rb") as f:
        params = pickle.load(f)
    m = params["<MEANS_INVVARS>"] / params["<INV_VARS>"]
    iE = params["<INV_VARS>"]
    w = params["<WEIGHTS>"]
    return m, iE, w