def take_24_near_apo(original_weights):
    """
    :param original_weights: dict
    :return: dict
    """
    new_weights = equalize_system_weights(original_weights)
    ordered_snapshots = load_algdock_snapshots_for_each_of_six_yank_systems()

    for system in new_weights["systems"].keys():
        for i, snapshot in enumerate(ordered_snapshots[system]):
            if i < len(ordered_snapshots[system]) - 24:
                new_weights[system][snapshot] = 0.
    return new_weights
def take_6_holo(original_weights):
    """
    only snapshots from apo of YANK states get nonzero weights
    :param original_weights: dict
    :return: new_weights
    """
    new_weights = equalize_system_weights(original_weights)
    ordered_snapshots = load_algdock_snapshots_for_each_of_six_yank_systems()

    for system in new_weights["systems"].keys():
        for i, snapshot in enumerate(ordered_snapshots[system]):
            if i < 6:
                new_weights[system][snapshot] = 1.
            else:
                new_weights[system][snapshot] = 0.

    return new_weights
    g_mean = w.groupby(state_indices).mean()
    states = []
    mean_w = []
    for i, v in g_mean.iteritems():
        states.append(i)
        mean_w.append(v)

    return np.array(states, dtype=int), np.array(mean_w, dtype=float)


# take single_snap_weights
block_weights, state_weights, single_snap_weights, stru_group_weights_equal_sys, stru_group_weights_ub_weighted = load_mbar_weights(
)

algdock_snapshots_for_each_of_six_yank_systems = load_algdock_snapshots_for_each_of_six_yank_systems(
)

ligand_names = {}
ligand_names["lysozyme.active.A__ABJ"] = "n-hexylbenzene"
ligand_names["benzene.A__AAA"] = "benzene"
ligand_names["lysozyme.inactive.A__AAS"] = "($\pm$)-camphor"
ligand_names["1-methylpyrrole.A__AAA"] = "methylpyrrole"
ligand_names["phenol.A__AAA"] = "phenol"
ligand_names["p-xylene.A__AAA"] = "p-xylene"

legends = [ligand_names[ligand] for ligand in SIX_YANK_SYSTEMS]

xs = []
ys = []
for ligand in SIX_YANK_SYSTEMS:
    print ligand