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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@

## Bug Fixes

- [#182](https://github.com/pybop-team/PyBOP/pull/182) - Allow square-brackets indexing of Dataset

# [v23.11](https://github.com/pybop-team/PyBOP/releases/tag/v23.11)
- Initial release
- Adds Pints, NLOpt, and SciPy optimisers
Expand Down
3 changes: 3 additions & 0 deletions pybop/_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ def __init__(self, data_dictionary):
self.data = data_dictionary
self.names = self.data.keys()

def __getitem__(self, key):
return self.data[key]

def __repr__(self):
"""
Return a string representation of the Dataset instance.
Expand Down
1 change: 1 addition & 0 deletions tests/unit/test_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def test_dataset(self):

# Test data structure
assert dataset.data == data_dictionary
assert np.all(dataset["Time [s]"] == solution["Time [s]"].data)

# Test exception for non-dictionary inputs
with pytest.raises(ValueError):
Expand Down