From 5a10ad1a78446da7ac312d333bed19f0e296736b Mon Sep 17 00:00:00 2001 From: Marco Cammarata Date: Fri, 20 Jan 2017 10:42:44 +0100 Subject: [PATCH] clean up and improved cell submodule, has also an helper for printing reflections on figure --- xray/cell.py | 64 ++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 47 insertions(+), 17 deletions(-) diff --git a/xray/cell.py b/xray/cell.py index cd28428..0b26a21 100644 --- a/xray/cell.py +++ b/xray/cell.py @@ -1,4 +1,6 @@ from __future__ import division,print_function +import collections +import itertools import numpy as np from numpy import sin,cos @@ -34,35 +36,63 @@ class Triclinic(object): d = self.V/np.sqrt(temp) return d - def q(self,h,k,l): + def Q(self,h,k,l): return 2*np.pi/self.d(h,k,l) + def reflection_list(self,maxQ=3,lim=10): + ret=dict() + # prepare hkl + i = range(-lim,lim+1) + prod = itertools.product( i,i,i ) + hkl = np.asarray( list( itertools.product( i,i,i ) ) ) + h,k,l = hkl.T + q = self.Q(h,k,l) + + idx = q