def compute_loss_curves_maps(filename, builder, rlzi, monitor):
    """
    :param filename: path to the datastore
    :param builder: LossCurvesMapsBuilder instance
    :param rlzi: realization index
    :param monitor: Monitor instance
    :returns: rlzi, (curves, maps)
    """
    with datastore.read(filename) as dstore:
        rlzs = dstore['losses_by_event']['rlzi']
        losses = dstore['losses_by_event'][rlzs == rlzi]['loss']
    return rlzi, builder.build_curves_maps(losses, rlzi)
:param filename: path to the datastore
    :param builder: LossCurvesMapsBuilder instance
    :param rlzi: realization index
    :param monitor: Monitor instance
    :returns: rlzi, (curves, maps)