def testReadFile(self):
        filename = get_current_module_path(__file__,
                                           "../emmff/spectra/spectrum1.emsa")

        self.emsa.open(filename)

        self.assertNotEqual(0, len(self.emsa.lines))

        self.assertEqual(1054, len(self.emsa.lines))

        filename = get_current_module_path(__file__,
                                           "../emmff/spectra/BadFile.emsa")

        self.assertRaises(IOError, self.emsa.open, filename)
Exemple #2
0
    def setUp(self):
        unittest.TestCase.setUp(self)

        self.filepath = get_current_module_path(__file__, "../../test_data/k3670_30keV_OFeCalibration.csp")
        if not is_test_data_file(self.filepath):
            raise SkipTest

        self.gpFile = genesisPolarisFile.GenesisPolarisFile()
    def setUp(self):
        unittest.TestCase.setUp(self)

        self.filepath = get_current_module_path(__file__,
                                                "../../test_data/test01.trc")
        if not is_test_data_file(self.filepath):
            raise SkipTest

        self.traceFile = TraceFile.TraceFile(self.filepath)
    def setUp(self):
        """
        Setup method.
        """

        unittest.TestCase.setUp(self)

        self.path = get_current_module_path(
            __file__, "../../../test_data/Bruker/MapRaw")
    def setUp(self):
        unittest.TestCase.setUp(self)

        self.filepath = get_current_module_path(
            __file__, "../emmff/spectra/spectrum1.emsa")
        if not os.path.isfile(self.filepath):
            raise SkipTest

        self.emsa = emsaFormat.EmsaFormat(self.filepath)
    def setUp(self):
        unittest.TestCase.setUp(self)

        self.filepath = get_current_module_path(
            __file__, "../../../test_data/SpectrumProcessing 10.txt")
        if not is_test_data_file(self.filepath):
            raise SkipTest

        self.results = ReadSpectrumProcessingResults.ReadSpectrumProcessingResults(
            self.filepath)
    def setUp(self):
        unittest.TestCase.setUp(self)

        self.filepathRef = get_current_module_path(__file__, "../../test_data/TEM_Edax/OVERALL.CSV")
        if not is_test_data_file(self.filepathRef):
            raise SkipTest

        self.data = TemCsvFile.TemCsvFile(self.filepathRef)

        self.numberPoints = 1024
Exemple #8
0
    def setUp(self):
        """
        Setup method.
        """

        unittest.TestCase.setUp(self)

        self.path = get_current_module_path(
            __file__, "../../../test_data/OxfordInstruments/MapRaw")
        if not os.path.isdir(self.path):
            raise SkipTest
Exemple #9
0
    def setUp(self):
        unittest.TestCase.setUp(self)

        filepath = get_current_module_path(__file__, "spectra/spectrum1.emsa")
        if not os.path.isfile(filepath):
            raise SkipTest
        if PY3:
            with open(filepath, 'r', newline="\r\n") as f:
                self.emsa = emsa.read(f)
        elif PY2:
            with open(filepath, 'rb') as f:
                self.emsa = emsa.read(f)
Exemple #10
0
    def setUp(self):
        warnings.simplefilter("ignore")

        unittest.TestCase.setUp(self)

        projectPath = get_current_module_path(__file__)

        self.filename = os.path.join(projectPath,
                                     "../../test_data/data0407.ful")
        if not is_test_data_file(self.filename):
            raise SkipTest

        self.linescanFile = JEOL8900McGill.JEOL8900McGill(self.filename)
    def testReadlines(self):
        emsa = emsaFormat.EmsaFormat()

        filename = get_current_module_path(__file__,
                                           "../emmff/spectra/spectrum1.emsa")

        emsa.open(filename)

        emsa.readLines()

        self.assertEquals(30, len(emsa.keywords))

        self.assertEquals(1024, len(emsa.values))
    def test_isValidFile(self):
        folderpath = get_current_module_path(__file__, "../../../test_data")

        filepath = os.path.join(folderpath, "SpectrumFullResults 10.txt")
        self.assertEquals(True, ReadSpectrumFullResults.isValidFile(filepath))

        filepath = os.path.join(folderpath, "SpectrumProcessing 10.txt")
        self.assertEquals(False, ReadSpectrumFullResults.isValidFile(filepath))

        filepath = os.path.join(folderpath, "AllSpectra.txt")
        self.assertEquals(False, ReadSpectrumFullResults.isValidFile(filepath))

        #self.fail("Test if the TestCase is working.")
        self.assertTrue(True)
    def testReadFileTEMBruker(self):
        filename = get_current_module_path(
            __file__, "../../test_data/TEM_Bruker/Gold-pt 2-2.msa")
        if not os.path.isfile(filename):
            raise SkipTest

        emsa = emsaFormat.EmsaFormat()
        emsa.open(filename)
        emsa.readLines()
        emsa.setHeader()
        emsa.setSpectrumData()

        self.assertNotEqual(0, len(emsa.lines))

        self.assertEqual(1055, len(emsa.lines))

        self.assertEqual(1024, len(emsa.values))
        self.assertEqual(4096, len(emsa.getDataX()))
        self.assertEqual(4096, len(emsa.getDataY()))
    def test_is_test_data_file(self):
        self.assertFalse(is_test_data_file(self.file_path))

        self.assertFalse(is_test_data_file(get_current_module_path(__file__)))

        self.assertTrue(is_test_data_file(__file__))
    def setUp(self):
        unittest.TestCase.setUp(self)

        self.file_path = get_current_module_path(__file__, "../test_data/lfs_test_file.txt")
        if not os.path.isfile(self.file_path):
            raise SkipTest