diff --git a/examples/weighted_complex/plot.py b/examples/weighted_complex/plot.py new file mode 100644 index 0000000..b000460 --- /dev/null +++ b/examples/weighted_complex/plot.py @@ -0,0 +1,9 @@ +from simplicial_kuramoto.frustration_scan import plot_projections, plot_order +import matplotlib.pyplot as plt + +if __name__ == "__main__": + for i in range(50): + path = f"results/square_{i}.pkl" + plot_projections(path, f"projections_{i:02d}.png") + plot_order(path, f"order_{i:02d}.png") + plt.close('all') diff --git a/examples/weighted_complex/scan.py b/examples/weighted_complex/scan.py new file mode 100755 index 0000000..1909f52 --- /dev/null +++ b/examples/weighted_complex/scan.py @@ -0,0 +1,39 @@ +import numpy as np + +from simplicial_kuramoto import SimplicialComplex +from simplicial_kuramoto.frustration_scan import scan_frustration_parameters +from simplicial_kuramoto.graph_generator import delaunay_with_holes +from simplicial_kuramoto.plotting import draw_simplicial_complex + +if __name__ == "__main__": + points = [[-1, -1], [-1, 1], [1, 1], [1, -1]] + w = 0.1 + ws = np.linspace(0.1, 1.5, 50) + for i, w in enumerate(ws): + graph, points = delaunay_with_holes(points=points) + for _i, (u, v) in enumerate(graph.edges): + if _i == 0: + graph[u][v]["weight"] = w + else: + graph[u][v]["weight"] = 1.0 + + Gsc = SimplicialComplex(graph=graph, face_weights=[w, w]) + draw_simplicial_complex(Gsc, "complex.pdf") + + alpha1 = np.linspace(0, 2.5, 80) + alpha2 = np.linspace(0, np.pi / 2.0, 120) + n_repeats = 1 + t_max = 1000 + n_t = 500 + n_workers = 80 + + scan_frustration_parameters( + Gsc, + filename=f"square_{i}.pkl", + alpha1=alpha1, + alpha2=alpha2, + repeats=n_repeats, + n_workers=n_workers, + t_max=t_max, + n_t=n_t, + ) diff --git a/simplicial_kuramoto/frustration_scan.py b/simplicial_kuramoto/frustration_scan.py index 0cb24c2..bd439c6 100644 --- a/simplicial_kuramoto/frustration_scan.py +++ b/simplicial_kuramoto/frustration_scan.py @@ -412,7 +412,7 @@ def _get_scan_boundary(vec, axis=0): vec = np.diff(vec, axis=axis) > 0 return a2[vec.T] - step1 / 2.0, a1[vec.T] - plt.figure() # figsize=(5, 4)) + plt.figure(figsize=(5, 4)) plt.imshow(harm_order, origin="lower", extent=extent, aspect="auto") if with_proj: plt.plot(*_get_scan_boundary(grad), c="k", lw=1)