diff --git a/src/nwb/base/TimeSeries.hpp b/src/nwb/base/TimeSeries.hpp index 750ff1b..0266c91 100644 --- a/src/nwb/base/TimeSeries.hpp +++ b/src/nwb/base/TimeSeries.hpp @@ -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 diff --git a/tests/examples/test_ecephys_data_read.cpp b/tests/examples/test_ecephys_data_read.cpp index e87f903..9f013a2 100644 --- a/tests/examples/test_ecephys_data_read.cpp +++ b/tests/examples/test_ecephys_data_read.cpp @@ -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 dataSlice = readDataWrapper->values(