def plot_histo_gram(f_name, rg): import matplotlib.pyplot as plt sfig = 420 plt.figure() patterns, hist_record = zload(f_name) for hist, bins in hist_record: hist = hist[1:] bins = bins[1:] bins /= 3600 width = 0.7 * (bins[1] - bins[0]) plt.subplot(sfig) center = (bins[:-1] + bins[1:]) / 2 plt.bar(center, hist, align='center', width=width) plt.xlim([r / 3600.0 for r in rg]) plt.show()
def plot_histo_gram(f_name, rg): import matplotlib.pyplot as plt sfig = 420 plt.figure() patterns, hist_record = zload(f_name) for hist, bins in hist_record: hist = hist[1:] bins = bins[1:] bins /= 3600 width = 0.7*(bins[1]-bins[0]) plt.subplot(sfig) center = (bins[:-1]+bins[1:])/2 plt.bar(center, hist, align = 'center', width = width) plt.xlim([r/3600.0 for r in rg]) plt.show()
ls = linestyles[i % len(linestyles)] plt.plot(x, mat[:, i], linestyle=ls, marker=style, color=color, markersize=4) if __name__ == "__main__": parser = argparse.ArgumentParser(description="Probability Law Identification") parser.add_argument('sscheck', help='self check file') parser.add_argument('lamb', type=float, help='up bound for the threshold') parser.add_argument('entro', help="['mf', 'mb'] entropy type") parser.add_argument('pic_name', default=None, help="output picture name") args = parser.parse_args() data = zload(args.sscheck) # import ipdb;ipdb.set_trace() I_rec = data['I_rec'] n = I_rec[0].shape[0] # no. of PLs m = len(I_rec) # no. of windows seq_map = { 'mf':0, 'mb':1 } # Convert I_rec to the weight of bipartie graph D = np.zeros((m, n)) for j in xrange(n): for i in xrange(m): D[i, j] = I_rec[i][j, seq_map[args.entro]]