Skip to content

Commit

Permalink
Add TimeSeries.descriptionLazy field to test that reading string attr…
Browse files Browse the repository at this point in the history
…ibutes works
  • Loading branch information
oruebel committed Sep 22, 2024
1 parent aad6928 commit 5a411c4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/nwb/base/TimeSeries.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,5 +100,11 @@ class TimeSeries : public Container
float,
"data/resolution",
Smallest meaningful difference between values in data.)

DEFINE_FIELD(descriptionLazy,
AttributeField,
std::string,
"description",
Description of the series)
};
} // namespace AQNWB::NWB
9 changes: 9 additions & 0 deletions tests/examples/test_ecephys_data_read.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,15 @@ TEST_CASE("ElectricalSeriesReadExample", "[ecephys]")
auto readBoostMulitArray = readDataValues.as_multi_array<2>();
// [example_read_only_snippet]

// Test that reading a string attribute works
auto esDescr = electricalSeries->descriptionLazy();
auto esDescrData = esDescr->values();
REQUIRE(esDescrData.data.size() == 1);
REQUIRE(esDescrData.shape.size() == 0);
REQUIRE(esDescrData.data[0]
== std::string("Stores continuously sampled voltage data from an "
"extracellular ephys recording"));

// TODO Slicing doesn't seem to work quite yet. The full data is loaded
// instead. Let's read the first 10 timesteps for the first two channels
/*DataBlock<float> dataSlice = readDataWrapper->values<float>(
Expand Down

0 comments on commit 5a411c4

Please sign in to comment.