Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/vitabel/timeseries.py
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,10 @@ def __init__(
offset=offset,
)

def __repr__(self) -> str:
"""A string representation of the channel."""
return f"{self.__class__.__name__}({self.name})"

def data_hash(self) -> str:
"""Return a hash representing the data and the metadata of this channel."""
data = {
Expand Down
8 changes: 8 additions & 0 deletions tests/test_timeseries.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,14 @@ def test_channel_time_only():
assert channel.is_time_only()


def test_channel_repr():
time = np.arange(0, 1, 0.1)
data = np.sin(2 * np.pi * time)
channel = Channel(name="HR", time_index=time, data=data)

assert repr(channel) == "Channel(HR)"


def test_channel_get_data():
time = np.arange(0, 5, 0.1)
data = np.sin(2 * np.pi * time)
Expand Down
Loading