from numpy.linalg import norm except ImportError: from numjy import matrix from numjy.linalg import norm from diffcalc.log import logging from diffcalc.hkl.calcbase import HklCalculatorBase from diffcalc.hkl.you.geometry import create_you_matrices, calcMU, calcPHI, \ calcCHI from diffcalc.hkl.you.geometry import YouPosition from diffcalc.util import DiffcalcException, bound, angle_between_vectors from diffcalc.util import cross3, z_rotation, x_rotation from diffcalc.ub.calc import PaperSpecificUbCalcStrategy from diffcalc.hkl.you.constraints import NUNAME logger = logging.getLogger("diffcalc.hkl.you.calc") I = matrix('1 0 0; 0 1 0; 0 0 1') y = matrix('0; 1; 0') SMALL = 1e-8 TORAD = pi / 180 TODEG = 180 / pi PRINT_DEGENERATE = False def is_small(x): return abs(x) < SMALL def ne(a, b):
try: from collection import OrderedDict except ImportError: from simplejson import OrderedDict try: import json except ImportError: import simplejson as json try: from numpy import matrix except ImportError: from numjy import matrix logger = logging.getLogger("diffcalc.ub.calcstate") TODEG = 180 / pi class UBCalcState(): def __init__(self, name=None, crystal=None, reflist=None, orientlist=None, tau=0, sigma=0, manual_U=None, manual_UB=None, or0=None, or1=None, reference=None, surface=None): assert reflist is not None self.name = name self.crystal = crystal self.reflist = reflist self.orientlist = orientlist self.tau = tau # degrees
from math import pi, asin, acos, atan2, sin, cos, sqrt try: from numpy import matrix except ImportError: from numjy import matrix from diffcalc.log import logging from diffcalc.util import bound, AbstractPosition, DiffcalcException,\ x_rotation, z_rotation from diffcalc.hkl.vlieg.geometry import VliegGeometry from diffcalc.ub.calc import PaperSpecificUbCalcStrategy from diffcalc.hkl.calcbase import HklCalculatorBase from diffcalc.hkl.common import DummyParameterManager logger = logging.getLogger("diffcalc.hkl.willmot.calcwill") CHOOSE_POSITIVE_GAMMA = True TORAD = pi / 180 TODEG = 180 / pi I = matrix('1 0 0; 0 1 0; 0 0 1') SMALL = 1e-10 TEMPORARY_CONSTRAINTS_DICT_RAD = {'betain': 2 * TORAD} def create_matrices(delta, gamma, omegah, phi): return (calc_DELTA(delta), calc_GAMMA(gamma), calc_OMEGAH(omegah), calc_PHI(phi))