def setUpClass(cls): cls.nch = 9 cls.ncch = 4 cls.nch2d = (9, 13) cls.ncch1 = 4 cls.ncch2 = 6 # standard 1S+1D goniometer qconv = xu.QConversion('x+', 'x+', (0, 1, 0)) cls.hxrd = xu.HXRD((1., 1., 0.), (0., 0., 1.), qconv=qconv) # comparable goniometer with translations qconv = xu.QConversion('x+', ['ty', 'tz'], (0, 1e-15, 0)) cls.hxrdtrans = xu.HXRD((1., 1., 0.), (0., 0., 1.), qconv=qconv, sampleor='z+') cls.hxrdtrans.Ang2Q.init_linear('z+', cls.ncch, cls.nch, 1e-15, 50e-6) cls.hxrdtrans.Ang2Q.init_area('z+', 'x+', cls.ncch1, cls.ncch2, cls.nch2d[0], cls.nch2d[1], 1e-15, 50e-6, 50e-6) cls.angle = numpy.random.rand() * 45
def setUpClass(cls): cls.mat = xu.materials.GeTe qconv = xu.QConversion(['x+', 'y+', 'z-'], 'x+', [0, 1, 0]) inp = numpy.cross(cls.mat.Q(1, -1, 0), cls.mat.Q(1, 1, 1)) cls.hxrd = xu.HXRD(inp, cls.mat.Q(1, 1, 1), qconv=qconv) cls.hkltest = (1, 3, 2)
import os import numpy import xrayutilities as xu Si = xu.materials.Si datadir = 'data' specfile = "si_align.spec" en = 15000 # eV wl = xu.en2lam(en) imgdir = os.path.join(datadir, "si_align_") # data path for CCD files filetmp = "si_align_12_%04d.edf.gz" qconv = xu.QConversion(['z+', 'y-'], ['z+', 'y-'], [1, 0, 0]) hxrd = xu.HXRD(Si.Q(1, 1, -2), Si.Q(1, 1, 1), wl=wl, qconv=qconv) # manually selected images s = xu.io.SPECFile(specfile, path=datadir) for num in [61, 62, 63, 20, 21, 26, 27, 28]: s[num].ReadData() try: imagenrs = numpy.append(imagenrs, s[num].data['ccd_n']) except: imagenrs = s[num].data['ccd_n'] # avoid images which do not have to full beam on the detector as well as # other which show signal due to cosmic radiation avoid_images = [37, 57, 62, 63, 65, 87, 99, 106, 110, 111, 126, 130, 175,
return l latticeConstants = [3.905, 3.905, 3.905] STO = xu.materials.Material("SrTiO3", Pnma(*latticeConstants)) #%% # S2-D2 geometry # start with outermost circle: # S2: phi, theta # D2: nu, del # with beam direction along +z and surface normal along +y S2 = ('y+', 'x-') D2 = ('y-', 'x-') beamDir = (0, 0, 1) qconv = xu.QConversion(S2, D2, beamDir) #%% # Specify in-plane direction [1,0,0] and normal direction [0,0,1] surface normal hxrd = xu.HXRD(STO.Q(0, 1, 0), STO.Q(0, 0, 1), qconv=qconv) hxrd.energy = 10000 #%% hkl = (0, 0, 1) q_material = STO.Q(hkl) q_laboratory = hxrd.Transform(q_material) # transform print('SrTiO3: hkl ', hkl, ' qvec ', np.round(q_material, 5)) print('Lattice plane distance: %.4f' % STO.planeDistance(hkl)) #%% #### determine the goniometer angles with the correct geometry restrictions # tell bounds of angles / (min,max) pair or fixed value for all motors