import numpy as np from plotseq import plot_seq Z = np.loadtxt('Z.txt') plot_seq(Z, (2, 2), colormap='jet', filename="img/clustering_au30_area_2k")
else: model = None model = MPI_COMM.bcast(model, root=0) scoreinds = score_dir(extractor, model, dir_path, limit=None, batch_size=200) if MPI_RANK == 0: labeler = SeqLabeler(seq_files) else: labeler = None labeler = MPI_COMM.bcast(labeler, root=0) scoreinds = relabel(labeler, scoreinds) if MPI_RANK == 0: Z = np.empty([NY, NX]) Z[:] = np.nan for score, idx in scoreinds: if score is not None: ix, iy = idx2XY(idx, NX) if ix < NY: Z[ix, iy] = score logging.debug('Z matrix has %d nans' % sum(1 for row in Z for z in row if np.isnan(z))) np.savetxt('Z_au31.txt', Z) logging.info('Write Z matrix into Z_au31.txt in ' + os.path.dirname(os.path.abspath(__file__))) from plotseq import plot_seq # # Z = np.loadtxt('Z.txt') plot_seq(Z, step, colormap='jet', filename=scratch + "img/clustering_" + case_name)