def _spec_or_angles(angles,calc_kappa=False): """ Angles defined by spec for the OR's. See specfile.py Notes: ------ Assume the following. If parsing angles from the P array: (generally shouldnt need this since angles are tagged with motor labels on read) angles = P if psic: angles = angles[0:5] elif kappa fourc angles = [angles[0:3], angles[8], angles[7]] If parsing angles from the G array: angles = G[x:y] where x:y depend on whether you are parsing out or0 or or1. See spec_G below We then assume the following: del = angles[0] eta = angles[1] chi = angles[2] phi = angles[3] nu = angles[4] mu = angles[5] Note: calc kappa, keta and kphi kap_alp = 50.031; keta = eta - asin(-tan(chi/2)/tan(kap_alp)) kphi = phi - asin(-tan(chi/2)/tan(kap_alp)) kappa = asin(sin(chi/2)/sin(kap_alp)) """ # angles from spec delta = angles[0] eta = angles[1] chi = angles[2] phi = angles[3] nu = angles[4] mu = angles[5] # kappa angles if calc_kappa: kap_alp = 50.031; keta = eta - arcsind(-tand(chi/2.)/tand(kap_alp)) kphi = phi - arcsind(-tand(chi/2.)/tand(kap_alp)) kappa = asind(sind(chi/2.)/sind(kap_alp)) return {'phi':phi,'chi':chi,'eta':eta,'mu':mu, 'delta':delta,'nu':nu, 'keta':keta,'kphi':kphi,'kappa':kappa} else: return {'phi':phi,'chi':chi,'eta':eta,'mu':mu, 'delta':delta,'nu':nu}
def cartesian(self, shift=[0., 0., 0.]): """ Calculates a cartesian basis using: Va = a' is parallel to a Vb = b' is perpendicular to a' and in the a/b plane Vc = c' is perpendicular to the a'/c' plane A shift vector may be specified to shift the origin of the cartesian lattice relative to the original lattice origin (specify shift in fractional coordinates of the original lattice) """ (a, b, c, alp, bet, gam) = self.lattice.cell() (ar, br, cr, alpr, betr, gamr) = self.lattice.rcell() Va = [1. / a, 0., 0.] Vb = [-1. / (a * tand(gam)), 1. / (b * sind(gam)), 0.] Vc = [ar * cosd(betr), br * cosd(alpr), cr] self.basis(Va=Va, Vb=Vb, Vc=Vc, shift=shift)
def cartesian(self,shift=[0.,0.,0.]): """ Calculates a cartesian basis using: Va = a' is parallel to a Vb = b' is perpendicular to a' and in the a/b plane Vc = c' is perpendicular to the a'/c' plane A shift vector may be specified to shift the origin of the cartesian lattice relative to the original lattice origin (specify shift in fractional coordinates of the original lattice) """ (a,b,c,alp,bet,gam) = self.lattice.cell() (ar,br,cr,alpr,betr,gamr) = self.lattice.rcell() Va = [1./a, 0. , 0.] Vb = [-1./(a*tand(gam)), 1./(b*sind(gam)), 0.] Vc = [ar*cosd(betr), br*cosd(alpr), cr] self.basis(Va=Va,Vb=Vb,Vc=Vc,shift=shift)
def _spec_or_angles(angles, calc_kappa=False): """ Angles defined by spec for the OR's. See specfile.py Notes: ------ Assume the following. If parsing angles from the P array: (generally shouldnt need this since angles are tagged with motor labels on read) angles = P if psic: angles = angles[0:5] elif kappa fourc angles = [angles[0:3], angles[8], angles[7]] If parsing angles from the G array: angles = G[x:y] where x:y depend on whether you are parsing out or0 or or1. See spec_G below We then assume the following: del = angles[0] eta = angles[1] chi = angles[2] phi = angles[3] nu = angles[4] mu = angles[5] Note: calc kappa, keta and kphi kap_alp = 50.031; keta = eta - asin(-tan(chi/2)/tan(kap_alp)) kphi = phi - asin(-tan(chi/2)/tan(kap_alp)) kappa = asin(sin(chi/2)/sin(kap_alp)) """ # angles from spec delta = angles[0] eta = angles[1] chi = angles[2] phi = angles[3] nu = angles[4] mu = angles[5] # kappa angles if calc_kappa: kap_alp = 50.031 keta = eta - arcsind(-tand(chi / 2.) / tand(kap_alp)) kphi = phi - arcsind(-tand(chi / 2.) / tand(kap_alp)) kappa = asind(sind(chi / 2.) / sind(kap_alp)) return { 'phi': phi, 'chi': chi, 'eta': eta, 'mu': mu, 'delta': delta, 'nu': nu, 'keta': keta, 'kphi': kphi, 'kappa': kappa } else: return { 'phi': phi, 'chi': chi, 'eta': eta, 'mu': mu, 'delta': delta, 'nu': nu }