Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import gudhi
periodic_cc = gudhi.PeriodicCubicalComplex(perseus_file='../3d_torus.txt')
diag = periodic_cc.persistence()
gudhi.plot_persistence_barcode(diag)
print("#####################################################################")
print("Show diagram persistence example")
gudhi.plot_persistence_diagram(persistence)
plot.show()
print("#####################################################################")
print("Show diagram persistence example with a confidence band")
gudhi.plot_persistence_diagram(persistence, band=0.2)
plot.show()
print("#####################################################################")
print("Show barcode and diagram persistence side by side example")
fig, axes = plot.subplots(nrows=1, ncols=2)
gudhi.plot_persistence_barcode(persistence, axes = axes[0])
gudhi.plot_persistence_diagram(persistence, axes = axes[1])
fig.suptitle("barcode versus diagram")
plot.show()
__copyright__ = "Copyright (C) 2016 Inria"
__license__ = "MIT"
print("#####################################################################")
print("Show barcode persistence example")
persistence = [
(2, (1.0, float("inf"))),
(1, (1.4142135623730951, float("inf"))),
(1, (1.4142135623730951, float("inf"))),
(0, (0.0, float("inf"))),
(0, (0.0, 1.0)),
(0, (0.0, 1.0)),
(0, (0.0, 1.0)),
]
gudhi.plot_persistence_barcode(persistence)
plot.show()
print("#####################################################################")
print("Show diagram persistence example")
gudhi.plot_persistence_diagram(persistence)
plot.show()
print("#####################################################################")
print("Show diagram persistence example with a confidence band")
gudhi.plot_persistence_diagram(persistence, band=0.2)
plot.show()
print("#####################################################################")
print("Show barcode and diagram persistence side by side example")
if is_file_perseus(args.file):
print("#####################################################################")
print("PeriodicCubicalComplex creation")
periodic_cubical_complex = gudhi.PeriodicCubicalComplex(perseus_file=args.file)
print("persistence(homology_coeff_field=3, min_persistence=0)=")
diag = periodic_cubical_complex.persistence(
homology_coeff_field=3, min_persistence=0
)
print(diag)
print("betti_numbers()=")
print(periodic_cubical_complex.betti_numbers())
if args.no_barcode == False:
gudhi.plot_persistence_barcode(diag)
plot.show()
else:
print(args.file, "is not a valid perseus style file")