def build_weights(realizations, imt_dt):
    """
    :returns: an array with the realization weights of shape (R, M)
    """
    arr = numpy.zeros((len(realizations), len(imt_dt.names)))
    for m, imt in enumerate(imt_dt.names):
        arr[:, m] = [rlz.weight[imt] for rlz in realizations]
    return arr
:returns: an array with the realization weights of shape (R, M)