Exemple #1
0
    def test_open_rri_multiple_columns(self):
        rri = read_from_csv(
            "tests/test_files/rri_multiple_columns.csv", rri_col_index=1, row_offset=1
        )

        self.assertTrue(isinstance(rri, RRi))
        np.testing.assert_equal(rri.values, np.array([790, 815, 800, 795]))
Exemple #2
0
    def test_open_rri_separated_with_semicolon(self):
        rri = read_from_csv(
            'tests/test_files/rri_semicolon.csv',
            row_offset=1,
        )

        self.assertTrue(isinstance(rri, RRi))
        np.testing.assert_equal(rri.values, [790, 815, 800, 795])
Exemple #3
0
    def test_open_rri_single_column_with_header(self):
        rri = read_from_csv(
            'tests/test_files/rri_header.csv',
            row_offset=1
        )

        self.assertTrue(isinstance(rri, RRi))
        np.testing.assert_equal(rri.values, np.array([790, 815, 800, 795]))
Exemple #4
0
    def test_open_rri_with_time(self):
        rri = read_from_csv(
            'tests/test_files/rri_multiple_columns.csv',
            rri_col_index=1,
            time_col_index=0,
            row_offset=1
        )

        self.assertTrue(isinstance(rri, RRi))
        np.testing.assert_equal(rri.values, np.array([790, 815, 800, 795]))
        np.testing.assert_equal(rri.time, np.array([1.0, 2.0, 3.0, 4.0]))
Exemple #5
0
    def test_parse_time_column_in_csv(self):
        rri = read_from_csv(
            "tests/test_files/rri_multiple_columns.csv",
            rri_col_index=1,
            time_col_index=0,
            row_offset=1,
            time_parser=float,
        )

        self.assertTrue(isinstance(rri, RRi))
        np.testing.assert_equal(rri.values, np.array([790, 815, 800, 795]))
        np.testing.assert_equal(rri.time, np.array([1.0, 2.0, 3.0, 4.0]))
Exemple #6
0
    def test_parse_datetime_column_in_csv(self):
        def _time_parser(dt):
            return int(dt.split(":")[-1])

        rri = read_from_csv(
            "tests/test_files/rri_multiple_columns_datetime.csv",
            rri_col_index=1,
            time_col_index=0,
            row_offset=1,
            time_parser=_time_parser,
        )

        self.assertTrue(isinstance(rri, RRi))
        np.testing.assert_equal(rri.values, np.array([790, 815, 800, 795]))
        np.testing.assert_equal(rri.time, np.array([56, 57, 58, 59]))
Exemple #7
0
    def test_open_rri_single_column(self):
        rri = read_from_csv('tests/test_files/rri_1.csv')

        self.assertTrue(isinstance(rri, RRi))
        np.testing.assert_equal(rri.values, np.array([790, 815, 800, 795]))