示例#1
0
    def test_convert_chimera_file_equality(self, filename):
        """
        Test that the original/converted matrices and sample rates are the same for one-channel data.
        """
        data_filename = tf.get_abs_path('chimera_1event.log')

        output_filename = convert_file(data_filename, output_filename=filename)

        orig_reader = get_reader_from_filename(data_filename)
        orig_data_all = orig_reader.get_all_data()
        orig_sample_rate = orig_reader.get_sample_rate()

        self.assertEqual(len(orig_data_all), 1)

        out_reader = DataFileReader(output_filename)
        out_data_all = out_reader.get_all_data()
        out_sample_rate = out_reader.get_sample_rate()

        self.assertEqual(len(out_data_all), 1)

        orig_data = orig_data_all[0]
        out_data = out_data_all[0]

        # assert sample rates are equal
        self.assertAlmostEqual(1.0 * orig_sample_rate / out_sample_rate, 1, 4)

        # assert the two arrays are equal
        np.testing.assert_array_equal(orig_data, out_data)

        orig_reader.close()
        out_reader.close()
示例#2
0
    def test_convert_file_set_output_filename(self, filename):
        """
        Tests that the output filename can be set correctly.
        """
        data_filename = tf.get_abs_path('chimera_1event.log')

        output_filename = convert_file(data_filename, output_filename=filename)

        # Test that we can set the output filename
        self.assertEqual(output_filename, filename, "output_filename not correct")
示例#3
0
    def test_convert_file_set_output_filename(self, filename):
        """
        Tests that the output filename can be set correctly.
        """
        data_filename = os.path.dirname(os.path.realpath(__file__))
        data_filename = os.path.join(data_filename, 'testDataFiles', 'chimera_1event.log')

        output_filename = convert_file(data_filename, output_filename=filename)

        # Test that we can set the output filename
        self.assertEqual(output_filename, filename, "output_filename not correct")