def test_histogram_stepped(): bins, data = analysis.histogram_stepped(sample_data_0) nt.ok_(np.allclose(bins, np.array([8, 9, 10]))) nt.ok_(np.allclose(data, np.array([3., 1.]))) bins, data = analysis.histogram_stepped(sample_data_1) nt.ok_(np.allclose(bins, np.array([7, 8, 9, 10]))) nt.ok_(np.allclose(data, np.array([3., 3., 1.])))
def histogram_stepped_population(ph_list, new_fig=True, subplot=False, color='b', alpha=0.7, **kwargs): '''Extracts and plots the stepped histogram of a list of persistence diagrams. The histogram is normalized acording to the number of persistence diagrams. ''' fig, ax = _cm.get_figure(new_fig=new_fig, subplot=subplot) hist_data = analysis.histogram_stepped(analysis.collapse(ph_list)) ax.fill_between(hist_data[0][:-1], 0, hist_data[1] / len(ph_list), color=color, alpha=alpha) return _cm.plot_style(fig=fig, ax=ax, **kwargs)
def histogram_stepped(ph, new_fig=True, subplot=False, color='b', alpha=0.7, **kwargs): '''Extracts and plots the stepped histogram of a persistent homology array. ''' fig, ax = _cm.get_figure(new_fig=new_fig, subplot=subplot) hist_data = analysis.histogram_stepped(ph) ax.fill_between(hist_data[0][:-1], 0, hist_data[1], color=color, alpha=alpha) return _cm.plot_style(fig=fig, ax=ax, **kwargs)