From f9ef4e802ae7a4b0f3644db30479aa2dbfbc7514 Mon Sep 17 00:00:00 2001 From: Felix Dusel Date: Thu, 16 Jun 2022 02:19:48 +0200 Subject: [PATCH 01/14] kerneldunham works now. the problem was a different definition of p2w and w2p compared to the working version, a line that rotates every polygon by some angle for (for me) unknown reasons, a missing self.generate() in the __init__ and a superfluous create_fund_poly in kerneldunham that was overwritten within the kernelbase. CAUTION: in order to run the library, I had to remove the relative imports by removing the dot from e.g. from .kernelflo import KernelFlo --- hypertiling/core.py | 14 ++++++-------- hypertiling/hyperpolygon.py | 15 +++++++-------- hypertiling/{io.py => ion.py} | 0 hypertiling/kernelbase.py | 29 ++++++++++------------------- hypertiling/kerneldunham.py | 29 ++++++++++------------------- hypertiling/transformation.py | 4 ++-- 6 files changed, 35 insertions(+), 56 deletions(-) rename hypertiling/{io.py => ion.py} (100%) diff --git a/hypertiling/core.py b/hypertiling/core.py index 50de28e..9b2f295 100644 --- a/hypertiling/core.py +++ b/hypertiling/core.py @@ -1,9 +1,7 @@ # relative imports -from .kernelflo import KernelFlo -from .kernelmanu import KernelManu -from .kerneldunham import KernelDunham - - +from kernelflo import KernelFlo +from kernelmanu import KernelManu +from kerneldunham import KernelDunham # factory pattern allows to select between kernels @@ -31,13 +29,13 @@ def HyperbolicTiling(p, q, n, center="cell", kernel="flo"): if p>20 or q>20 and n>5: print("[hypertiling] Warning: The lattice might become very large with your parameter choice!") - kernels = { "manu": KernelManu, # to-do: we need better names for the kernels ;) "flo": KernelFlo, "dunham": KernelDunham} if kernel not in kernels: - raise KeyError("[hypertiling] Error: No valid kernel specified") + raise KeyError("[hypertiling] Error: No valid kernel specified") if kernel == "dunham": - raise NotImplementedError("[hypertiling] Error: Dunham kernel is currently broken (fixme!)") + print("Beware, kernel broken") + # raise NotImplementedError("[hypertiling] Error: Dunham kernel is currently broken (fixme!)") return kernels[kernel](p, q, n, center) diff --git a/hypertiling/hyperpolygon.py b/hypertiling/hyperpolygon.py index f852539..98e0b50 100644 --- a/hypertiling/hyperpolygon.py +++ b/hypertiling/hyperpolygon.py @@ -1,6 +1,6 @@ from math import floor import numpy as np -from .transformation import * +from transformation import * def morigin_py(p, z0, verticesP): for i in range(p + 1): @@ -147,9 +147,6 @@ class HyperPolygon: return True return False - - - # transforms the entire polygon: to the origin, rotate it and back again def tf_full(self, ind, phi): mfull(self.p, phi, ind, self.verticesP) @@ -166,7 +163,6 @@ class HyperPolygon: z = moeb_translate_trafo(self.verticesP[i], s) self.verticesP[i] = z - def moeb_inverse(self, z0): morigin_inv(self.p, z0, self.verticesP) @@ -177,14 +173,11 @@ class HyperPolygon: z = z*rotation self.verticesP[i] = z - - # compute angle between center and the positive x-axis def find_angle(self): self.angle = math.degrees(math.atan2(self.centerP().imag, self.centerP().real)) self.angle += 360 if self.angle < 0 else 0 - def find_sector(self, k, offset=0): """ compute in which sector out of k sectors the polygon resides @@ -209,3 +202,9 @@ class HyperPolygon: def find_orientation(self): self.orientation = np.angle(self.verticesP[0]-self.centerP()) + # ONLY USED BY dunhams tiling class! Transforms all points of the polygon by matrix tmat + def transform(self, tmat): + for i in range(self.p): + vertex = p2w_py(self.verticesP[i]) + result = tmat @ vertex + self.verticesP[i] = w2p_py(result) diff --git a/hypertiling/io.py b/hypertiling/ion.py similarity index 100% rename from hypertiling/io.py rename to hypertiling/ion.py diff --git a/hypertiling/kernelbase.py b/hypertiling/kernelbase.py index 9fe1ef8..d29d9d0 100644 --- a/hypertiling/kernelbase.py +++ b/hypertiling/kernelbase.py @@ -2,9 +2,9 @@ import numpy as np import math import copy # relative imports -from .hyperpolygon import HyperPolygon -from .transformation import p2w -from .util import fund_radius +from hyperpolygon import HyperPolygon +from transformation import p2w +from util import fund_radius # the main object of this library # essentially represents a list of polygons which constitute the hyperbolic lattice @@ -48,15 +48,14 @@ class HyperbolicTilingBase: # technical parameters # do not change, unless you know what you are doing!) - self.degtol = 1 # sector boundary tolerance + self.degtol = 1 # sector boundary tolerance # angular offset, rotates the entire construction by a bit during construction if center == "cell": - self.mangle = self.degphi/math.sqrt(5) + self.mangle = self.degphi/math.sqrt(5) elif center == "vertex": self.mangle = self.degqhi/math.sqrt(5) - # fundamental polygon of the tiling self.fund_poly = self.create_fundamental_polygon(center) @@ -66,17 +65,14 @@ class HyperbolicTilingBase: if center not in ['cell', 'vertex']: raise ValueError('Invalid value for argument "center"!') - def __getitem__(self, idx): return self.polygons[idx] - def __iter__(self): self.iterctr = 0 self.itervar = self.polygons[self.iterctr] return self - def __next__(self): if self.iterctr < len(self.polygons): retval = self.polygons[self.iterctr] @@ -85,11 +81,9 @@ class HyperbolicTilingBase: else: raise StopIteration - def __len__(self): return len(self.polygons) - def create_fundamental_polygon(self, center='cell'): """ Constructs the vertices of the fundamental hyperbolic {p,q} polygon @@ -105,9 +99,9 @@ class HyperbolicTilingBase: """ r = fund_radius(self.p, self.q) polygon = HyperPolygon(self.p) - + offset = np.pi/self.p for i in range(self.p): - z = complex(math.cos(i*self.phi), math.sin(i*self.phi)) # = exp(i*phi) + z = complex(math.cos(i*self.phi+offset), math.sin(i*self.phi+offset)) # = exp(i*phi) z = z/abs(z) z = r * z polygon.verticesP[i] = z @@ -120,16 +114,17 @@ class HyperbolicTilingBase: polygon.moeb_rotate(vertangle) polygon.find_angle() - polygon.moeb_rotate(-2*math.pi/360*self.mangle) + # polygon.moeb_rotate(-2*math.pi/360*self.mangle) return polygon + class KernelCommon(HyperbolicTilingBase): """ Commonalities """ - def __init__ (self, p, q, n, center): + def __init__(self, p, q, n, center): super(KernelCommon, self).__init__(p, q, n, center) def replicate(self): @@ -141,7 +136,6 @@ class KernelCommon(HyperbolicTilingBase): elif self.center == 'vertex': self.angular_replicate(copy.deepcopy(self.polygons), self.q) - def generate(self): """ do full construction @@ -149,8 +143,6 @@ class KernelCommon(HyperbolicTilingBase): self.generate_sector() self.replicate() - - def generate_adj_poly(self, polygon, ind, k): """ finds the next polygon by k-fold rotation of polygon around the vertex number ind @@ -158,7 +150,6 @@ class KernelCommon(HyperbolicTilingBase): polygon.tf_full(ind, k*self.qhi) return polygon - # tessellates the disk by applying a rotation of 2pi/p to the pizza slice def angular_replicate(self, polygons, k): if self.center == 'cell': diff --git a/hypertiling/kerneldunham.py b/hypertiling/kerneldunham.py index 29e643b..877eff3 100644 --- a/hypertiling/kerneldunham.py +++ b/hypertiling/kerneldunham.py @@ -2,10 +2,10 @@ import numpy as np import copy # relative imports -from .kernelbase import HyperbolicTilingBase -from .hyperpolygon import HyperPolygon, mfull_point -from .transformation import p2w -from .util import fund_radius +from kernelbase import HyperbolicTilingBase +from hyperpolygon import HyperPolygon, mfull_point +from transformation import p2w +from util import fund_radius class KernelDunham(HyperbolicTilingBase): @@ -17,8 +17,8 @@ class KernelDunham(HyperbolicTilingBase): currently broken! fixme """ - def __init__ (self, p, q, n, center="cell"): - super(KernelDunham, self).__init__(p, q, n, center="cell") + def __init__(self, p, q, n, center="cell"): + super(KernelDunham, self).__init__(p, q, n, center=center) # reflection and rotation matrices self.b = np.arccosh(np.cos(np.pi / q) / np.sin(np.pi / p)) @@ -40,27 +40,18 @@ class KernelDunham(HyperbolicTilingBase): self.RotCenterG = np.eye(3) # G for usage in generate() self.RotCenterR = np.eye(3) # R for usage in replicate(...) - self.fund_poly = self.create_fundamental_polygon() + self.fund_poly = self.create_fundamental_polygon(center) self.polygons = [self.fund_poly] - - def create_fundamental_polygon(self): # constructs the verticesP of the fundamental hyperbolic {p,q} polygon - r = fund_radius(self.p, self.q) - polygon = HyperPolygon(self.p) - angle = np.pi / self.p - for i in range(self.p): # for every corner of the polygon - z = complex(r * np.cos(angle + 2 * np.pi * i / self.p), r * np.sin(angle + 2 * np.pi * i / self.p)) - polygon.verticesP[i] = z - polygon.verticesW[:, i] = p2w(z) - return polygon + self.generate() def generate(self): if self.nlayers == 1: return - for _ in range(self.p): + for i in range(self.p): RotVertex = self.RotCenterG @ self.RotQ self.replicate(self.polygons, RotVertex, self.nlayers - 2, "Edge") - for _ in range(self.q - 3): + for j in range(self.q - 3): RotVertex = RotVertex @ self.RotQ self.replicate(self.polygons, RotVertex, self.nlayers - 2, "Vertex") diff --git a/hypertiling/transformation.py b/hypertiling/transformation.py index 476127f..f1431dd 100644 --- a/hypertiling/transformation.py +++ b/hypertiling/transformation.py @@ -170,11 +170,11 @@ def p2w_py(z): xx = x*x yy = y*y factor = 1 / (1-xx-yy) - return factor*nparray([(1+xx+yy), 2*x, 2*y]) + return factor*nparray([2*x, 2*y, (1+xx+yy)]) def w2p_py(point): '''Convert Weierstraß to Poincare representation ''' - [t, x, y] = point + [x, y, t] = point factor = 1 / (1+t) return complex(x*factor, y*factor) -- GitLab From e6884c15db5686ac8889511b965b8f3446cbcf08 Mon Sep 17 00:00:00 2001 From: fdusel Date: Fri, 17 Jun 2022 04:58:43 -0700 Subject: [PATCH 02/14] fixed relative imports, the tests should work now --- hypertiling/core.py | 6 +++--- hypertiling/hyperpolygon.py | 2 +- hypertiling/kernelbase.py | 6 +++--- hypertiling/kerneldunham.py | 8 ++++---- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/hypertiling/core.py b/hypertiling/core.py index 9b2f295..5860dcf 100644 --- a/hypertiling/core.py +++ b/hypertiling/core.py @@ -1,7 +1,7 @@ # relative imports -from kernelflo import KernelFlo -from kernelmanu import KernelManu -from kerneldunham import KernelDunham +from .kernelflo import KernelFlo +from .kernelmanu import KernelManu +from .kerneldunham import KernelDunham # factory pattern allows to select between kernels diff --git a/hypertiling/hyperpolygon.py b/hypertiling/hyperpolygon.py index 98e0b50..cb0c64b 100644 --- a/hypertiling/hyperpolygon.py +++ b/hypertiling/hyperpolygon.py @@ -1,6 +1,6 @@ from math import floor import numpy as np -from transformation import * +from .transformation import * def morigin_py(p, z0, verticesP): for i in range(p + 1): diff --git a/hypertiling/kernelbase.py b/hypertiling/kernelbase.py index d29d9d0..213f6c9 100644 --- a/hypertiling/kernelbase.py +++ b/hypertiling/kernelbase.py @@ -2,9 +2,9 @@ import numpy as np import math import copy # relative imports -from hyperpolygon import HyperPolygon -from transformation import p2w -from util import fund_radius +from .hyperpolygon import HyperPolygon +from .transformation import p2w +from .util import fund_radius # the main object of this library # essentially represents a list of polygons which constitute the hyperbolic lattice diff --git a/hypertiling/kerneldunham.py b/hypertiling/kerneldunham.py index 877eff3..7e25277 100644 --- a/hypertiling/kerneldunham.py +++ b/hypertiling/kerneldunham.py @@ -2,10 +2,10 @@ import numpy as np import copy # relative imports -from kernelbase import HyperbolicTilingBase -from hyperpolygon import HyperPolygon, mfull_point -from transformation import p2w -from util import fund_radius +from .kernelbase import HyperbolicTilingBase +from .hyperpolygon import HyperPolygon, mfull_point +from .transformation import p2w +from .util import fund_radius class KernelDunham(HyperbolicTilingBase): -- GitLab From aeacc661c961b4ee721cc14c2213674ef3272d79 Mon Sep 17 00:00:00 2001 From: fdusel Date: Fri, 17 Jun 2022 06:25:25 -0700 Subject: [PATCH 03/14] remove duplicates function added in order to pass tests --- hypertiling/kerneldunham.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hypertiling/kerneldunham.py b/hypertiling/kerneldunham.py index 7e25277..4b3c360 100644 --- a/hypertiling/kerneldunham.py +++ b/hypertiling/kerneldunham.py @@ -5,7 +5,7 @@ import copy from .kernelbase import HyperbolicTilingBase from .hyperpolygon import HyperPolygon, mfull_point from .transformation import p2w -from .util import fund_radius +from .util import fund_radius, remove_duplicates class KernelDunham(HyperbolicTilingBase): @@ -43,6 +43,7 @@ class KernelDunham(HyperbolicTilingBase): self.fund_poly = self.create_fundamental_polygon(center) self.polygons = [self.fund_poly] self.generate() + self.polygons = remove_duplicates(self.polygons) def generate(self): if self.nlayers == 1: -- GitLab From b239fe6820492d7d24573582e343c67622980053 Mon Sep 17 00:00:00 2001 From: Felix Dusel Date: Mon, 20 Jun 2022 16:09:21 +0200 Subject: [PATCH 04/14] dots removed --- hypertiling/CenterContainer.py | 2 +- hypertiling/__init__.py | 2 +- hypertiling/core.py | 6 +++--- hypertiling/geodesics.py | 4 ++-- hypertiling/hyperpolygon.py | 2 +- hypertiling/{io.py => ion.py} | 0 hypertiling/kernelbase.py | 6 +++--- hypertiling/kerneldunham.py | 8 ++++---- hypertiling/kernelflo.py | 10 +++++----- hypertiling/kernelmanu.py | 8 ++++---- hypertiling/neighbours.py | 2 +- hypertiling/plot.py | 2 +- hypertiling/util.py | 8 ++++---- 13 files changed, 30 insertions(+), 30 deletions(-) rename hypertiling/{io.py => ion.py} (100%) diff --git a/hypertiling/CenterContainer.py b/hypertiling/CenterContainer.py index cb5aa3b..963d085 100644 --- a/hypertiling/CenterContainer.py +++ b/hypertiling/CenterContainer.py @@ -1,6 +1,6 @@ import math -from .util import fund_radius +from util import fund_radius class HTCenter: '''This helper class wraps a complex and enables comparison based on the angle''' diff --git a/hypertiling/__init__.py b/hypertiling/__init__.py index 77ccf3b..ebb787f 100644 --- a/hypertiling/__init__.py +++ b/hypertiling/__init__.py @@ -1,4 +1,4 @@ -from .core import HyperbolicTiling +from core import HyperbolicTiling __all__ = ['HyperbolicTiling'] diff --git a/hypertiling/core.py b/hypertiling/core.py index 50de28e..414c9f8 100644 --- a/hypertiling/core.py +++ b/hypertiling/core.py @@ -1,7 +1,7 @@ # relative imports -from .kernelflo import KernelFlo -from .kernelmanu import KernelManu -from .kerneldunham import KernelDunham +from kernelflo import KernelFlo +from kernelmanu import KernelManu +from kerneldunham import KernelDunham diff --git a/hypertiling/geodesics.py b/hypertiling/geodesics.py index 4a118fd..378080f 100644 --- a/hypertiling/geodesics.py +++ b/hypertiling/geodesics.py @@ -57,8 +57,8 @@ def circle_through_three_points(z1, z2, z3, verbose=False): -from .transformation import moeb_origin_trafo, moeb_origin_trafo_inverse -from .distance import disk_distance +from transformation import moeb_origin_trafo, moeb_origin_trafo_inverse +from distance import disk_distance # return the geodesic midpoint betwen z1 and z2 def geodesic_midpoint(z1,z2): diff --git a/hypertiling/hyperpolygon.py b/hypertiling/hyperpolygon.py index f852539..e3d2628 100644 --- a/hypertiling/hyperpolygon.py +++ b/hypertiling/hyperpolygon.py @@ -1,6 +1,6 @@ from math import floor import numpy as np -from .transformation import * +from transformation import * def morigin_py(p, z0, verticesP): for i in range(p + 1): diff --git a/hypertiling/io.py b/hypertiling/ion.py similarity index 100% rename from hypertiling/io.py rename to hypertiling/ion.py diff --git a/hypertiling/kernelbase.py b/hypertiling/kernelbase.py index 9fe1ef8..cfdb164 100644 --- a/hypertiling/kernelbase.py +++ b/hypertiling/kernelbase.py @@ -2,9 +2,9 @@ import numpy as np import math import copy # relative imports -from .hyperpolygon import HyperPolygon -from .transformation import p2w -from .util import fund_radius +from hyperpolygon import HyperPolygon +from transformation import p2w +from util import fund_radius # the main object of this library # essentially represents a list of polygons which constitute the hyperbolic lattice diff --git a/hypertiling/kerneldunham.py b/hypertiling/kerneldunham.py index 29e643b..794e2a8 100644 --- a/hypertiling/kerneldunham.py +++ b/hypertiling/kerneldunham.py @@ -2,10 +2,10 @@ import numpy as np import copy # relative imports -from .kernelbase import HyperbolicTilingBase -from .hyperpolygon import HyperPolygon, mfull_point -from .transformation import p2w -from .util import fund_radius +from kernelbase import HyperbolicTilingBase +from hyperpolygon import HyperPolygon, mfull_point +from transformation import p2w +from util import fund_radius class KernelDunham(HyperbolicTilingBase): diff --git a/hypertiling/kernelflo.py b/hypertiling/kernelflo.py index 8fe6c50..c155383 100644 --- a/hypertiling/kernelflo.py +++ b/hypertiling/kernelflo.py @@ -3,11 +3,11 @@ import math import copy # relative imports -from .kernelbase import KernelCommon -from .hyperpolygon import HyperPolygon, mfull_point -from .transformation import moeb_rotate_trafo -from .util import fund_radius -from .CenterContainer import CenterContainer +from kernelbase import KernelCommon +from hyperpolygon import HyperPolygon, mfull_point +from transformation import moeb_rotate_trafo +from util import fund_radius +from CenterContainer import CenterContainer class KernelFlo(KernelCommon): """ diff --git a/hypertiling/kernelmanu.py b/hypertiling/kernelmanu.py index c651b55..12516ac 100644 --- a/hypertiling/kernelmanu.py +++ b/hypertiling/kernelmanu.py @@ -3,10 +3,10 @@ import math import copy # relative imports -from .kernelbase import KernelCommon -from .hyperpolygon import HyperPolygon, mfull_point -from .transformation import p2w, moeb_rotate_trafo -from .distance import disk_distance +from kernelbase import KernelCommon +from hyperpolygon import HyperPolygon, mfull_point +from transformation import p2w, moeb_rotate_trafo +from distance import disk_distance class KernelManu(KernelCommon): """ Tiling construction algorithm written by M. Schrauth and F. Dusel """ diff --git a/hypertiling/neighbours.py b/hypertiling/neighbours.py index 1609c26..ad37f5e 100644 --- a/hypertiling/neighbours.py +++ b/hypertiling/neighbours.py @@ -1,6 +1,6 @@ import numpy as np import math -from .distance import weierstrass_distance, lorentzian_distance +from distance import weierstrass_distance, lorentzian_distance # wrapper to provide a nicer interface def find(tiling, nn_dist=None, which="optimized", index_from_zero=True, verbose=False): diff --git a/hypertiling/plot.py b/hypertiling/plot.py index 36c995c..441523f 100644 --- a/hypertiling/plot.py +++ b/hypertiling/plot.py @@ -4,7 +4,7 @@ import matplotlib.pyplot as plt import matplotlib.cm as cmap from matplotlib.patches import Polygon from matplotlib.collections import PatchCollection, PolyCollection -from .geodesics import geodesic_arc +from geodesics import geodesic_arc # taken from http://exnumerus.blogspot.com/2011/02/how-to-quickly-plot-polygons-in.html diff --git a/hypertiling/util.py b/hypertiling/util.py index a08193a..b67fb93 100644 --- a/hypertiling/util.py +++ b/hypertiling/util.py @@ -2,10 +2,10 @@ import copy import numpy as np import math -from .distance import weierstrass_distance -from .hyperpolygon import HyperPolygon -from .transformation import p2w -from .geodesics import geodesic_midpoint +from distance import weierstrass_distance +from hyperpolygon import HyperPolygon +from transformation import p2w +from geodesics import geodesic_midpoint # radius of the fundamental (and every other) polygon -- GitLab From 94de1dc32e5285f76aa457666e6c4fb834566703 Mon Sep 17 00:00:00 2001 From: Felix Dusel Date: Mon, 20 Jun 2022 16:56:14 +0200 Subject: [PATCH 05/14] working version of kerneldunham --- hypertiling/core.py | 3 ++- hypertiling/hyperpolygon.py | 7 +++++++ hypertiling/kernelbase.py | 2 +- hypertiling/kerneldunham.py | 32 +++++++++++++++++++++----------- hypertiling/transformation.py | 4 ++-- 5 files changed, 33 insertions(+), 15 deletions(-) diff --git a/hypertiling/core.py b/hypertiling/core.py index 414c9f8..28ddb70 100644 --- a/hypertiling/core.py +++ b/hypertiling/core.py @@ -39,5 +39,6 @@ def HyperbolicTiling(p, q, n, center="cell", kernel="flo"): if kernel not in kernels: raise KeyError("[hypertiling] Error: No valid kernel specified") if kernel == "dunham": - raise NotImplementedError("[hypertiling] Error: Dunham kernel is currently broken (fixme!)") + print("possibly broken") + # raise NotImplementedError("[hypertiling] Error: Dunham kernel is currently broken (fixme!)") return kernels[kernel](p, q, n, center) diff --git a/hypertiling/hyperpolygon.py b/hypertiling/hyperpolygon.py index e3d2628..2a65cd3 100644 --- a/hypertiling/hyperpolygon.py +++ b/hypertiling/hyperpolygon.py @@ -209,3 +209,10 @@ class HyperPolygon: def find_orientation(self): self.orientation = np.angle(self.verticesP[0]-self.centerP()) + # ONLY USED BY dunhams tiling class! Transforms all points of the polygon by matrix tmat + def transform(self, tmat): + for i in range(self.p + 1): # +1 to include center + vertex = p2w_py(self.verticesP[i]) + result = tmat @ vertex + self.verticesP[i] = w2p_py(result) + diff --git a/hypertiling/kernelbase.py b/hypertiling/kernelbase.py index cfdb164..898bd37 100644 --- a/hypertiling/kernelbase.py +++ b/hypertiling/kernelbase.py @@ -52,7 +52,7 @@ class HyperbolicTilingBase: # angular offset, rotates the entire construction by a bit during construction if center == "cell": - self.mangle = self.degphi/math.sqrt(5) + self.mangle = self.degphi/math.sqrt(5) elif center == "vertex": self.mangle = self.degqhi/math.sqrt(5) diff --git a/hypertiling/kerneldunham.py b/hypertiling/kerneldunham.py index 794e2a8..8a5596f 100644 --- a/hypertiling/kerneldunham.py +++ b/hypertiling/kerneldunham.py @@ -17,7 +17,7 @@ class KernelDunham(HyperbolicTilingBase): currently broken! fixme """ - def __init__ (self, p, q, n, center="cell"): + def __init__(self, p, q, n, center="cell"): super(KernelDunham, self).__init__(p, q, n, center="cell") # reflection and rotation matrices @@ -41,18 +41,9 @@ class KernelDunham(HyperbolicTilingBase): self.RotCenterR = np.eye(3) # R for usage in replicate(...) self.fund_poly = self.create_fundamental_polygon() + self.fund_poly.moeb_rotate(2*np.pi/360*(self.mangle+180)) # sloppy: reverts the default rotation in kernelbase self.polygons = [self.fund_poly] - def create_fundamental_polygon(self): # constructs the verticesP of the fundamental hyperbolic {p,q} polygon - r = fund_radius(self.p, self.q) - polygon = HyperPolygon(self.p) - angle = np.pi / self.p - for i in range(self.p): # for every corner of the polygon - z = complex(r * np.cos(angle + 2 * np.pi * i / self.p), r * np.sin(angle + 2 * np.pi * i / self.p)) - polygon.verticesP[i] = z - polygon.verticesW[:, i] = p2w(z) - return polygon - def generate(self): if self.nlayers == 1: return @@ -66,6 +57,25 @@ class KernelDunham(HyperbolicTilingBase): self.RotCenterG = self.RotCenterG @ self.RotP + # remove duplicates: this kernel produces duplicates during construction per definition + dgts = 10 + centerset = set() + centerset.add(np.round(self.fund_poly.centerP(), dgts)) + polygonlist = [self.fund_poly] + for pgon in self.polygons: + # try adding to centerlist; it is a set() and takes care of duplicates + center = np.round(pgon.centerP(), dgts) # caution: rounding precision chosen arbitrarily + if pgon.layer == 2: + print(pgon.verticesP) + lenA = len(centerset) + centerset.add(center) + lenB = len(centerset) + + if lenB > lenA: + polygonlist.append(pgon) + + self.polygons = polygonlist + def replicate(self, Polygons, InitialTran, LayersToDo, AdjacencyType): poly = copy.deepcopy(self.fund_poly) poly.transform(InitialTran) diff --git a/hypertiling/transformation.py b/hypertiling/transformation.py index 476127f..f1431dd 100644 --- a/hypertiling/transformation.py +++ b/hypertiling/transformation.py @@ -170,11 +170,11 @@ def p2w_py(z): xx = x*x yy = y*y factor = 1 / (1-xx-yy) - return factor*nparray([(1+xx+yy), 2*x, 2*y]) + return factor*nparray([2*x, 2*y, (1+xx+yy)]) def w2p_py(point): '''Convert Weierstraß to Poincare representation ''' - [t, x, y] = point + [x, y, t] = point factor = 1 / (1+t) return complex(x*factor, y*factor) -- GitLab From e219f551ab9c6be49ddb940acd125457fdf2a9fd Mon Sep 17 00:00:00 2001 From: Felix Dusel Date: Mon, 20 Jun 2022 18:26:14 +0200 Subject: [PATCH 06/14] dots added again...ugh --- hypertiling/CenterContainer.py | 2 +- hypertiling/{ion.py => io.py} | 0 hypertiling/kernelflo.py | 10 +++++----- hypertiling/kernelmanu.py | 8 ++++---- hypertiling/neighbours.py | 2 +- hypertiling/plot.py | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-) rename hypertiling/{ion.py => io.py} (100%) diff --git a/hypertiling/CenterContainer.py b/hypertiling/CenterContainer.py index 963d085..cb5aa3b 100644 --- a/hypertiling/CenterContainer.py +++ b/hypertiling/CenterContainer.py @@ -1,6 +1,6 @@ import math -from util import fund_radius +from .util import fund_radius class HTCenter: '''This helper class wraps a complex and enables comparison based on the angle''' diff --git a/hypertiling/ion.py b/hypertiling/io.py similarity index 100% rename from hypertiling/ion.py rename to hypertiling/io.py diff --git a/hypertiling/kernelflo.py b/hypertiling/kernelflo.py index c155383..8fe6c50 100644 --- a/hypertiling/kernelflo.py +++ b/hypertiling/kernelflo.py @@ -3,11 +3,11 @@ import math import copy # relative imports -from kernelbase import KernelCommon -from hyperpolygon import HyperPolygon, mfull_point -from transformation import moeb_rotate_trafo -from util import fund_radius -from CenterContainer import CenterContainer +from .kernelbase import KernelCommon +from .hyperpolygon import HyperPolygon, mfull_point +from .transformation import moeb_rotate_trafo +from .util import fund_radius +from .CenterContainer import CenterContainer class KernelFlo(KernelCommon): """ diff --git a/hypertiling/kernelmanu.py b/hypertiling/kernelmanu.py index 12516ac..c651b55 100644 --- a/hypertiling/kernelmanu.py +++ b/hypertiling/kernelmanu.py @@ -3,10 +3,10 @@ import math import copy # relative imports -from kernelbase import KernelCommon -from hyperpolygon import HyperPolygon, mfull_point -from transformation import p2w, moeb_rotate_trafo -from distance import disk_distance +from .kernelbase import KernelCommon +from .hyperpolygon import HyperPolygon, mfull_point +from .transformation import p2w, moeb_rotate_trafo +from .distance import disk_distance class KernelManu(KernelCommon): """ Tiling construction algorithm written by M. Schrauth and F. Dusel """ diff --git a/hypertiling/neighbours.py b/hypertiling/neighbours.py index ad37f5e..1609c26 100644 --- a/hypertiling/neighbours.py +++ b/hypertiling/neighbours.py @@ -1,6 +1,6 @@ import numpy as np import math -from distance import weierstrass_distance, lorentzian_distance +from .distance import weierstrass_distance, lorentzian_distance # wrapper to provide a nicer interface def find(tiling, nn_dist=None, which="optimized", index_from_zero=True, verbose=False): diff --git a/hypertiling/plot.py b/hypertiling/plot.py index 441523f..36c995c 100644 --- a/hypertiling/plot.py +++ b/hypertiling/plot.py @@ -4,7 +4,7 @@ import matplotlib.pyplot as plt import matplotlib.cm as cmap from matplotlib.patches import Polygon from matplotlib.collections import PatchCollection, PolyCollection -from geodesics import geodesic_arc +from .geodesics import geodesic_arc # taken from http://exnumerus.blogspot.com/2011/02/how-to-quickly-plot-polygons-in.html -- GitLab From cefca3c9334d5aa663c9450731f792ed491cb3b8 Mon Sep 17 00:00:00 2001 From: Felix Dusel Date: Mon, 20 Jun 2022 18:42:58 +0200 Subject: [PATCH 07/14] more dots bruh --- hypertiling/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hypertiling/__init__.py b/hypertiling/__init__.py index ebb787f..77ccf3b 100644 --- a/hypertiling/__init__.py +++ b/hypertiling/__init__.py @@ -1,4 +1,4 @@ -from core import HyperbolicTiling +from .core import HyperbolicTiling __all__ = ['HyperbolicTiling'] -- GitLab From fa8d193d4bae6e127a79d9058891d2ac03bc22d5 Mon Sep 17 00:00:00 2001 From: fdusel Date: Tue, 21 Jun 2022 13:31:08 +0200 Subject: [PATCH 08/14] now ive got all dots i swear --- hypertiling/util.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hypertiling/util.py b/hypertiling/util.py index b67fb93..a08193a 100644 --- a/hypertiling/util.py +++ b/hypertiling/util.py @@ -2,10 +2,10 @@ import copy import numpy as np import math -from distance import weierstrass_distance -from hyperpolygon import HyperPolygon -from transformation import p2w -from geodesics import geodesic_midpoint +from .distance import weierstrass_distance +from .hyperpolygon import HyperPolygon +from .transformation import p2w +from .geodesics import geodesic_midpoint # radius of the fundamental (and every other) polygon -- GitLab From 35bb6a554f16ebc82251777bd851d767412d8fc2 Mon Sep 17 00:00:00 2001 From: fdusel Date: Tue, 21 Jun 2022 13:38:59 +0200 Subject: [PATCH 09/14] ... --- hypertiling/geodesics.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hypertiling/geodesics.py b/hypertiling/geodesics.py index 378080f..4a118fd 100644 --- a/hypertiling/geodesics.py +++ b/hypertiling/geodesics.py @@ -57,8 +57,8 @@ def circle_through_three_points(z1, z2, z3, verbose=False): -from transformation import moeb_origin_trafo, moeb_origin_trafo_inverse -from distance import disk_distance +from .transformation import moeb_origin_trafo, moeb_origin_trafo_inverse +from .distance import disk_distance # return the geodesic midpoint betwen z1 and z2 def geodesic_midpoint(z1,z2): -- GitLab From c55eab848b8e979d3f5bcdd6249802ef3cb456a0 Mon Sep 17 00:00:00 2001 From: fdusel Date: Tue, 21 Jun 2022 15:30:28 +0200 Subject: [PATCH 10/14] kernel option in P2W etc added --- hypertiling/geodesics.py | 1 + hypertiling/hyperpolygon.py | 7 ++++++- hypertiling/kernelbase.py | 8 ++++++-- hypertiling/kerneldunham.py | 9 +++++++++ hypertiling/kernelflo.py | 10 ++++++++-- hypertiling/kernelmanu.py | 11 +++++++++-- hypertiling/transformation.py | 17 +++++++++++++---- hypertiling/util.py | 23 +++++++++++------------ 8 files changed, 63 insertions(+), 23 deletions(-) diff --git a/hypertiling/geodesics.py b/hypertiling/geodesics.py index 4a118fd..045bc0c 100644 --- a/hypertiling/geodesics.py +++ b/hypertiling/geodesics.py @@ -1,5 +1,6 @@ import numpy as np + # returns the "minor" of a matrix def minor(M, i, j): M = np.delete(M, i, 0) diff --git a/hypertiling/hyperpolygon.py b/hypertiling/hyperpolygon.py index 8a97f4c..b20877b 100644 --- a/hypertiling/hyperpolygon.py +++ b/hypertiling/hyperpolygon.py @@ -205,6 +205,11 @@ class HyperPolygon: # ONLY USED BY dunhams tiling class! Transforms all points of the polygon by matrix tmat def transform(self, tmat): for i in range(self.p + 1): # +1 to include center - vertex = p2w_py(self.verticesP[i]) + vertex = p2w_py(self.verticesP[i], kernel="dunham") result = tmat @ vertex +<<<<<<< Updated upstream self.verticesP[i] = w2p_py(result) +======= + self.verticesP[i] = w2p_py(result, kernel="dunham") + +>>>>>>> Stashed changes diff --git a/hypertiling/kernelbase.py b/hypertiling/kernelbase.py index 28942dc..e0553d8 100644 --- a/hypertiling/kernelbase.py +++ b/hypertiling/kernelbase.py @@ -6,6 +6,10 @@ import copy from .hyperpolygon import HyperPolygon from .transformation import p2w from .util import fund_radius +<<<<<<< Updated upstream +======= + +>>>>>>> Stashed changes # the main object of this library # essentially represents a list of polygons which constitute the hyperbolic lattice @@ -132,9 +136,9 @@ class KernelCommon(HyperbolicTilingBase): """ tessellate the entire disk by replicating the fundamental sector """ - if self.center == 'cell': + if self.center == 'cell': # and self.nlayers > 1: self.angular_replicate(copy.deepcopy(self.polygons), self.p) - elif self.center == 'vertex': + elif self.center == 'vertex': # and self.nlayers > 1: self.angular_replicate(copy.deepcopy(self.polygons), self.q) def generate(self): diff --git a/hypertiling/kerneldunham.py b/hypertiling/kerneldunham.py index 5f416cd..322f7b0 100644 --- a/hypertiling/kerneldunham.py +++ b/hypertiling/kerneldunham.py @@ -5,7 +5,11 @@ import copy from .kernelbase import HyperbolicTilingBase from .hyperpolygon import HyperPolygon, mfull_point from .transformation import p2w +<<<<<<< Updated upstream from .util import fund_radius, remove_duplicates +======= +from .util import fund_radius +>>>>>>> Stashed changes class KernelDunham(HyperbolicTilingBase): @@ -50,6 +54,11 @@ class KernelDunham(HyperbolicTilingBase): def generate(self): + # if self.nlayers == 0: + # self.polygons = [] + # return + # elif self.nlayers == 1: + # return if self.nlayers == 1: return diff --git a/hypertiling/kernelflo.py b/hypertiling/kernelflo.py index 8fe6c50..2b32178 100644 --- a/hypertiling/kernelflo.py +++ b/hypertiling/kernelflo.py @@ -13,7 +13,7 @@ class KernelFlo(KernelCommon): """ High precision kernel written by F. Goth """ - def __init__ (self, p, q, n, center): + def __init__(self, p, q, n, center): super(KernelFlo, self).__init__(p, q, n, center) def generate_sector(self): @@ -28,7 +28,13 @@ class KernelFlo(KernelCommon): self.polygons = [] # add fundamental polygon to list - self.polygons.append(self.fund_poly) + self.polygons = [self.fund_poly] + if self.nlayers == 1: + return + # if self.nlayers > 0: + # self.polygons.append(self.fund_poly) + # else: + # return # angle width of the fundamental sector sect_angle = self.phi diff --git a/hypertiling/kernelmanu.py b/hypertiling/kernelmanu.py index c651b55..0cdb17f 100644 --- a/hypertiling/kernelmanu.py +++ b/hypertiling/kernelmanu.py @@ -11,10 +11,10 @@ from .distance import disk_distance class KernelManu(KernelCommon): """ Tiling construction algorithm written by M. Schrauth and F. Dusel """ - def __init__ (self, p, q, n, center): + def __init__(self, p, q, n, center): super(KernelManu, self).__init__(p, q, n, center) self.dgts = 8 - self.accuracy = 10**(-self.dgts) # numerical accuracy + self.accuracy = 10**(-self.dgts) # numerical accuracy def generate_sector(self): @@ -31,6 +31,13 @@ class KernelManu(KernelCommon): # add fundamental polygon to list self.polygons.append(self.fund_poly) + # if self.nlayers == 1: + # return + # if self.nlayers > 0: + # self.polygons.append(self.fund_poly) + # else: + # return + # angle width of the fundamental sector sect_angle = self.phi sect_angle_deg = self.degphi diff --git a/hypertiling/transformation.py b/hypertiling/transformation.py index f1431dd..5c3e738 100644 --- a/hypertiling/transformation.py +++ b/hypertiling/transformation.py @@ -164,17 +164,26 @@ def ddcplxdiv(a, da, b, db): return complex(r, i), complex(dr, di) -def p2w_py(z): + +def p2w_py(z, kernel="manu"): '''Convert Poincare to Weierstraß representation ''' x, y = z.real, z.imag xx = x*x yy = y*y factor = 1 / (1-xx-yy) - return factor*nparray([2*x, 2*y, (1+xx+yy)]) + # return factor * nparray([(1 + xx + yy), 2 * x, 2 * y]) # flo/manu version + if kernel == "dunham": + return factor*nparray([2*x, 2*y, (1+xx+yy)]) # dunham version + else: + return factor*nparray([(1+xx+yy), 2*x, 2*y]) # flo/manu version -def w2p_py(point): +def w2p_py(point, kernel="manu"): '''Convert Weierstraß to Poincare representation ''' - [x, y, t] = point + [t, x, y] = point # flo/manu version + if kernel == "dunham": + [x, y, t] = point # dunham version + else: + [t, x, y] = point # flo/manu version factor = 1 / (1+t) return complex(x*factor, y*factor) diff --git a/hypertiling/util.py b/hypertiling/util.py index a08193a..577a6cc 100644 --- a/hypertiling/util.py +++ b/hypertiling/util.py @@ -10,8 +10,8 @@ from .geodesics import geodesic_midpoint # radius of the fundamental (and every other) polygon def fund_radius(p, q): - num = math.cos(math.pi*(p+q)/p/q) #np.cos(np.pi / p + np.pi / q) - denom = math.cos(math.pi*(q-p)/p/q)#np.cos(np.pi / p - np.pi / q) + num = math.cos(math.pi*(p+q)/p/q) # np.cos(np.pi / p + np.pi / q) + denom = math.cos(math.pi*(q-p)/p/q) # np.cos(np.pi / p - np.pi / q) return np.sqrt(num / denom) @@ -77,8 +77,6 @@ def border_variance(tiling): return var/len(border) - - # formula from Mertens & Moore, PRE 96, 042116 (2017) # note that they use a different convention def n_cell_centered(p,q,n): @@ -87,6 +85,7 @@ def n_cell_centered(p,q,n): retval = retval + n_cell_centered_recursion(q,p,j) # note the exchange p<-->q return retval + def n_cell_centered_recursion(p,q,l): a = (p-2)*(q-2)-2 if l==0: @@ -98,13 +97,14 @@ def n_cell_centered_recursion(p,q,l): # Eq. A4 from Mertens & Moore, PRE 96, 042116 (2017) -def n_vertex_centered(p,q,l): - if l==0: - retval = 0 # no faces in zeroth layer - else: - #retval = ( n_v(p,q,l)+n_v(p,q,l-1) )/(p-2) - retval = ( n_v_vertex_centered(p,q,l)+n_v_vertex_centered(p,q,l-1) )/(p-2) - return retval +def n_vertex_centered(p, q, l): + if l == 0: + retval = 0 # no faces in zeroth layer + else: + #retval = ( n_v(p,q,l)+n_v(p,q,l-1) )/(p-2) + retval = ( n_v_vertex_centered(p,q,l)+n_v_vertex_centered(p,q,l-1) )/(p-2) + return retval + # Eq. A1, A2 from Mertens & Moore, PRE 96, 042116 (2017) def n_v_vertex_centered(p,q,n): @@ -114,7 +114,6 @@ def n_v_vertex_centered(p,q,n): return retval - # the following functions find the total number of polygons for some {p, q} tessellation of l layers # reference: Baek et al., Phys. Rev.E. 79.011124 def find_num_of_pgons_73(l): -- GitLab From 057a6a920a0da635b6a0267bdb18bd8c63fee418 Mon Sep 17 00:00:00 2001 From: fdusel Date: Tue, 21 Jun 2022 15:43:00 +0200 Subject: [PATCH 11/14] merge conflicts solved --- hypertiling/hyperpolygon.py | 5 ----- hypertiling/kernelbase.py | 3 --- hypertiling/kerneldunham.py | 4 ---- hypertiling/neighbours.py | 26 +++++++++++++------------- 4 files changed, 13 insertions(+), 25 deletions(-) diff --git a/hypertiling/hyperpolygon.py b/hypertiling/hyperpolygon.py index b20877b..1dad401 100644 --- a/hypertiling/hyperpolygon.py +++ b/hypertiling/hyperpolygon.py @@ -207,9 +207,4 @@ class HyperPolygon: for i in range(self.p + 1): # +1 to include center vertex = p2w_py(self.verticesP[i], kernel="dunham") result = tmat @ vertex -<<<<<<< Updated upstream - self.verticesP[i] = w2p_py(result) -======= self.verticesP[i] = w2p_py(result, kernel="dunham") - ->>>>>>> Stashed changes diff --git a/hypertiling/kernelbase.py b/hypertiling/kernelbase.py index e0553d8..9765cd7 100644 --- a/hypertiling/kernelbase.py +++ b/hypertiling/kernelbase.py @@ -6,10 +6,7 @@ import copy from .hyperpolygon import HyperPolygon from .transformation import p2w from .util import fund_radius -<<<<<<< Updated upstream -======= ->>>>>>> Stashed changes # the main object of this library # essentially represents a list of polygons which constitute the hyperbolic lattice diff --git a/hypertiling/kerneldunham.py b/hypertiling/kerneldunham.py index 322f7b0..a937d95 100644 --- a/hypertiling/kerneldunham.py +++ b/hypertiling/kerneldunham.py @@ -5,11 +5,7 @@ import copy from .kernelbase import HyperbolicTilingBase from .hyperpolygon import HyperPolygon, mfull_point from .transformation import p2w -<<<<<<< Updated upstream from .util import fund_radius, remove_duplicates -======= -from .util import fund_radius ->>>>>>> Stashed changes class KernelDunham(HyperbolicTilingBase): diff --git a/hypertiling/neighbours.py b/hypertiling/neighbours.py index 1609c26..0c6bef3 100644 --- a/hypertiling/neighbours.py +++ b/hypertiling/neighbours.py @@ -224,24 +224,24 @@ def find_nn_optimized_slice(tiling, nn_dist, eps=1e-5): # shifts local neighbour list to another sector def shift(lst,times): - lst = sorted(lst) - haszero = (0 in lst) + lst = sorted(lst) + haszero = (0 in lst) # fundamental cell requires a little extra care - if haszero: - lsta = np.array(lst[1:]) + times*pps - lsta[lsta>totalnum-1] -= (totalnum-1) - lsta[lsta<1] += (totalnum-1) - return sorted([0]+list(lsta)) - else: - lsta = np.array(lst) + times*pps - lsta[lsta>totalnum-1] -= (totalnum-1) - lsta[lsta<1] += (totalnum-1) - return sorted(list(lsta)) + if haszero: + lsta = np.array(lst[1:]) + times*pps + lsta[lsta>totalnum-1] -= (totalnum-1) + lsta[lsta<1] += (totalnum-1) + return sorted([0]+list(lsta)) + else: + lsta = np.array(lst) + times*pps + lsta[lsta>totalnum-1] -= (totalnum-1) + lsta[lsta<1] += (totalnum-1) + return sorted(list(lsta)) # increment indices by one def increment(lst): - return list(np.array(lst)+1) + return list(np.array(lst)+1) -- GitLab From a95e2f314eb55b8fc19bdfe30e0a770bd95d8f56 Mon Sep 17 00:00:00 2001 From: fdusel Date: Tue, 21 Jun 2022 16:20:19 +0200 Subject: [PATCH 12/14] mysteriously missing line added again --- hypertiling/core.py | 2 ++ hypertiling/{io.py => ion.py} | 0 hypertiling/kernelflo.py | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) rename hypertiling/{io.py => ion.py} (100%) diff --git a/hypertiling/core.py b/hypertiling/core.py index 145ab1b..ff6af0f 100644 --- a/hypertiling/core.py +++ b/hypertiling/core.py @@ -37,3 +37,5 @@ def HyperbolicTiling(p, q, n, center="cell", kernel="flo"): raise KeyError("[hypertiling] Error: No valid kernel specified") if kernel == "dunham": print("possibly broken") + + return kernels[kernel](p, q, n, center) diff --git a/hypertiling/io.py b/hypertiling/ion.py similarity index 100% rename from hypertiling/io.py rename to hypertiling/ion.py diff --git a/hypertiling/kernelflo.py b/hypertiling/kernelflo.py index 2b32178..5ade05b 100644 --- a/hypertiling/kernelflo.py +++ b/hypertiling/kernelflo.py @@ -28,7 +28,8 @@ class KernelFlo(KernelCommon): self.polygons = [] # add fundamental polygon to list - self.polygons = [self.fund_poly] + self.polygons.append(self.fund_poly) + if self.nlayers == 1: return # if self.nlayers > 0: -- GitLab From b9bb088429d41974f2cd513059cf4497f8e06ab5 Mon Sep 17 00:00:00 2001 From: fdusel Date: Tue, 21 Jun 2022 16:47:04 +0200 Subject: [PATCH 13/14] wrong offset in create_fund_poly removed --- hypertiling/kernelbase.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hypertiling/kernelbase.py b/hypertiling/kernelbase.py index 9765cd7..82efaec 100644 --- a/hypertiling/kernelbase.py +++ b/hypertiling/kernelbase.py @@ -101,9 +101,8 @@ class HyperbolicTilingBase: """ r = fund_radius(self.p, self.q) polygon = HyperPolygon(self.p) - offset = np.pi/self.p for i in range(self.p): - z = complex(math.cos(i*self.phi+offset), math.sin(i*self.phi+offset)) # = exp(i*phi) + z = complex(math.cos(i*self.phi), math.sin(i*self.phi)) # = exp(i*phi) z = z/abs(z) z = r * z polygon.verticesP[i] = z -- GitLab From 138d2fbc061df59e055bdbbdc2c283b6aa32d7b1 Mon Sep 17 00:00:00 2001 From: Felix Dusel Date: Thu, 7 Jul 2022 17:46:30 +0200 Subject: [PATCH 14/14] merely a backup push, wont pass pipelines sorry for bothering --- hypertiling/CenterContainer.py | 2 +- hypertiling/core.py | 7 ++++--- hypertiling/hyperpolygon.py | 2 +- hypertiling/kernelbase.py | 6 +++--- hypertiling/kerneldunham.py | 9 ++++----- hypertiling/kernelflo.py | 10 +++++----- hypertiling/kernelmanu.py | 8 ++++---- hypertiling/plot.py | 2 +- 8 files changed, 23 insertions(+), 23 deletions(-) diff --git a/hypertiling/CenterContainer.py b/hypertiling/CenterContainer.py index cb5aa3b..963d085 100644 --- a/hypertiling/CenterContainer.py +++ b/hypertiling/CenterContainer.py @@ -1,6 +1,6 @@ import math -from .util import fund_radius +from util import fund_radius class HTCenter: '''This helper class wraps a complex and enables comparison based on the angle''' diff --git a/hypertiling/core.py b/hypertiling/core.py index 145ab1b..531f852 100644 --- a/hypertiling/core.py +++ b/hypertiling/core.py @@ -1,7 +1,7 @@ # relative imports -from .kernelflo import KernelFlo -from .kernelmanu import KernelManu -from .kerneldunham import KernelDunham +from kernelflo import KernelFlo +from kernelmanu import KernelManu +from kerneldunham import KernelDunham # factory pattern allows to select between kernels @@ -37,3 +37,4 @@ def HyperbolicTiling(p, q, n, center="cell", kernel="flo"): raise KeyError("[hypertiling] Error: No valid kernel specified") if kernel == "dunham": print("possibly broken") + return kernels[kernel](p, q, n, center) \ No newline at end of file diff --git a/hypertiling/hyperpolygon.py b/hypertiling/hyperpolygon.py index 8a97f4c..b338d7e 100644 --- a/hypertiling/hyperpolygon.py +++ b/hypertiling/hyperpolygon.py @@ -1,6 +1,6 @@ from math import floor import numpy as np -from .transformation import * +from transformation import * def morigin_py(p, z0, verticesP): for i in range(p + 1): diff --git a/hypertiling/kernelbase.py b/hypertiling/kernelbase.py index 28942dc..0e23eff 100644 --- a/hypertiling/kernelbase.py +++ b/hypertiling/kernelbase.py @@ -3,9 +3,9 @@ import math import copy # relative imports -from .hyperpolygon import HyperPolygon -from .transformation import p2w -from .util import fund_radius +from hyperpolygon import HyperPolygon +from transformation import p2w +from util import fund_radius # the main object of this library # essentially represents a list of polygons which constitute the hyperbolic lattice diff --git a/hypertiling/kerneldunham.py b/hypertiling/kerneldunham.py index 5f416cd..dffea93 100644 --- a/hypertiling/kerneldunham.py +++ b/hypertiling/kerneldunham.py @@ -2,10 +2,10 @@ import numpy as np import copy # relative imports -from .kernelbase import HyperbolicTilingBase -from .hyperpolygon import HyperPolygon, mfull_point -from .transformation import p2w -from .util import fund_radius, remove_duplicates +from kernelbase import HyperbolicTilingBase +from hyperpolygon import HyperPolygon, mfull_point +from transformation import p2w +from util import fund_radius, remove_duplicates class KernelDunham(HyperbolicTilingBase): @@ -48,7 +48,6 @@ class KernelDunham(HyperbolicTilingBase): self.fund_poly.moeb_rotate(2*np.pi/360*(self.mangle+180)) # sloppy: reverts the default rotation in kernelbase self.polygons = [self.fund_poly] - def generate(self): if self.nlayers == 1: return diff --git a/hypertiling/kernelflo.py b/hypertiling/kernelflo.py index 8fe6c50..c155383 100644 --- a/hypertiling/kernelflo.py +++ b/hypertiling/kernelflo.py @@ -3,11 +3,11 @@ import math import copy # relative imports -from .kernelbase import KernelCommon -from .hyperpolygon import HyperPolygon, mfull_point -from .transformation import moeb_rotate_trafo -from .util import fund_radius -from .CenterContainer import CenterContainer +from kernelbase import KernelCommon +from hyperpolygon import HyperPolygon, mfull_point +from transformation import moeb_rotate_trafo +from util import fund_radius +from CenterContainer import CenterContainer class KernelFlo(KernelCommon): """ diff --git a/hypertiling/kernelmanu.py b/hypertiling/kernelmanu.py index c651b55..12516ac 100644 --- a/hypertiling/kernelmanu.py +++ b/hypertiling/kernelmanu.py @@ -3,10 +3,10 @@ import math import copy # relative imports -from .kernelbase import KernelCommon -from .hyperpolygon import HyperPolygon, mfull_point -from .transformation import p2w, moeb_rotate_trafo -from .distance import disk_distance +from kernelbase import KernelCommon +from hyperpolygon import HyperPolygon, mfull_point +from transformation import p2w, moeb_rotate_trafo +from distance import disk_distance class KernelManu(KernelCommon): """ Tiling construction algorithm written by M. Schrauth and F. Dusel """ diff --git a/hypertiling/plot.py b/hypertiling/plot.py index 36c995c..441523f 100644 --- a/hypertiling/plot.py +++ b/hypertiling/plot.py @@ -4,7 +4,7 @@ import matplotlib.pyplot as plt import matplotlib.cm as cmap from matplotlib.patches import Polygon from matplotlib.collections import PatchCollection, PolyCollection -from .geodesics import geodesic_arc +from geodesics import geodesic_arc # taken from http://exnumerus.blogspot.com/2011/02/how-to-quickly-plot-polygons-in.html -- GitLab