Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support reading of arbitrary RegisteredTypes #143

Merged
merged 27 commits into from
Feb 13, 2025
Merged
Changes from 5 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
e015a1d
Add unit tests for BaseIO::findTypes
oruebel Jan 14, 2025
f332165
Add unit tests for unsupported data type
oruebel Jan 14, 2025
1568e97
Enhance testing for RegisteredType
oruebel Jan 15, 2025
6ee040c
Update getGroupObjects to getStorageObjects
oruebel Jan 16, 2025
41c2210
Merge pull request #139 from NeurodataWithoutBorders/add_findTypes_tests
oruebel Jan 16, 2025
9fc3e86
Add unit test for findType with Dataset
oruebel Jan 16, 2025
b9fcb4c
Fix #131 support reading of custom fields via RegisteredType
oruebel Jan 19, 2025
e33469b
Fix codespell
oruebel Jan 19, 2025
589da5d
Support reading VectorData columns with data type defined in the schema
oruebel Jan 19, 2025
7e33d55
Allow custom template type for DEFINE_REGISTERED_FIELD macro
oruebel Jan 19, 2025
4a1c460
Update read examples and docs
oruebel Jan 19, 2025
48f2c8a
Add error check in DEFINE_REGISTERED_FIELD
oruebel Jan 19, 2025
4014b61
Removed unused code
oruebel Jan 19, 2025
5100ad2
Update docs/pages/userdocs/read.dox
oruebel Jan 23, 2025
67bc2cd
Update src/Types.hpp
oruebel Jan 23, 2025
19fecb4
Add additional test case for HDF5IO::getStorageObjects
oruebel Jan 23, 2025
1a713e0
Merge branch 'main' into general_obj_lookup
oruebel Jan 23, 2025
a496583
Merge branch 'general_obj_lookup' into add_read_columns
oruebel Jan 23, 2025
0cb0575
Fix linter and compiler warnings
oruebel Jan 23, 2025
39dcaad
Merge branch 'main' into add_read_columns
oruebel Jan 23, 2025
b0be5ef
Fix build error after merge conflict
oruebel Jan 23, 2025
2a4a779
Merge branch 'main' into add_read_columns
oruebel Jan 23, 2025
c24398d
Improve develeoper docs for REGISTER_SUBCLASS_WITH_TYPENAME
oruebel Jan 27, 2025
42e61b7
Merge branch 'main' into add_read_columns
oruebel Jan 27, 2025
82c9431
Clarify comments for templates
oruebel Feb 11, 2025
fa34542
Merge branch 'add_read_columns' of https://github.com/lbl-cbg/aq-nwb …
oruebel Feb 11, 2025
7df6c77
Merge branch 'main' into add_read_columns
oruebel Feb 11, 2025
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: 1 addition & 1 deletion docs/pages/userdocs/read.dox
Original file line number Diff line number Diff line change
@@ -308,7 +308,7 @@
* - \ref AQNWB::IO::BaseIO "BaseIO", \ref AQNWB::IO::HDF5::HDF5IO "HDF5IO" are responsible for
* i) reading type attribute and group information, ii) searching the file for typed objects via
* \ref AQNWB::IO::BaseIO::findTypes "findTypes()" methods, and iii) retrieving the paths of all
* object associated with a storage objects (e.g., a Group) via \ref AQNWB::IO::BaseIO::getStorageObjects "getStoragebjects()"
* object associated with a storage object (e.g., a Group) via \ref AQNWB::IO::BaseIO::getStorageObjects "getStorageObjects()"
*
* \subsubsection read_design_wrapper_registeredType RegisteredType
*
2 changes: 1 addition & 1 deletion src/Types.hpp
Original file line number Diff line number Diff line change
@@ -39,7 +39,7 @@ class Types
* \brief Helper struct to check if a value is a data field, i.e.,
* Dataset or Attribute
*
* This function is used to enforce constrains on templated functions that
* This function is used to enforce constraints on templated functions that
* should only be callable for valid StorageObjectType values
*/
template<StorageObjectType T>
14 changes: 14 additions & 0 deletions src/nwb/NWBFile.hpp
Original file line number Diff line number Diff line change
@@ -130,6 +130,20 @@ class NWBFile : public Container
const IO::BaseDataType& dataType = IO::BaseDataType::I16,
RecordingContainers* recordingContainers = nullptr,
std::vector<SizeType>& containerIndexes = emptyContainerIndexes);

/** @brief Create AnnotationSeries objects to record data into.
* Created objects are stored in recordingContainers.
* @param recordingNames vector indicating the names of the AnnotationSeries
* within the acquisition group
* @param recordingContainers The container to store the created TimeSeries.
* @param containerIndexes The indexes of the containers added to
* recordingContainers
* @return Status The status of the object creation operation.
*/
Status createAnnotationSeries(
std::vector<std::string> recordingNames,
RecordingContainers* recordingContainers = nullptr,
std::vector<SizeType>& containerIndexes = emptyContainerIndexes);

DEFINE_REGISTERED_FIELD(readElectrodeTable,
ElectrodeTable,
32 changes: 32 additions & 0 deletions tests/testHDF5IO.cpp
Original file line number Diff line number Diff line change
@@ -142,6 +142,38 @@ TEST_CASE("getStorageObjects", "[hdf5io]")
REQUIRE(groupContent.size() == 0);
}

SECTION("attribute")
{
int attrData1 = 42;
hdf5io.createAttribute(BaseDataType::I32, &attrData1, "/", "attr1");
auto attributeContent = hdf5io.getStorageObjects("/attr1");
REQUIRE(attributeContent.size() == 0);
}

SECTION("dataset w/o attribute")
{
// Dataset without attributes
hdf5io.createArrayDataSet(
BaseDataType::I32, SizeArray {0}, SizeArray {1}, "/data");
auto datasetContent = hdf5io.getStorageObjects("/data");
REQUIRE(datasetContent.size() == 0);

// Dataset with attribute
int attrData1 = 42;
hdf5io.createAttribute(BaseDataType::I32, &attrData1, "/data", "attr1");
auto dataContent2 = hdf5io.getStorageObjects("/data");
REQUIRE(dataContent2.size() == 1);
REQUIRE(
dataContent2[0]
== std::make_pair(std::string("attr1"), StorageObjectType::Attribute));
}

SECTION("invalid path")
{
auto invalidPathContent = hdf5io.getStorageObjects("/invalid/path");
REQUIRE(invalidPathContent.size() == 0);
}

SECTION("group with datasets, subgroups, and attributes")
{
hdf5io.createGroup("/data");