def _set_sgnum(self, v): """Set method for sgnum""" self._sgnum = v self._spaceGroup = SG(self._sgnum) self._newPdata() return
def _toSixLP(self, sgn, lp): """ Generate all six lattice parameters, making sure units are attached. """ tmpSG = SG(sgn) lp6 = list(tmpSG.sixLatticeParams(lp)) # make sure angles have attached units for i in range(6): if not hasattr(lp6[i], 'getVal'): if i in range(3): lp6[i] = _angstroms(lp6[i]) else: lp6[i] = _degrees(lp6[i]) pass pass pass return lp6
def _readCfg(self, p): """Read values from config parser""" # Lattice parameters lpStrings = ( ('a-in-angstroms', _angstroms), ('b-in-angstroms', _angstroms), ('c-in-angstroms', _angstroms), ('alpha-in-degrees', _degrees), ('beta-in-degrees', _degrees), ('gamma-in-degrees', _degrees) ) sgnum = p.getint(self.name, 'space-group') tmpSG = SG(sgnum) try: hklMax = p.getint(self.name, 'hkls-ssmax') except: hklMax = Material.DFLT_SSMAX try: beamEnergy = p.getfloat(self.name, 'beam-energy') except: beamEnergy = Material.DFLT_KEV lparams = [] for ind in tmpSG.reqParams: param, unit = lpStrings[ind] lparams.append(unit(p.getfloat(self.name, param))) pass # Initialize self._hklMax = hklMax self._beamEnergy = beamEnergy self._lparms = self._toSixLP(sgnum, lparams) self.sgnum = sgnum self.description = p.get(self.name, 'description') return