示例#1
0
    def test_scaling(self):
        """
        Tests that the chimera data is scaled correctly, from a known test file.
        """
        directory = os.path.dirname(os.path.abspath(__file__))
        filename = os.path.join(directory, 'testDataFiles',
                                'spheres_20140114_154938_beginning.log')

        reader = ChimeraReader(filename)

        data = reader.get_all_data()[0]
        reader.close()

        baseline = np.mean(data)
        baseline_should_be = 7.57604  # Value gotten from original MATLAB script

        self.assertAlmostEqual(
            baseline, baseline_should_be, 2,
            "Baseline scaled wrong. Should be {0}, got {1}.".format(
                baseline_should_be, baseline))

        std = np.std(data)
        std_should_be = 1.15445  # Value gotten from original MATLAB script

        self.assertAlmostEqual(
            std, std_should_be, 2,
            "Baseline scaled wrong. Should be {0}, got {1}.".format(
                std_should_be, std))
示例#2
0
 def test_get_all_data(self):
     # Make sure path to chimera file is correct.
     filename = tf.get_abs_path('chimera_small.log')
     chimera_reader = ChimeraReader(filename)
     data = chimera_reader.get_all_data(False)
     self._test_small_chimera_file_help(data)
     chimera_reader.close()
示例#3
0
 def test_open_chimera_data(self):
     # Make sure path to chimera file is correct.
     directory = os.path.dirname(os.path.abspath(__file__))
     filename = os.path.join(os.path.join(directory, 'testDataFiles'), 'smallChimera.log')
     chimera_reader = ChimeraReader(filename)
     data = chimera_reader.get_all_data(False)
     self._test_small_chimera_file_help(data)
     chimera_reader.close()
示例#4
0
 def test_open_chimera_data(self):
     # Make sure path to chimera file is correct.
     directory = os.path.dirname(os.path.abspath(__file__))
     filename = os.path.join(os.path.join(directory, 'testDataFiles'),
                             'smallChimera.log')
     chimera_reader = ChimeraReader(filename)
     data = chimera_reader.get_all_data(False)
     self._test_small_chimera_file_help(data)
     chimera_reader.close()
示例#5
0
    def test_decimate_scaling(self):
        """
        Tests that the scaling of the decimated data is the same as the undecimated data.
        """
        directory = os.path.dirname(os.path.abspath(__file__))
        filename = os.path.join(directory, 'testDataFiles', 'spheres_20140114_154938_beginning.log')

        reader = ChimeraReader(filename)

        data = reader.get_all_data()[0]
        data_decimated = reader.get_all_data(decimate=True)[0]
        reader.close()

        baseline = np.mean(data)
        baseline_decimate = np.mean(data_decimated)

        self.assertAlmostEqual(baseline, baseline_decimate, 2,
                               "Decimated baseline scaled wrong. Should be {0}, got {1}.".format(baseline,
                                                                                                 baseline_decimate))
示例#6
0
    def test_scaling(self):
        """
        Tests that the chimera data is scaled correctly, from a known test file.
        """
        directory = os.path.dirname(os.path.abspath(__file__))
        filename = os.path.join(directory, 'testDataFiles', 'spheres_20140114_154938_beginning.log')

        reader = ChimeraReader(filename)

        data = reader.get_all_data()[0]
        reader.close()

        baseline = np.mean(data)
        baseline_should_be = 7.57604  # Value gotten from original MATLAB script

        self.assertAlmostEqual(baseline, baseline_should_be, 2,
                               "Baseline scaled wrong. Should be {0}, got {1}.".format(baseline_should_be, baseline))

        std = np.std(data)
        std_should_be = 1.15445  # Value gotten from original MATLAB script

        self.assertAlmostEqual(std, std_should_be, 2,
                               "Baseline scaled wrong. Should be {0}, got {1}.".format(std_should_be, std))
示例#7
0
    def test_decimate_scaling(self):
        """
        Tests that the scaling of the decimated data is the same as the undecimated data.
        """
        directory = os.path.dirname(os.path.abspath(__file__))
        filename = os.path.join(directory, 'testDataFiles',
                                'spheres_20140114_154938_beginning.log')

        reader = ChimeraReader(filename)

        data = reader.get_all_data()[0]
        data_decimated = reader.get_all_data(decimate=True)[0]
        reader.close()

        baseline = np.mean(data)
        baseline_decimate = np.mean(data_decimated)

        self.assertAlmostEqual(
            baseline, baseline_decimate, 2,
            "Decimated baseline scaled wrong. Should be {0}, got {1}.".format(
                baseline, baseline_decimate))
示例#8
0
def profile_chimera():
    filename = tf.get_abs_path('spheres_20140114_154938_beginning.log')
    reader = ChimeraReader(filename)
    _reader_tasks(reader)
    reader.close()