def __init__(self): DATAPATH = os.path.abspath("/home/pycrysfml/hklgen/examples/sxtal") observedFile = os.path.join(DATAPATH, r"prnio.int") infoFile = os.path.join(DATAPATH, r"prnio.cfl") #Read data self.spaceGroup, self.crystalCell, self.atomList = H.readInfo(infoFile) #Return wavelength, refList, sfs2, error, two-theta, and four-circle parameters wavelength, refList, sfs2, error = S.readIntFile(observedFile, kind="int", cell=self.crystalCell) self.wavelength = wavelength self.refList = refList self.sfs2 = sfs2 self.error = error self.tt = [ H.twoTheta(H.calcS(self.crystalCell, ref.hkl), wavelength) for ref in refList ] self.backg = None self.exclusions = [] self.observation_space = spaces.MultiBinary(len(self.refList)) self.action_space = spaces.Discrete(len(self.refList)) self.episodeNum = 0 self.reset()
def main(): tt = [H.twoTheta(H.calcS(cell, ref.hkl),wavelength) for ref in magRefList] print getMagStrFacts() S.diffPatternXtal(infoFile=infoFile, cell=cell, scale=1, tt=tt, obsIntensity=np.zeros(len(magRefList)), wavelength=wavelength, basisSymmetry=symmetry, magAtomList=magAtomList, plot=True, residuals=True, nuclear=False, error=None, magnetic=True, info=True, base=0, refList=refList, extinctions=None)
def __init__(self, observedFile, infoFile, backgFile=None, sxtal=True): #Read data self.spaceGroup, self.crystalCell, self.atomList = H.readInfo(infoFile) # return wavelength, refList, sfs2, error, two-theta, and four-circle parameters wavelength, refList, sfs2, error = S.readIntFile(observedFile, kind="int", cell=self.crystalCell) self.wavelength = wavelength self.refList = refList self.sfs2 = sfs2 self.error = error self.tt = [ H.twoTheta(H.calcS(self.crystalCell, ref.hkl), wavelength) for ref in refList ] self.backg = None self.exclusions = [] self.reset()
import sxtal_model as S #import bumps.parameter #def dont(self, *args, **kw): raise Exception("don't") #bumps.parameter.OperatorAdd.__init__ = dont np.seterr(divide="ignore", invalid="ignore") DATAPATH = os.path.dirname(os.path.abspath(__file__)) backgFile = None#os.path.join(DATAPATH,r"hobk_bas.bac") observedFile = os.path.join(DATAPATH,r"prnio.int") infoFile = os.path.join(DATAPATH,r"prnio.cfl") spaceGroup, crystalCell, atomList = H.readInfo(infoFile) exclusions = [] # return wavelength, refList, sfs2, error, two-theta, and four-circle parameters wavelength, refList, sfs2, error = S.readIntFile(observedFile, kind="int", cell=crystalCell) tt = [H.twoTheta(H.calcS(crystalCell, ref.hkl), wavelength) for ref in refList] backg = None def fit(): cell = Mod.makeCell(crystalCell, spaceGroup.xtalSystem) #cell.a.pm(5.0) #cell.c.pm(5.0) m = S.Model(tt, sfs2, backg, wavelength, spaceGroup, cell, [atomList], exclusions, scale=0.06298, error=error, hkls=refList, extinction=[0.0001054]) m.scale.range(0,100) #m.base.pm(1000) for atomModel in m.atomListModel.atomModels: #atomModel.x.range(0,1) #atomModel.y.range(0,1) #atomModel.z.range(0,1)
#bumps.parameter.OperatorAdd.__init__ = dont np.seterr(divide="ignore", invalid="ignore") DATAPATH = os.path.dirname(os.path.abspath(__file__)) observedFile = os.path.join(DATAPATH,r"MnWO4_nuclear_5K.int") infoFile = os.path.join(DATAPATH,r"AF4_5k.cfl") magfile = os.path.join(DATAPATH, r"MnWO4_magneticAF4_5K.int") (spaceGroup, crystalCell, magAtomList, symmetry) = H.readMagInfo(infoFile) spaceGroup, crystalCell, atomList = H.readInfo(infoFile) exclusions = [] # return wavelength, refList, sfs2, error, two-theta, and four-circle parameters wavelength, refList, sfs2, error = S.readIntFile(observedFile, kind="int", cell=crystalCell) magrefList, magsfs2, magerror = S.readMagIntFile(magfile, cell=crystalCell) tt = [H.twoTheta(H.calcS(crystalCell, ref.hkl), wavelength) for ref in refList] sfs2 = list(sfs2) sfs2.extend(magsfs2) sfs2 = np.array(sfs2) tt.extend([H.twoTheta(H.calcS(crystalCell, ref.hkl), wavelength) for ref in magrefList]) error = list(error) error.extend(list(magerror)) error2 = [item for item in error] backg = None basisSymmetry = copy(symmetry) def fit(): cell = Mod.makeCell(crystalCell, spaceGroup.xtalSystem) #cell.a.pm(5.0) #cell.c.pm(5.0) m = S.Model(tt, sfs2, backg, wavelength, spaceGroup, cell,
infoFile = os.path.join(DATAPATH,r"../mote2.cfl") inFile = open(observedFile, "r") inFile.readline() inFile.readline() inFile.readline() line = inFile.readline().split() A = float(line[1]) B = float(line[2]) C = float(line[3]) #Read data spaceGroup, crystalCell, atomList = H.readInfo(infoFile) # return wavelength, refList, sfs2, error, two-theta, and four-circle parameters wavelength, refList, sfs2, error = S.readIntFile(observedFile, kind="int", cell=crystalCell) tt = [H.twoTheta(H.calcS(crystalCell, ref.hkl), wavelength) for ref in refList] backg = None exclusions = [] #Make a dictionary of the indices of each HKL value for the given crystal d = {} for i in range(len(refList)): d[str(refList[i].hkl).replace("[","").replace("]","").replace(",","")] = i def setInitParams(): #Make a cell cell = Mod.makeCell(crystalCell, spaceGroup.xtalSystem) #Define a model m = S.Model([], [], backg, wavelength, spaceGroup, cell, [atomList], exclusions,