From d76a036c339a5761994fa62e8fb38e50a1950d15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ne=C4=8Dada?= Date: Sun, 5 Feb 2017 22:38:58 +0200 Subject: [PATCH] Final fix of hexpoints + some ipynb demo. Former-commit-id: cf3c5256aef489e0ac813182593a23bce2d6c3d8 --- qpms/__init__.py | 1 + qpms/{hex.py => hexpoints.py} | 8 +++++--- setup.py | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) rename qpms/{hex.py => hexpoints.py} (93%) diff --git a/qpms/__init__.py b/qpms/__init__.py index f202b6a..c2d880c 100644 --- a/qpms/__init__.py +++ b/qpms/__init__.py @@ -4,3 +4,4 @@ __version__ = get_distribution('qpms').version from qpms_c import * from .qpms_p import * from .lattices import * +from .hexpoints import * diff --git a/qpms/hex.py b/qpms/hexpoints.py similarity index 93% rename from qpms/hex.py rename to qpms/hexpoints.py index 75af9ce..7a04db5 100644 --- a/qpms/hex.py +++ b/qpms/hexpoints.py @@ -1,12 +1,12 @@ import math import numpy as np +nx = None _s3 = math.sqrt(3) -_e6 = np.array([[math.cos(2*math.pi*i/6),math.sin(2*math.pi*i/6),0] if v3d else [math.cos(2*math.pi*i/6),math.sin(2*math.pi*i/6)] for i in range(6)]) -_f6 = np.array([[-math.sin(2*math.pi*i/6),math.cos(2*math.pi*i/6),0] if v3d else [math.sin(2*math.pi*i/6),-math.cos(2*math.pi*i/6)] for i in range(6)]) - + def generate_trianglepoints(maxlayer, include_origin = False, v3d = True, circular = True, sixthindices = False, mirrorindices = False): + _e6 = np.array([[math.cos(2*math.pi*i/6),math.sin(2*math.pi*i/6),0] if v3d else [math.cos(2*math.pi*i/6),math.sin(2*math.pi*i/6)] for i in range(6)]) points = np.empty((3*maxlayer*(maxlayer+1)+(1 if include_origin else 0), 3 if v3d else 2)) point_i = 0 if (include_origin): @@ -72,6 +72,8 @@ def generate_trianglepoints(maxlayer, include_origin = False, v3d = True, circul 'nmi' : nmi if mirrorindices else None} def generate_trianglepoints_hexcomplement(maxlayer, v3d = True, circular = True, thirdindices = False, mirrorindices=False): + _e6 = np.array([[math.cos(2*math.pi*i/6),math.sin(2*math.pi*i/6),0] if v3d else [math.cos(2*math.pi*i/6),math.sin(2*math.pi*i/6)] for i in range(6)]) + _f6 = np.array([[-math.sin(2*math.pi*i/6),math.cos(2*math.pi*i/6),0] if v3d else [math.sin(2*math.pi*i/6),-math.cos(2*math.pi*i/6)] for i in range(6)]) points = np.empty((3*maxlayer*maxlayer, 3 if v3d else 2)) point_i = 0 # 3 * layer ** 2 is the basis index for a layer, a layer contains 3 * (2*layer + 1) points diff --git a/setup.py b/setup.py index ab8e9b5..b5ae396 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ qpms_c = Extension('qpms_c', sources = ['qpms/qpms_c.pyx']) setup(name='qpms', - version = "0.1.7", + version = "0.1.8", packages=['qpms'], # setup_requires=['setuptools_cython'], install_requires=['cython>=0.21','quaternion','spherical_functions','py_gmm'],