Ejemplo n.º 1
0
    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()
Ejemplo n.º 2
0
    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()
Ejemplo n.º 3
0
import hkl_model as Mod
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)
Ejemplo n.º 4
0
observedFile = os.path.join(DATAPATH,r"../simulation.int")
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,
Ejemplo n.º 5
0
#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"35Lcombined.dat")
infoFile = os.path.join(DATAPATH, r"35Lcombined.cfl")

(spaceGroup, crystalCell, magAtomList, symmetry) = H.readMagInfo(infoFile)
atomList = H.readInfo(infoFile)[2]
exclusions = []
# return wavelength, refList, sfs2, error, two-theta, and four-circle parameters
wavelength, refList, sfs2, error, tt, four_circle = S.readIntFile(observedFile)
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, (atomList, magAtomList),
                exclusions,
Ejemplo n.º 6
0
#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"35Lcombined.dat")
infoFile = os.path.join(DATAPATH,r"35Lcombined.cfl")

(spaceGroup, crystalCell, magAtomList, symmetry) = H.readMagInfo(infoFile)
atomList = H.readInfo(infoFile)[2]
exclusions = []
# return wavelength, refList, sfs2, error, two-theta, and four-circle parameters
wavelength, refList, sfs2, error, tt, four_circle = S.readIntFile(observedFile)
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,
                (atomList, magAtomList), exclusions, magnetic=True,
                symmetry=symmetry, newSymmetry=basisSymmetry, scale=1.557, error=error, hkls=refList)
    m.scale.range(0,100)
    #m.base.pm(1000)
    m.extinction.range(0,10.0)
    for atomModel in m.atomListModel.atomModels:
        #atomModel.x.range(0,1)