fig, axs = plt.subplots(len(model_paths), 1, figsize=(6, 6))
    fig.subplots_adjust(top=0.875, bottom=0.075)
    fig.suptitle(
        f'{feature}:\nPosterior Probabilities of Mixture Model Components',
        y=0.95,
        size=10)
    for i, model_path in enumerate(model_paths):
        # Load model
        with open('/'.join(['out', feature, model_path])) as file:
            dist_names, params, params_fix, weights, name = json.load(file)
        dists = [dists_dict[dist_name] for dist_name in dist_names]
        mixmod = MixtureModel(dists, params, params_fix, weights, name)

        # Create heatmap
        data = rates.loc[rates[feature] != 0, feature].sort_values()
        expts = mixmod.posterior(data)

        # Plot heatmap
        ax = axs[i]
        ax.imshow(expts,
                  vmin=0,
                  vmax=1,
                  aspect='auto',
                  extent=[0, len(data), 0, len(mixmod.dists)])
        ax.set_aspect(0.035 * len(data))
        ax.set_title(mixmod.name, size=8)
        ax.tick_params(labelsize=7.5)
        ax.set_yticks([i + 0.5 for i in range(len(mixmod.dists))])
        ax.set_yticklabels([dist.name for dist in dists])
        if i != len(model_paths) - 1:
            ax.tick_params(labelbottom=False)
rates = {}
counts = {}
fracs = {}
for feature in pics_lt:
    # Load model, sorting components by scale and instantiating distributions from names
    with open(f'../mixture_pic/out/{feature}/model_{model_paths[feature]}.json') as file:
        model = json.load(file)
    model_params, name = model[:-1], model[-1]
    dist_names, params, params_fix, weights = [list(x) for x in zip(*sorted(zip(*model[:-1]), key=lambda y: y[1]['scale']))]
    dists = [dists_dict[dist_name] for dist_name in dist_names]
    mixmod = MixtureModel(dists, params, params_fix, weights, name)

    # Remove extremes
    raw = pics_lt[feature]
    idx = np.flatnonzero(mixmod.posterior(raw)[-1] < thresh)
    clean = raw[idx]
    rates[feature] = (clean ** 2).groupby('block_id').mean()

    # Count extremes
    counts[feature] = len(raw) - len(clean)
    fracs[feature] = (len(raw) - len(clean)) / (len(raw) - (raw == 0).sum())  # Fraction of non-zero contrasts

    # Plot histograms of contrast counts in each block
    y = clean.groupby('block_id').count().value_counts()
    plt.bar(y.index, y)
    plt.title(f'{feature}: Contrast Counts in Blocks')
    plt.ylabel('Count')
    plt.xlabel('Number of Contrasts in Block')
    plt.xlim(0, 10)
    plt.savefig(f'out/bar_{feature}.png')