import json import numpy as np from cross_ratio_lattice import complete_c, residual # Same boundary data, two valid local completion orders for z[2,2]. rng = np.random.default_rng(77) boundary = rng.normal(size=5) + 1j*rng.normal(size=5) left = rng.normal(size=5) + 1j*rng.normal(size=5) left[0] = boundary[0] def path(order): z = np.zeros((3,3), dtype=np.complex128) z[0,:] = boundary[:3] z[:,0] = left[:3] for i,j in order: z[i+1,j+1], _ = complete_c(z[i,j], z[i+1,j], z[i,j+1]) return z # Both orders compute all cells, but choose different intermediate staircase. row = path([(0,0),(0,1),(1,0),(1,1)]) col = path([(0,0),(1,0),(0,1),(1,1)]) result = { 'z22_path_disagreement': float(abs(row[2,2]-col[2,2])), 'row_residual_max': float(np.nanmax(residual(row[:-1,:-1],row[1:,:-1],row[1:,1:],row[:-1,1:]))), 'col_residual_max': float(np.nanmax(residual(col[:-1,:-1],col[1:,:-1],col[1:,1:],col[:-1,1:]))) } print(json.dumps(result, indent=2)) with open('path_results.json','w') as f: json.dump(result,f,indent=2)