Exemplo n.º 1
0
def test_channel_as_dataframe_with_raw_data():
    """Convert channel to Pandas dataframe with absolute time index"""

    test_file, _ = scenarios.scaled_data().values
    expected_raw_data = np.array([1, 2, 3, 4], dtype=np.int32)
    tdms_data = test_file.load()

    df = tdms_data["group"]["channel1"].as_dataframe(scaled_data=False)

    np.testing.assert_equal(df["/'group'/'channel1'"], expected_raw_data)
Exemplo n.º 2
0
def test_indexing_scaled_channel_with_integer():
    """ Test indexing into a channel with an integer index when the channel is scaled
    """
    test_file, expected_data = scenarios.scaled_data().values
    with test_file.get_tempfile() as temp_file:
        with TdmsFile.open(temp_file.file) as tdms_file:
            for ((group, channel), expected_channel_data) in expected_data.items():
                channel_object = tdms_file[group][channel]
                values = []
                for i in range(len(channel_object)):
                    values.append(channel_object[i])
                compare_arrays(values, expected_channel_data)