Exemple #1
0
            yi = np.loadtxt(yi_path, delimiter=',')
            lami_path = f'{path}/img/txt/lam{i}_best.txt'
            lami = np.loadtxt(lami_path, dtype=int)
            wi_path = f'{path}/img/txt/W{i}_best.txt'
            wi = np.loadtxt(wi_path)
            zi_path = f'{path}/img/txt/Z{i}_best.txt'
            zi = np.loadtxt(zi_path)

            # Plot
            plt.figure(figsize=(6, 6))
            plot_yz.plot_y_centroids(yi,
                                     lami,
                                     wi,
                                     vlim=(-3, 3),
                                     cm=blue2red.cm(6),
                                     population=population,
                                     Zi=zi,
                                     fs_xlabel=16,
                                     fs_ylabel=16,
                                     fs_xticks=16,
                                     fs_yticks=16)
            outpath = f'{path}/img/y{i}_centroid.pdf'
            plt.savefig(outpath, bbox_inches="tight")
            plt.close()

            # Plot Z estimate.
            plt.figure(figsize=(6, 6))
            plot_yz.plot_Z(Z_mean=zi,
                           wi_mean=wi,
                           lami_est=lami,
                           w_thresh=0.0,
        for i in (1, 2):
            # Read data
            yi_path = f'{path}/img/txt/y{i}_mean.csv'
            yi = np.loadtxt(yi_path, delimiter=',')
            lami_path = f'{path}/img/txt/lam{i}_best.txt'
            lami = np.loadtxt(lami_path, dtype=int)
            wi_path = f'{path}/img/txt/W{i}_best.txt'
            wi = np.loadtxt(wi_path)
            zi_path = f'{path}/img/txt/Z{i}_best.txt'
            Zi = np.loadtxt(zi_path)

            # Plot y centroids
            plt.figure(figsize=(6, 6))
            plot_yz.plot_y_centroids(yi,
                                     lami,
                                     wi,
                                     vlim=(-3, 3),
                                     cm=blue2red.cm(6),
                                     population=population,
                                     Zi=Zi,
                                     fs_xlabel=16,
                                     fs_ylabel=16,
                                     fs_xticks=14,
                                     fs_yticks=16,
                                     rotation=45,
                                     markernames=markernames,
                                     ha="right")
            outpath = f'{path}/img/y{i}_centroid.pdf'
            plt.savefig(outpath, bbox_inches="tight")
            plt.close()