def setUp(self): unittest.TestCase.setUp(self) testDataFolder = Files.getCurrentModulePath(__file__, 'testdata') self.testTxtFilepath = os.path.join(testDataFolder, 'test_txtFile.txt') self.txt = txtFile.txt(self.testTxtFilepath)
def setUp(self): unittest.TestCase.setUp(self) testDataFolder = Files.getCurrentModulePath(__file__, '') self.testCprFilepath = os.path.join(testDataFolder, 'cprmaster.cpr') self.cpr = cprFile.cpr(self.testCprFilepath)
def setUp(self): unittest.TestCase.setUp(self) relativePath = os.path.join('..', 'testdata', 'pe-spect-01.dat') filepath = Files.getCurrentModulePath(__file__, relativePath) self.energies, self.intensities = self._read_spectrum(filepath)
def setUp(self): unittest.TestCase.setUp(self) relativePath = os.path.join('testdata', 'test_ctfFile.ctf') filepath = Files.getCurrentModulePath(__file__, relativePath) self.ctf = ctfFile.ctf(filepath)
def setUp(self): unittest.TestCase.setUp(self) relativepath = os.path.join('..', 'testdata', 'goodconfiguration.cfg') configurationfilepath = Files.getCurrentModulePath(__file__, relativepath) self.scatter = scatteringfactors.ElasticAtomicScatteringFactors(configurationfilepath)
def setUp(self): unittest.TestCase.setUp(self) # Unit cell. unitcell_fcc = unitcell.create_cubic_unitcell(5.43) unitcell_bcc = unitcell.create_cubic_unitcell(2.87) unitcell_hcp = unitcell.create_hexagonal_unitcell(3.21, 5.21) # Atom sites. atoms_fcc = atomsites.create_fcc_atomsites(14) atoms_bcc = atomsites.create_bcc_atomsites(14) atoms_hcp = atomsites.create_hcp_atomsites(14) # Scattering factors relativepath = os.path.join('..', 'testdata', 'goodconfiguration.cfg') configurationfilepath = Files.getCurrentModulePath(__file__, relativepath) scatter = scatteringfactors.ElasticAtomicScatteringFactors(configurationfilepath) # Reflectors self.refls_fcc = \ reflectors.Reflectors(unitcell_fcc, atoms_fcc, scatter, maxindice=2) self.refls_bcc = \ reflectors.Reflectors(unitcell_bcc, atoms_bcc, scatter, maxindice=2) self.refls_hcp = \ reflectors.Reflectors(unitcell_hcp, atoms_hcp, scatter, maxindice=2)
def setUp(self): unittest.TestCase.setUp(self) relativePath = os.path.join('..', 'testdata', 'aluminum.cif') filepath = Files.getCurrentModulePath(__file__, relativePath) self.cifAl = cif.Reader(filepath) relativePath = os.path.join('..', 'testdata', 'iron.cif') filepath = Files.getCurrentModulePath(__file__, relativePath) self.cifFe = cif.Reader(filepath) relativePath = os.path.join('..', 'testdata', 'zirconium.cif') filepath = Files.getCurrentModulePath(__file__, relativePath) self.cifZr = cif.Reader(filepath) relativePath = os.path.join('..', 'testdata', 'rudimer.cif') filepath = Files.getCurrentModulePath(__file__, relativePath) self.cifRuDimer = cif.Reader(filepath)
def __init__(self, configurationfilepath=None): """ Read scattering factors from tables. Two implementations: * :class:`ElasticAtomicScatteringFactors` * :class:`XrayScatteringFactors` """ if configurationfilepath is None: relativepath = os.path.join('..', 'ebsdtools.cfg') configurationfilepath = Files.getCurrentModulePath(__file__, relativepath) self._readconfiguration(configurationfilepath) self._read()
def __init__(self, configurationfilepath=None): """ Return the elastic atomic scattering factors as given by the Crystallography Tables. The data is a exponential fit of the scattering factors. It is calculated from :math:`s = \\frac{4\\pi\\sin\\theta}{\\lambda}`. It is separated into two files: from 0 to 2 A^{-1} and 2 to 6 A^{-1}. :arg configurationfilepath: file path of the configuration file for the module. If ``None``, the default configuration file is loaded. :type configurationfilepath: :class:`str` **References** International Tables For Crystallography, Volume C, p. 262 and 282-285 """ if configurationfilepath is None: relativepath = os.path.join('..', 'ebsdtools.cfg') configurationfilepath = Files.getCurrentModulePath(__file__, relativepath) self._readconfiguration(configurationfilepath) self._read()
def setUp(self): unittest.TestCase.setUp(self) # Manual testing self.cubic = unitcell.create_cubic_unitcell(2) self.tetragonal = unitcell.create_tetragonal_unitcell(2, 3) self.orthorhombic = unitcell.create_orthorhombic_unitcell(1, 2, 3) self.trigonal = unitcell.create_trigonal_unitcell(2, 35.0 / 180 * pi) self.hexagonal = unitcell.create_hexagonal_unitcell(2, 3) self.monoclinic = unitcell.create_monoclinic_unitcell(1, 2, 3, 55.0 / 180 * pi) self.triclinic = \ unitcell.create_triclinic_unitcell(1, 2, 3, 75.0 / 180 * pi, 55.0 / 180 * pi, 35.0 / 180 * pi) self.planes = [plane.Plane(1, 0, 0), plane.Plane(1, 1, 0), plane.Plane(1, 1, 1), plane.Plane(2, 0, 2), plane.Plane(1, 2, 3), plane.Plane(4, 5, 6), plane.Plane(0, 9, 2)] # Example 1.13 from Mathematical Crystallography (p.31-33) self.L1 = unitcell.create_hexagonal_unitcell(4.914, 5.409) self.atom1 = atomsite.AtomSite(8, (0.4141, 0.2681, 0.1188)) self.atom2 = atomsite.AtomSite(14, (0.4699, 0.0, 0.0)) self.atom3 = atomsite.AtomSite(14, (0.5301, 0.5301, 0.3333)) # Problem 1.13 from Mathematical Crystallography (p.34) alpha = 93.11 / 180.0 * pi beta = 115.91 / 180.0 * pi gamma = 91.26 / 180.0 * pi self.L2 = unitcell.create_triclinic_unitcell(8.173, 12.869, 14.165 , alpha, beta, gamma) self.atom4 = atomsite.AtomSite(8, (0.3419, 0.3587, 0.1333)) self.atom5 = atomsite.AtomSite(14, (0.5041, 0.3204, 0.1099)) self.atom6 = atomsite.AtomSite(13, (0.1852, 0.3775, 0.1816)) # Example 2.16 and Problem 2.9 from Mathematical Crystallography (p.64-65) alpha = 114.27 / 180.0 * pi beta = 82.68 / 180.0 * pi gamma = 94.58 / 180.0 * pi self.L3 = unitcell.create_triclinic_unitcell(6.621, 7.551, 17.381 , alpha, beta, gamma) # Problem 2.15 from Mathematical Crystallography (p.79) alpha = 113.97 / 180.0 * pi beta = 98.64 / 180.0 * pi gamma = 67.25 / 180.0 * pi self.L4 = unitcell.create_triclinic_unitcell(5.148, 7.251, 5.060 , alpha, beta, gamma) # Scattering factors relativepath = os.path.join('..', 'testdata', 'goodconfiguration.cfg') configurationfilepath = Files.getCurrentModulePath(__file__, relativepath) self.scatter = scatteringfactors.XrayScatteringFactors(configurationfilepath) # Atom sites self.atomsfcc = atomsites.AtomSites([atomsite.AtomSite(14, 0.5, 0.5, 0.0), atomsite.AtomSite(14, 0.5, 0.0, 0.5), atomsite.AtomSite(14, 0.0, 0.5, 0.5), atomsite.AtomSite(14, 0.0, 0.0, 0.0)]) self.atomsbcc = atomsites.AtomSites([atomsite.AtomSite(14, 0.5, 0.5, 0.5), atomsite.AtomSite(14, 0.0, 0.0, 0.0)]) self.atomshcp = atomsites.AtomSites([atomsite.AtomSite(14, 1 / 3.0, 2 / 3.0, 0.5), atomsite.AtomSite(14, 0.0, 0.0, 0.0)])
def setUp(self): unittest.TestCase.setUp(self) # Manual testing self.cubic = unitcell.create_cubic_unitcell(2) self.tetragonal = unitcell.create_tetragonal_unitcell(2, 3) self.orthorhombic = unitcell.create_orthorhombic_unitcell(1, 2, 3) self.trigonal = unitcell.create_trigonal_unitcell(2, 35.0 / 180 * pi) self.hexagonal = unitcell.create_hexagonal_unitcell(2, 3) self.monoclinic = unitcell.create_monoclinic_unitcell( 1, 2, 3, 55.0 / 180 * pi) self.triclinic = \ unitcell.create_triclinic_unitcell(1, 2, 3, 75.0 / 180 * pi, 55.0 / 180 * pi, 35.0 / 180 * pi) self.planes = [ plane.Plane(1, 0, 0), plane.Plane(1, 1, 0), plane.Plane(1, 1, 1), plane.Plane(2, 0, 2), plane.Plane(1, 2, 3), plane.Plane(4, 5, 6), plane.Plane(0, 9, 2) ] # Example 1.13 from Mathematical Crystallography (p.31-33) self.L1 = unitcell.create_hexagonal_unitcell(4.914, 5.409) self.atom1 = atomsite.AtomSite(8, (0.4141, 0.2681, 0.1188)) self.atom2 = atomsite.AtomSite(14, (0.4699, 0.0, 0.0)) self.atom3 = atomsite.AtomSite(14, (0.5301, 0.5301, 0.3333)) # Problem 1.13 from Mathematical Crystallography (p.34) alpha = 93.11 / 180.0 * pi beta = 115.91 / 180.0 * pi gamma = 91.26 / 180.0 * pi self.L2 = unitcell.create_triclinic_unitcell(8.173, 12.869, 14.165, alpha, beta, gamma) self.atom4 = atomsite.AtomSite(8, (0.3419, 0.3587, 0.1333)) self.atom5 = atomsite.AtomSite(14, (0.5041, 0.3204, 0.1099)) self.atom6 = atomsite.AtomSite(13, (0.1852, 0.3775, 0.1816)) # Example 2.16 and Problem 2.9 from Mathematical Crystallography (p.64-65) alpha = 114.27 / 180.0 * pi beta = 82.68 / 180.0 * pi gamma = 94.58 / 180.0 * pi self.L3 = unitcell.create_triclinic_unitcell(6.621, 7.551, 17.381, alpha, beta, gamma) # Problem 2.15 from Mathematical Crystallography (p.79) alpha = 113.97 / 180.0 * pi beta = 98.64 / 180.0 * pi gamma = 67.25 / 180.0 * pi self.L4 = unitcell.create_triclinic_unitcell(5.148, 7.251, 5.060, alpha, beta, gamma) # Scattering factors relativepath = os.path.join('..', 'testdata', 'goodconfiguration.cfg') configurationfilepath = Files.getCurrentModulePath( __file__, relativepath) self.scatter = scatteringfactors.XrayScatteringFactors( configurationfilepath) # Atom sites self.atomsfcc = atomsites.AtomSites([ atomsite.AtomSite(14, 0.5, 0.5, 0.0), atomsite.AtomSite(14, 0.5, 0.0, 0.5), atomsite.AtomSite(14, 0.0, 0.5, 0.5), atomsite.AtomSite(14, 0.0, 0.0, 0.0) ]) self.atomsbcc = atomsites.AtomSites([ atomsite.AtomSite(14, 0.5, 0.5, 0.5), atomsite.AtomSite(14, 0.0, 0.0, 0.0) ]) self.atomshcp = atomsites.AtomSites([ atomsite.AtomSite(14, 1 / 3.0, 2 / 3.0, 0.5), atomsite.AtomSite(14, 0.0, 0.0, 0.0) ])
def setUp(self): unittest.TestCase.setUp(self) filepath = Files.getCurrentModulePath(__file__, os.path.join('testdata', 'test.smp')) self.reader = smp.reader(open(filepath, 'rb'))