Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
)
parser.add_argument("-f", "--file", type=str, required=True)
parser.add_argument(
"--no-barcode",
default=False,
action="store_true",
help="Flag for not to display the barcodes",
)
args = parser.parse_args()
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")
import gudhi
periodic_cc = gudhi.PeriodicCubicalComplex(perseus_file='../3d_torus.txt')
diag = periodic_cc.persistence()
gudhi.plot_persistence_barcode(diag)