From be6896fc33d476132045acbf52bc4a0f8eda78f8 Mon Sep 17 00:00:00 2001 From: Steph Prince <40640337+stephprince@users.noreply.github.com> Date: Fri, 23 Aug 2024 16:13:56 -0700 Subject: [PATCH 01/22] rename and move files --- CMakeLists.txt | 50 ++++++++++--- CMakePresets.json | 2 +- README.md | 8 ++- cmake/install-config.cmake | 1 + cmake/install-rules.cmake | 70 ++++++++++++++++++- cmake/variables.cmake | 13 ++-- {src => include/aqnwb}/BaseIO.hpp | 2 +- {src => include/aqnwb}/Channel.hpp | 2 +- {src => include/aqnwb}/Types.hpp | 0 {src => include/aqnwb}/Utils.hpp | 5 +- include/aqnwb/aqnwb.hpp | 27 +++++++ {src => include/aqnwb}/hdf5/HDF5IO.hpp | 4 +- {src => include/aqnwb}/nwb/NWBFile.hpp | 6 +- {src => include/aqnwb}/nwb/NWBRecording.hpp | 4 +- .../aqnwb}/nwb/base/TimeSeries.hpp | 4 +- {src => include/aqnwb}/nwb/device/Device.hpp | 4 +- .../aqnwb}/nwb/ecephys/ElectricalSeries.hpp | 6 +- .../aqnwb}/nwb/file/ElectrodeGroup.hpp | 6 +- .../aqnwb}/nwb/file/ElectrodeTable.hpp | 8 +-- .../aqnwb}/nwb/hdmf/base/Container.hpp | 2 +- {src => include/aqnwb}/nwb/hdmf/base/Data.hpp | 2 +- .../aqnwb}/nwb/hdmf/table/DynamicTable.hpp | 8 +-- .../nwb/hdmf/table/ElementIdentifiers.hpp | 2 +- .../aqnwb}/nwb/hdmf/table/VectorData.hpp | 2 +- python_scripts/make_test_table.py | 68 ++++++++++++++++++ src/BaseIO.cpp | 4 +- src/Channel.cpp | 2 +- src/aqnwb.cpp | 13 ++++ src/hdf5/HDF5IO.cpp | 5 +- src/nwb/NWBFile.cpp | 18 ++--- src/nwb/NWBRecording.cpp | 9 ++- src/nwb/base/TimeSeries.cpp | 2 +- src/nwb/device/Device.cpp | 2 +- src/nwb/ecephys/ElectricalSeries.cpp | 4 +- src/nwb/file/ElectrodeGroup.cpp | 2 +- src/nwb/file/ElectrodeTable.cpp | 4 +- src/nwb/hdmf/base/Container.cpp | 2 +- src/nwb/hdmf/table/DynamicTable.cpp | 2 +- src/nwb/hdmf/table/VectorData.cpp | 2 +- tests/CMakeLists.txt | 14 ++-- tests/testBase.cpp | 8 +-- tests/testEcephys.cpp | 18 ++--- tests/testFile.cpp | 10 +-- tests/testHDF5IO.cpp | 12 ++-- tests/testNWBFile.cpp | 10 +-- tests/testNWBRecording.cpp | 14 ++-- tests/testUtils.hpp | 6 +- 47 files changed, 338 insertions(+), 131 deletions(-) create mode 100644 cmake/install-config.cmake rename {src => include/aqnwb}/BaseIO.hpp (99%) rename {src => include/aqnwb}/Channel.hpp (98%) rename {src => include/aqnwb}/Types.hpp (100%) rename {src => include/aqnwb}/Utils.hpp (97%) create mode 100644 include/aqnwb/aqnwb.hpp rename {src => include/aqnwb}/hdf5/HDF5IO.hpp (99%) rename {src => include/aqnwb}/nwb/NWBFile.hpp (97%) rename {src => include/aqnwb}/nwb/NWBRecording.hpp (97%) rename {src => include/aqnwb}/nwb/base/TimeSeries.hpp (98%) rename {src => include/aqnwb}/nwb/device/Device.hpp (94%) rename {src => include/aqnwb}/nwb/ecephys/ElectricalSeries.hpp (97%) rename {src => include/aqnwb}/nwb/file/ElectrodeGroup.hpp (94%) rename {src => include/aqnwb}/nwb/file/ElectrodeTable.hpp (94%) rename {src => include/aqnwb}/nwb/hdmf/base/Container.hpp (96%) rename {src => include/aqnwb}/nwb/hdmf/base/Data.hpp (92%) rename {src => include/aqnwb}/nwb/hdmf/table/DynamicTable.hpp (93%) rename {src => include/aqnwb}/nwb/hdmf/table/ElementIdentifiers.hpp (84%) rename {src => include/aqnwb}/nwb/hdmf/table/VectorData.hpp (91%) create mode 100644 python_scripts/make_test_table.py create mode 100644 src/aqnwb.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index d460da7b..3401a10c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,7 +6,7 @@ endif() include(cmake/prelude.cmake) project( - aq-nwb + aqnwb VERSION 0.1.0 DESCRIPTION "An API to acquire neurophysiology data in the NWB format" LANGUAGES CXX @@ -18,7 +18,8 @@ include(cmake/variables.cmake) # ---- Declare library ---- add_library( - aq-nwb_lib OBJECT + aqnwb_aqnwb + src/aqnwb.cpp src/BaseIO.cpp src/Channel.cpp src/hdf5/HDF5IO.cpp @@ -29,20 +30,47 @@ add_library( src/nwb/ecephys/ElectricalSeries.cpp src/nwb/file/ElectrodeGroup.cpp src/nwb/file/ElectrodeTable.cpp - src/nwb/hdmf/base/Data.hpp src/nwb/hdmf/base/Container.cpp src/nwb/hdmf/table/DynamicTable.cpp - src/nwb/hdmf/table/ElementIdentifiers.hpp - src/nwb/hdmf/table/VectorData.hpp +) + +add_library(aqnwb::aqnwb ALIAS aqnwb_aqnwb) + +include(GenerateExportHeader) +generate_export_header( + aqnwb_aqnwb + BASE_NAME aqnwb + EXPORT_FILE_NAME export/aqnwb/aqnwb_export.hpp + CUSTOM_CONTENT_FROM_VARIABLE pragma_suppress_c4251 +) + +if(NOT BUILD_SHARED_LIBS) + target_compile_definitions(aqnwb_aqnwb PUBLIC SHARED_STATIC_DEFINE) +endif() + +set_target_properties( + aqnwb_aqnwb PROPERTIES + CXX_VISIBILITY_PRESET hidden + VISIBILITY_INLINES_HIDDEN YES + VERSION "${PROJECT_VERSION}" + SOVERSION "${PROJECT_VERSION_MAJOR}" + EXPORT_NAME aqnwb + OUTPUT_NAME aqnwb +) + +target_include_directories( + aqnwb_aqnwb ${warning_guard} + PUBLIC + "\$" ) target_include_directories( - aq-nwb_lib ${warning_guard} + aqnwb_aqnwb SYSTEM PUBLIC - "$" + "\$" ) -target_compile_features(aq-nwb_lib PUBLIC cxx_std_17) +target_compile_features(aqnwb_aqnwb PUBLIC cxx_std_17) # ---- Additional libraries needed ---- find_package(HDF5 REQUIRED COMPONENTS CXX) @@ -51,7 +79,7 @@ include_directories(${HDF5_INCLUDE_DIRS}) find_package(Boost REQUIRED) include_directories(${Boost_INCLUDE_DIRS}) -target_link_libraries(aq-nwb_lib ${HDF5_CXX_LIBRARIES} ${Boost_LIBRARIES}) +target_link_libraries(aqnwb_aqnwb ${HDF5_CXX_LIBRARIES} ${Boost_LIBRARIES}) # ---- Install rules ---- @@ -61,12 +89,12 @@ endif() # ---- Developer mode ---- -if(NOT aq-nwb_DEVELOPER_MODE) +if(NOT aqnwb_DEVELOPER_MODE) return() elseif(NOT PROJECT_IS_TOP_LEVEL) message( AUTHOR_WARNING - "Developer mode is intended for developers of aq-nwb" + "Developer mode is intended for developers of aqnwb" ) endif() diff --git a/CMakePresets.json b/CMakePresets.json index dc9249ea..f464eddf 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -26,7 +26,7 @@ "hidden": true, "inherits": "cmake-pedantic", "cacheVariables": { - "aq-nwb_DEVELOPER_MODE": "ON" + "aqnwb_DEVELOPER_MODE": "ON" } }, { diff --git a/README.md b/README.md index f393564d..357eee24 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,8 @@ Note, if you are using custom installations of HDF5 or BOOST that are not being automatically by cmake, you can specify `HDF5_ROOT` and `BOOST_ROOT` environment variables to point to install directories of HDF5 and BOOST respectively. +Use the flag `-DBUILD_SHARED_LIBS=ON` to generate the shared library file. + ## Install @@ -59,12 +61,12 @@ cmake --install build --config Release ## Developing Build system targets that are only useful for developers of this project are -hidden if the `aq-nwb_DEVELOPER_MODE` option is disabled. Enabling this +hidden if the `aqnwb_DEVELOPER_MODE` option is disabled. Enabling this option makes tests and other developer targets and options available. You can enable -the option when configuring the build by adding ``-Daq-nwb_DEVELOPER_MODE=ON``, e.g.,: +the option when configuring the build by adding ``-Daqnwb_DEVELOPER_MODE=ON``, e.g.,: ```sh -cmake -S . -B build -Daq-nwb_DEVELOPER_MODE=ON +cmake -S . -B build -Daqnwb_DEVELOPER_MODE=ON ``` ### Presets diff --git a/cmake/install-config.cmake b/cmake/install-config.cmake new file mode 100644 index 00000000..3335168b --- /dev/null +++ b/cmake/install-config.cmake @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_LIST_DIR}/aqnwbTsargets.cmake") \ No newline at end of file diff --git a/cmake/install-rules.cmake b/cmake/install-rules.cmake index e6a7898c..e7a03161 100644 --- a/cmake/install-rules.cmake +++ b/cmake/install-rules.cmake @@ -1,3 +1,71 @@ if(PROJECT_IS_TOP_LEVEL) - include(CPack) + set( + CMAKE_INSTALL_INCLUDEDIR "include/aqnwb-${PROJECT_VERSION}" + CACHE STRING "" + ) + set_property(CACHE CMAKE_INSTALL_INCLUDEDIR PROPERTY TYPE PATH) endif() + +include(CMakePackageConfigHelpers) +include(GNUInstallDirs) + +set(package aqnwb) + +install( + DIRECTORY + include/ + "${PROJECT_BINARY_DIR}/export/" + DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" + COMPONENT aqnwb_Development +) + +install( + TARGETS aqnwb_aqnwb + EXPORT aqnwbTargets + RUNTIME # + COMPONENT aqnwb_Runtime + LIBRARY # + COMPONENT aqnwb_Runtime + NAMELINK_COMPONENT aqnwb_Development + ARCHIVE # + COMPONENT aqnwb_Development + INCLUDES # + DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" +) + +write_basic_package_version_file( + "${package}ConfigVersion.cmake" + COMPATIBILITY SameMajorVersion +) + +# Allow package maintainers to freely override the path for the configs +set( + aqnwb_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/${package}" + CACHE STRING "CMake package config location relative to the install prefix" +) +set_property(CACHE aqnwb_INSTALL_CMAKEDIR PROPERTY TYPE PATH) +mark_as_advanced(aqnwb_INSTALL_CMAKEDIR) + +install( + FILES cmake/install-config.cmake + DESTINATION "${aqnwb_INSTALL_CMAKEDIR}" + RENAME "${package}Config.cmake" + COMPONENT aqnwb_Development +) + +install( + FILES "${PROJECT_BINARY_DIR}/${package}ConfigVersion.cmake" + DESTINATION "${aqnwb_INSTALL_CMAKEDIR}" + COMPONENT aqnwb_Development +) + +install( + EXPORT aqnwbTargets + NAMESPACE aqnwb:: + DESTINATION "${aqnwb_INSTALL_CMAKEDIR}" + COMPONENT aqnwb_Development +) + +if(PROJECT_IS_TOP_LEVEL) + include(CPack) +endif() \ No newline at end of file diff --git a/cmake/variables.cmake b/cmake/variables.cmake index ebb818af..f13781f5 100644 --- a/cmake/variables.cmake +++ b/cmake/variables.cmake @@ -1,11 +1,12 @@ # ---- Developer mode ---- # Developer mode enables targets and code paths in the CMake scripts that are -# only relevant for the developer(s) of aq-nwb +# only relevant for the developer(s) of aqnwb # Targets necessary to build the project must be provided unconditionally, so # consumers can trivially build and package the project if(PROJECT_IS_TOP_LEVEL) - option(aq-nwb_DEVELOPER_MODE "Enable developer mode" OFF) + option(aqnwb_DEVELOPER_MODE "Enable developer mode" OFF) + option(BUILD_SHARED_LIBS "Build shared libs." OFF) endif() # ---- Warning guard ---- @@ -17,12 +18,12 @@ endif() set(warning_guard "") if(NOT PROJECT_IS_TOP_LEVEL) option( - aq-nwb_INCLUDES_WITH_SYSTEM - "Use SYSTEM modifier for aq-nwb's includes, disabling warnings" + aqnwb_INCLUDES_WITH_SYSTEM + "Use SYSTEM modifier for aqnwb's includes, disabling warnings" ON ) - mark_as_advanced(aq-nwb_INCLUDES_WITH_SYSTEM) - if(aq-nwb_INCLUDES_WITH_SYSTEM) + mark_as_advanced(aqnwb_INCLUDES_WITH_SYSTEM) + if(aqnwb_INCLUDES_WITH_SYSTEM) set(warning_guard SYSTEM) endif() endif() diff --git a/src/BaseIO.hpp b/include/aqnwb/BaseIO.hpp similarity index 99% rename from src/BaseIO.hpp rename to include/aqnwb/BaseIO.hpp index 14ed1c76..0f897e45 100644 --- a/src/BaseIO.hpp +++ b/include/aqnwb/BaseIO.hpp @@ -6,7 +6,7 @@ #include #include -#include "Types.hpp" +#include "aqnwb/Types.hpp" #define DEFAULT_STR_SIZE 256 #define DEFAULT_ARRAY_SIZE 1 diff --git a/src/Channel.hpp b/include/aqnwb/Channel.hpp similarity index 98% rename from src/Channel.hpp rename to include/aqnwb/Channel.hpp index fe835272..66fe06f6 100644 --- a/src/Channel.hpp +++ b/include/aqnwb/Channel.hpp @@ -3,7 +3,7 @@ #include #include -#include "Types.hpp" +#include "aqnwb/Types.hpp" using SizeType = AQNWB::Types::SizeType; diff --git a/src/Types.hpp b/include/aqnwb/Types.hpp similarity index 100% rename from src/Types.hpp rename to include/aqnwb/Types.hpp diff --git a/src/Utils.hpp b/include/aqnwb/Utils.hpp similarity index 97% rename from src/Utils.hpp rename to include/aqnwb/Utils.hpp index b1a85813..31a4717f 100644 --- a/src/Utils.hpp +++ b/include/aqnwb/Utils.hpp @@ -8,9 +8,10 @@ #include #include -#include "BaseIO.hpp" #include "boost/date_time/c_local_time_adjustor.hpp" -#include "hdf5/HDF5IO.hpp" + +#include "aqnwb/BaseIO.hpp" +#include "aqnwb/hdf5/HDF5IO.hpp" namespace AQNWB { diff --git a/include/aqnwb/aqnwb.hpp b/include/aqnwb/aqnwb.hpp new file mode 100644 index 00000000..585ebccf --- /dev/null +++ b/include/aqnwb/aqnwb.hpp @@ -0,0 +1,27 @@ +#pragma once + +#include + +#include "aqnwb/aqnwb_export.hpp" + +/** + * @brief Reports the name of the library + * + * Please see the note above for considerations when creating shared libraries. + */ +class AQNWB_EXPORT exported_class +{ +public: + /** + * @brief Initializes the name field to the name of the project + */ + exported_class(); + + /** + * @brief Returns a non-owning pointer to the string stored in this class + */ + auto name() const -> char const*; + +private: + std::string m_name; +}; \ No newline at end of file diff --git a/src/hdf5/HDF5IO.hpp b/include/aqnwb/hdf5/HDF5IO.hpp similarity index 99% rename from src/hdf5/HDF5IO.hpp rename to include/aqnwb/hdf5/HDF5IO.hpp index 4fec9adb..30e2137e 100644 --- a/src/hdf5/HDF5IO.hpp +++ b/include/aqnwb/hdf5/HDF5IO.hpp @@ -6,8 +6,8 @@ #include -#include "BaseIO.hpp" -#include "Types.hpp" +#include "aqnwb/BaseIO.hpp" +#include "aqnwb/Types.hpp" namespace H5 { diff --git a/src/nwb/NWBFile.hpp b/include/aqnwb/nwb/NWBFile.hpp similarity index 97% rename from src/nwb/NWBFile.hpp rename to include/aqnwb/nwb/NWBFile.hpp index 25b58b15..6c78d071 100644 --- a/src/nwb/NWBFile.hpp +++ b/include/aqnwb/nwb/NWBFile.hpp @@ -4,9 +4,9 @@ #include #include -#include "BaseIO.hpp" -#include "Types.hpp" -#include "nwb/base/TimeSeries.hpp" +#include "aqnwb/BaseIO.hpp" +#include "aqnwb/Types.hpp" +#include "aqnwb/nwb/base/TimeSeries.hpp" namespace AQNWB::NWB { diff --git a/src/nwb/NWBRecording.hpp b/include/aqnwb/nwb/NWBRecording.hpp similarity index 97% rename from src/nwb/NWBRecording.hpp rename to include/aqnwb/nwb/NWBRecording.hpp index eb93501a..69268636 100644 --- a/src/nwb/NWBRecording.hpp +++ b/include/aqnwb/nwb/NWBRecording.hpp @@ -1,7 +1,7 @@ #pragma once -#include "Types.hpp" -#include "nwb/NWBFile.hpp" +#include "aqnwb/Types.hpp" +#include "aqnwb/nwb/NWBFile.hpp" namespace AQNWB::NWB { diff --git a/src/nwb/base/TimeSeries.hpp b/include/aqnwb/nwb/base/TimeSeries.hpp similarity index 98% rename from src/nwb/base/TimeSeries.hpp rename to include/aqnwb/nwb/base/TimeSeries.hpp index 08537856..004f2589 100644 --- a/src/nwb/base/TimeSeries.hpp +++ b/include/aqnwb/nwb/base/TimeSeries.hpp @@ -2,8 +2,8 @@ #include -#include "BaseIO.hpp" -#include "nwb/hdmf/base/Container.hpp" +#include "aqnwb/BaseIO.hpp" +#include "aqnwb/nwb/hdmf/base/Container.hpp" namespace AQNWB::NWB { diff --git a/src/nwb/device/Device.hpp b/include/aqnwb/nwb/device/Device.hpp similarity index 94% rename from src/nwb/device/Device.hpp rename to include/aqnwb/nwb/device/Device.hpp index 74ae7062..31acd7fb 100644 --- a/src/nwb/device/Device.hpp +++ b/include/aqnwb/nwb/device/Device.hpp @@ -2,8 +2,8 @@ #include -#include "BaseIO.hpp" -#include "nwb/hdmf/base/Container.hpp" +#include "aqnwb/BaseIO.hpp" +#include "aqnwb/nwb/hdmf/base/Container.hpp" namespace AQNWB::NWB { diff --git a/src/nwb/ecephys/ElectricalSeries.hpp b/include/aqnwb/nwb/ecephys/ElectricalSeries.hpp similarity index 97% rename from src/nwb/ecephys/ElectricalSeries.hpp rename to include/aqnwb/nwb/ecephys/ElectricalSeries.hpp index 597669be..8224286c 100644 --- a/src/nwb/ecephys/ElectricalSeries.hpp +++ b/include/aqnwb/nwb/ecephys/ElectricalSeries.hpp @@ -2,9 +2,9 @@ #include -#include "BaseIO.hpp" -#include "Channel.hpp" -#include "nwb/base/TimeSeries.hpp" +#include "aqnwb/BaseIO.hpp" +#include "aqnwb/Channel.hpp" +#include "aqnwb/nwb/base/TimeSeries.hpp" namespace AQNWB::NWB { diff --git a/src/nwb/file/ElectrodeGroup.hpp b/include/aqnwb/nwb/file/ElectrodeGroup.hpp similarity index 94% rename from src/nwb/file/ElectrodeGroup.hpp rename to include/aqnwb/nwb/file/ElectrodeGroup.hpp index 4f4c55ca..7b46ee2b 100644 --- a/src/nwb/file/ElectrodeGroup.hpp +++ b/include/aqnwb/nwb/file/ElectrodeGroup.hpp @@ -2,9 +2,9 @@ #include -#include "BaseIO.hpp" -#include "nwb/device/Device.hpp" -#include "nwb/hdmf/base/Container.hpp" +#include "aqnwb/BaseIO.hpp" +#include "aqnwb/nwb/device/Device.hpp" +#include "aqnwb/nwb/hdmf/base/Container.hpp" namespace AQNWB::NWB { diff --git a/src/nwb/file/ElectrodeTable.hpp b/include/aqnwb/nwb/file/ElectrodeTable.hpp similarity index 94% rename from src/nwb/file/ElectrodeTable.hpp rename to include/aqnwb/nwb/file/ElectrodeTable.hpp index b8611a32..6ab89ce2 100644 --- a/src/nwb/file/ElectrodeTable.hpp +++ b/include/aqnwb/nwb/file/ElectrodeTable.hpp @@ -2,10 +2,10 @@ #include -#include "BaseIO.hpp" -#include "nwb/hdmf/table/DynamicTable.hpp" -#include "nwb/hdmf/table/ElementIdentifiers.hpp" -#include "nwb/hdmf/table/VectorData.hpp" +#include "aqnwb/BaseIO.hpp" +#include "aqnwb/nwb/hdmf/table/DynamicTable.hpp" +#include "aqnwb/nwb/hdmf/table/ElementIdentifiers.hpp" +#include "aqnwb/nwb/hdmf/table/VectorData.hpp" namespace AQNWB::NWB { diff --git a/src/nwb/hdmf/base/Container.hpp b/include/aqnwb/nwb/hdmf/base/Container.hpp similarity index 96% rename from src/nwb/hdmf/base/Container.hpp rename to include/aqnwb/nwb/hdmf/base/Container.hpp index 1d89c875..e0e1126f 100644 --- a/src/nwb/hdmf/base/Container.hpp +++ b/include/aqnwb/nwb/hdmf/base/Container.hpp @@ -3,7 +3,7 @@ #include #include -#include "BaseIO.hpp" +#include "aqnwb/BaseIO.hpp" namespace AQNWB::NWB { diff --git a/src/nwb/hdmf/base/Data.hpp b/include/aqnwb/nwb/hdmf/base/Data.hpp similarity index 92% rename from src/nwb/hdmf/base/Data.hpp rename to include/aqnwb/nwb/hdmf/base/Data.hpp index ef146485..36eccace 100644 --- a/src/nwb/hdmf/base/Data.hpp +++ b/include/aqnwb/nwb/hdmf/base/Data.hpp @@ -2,7 +2,7 @@ #include -#include "BaseIO.hpp" +#include "aqnwb/BaseIO.hpp" namespace AQNWB::NWB { diff --git a/src/nwb/hdmf/table/DynamicTable.hpp b/include/aqnwb/nwb/hdmf/table/DynamicTable.hpp similarity index 93% rename from src/nwb/hdmf/table/DynamicTable.hpp rename to include/aqnwb/nwb/hdmf/table/DynamicTable.hpp index 6cd8c2a5..7352f428 100644 --- a/src/nwb/hdmf/table/DynamicTable.hpp +++ b/include/aqnwb/nwb/hdmf/table/DynamicTable.hpp @@ -2,10 +2,10 @@ #include -#include "BaseIO.hpp" -#include "nwb/hdmf/base/Container.hpp" -#include "nwb/hdmf/table/ElementIdentifiers.hpp" -#include "nwb/hdmf/table/VectorData.hpp" +#include "aqnwb/BaseIO.hpp" +#include "aqnwb/nwb/hdmf/base/Container.hpp" +#include "aqnwb/nwb/hdmf/table/ElementIdentifiers.hpp" +#include "aqnwb/nwb/hdmf/table/VectorData.hpp" namespace AQNWB::NWB { diff --git a/src/nwb/hdmf/table/ElementIdentifiers.hpp b/include/aqnwb/nwb/hdmf/table/ElementIdentifiers.hpp similarity index 84% rename from src/nwb/hdmf/table/ElementIdentifiers.hpp rename to include/aqnwb/nwb/hdmf/table/ElementIdentifiers.hpp index 813f472e..2f52d9e0 100644 --- a/src/nwb/hdmf/table/ElementIdentifiers.hpp +++ b/include/aqnwb/nwb/hdmf/table/ElementIdentifiers.hpp @@ -1,6 +1,6 @@ #pragma once -#include "nwb/hdmf/base/Data.hpp" +#include "aqnwb/nwb/hdmf/base/Data.hpp" namespace AQNWB::NWB { diff --git a/src/nwb/hdmf/table/VectorData.hpp b/include/aqnwb/nwb/hdmf/table/VectorData.hpp similarity index 91% rename from src/nwb/hdmf/table/VectorData.hpp rename to include/aqnwb/nwb/hdmf/table/VectorData.hpp index 7ee93f09..efb269f9 100644 --- a/src/nwb/hdmf/table/VectorData.hpp +++ b/include/aqnwb/nwb/hdmf/table/VectorData.hpp @@ -2,7 +2,7 @@ #include -#include "nwb/hdmf/base/Data.hpp" +#include "aqnwb/nwb/hdmf/base/Data.hpp" namespace AQNWB::NWB { diff --git a/python_scripts/make_test_table.py b/python_scripts/make_test_table.py new file mode 100644 index 00000000..b7241b9c --- /dev/null +++ b/python_scripts/make_test_table.py @@ -0,0 +1,68 @@ +from datetime import datetime +from uuid import uuid4 + +import numpy as np +from dateutil.tz import tzlocal + +from pynwb import NWBHDF5IO, NWBFile +from pynwb.ecephys import LFP, ElectricalSeries + +nwbfile = NWBFile( + session_description="my first synthetic recording", + identifier=str(uuid4()), + session_start_time=datetime.now(tzlocal()), + experimenter=[ + "Baggins, Bilbo", + ], + lab="Bag End Laboratory", + institution="University of Middle Earth at the Shire", + experiment_description="I went on an adventure to reclaim vast treasures.", + session_id="LONELYMTN001", +) + +device = nwbfile.create_device( + name="array", description="the best array", manufacturer="Probe Company 9000" +) + +nwbfile.add_electrode_column(name="label", description="label of electrode") + +nshanks = 4 +nchannels_per_shank = 3 +electrode_counter = 0 + +for ishank in range(nshanks): + # create an electrode group for this shank + electrode_group = nwbfile.create_electrode_group( + name="shank{}".format(ishank), + description="electrode group for shank {}".format(ishank), + device=device, + location="brain area", + ) + # add electrodes to the electrode table + for ielec in range(nchannels_per_shank): + nwbfile.add_electrode( + group=electrode_group, + label="shank{}elec{}".format(ishank, ielec), + location="brain area", + ) + electrode_counter += 1 + + +all_table_region = nwbfile.create_electrode_table_region( + region=list(range(electrode_counter)), # reference row indices 0 to N-1 + description="all electrodes", +) + + +raw_data = np.random.randn(50, 12) +raw_electrical_series = ElectricalSeries( + name="ElectricalSeries", + data=raw_data, + electrodes=all_table_region, + timestamps=[0.0, 0.1, 0.2, 0.3, 0.4], # in Hz +) + +nwbfile.add_acquisition(raw_electrical_series) + +with NWBHDF5IO("ecephys_tutorial.nwb", "w") as io: + io.write(nwbfile) \ No newline at end of file diff --git a/src/BaseIO.cpp b/src/BaseIO.cpp index f5165ff4..a70322d3 100644 --- a/src/BaseIO.cpp +++ b/src/BaseIO.cpp @@ -1,6 +1,6 @@ -#include "BaseIO.hpp" +#include "aqnwb/BaseIO.hpp" -#include "Utils.hpp" +#include "aqnwb/Utils.hpp" using namespace AQNWB; diff --git a/src/Channel.cpp b/src/Channel.cpp index 8b2dd936..ccc3f72b 100644 --- a/src/Channel.cpp +++ b/src/Channel.cpp @@ -1,6 +1,6 @@ #include -#include "Channel.hpp" +#include "aqnwb/Channel.hpp" using namespace AQNWB; diff --git a/src/aqnwb.cpp b/src/aqnwb.cpp new file mode 100644 index 00000000..5695d081 --- /dev/null +++ b/src/aqnwb.cpp @@ -0,0 +1,13 @@ +#include + +#include "aqnwb/aqnwb.hpp" + +exported_class::exported_class() + : m_name {"aqnwb"} +{ +} + +auto exported_class::name() const -> char const* +{ + return m_name.c_str(); +} \ No newline at end of file diff --git a/src/hdf5/HDF5IO.cpp b/src/hdf5/HDF5IO.cpp index 6f9ce86e..9a9a5376 100644 --- a/src/hdf5/HDF5IO.cpp +++ b/src/hdf5/HDF5IO.cpp @@ -4,11 +4,10 @@ #include #include -#include "HDF5IO.hpp" - #include -#include "Utils.hpp" +#include "aqnwb/Utils.hpp" +#include "aqnwb/hdf5/HDF5IO.hpp" using namespace H5; using namespace AQNWB::HDF5; diff --git a/src/nwb/NWBFile.cpp b/src/nwb/NWBFile.cpp index 76663aa9..a431c2f4 100644 --- a/src/nwb/NWBFile.cpp +++ b/src/nwb/NWBFile.cpp @@ -6,15 +6,15 @@ #include #include -#include "NWBFile.hpp" - -#include "BaseIO.hpp" -#include "Channel.hpp" -#include "Utils.hpp" -#include "nwb/device/Device.hpp" -#include "nwb/ecephys/ElectricalSeries.hpp" -#include "nwb/file/ElectrodeGroup.hpp" -#include "nwb/file/ElectrodeTable.hpp" + +#include "aqnwb/BaseIO.hpp" +#include "aqnwb/Channel.hpp" +#include "aqnwb/Utils.hpp" +#include "aqnwb/nwb/device/Device.hpp" +#include "aqnwb/nwb/ecephys/ElectricalSeries.hpp" +#include "aqnwb/nwb/file/ElectrodeGroup.hpp" +#include "aqnwb/nwb/file/ElectrodeTable.hpp" +#include "aqnwb/nwb/NWBFile.hpp" using namespace AQNWB::NWB; diff --git a/src/nwb/NWBRecording.cpp b/src/nwb/NWBRecording.cpp index a0b49460..d8a6c54d 100644 --- a/src/nwb/NWBRecording.cpp +++ b/src/nwb/NWBRecording.cpp @@ -1,8 +1,7 @@ -#include "NWBRecording.hpp" - -#include "Channel.hpp" -#include "Utils.hpp" -#include "hdf5/HDF5IO.hpp" +#include "aqnwb/Channel.hpp" +#include "aqnwb/nwb/NWBRecording.hpp" +#include "aqnwb/Utils.hpp" +#include "aqnwb/hdf5/HDF5IO.hpp" using namespace AQNWB::NWB; diff --git a/src/nwb/base/TimeSeries.cpp b/src/nwb/base/TimeSeries.cpp index a9c008b3..80128aeb 100644 --- a/src/nwb/base/TimeSeries.cpp +++ b/src/nwb/base/TimeSeries.cpp @@ -1,4 +1,4 @@ -#include "nwb/base/TimeSeries.hpp" +#include "aqnwb/nwb/base/TimeSeries.hpp" using namespace AQNWB::NWB; diff --git a/src/nwb/device/Device.cpp b/src/nwb/device/Device.cpp index 262d9207..5102f03c 100644 --- a/src/nwb/device/Device.cpp +++ b/src/nwb/device/Device.cpp @@ -1,4 +1,4 @@ -#include "nwb/device/Device.hpp" +#include "aqnwb/nwb/device/Device.hpp" using namespace AQNWB::NWB; diff --git a/src/nwb/ecephys/ElectricalSeries.cpp b/src/nwb/ecephys/ElectricalSeries.cpp index 797aa182..3f1fb2df 100644 --- a/src/nwb/ecephys/ElectricalSeries.cpp +++ b/src/nwb/ecephys/ElectricalSeries.cpp @@ -1,6 +1,6 @@ -#include "nwb/ecephys/ElectricalSeries.hpp" +#include "aqnwb/nwb/ecephys/ElectricalSeries.hpp" -#include "nwb/file/ElectrodeTable.hpp" +#include "aqnwb/nwb/file/ElectrodeTable.hpp" using namespace AQNWB::NWB; diff --git a/src/nwb/file/ElectrodeGroup.cpp b/src/nwb/file/ElectrodeGroup.cpp index b5beaa03..ac5e0171 100644 --- a/src/nwb/file/ElectrodeGroup.cpp +++ b/src/nwb/file/ElectrodeGroup.cpp @@ -1,4 +1,4 @@ -#include "nwb/file/ElectrodeGroup.hpp" +#include "aqnwb/nwb/file/ElectrodeGroup.hpp" using namespace AQNWB::NWB; diff --git a/src/nwb/file/ElectrodeTable.cpp b/src/nwb/file/ElectrodeTable.cpp index 027c9f6a..f68231cd 100644 --- a/src/nwb/file/ElectrodeTable.cpp +++ b/src/nwb/file/ElectrodeTable.cpp @@ -1,6 +1,6 @@ -#include "nwb/file/ElectrodeTable.hpp" +#include "aqnwb/nwb/file/ElectrodeTable.hpp" -#include "Channel.hpp" +#include "aqnwb/Channel.hpp" using namespace AQNWB::NWB; diff --git a/src/nwb/hdmf/base/Container.cpp b/src/nwb/hdmf/base/Container.cpp index 525d82ed..8cd28657 100644 --- a/src/nwb/hdmf/base/Container.cpp +++ b/src/nwb/hdmf/base/Container.cpp @@ -1,4 +1,4 @@ -#include "nwb/hdmf/base/Container.hpp" +#include "aqnwb/nwb/hdmf/base/Container.hpp" using namespace AQNWB::NWB; diff --git a/src/nwb/hdmf/table/DynamicTable.cpp b/src/nwb/hdmf/table/DynamicTable.cpp index e3e1c961..8c2dec7f 100644 --- a/src/nwb/hdmf/table/DynamicTable.cpp +++ b/src/nwb/hdmf/table/DynamicTable.cpp @@ -1,4 +1,4 @@ -#include "nwb/hdmf/table/DynamicTable.hpp" +#include "aqnwb/nwb/hdmf/table/DynamicTable.hpp" using namespace AQNWB::NWB; diff --git a/src/nwb/hdmf/table/VectorData.cpp b/src/nwb/hdmf/table/VectorData.cpp index 1438387e..5c71ebbe 100644 --- a/src/nwb/hdmf/table/VectorData.cpp +++ b/src/nwb/hdmf/table/VectorData.cpp @@ -1,4 +1,4 @@ -#include "nwb/hdmf/table/VectorData.hpp" +#include "aqnwb/nwb/hdmf/table/VectorData.hpp" using namespace AQNWB::NWB; diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index dbb5def8..5044ebde 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -2,7 +2,7 @@ # depends on being added from it, i.e. the testing is done only from the build # tree and is not feasible from an install location -project(aq-nwbTests LANGUAGES CXX) +project(aqnwbTests LANGUAGES CXX) # ---- Dependencies ---- @@ -11,7 +11,7 @@ include(Catch) # ---- Tests ---- -add_executable(aq-nwb_test +add_executable(aqnwb_test testBase.cpp testEcephys.cpp testFile.cpp @@ -19,14 +19,14 @@ add_executable(aq-nwb_test testNWBFile.cpp testNWBRecording.cpp) target_link_libraries( - aq-nwb_test PRIVATE - aq-nwb_lib + aqnwb_test PRIVATE + aqnwb::aqnwb Catch2::Catch2WithMain ) -target_compile_features(aq-nwb_test PRIVATE cxx_std_17) +target_compile_features(aqnwb_test PRIVATE cxx_std_17) -catch_discover_tests(aq-nwb_test) +catch_discover_tests(aqnwb_test) # ---- End-of-file commands ---- -add_folders(aq-nwbTests) +add_folders(aqnwbTests) diff --git a/tests/testBase.cpp b/tests/testBase.cpp index b3f46bc1..8d34ecd7 100644 --- a/tests/testBase.cpp +++ b/tests/testBase.cpp @@ -1,10 +1,10 @@ #include #include -#include "BaseIO.hpp" -#include "Types.hpp" -#include "Utils.hpp" -#include "nwb/base/TimeSeries.hpp" +#include "aqnwb/BaseIO.hpp" +#include "aqnwb/Types.hpp" +#include "aqnwb/Utils.hpp" +#include "aqnwb/nwb/base/TimeSeries.hpp" #include "testUtils.hpp" using namespace AQNWB; diff --git a/tests/testEcephys.cpp b/tests/testEcephys.cpp index 48737171..0c017856 100644 --- a/tests/testEcephys.cpp +++ b/tests/testEcephys.cpp @@ -2,15 +2,15 @@ #include #include -#include "BaseIO.hpp" -#include "Channel.hpp" -#include "Types.hpp" -#include "Utils.hpp" -#include "hdf5/HDF5IO.hpp" -#include "nwb/device/Device.hpp" -#include "nwb/ecephys/ElectricalSeries.hpp" -#include "nwb/file/ElectrodeGroup.hpp" -#include "nwb/file/ElectrodeTable.hpp" +#include "aqnwb/BaseIO.hpp" +#include "aqnwb/Channel.hpp" +#include "aqnwb/Types.hpp" +#include "aqnwb/Utils.hpp" +#include "aqnwb/hdf5/HDF5IO.hpp" +#include "aqnwb/nwb/device/Device.hpp" +#include "aqnwb/nwb/ecephys/ElectricalSeries.hpp" +#include "aqnwb/nwb/file/ElectrodeGroup.hpp" +#include "aqnwb/nwb/file/ElectrodeTable.hpp" #include "testUtils.hpp" using namespace AQNWB; diff --git a/tests/testFile.cpp b/tests/testFile.cpp index 568ba35d..a6bf583d 100644 --- a/tests/testFile.cpp +++ b/tests/testFile.cpp @@ -1,10 +1,10 @@ #include -#include "BaseIO.hpp" -#include "Channel.hpp" -#include "Types.hpp" -#include "hdf5/HDF5IO.hpp" -#include "nwb/file/ElectrodeTable.hpp" +#include "aqnwb/BaseIO.hpp" +#include "aqnwb/Channel.hpp" +#include "aqnwb/Types.hpp" +#include "aqnwb/hdf5/HDF5IO.hpp" +#include "aqnwb/nwb/file/ElectrodeTable.hpp" #include "testUtils.hpp" using namespace AQNWB; diff --git a/tests/testHDF5IO.cpp b/tests/testHDF5IO.cpp index cad5ed52..ce1ab6b3 100644 --- a/tests/testHDF5IO.cpp +++ b/tests/testHDF5IO.cpp @@ -3,12 +3,12 @@ #include -#include "BaseIO.hpp" -#include "Channel.hpp" -#include "Types.hpp" -#include "hdf5/HDF5IO.hpp" -#include "nwb/NWBFile.hpp" -#include "nwb/file/ElectrodeTable.hpp" +#include "aqnwb/BaseIO.hpp" +#include "aqnwb/Channel.hpp" +#include "aqnwb/Types.hpp" +#include "aqnwb/hdf5/HDF5IO.hpp" +#include "aqnwb/nwb/NWBFile.hpp" +#include "aqnwb/nwb/file/ElectrodeTable.hpp" #include "testUtils.hpp" using namespace AQNWB; diff --git a/tests/testNWBFile.cpp b/tests/testNWBFile.cpp index 231b2e90..a5852d15 100644 --- a/tests/testNWBFile.cpp +++ b/tests/testNWBFile.cpp @@ -1,10 +1,10 @@ #include -#include "BaseIO.hpp" -#include "Utils.hpp" -#include "hdf5/HDF5IO.hpp" -#include "nwb/NWBFile.hpp" -#include "nwb/base/TimeSeries.hpp" +#include "aqnwb/BaseIO.hpp" +#include "aqnwb/Utils.hpp" +#include "aqnwb/hdf5/HDF5IO.hpp" +#include "aqnwb/nwb/NWBFile.hpp" +#include "aqnwb/nwb/base/TimeSeries.hpp" #include "testUtils.hpp" using namespace AQNWB; diff --git a/tests/testNWBRecording.cpp b/tests/testNWBRecording.cpp index 4d24840c..0856345b 100644 --- a/tests/testNWBRecording.cpp +++ b/tests/testNWBRecording.cpp @@ -3,13 +3,13 @@ #include #include -#include "BaseIO.hpp" -#include "Channel.hpp" -#include "Types.hpp" -#include "Utils.hpp" -#include "hdf5/HDF5IO.hpp" -#include "nwb/NWBRecording.hpp" -#include "nwb/file/ElectrodeTable.hpp" +#include "aqnwb/BaseIO.hpp" +#include "aqnwb/Channel.hpp" +#include "aqnwb/Types.hpp" +#include "aqnwb/Utils.hpp" +#include "aqnwb/hdf5/HDF5IO.hpp" +#include "aqnwb/nwb/NWBRecording.hpp" +#include "aqnwb/nwb/file/ElectrodeTable.hpp" #include "testUtils.hpp" using namespace AQNWB; diff --git a/tests/testUtils.hpp b/tests/testUtils.hpp index 608b9296..fae6a012 100644 --- a/tests/testUtils.hpp +++ b/tests/testUtils.hpp @@ -6,10 +6,10 @@ #include #include -#include -#include "Channel.hpp" -#include "Types.hpp" +#include "aqnwb/Channel.hpp" +#include "aqnwb/hdf5/HDF5IO.hpp" +#include "aqnwb/Types.hpp" using namespace AQNWB; namespace fs = std::filesystem; From 49b41548fcc9f4f7590a31bd6a9557376d9d50c8 Mon Sep 17 00:00:00 2001 From: Steph Prince <40640337+stephprince@users.noreply.github.com> Date: Mon, 26 Aug 2024 10:25:57 -0700 Subject: [PATCH 02/22] update include paths --- tests/CMakeLists.txt | 2 +- tests/examples/test_HDF5IO_examples.cpp | 6 +++--- tests/examples/test_example.cpp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index fb14749e..955ca5eb 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -49,7 +49,7 @@ target_include_directories(reader_executable PRIVATE target_link_libraries( reader_executable PRIVATE - aqnwb_lib + aqnwb_aqnwb ) target_compile_features(reader_executable PRIVATE cxx_std_17) diff --git a/tests/examples/test_HDF5IO_examples.cpp b/tests/examples/test_HDF5IO_examples.cpp index 3a978f60..516a0764 100644 --- a/tests/examples/test_HDF5IO_examples.cpp +++ b/tests/examples/test_HDF5IO_examples.cpp @@ -9,9 +9,9 @@ #include -#include "hdf5/HDF5IO.hpp" -#include "nwb/NWBFile.hpp" -#include "nwb/file/ElectrodeTable.hpp" +#include "aqnwb/hdf5/HDF5IO.hpp" +#include "aqnwb/nwb/NWBFile.hpp" +#include "aqnwb/nwb/file/ElectrodeTable.hpp" #include "testUtils.hpp" using namespace AQNWB; diff --git a/tests/examples/test_example.cpp b/tests/examples/test_example.cpp index 356ec41f..ae78ec1f 100644 --- a/tests/examples/test_example.cpp +++ b/tests/examples/test_example.cpp @@ -1,7 +1,7 @@ // [example_all] #include -#include "hdf5/HDF5IO.hpp" +#include "aqnwb/hdf5/HDF5IO.hpp" #include "testUtils.hpp" TEST_CASE("SimpleExamples", "[hdf5io]") From daee786bf9280ba2c829eb02002577bcee7af2ef Mon Sep 17 00:00:00 2001 From: Steph Prince <40640337+stephprince@users.noreply.github.com> Date: Mon, 26 Aug 2024 10:37:04 -0700 Subject: [PATCH 03/22] update docs for shared library --- docs/pages/devdocs/install.dox | 6 ++++-- docs/pages/userdocs/install.dox | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/pages/devdocs/install.dox b/docs/pages/devdocs/install.dox index ac96f398..88eac8a6 100644 --- a/docs/pages/devdocs/install.dox +++ b/docs/pages/devdocs/install.dox @@ -10,14 +10,16 @@ * \section devbuild_sec Developer Build * * Build system targets that are only useful for developers of AqNWB are - * hidden if the `aq-nwb_DEVELOPER_MODE` option is disabled. Enabling this + * hidden if the `aqnwb_DEVELOPER_MODE` option is disabled. Enabling this * option makes \ref testing "tests" and other developer targets and options available. You can enable - * the option when configuring the build by adding `-Daq-nwb_DEVELOPER_MODE=ON`, e.g., + * the option when configuring the build by adding `-Daqnwb_DEVELOPER_MODE=ON`, e.g., * * \code{.sh} * cmake -S . -B build -Daq-nwb_DEVELOPER_MODE=ON * \endcode * + * Use the flag ``-DBUILD_SHARED_LIBS=ON`` to generate the shared library file. + * * \note * If you are using custom installations of **HDF5** or **BOOST** that are not being detected * automatically by cmake, you can specify `HDF5_ROOT` and `BOOST_ROOT` environment variables to diff --git a/docs/pages/userdocs/install.dox b/docs/pages/userdocs/install.dox index 8fc41c83..a6d44416 100644 --- a/docs/pages/userdocs/install.dox +++ b/docs/pages/userdocs/install.dox @@ -15,6 +15,8 @@ * cmake --build build --config Release * \endcode * + * Use the flag ``-DBUILD_SHARED_LIBS=ON`` to generate the shared library file. + * * \note * If you are using custom installations of **HDF5** or **BOOST** that are not being detected * automatically by cmake, you can specify `HDF5_ROOT` and `BOOST_ROOT` environment variables to From 5b54b9c5f34fd2672726cdf518832f3a2cf532fd Mon Sep 17 00:00:00 2001 From: Steph Prince <40640337+stephprince@users.noreply.github.com> Date: Wed, 28 Aug 2024 09:42:39 -0700 Subject: [PATCH 04/22] update package name and clean up --- CMakeLists.txt | 1 - docs/pages/devdocs/install.dox | 2 +- include/aqnwb/aqnwb.hpp | 24 ++---------------------- src/aqnwb.cpp | 13 ------------- tests/CMakeLists.txt | 2 +- 5 files changed, 4 insertions(+), 38 deletions(-) delete mode 100644 src/aqnwb.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 3401a10c..5e15b9e9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,7 +19,6 @@ include(cmake/variables.cmake) add_library( aqnwb_aqnwb - src/aqnwb.cpp src/BaseIO.cpp src/Channel.cpp src/hdf5/HDF5IO.cpp diff --git a/docs/pages/devdocs/install.dox b/docs/pages/devdocs/install.dox index 88eac8a6..cfd5ec9d 100644 --- a/docs/pages/devdocs/install.dox +++ b/docs/pages/devdocs/install.dox @@ -15,7 +15,7 @@ * the option when configuring the build by adding `-Daqnwb_DEVELOPER_MODE=ON`, e.g., * * \code{.sh} - * cmake -S . -B build -Daq-nwb_DEVELOPER_MODE=ON + * cmake -S . -B build -Daqnwb_DEVELOPER_MODE=ON * \endcode * * Use the flag ``-DBUILD_SHARED_LIBS=ON`` to generate the shared library file. diff --git a/include/aqnwb/aqnwb.hpp b/include/aqnwb/aqnwb.hpp index 585ebccf..51c65944 100644 --- a/include/aqnwb/aqnwb.hpp +++ b/include/aqnwb/aqnwb.hpp @@ -3,25 +3,5 @@ #include #include "aqnwb/aqnwb_export.hpp" - -/** - * @brief Reports the name of the library - * - * Please see the note above for considerations when creating shared libraries. - */ -class AQNWB_EXPORT exported_class -{ -public: - /** - * @brief Initializes the name field to the name of the project - */ - exported_class(); - - /** - * @brief Returns a non-owning pointer to the string stored in this class - */ - auto name() const -> char const*; - -private: - std::string m_name; -}; \ No newline at end of file +#include "aqnwb/nwb/NWBRecording.hpp" +#include "aqnwb/nwb/NWBFile.hpp" diff --git a/src/aqnwb.cpp b/src/aqnwb.cpp deleted file mode 100644 index 5695d081..00000000 --- a/src/aqnwb.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include - -#include "aqnwb/aqnwb.hpp" - -exported_class::exported_class() - : m_name {"aqnwb"} -{ -} - -auto exported_class::name() const -> char const* -{ - return m_name.c_str(); -} \ No newline at end of file diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 955ca5eb..b830774f 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -22,7 +22,7 @@ add_executable(aqnwb_test examples/test_example.cpp ) -# Ensure the aq-nwb_test target can include headers from the current directory +# Ensure the aqnwb_test target can include headers from the current directory target_include_directories(aqnwb_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} # Include current directory ) From 43fc043054d77ff701e1c4cab5147a34ed30872a Mon Sep 17 00:00:00 2001 From: Steph Prince <40640337+stephprince@users.noreply.github.com> Date: Wed, 28 Aug 2024 09:43:04 -0700 Subject: [PATCH 05/22] add groupIndex to channels --- include/aqnwb/Channel.hpp | 6 ++++++ src/Channel.cpp | 2 ++ tests/testFile.cpp | 6 +++--- tests/testUtils.hpp | 1 + 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/include/aqnwb/Channel.hpp b/include/aqnwb/Channel.hpp index 66fe06f6..1bf94c3d 100644 --- a/include/aqnwb/Channel.hpp +++ b/include/aqnwb/Channel.hpp @@ -20,6 +20,7 @@ class Channel */ Channel(const std::string name, const std::string groupName, + const SizeType groupIndex, const SizeType localIndex, const SizeType globalIndex, const float conversion = 1e6f, // uV to V @@ -63,6 +64,11 @@ class Channel */ std::string groupName; + /** + * @brief Index of array group the channel belongs to. + */ + SizeType groupIndex; + /** * @brief Index of channel within the recording array. */ diff --git a/src/Channel.cpp b/src/Channel.cpp index ccc3f72b..af52a929 100644 --- a/src/Channel.cpp +++ b/src/Channel.cpp @@ -6,6 +6,7 @@ using namespace AQNWB; Channel::Channel(const std::string name, const std::string groupName, + const SizeType groupIndex, const SizeType localIndex, const SizeType globalIndex, const float conversion, @@ -15,6 +16,7 @@ Channel::Channel(const std::string name, const std::string comments) : name(name) , groupName(groupName) + , groupIndex(groupIndex) , localIndex(localIndex) , globalIndex(globalIndex) , position(position) diff --git a/tests/testFile.cpp b/tests/testFile.cpp index a6bf583d..58c2d32b 100644 --- a/tests/testFile.cpp +++ b/tests/testFile.cpp @@ -22,9 +22,9 @@ TEST_CASE("ElectrodeTable", "[ecephys]") std::vector channelIDs = {0, 1, 2}; std::vector channels = { - Channel("ch0", "array0", channelIDs[0], 0), - Channel("ch1", "array0", channelIDs[1], 1), - Channel("ch2", "array0", channelIDs[2], 2), + Channel("ch0", "array0", 0, channelIDs[0], 0), + Channel("ch1", "array0", 0, channelIDs[1], 1), + Channel("ch2", "array0", 0, channelIDs[2], 2), }; NWB::ElectrodeTable electrodeTable(io); diff --git a/tests/testUtils.hpp b/tests/testUtils.hpp index fae6a012..eec4323b 100644 --- a/tests/testUtils.hpp +++ b/tests/testUtils.hpp @@ -41,6 +41,7 @@ inline std::vector getMockChannelArrays( for (SizeType j = 0; j < numChannels; j++) { Channel ch("ch" + std::to_string(j), "array" + std::to_string(i), + i, j, i * numArrays + j); chGroup.push_back(ch); From 6042ef6e85af95d9ed085d827583a4be74530e58 Mon Sep 17 00:00:00 2001 From: Steph Prince <40640337+stephprince@users.noreply.github.com> Date: Wed, 28 Aug 2024 09:43:30 -0700 Subject: [PATCH 06/22] update dynamictable string dataset write --- src/nwb/hdmf/table/DynamicTable.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/nwb/hdmf/table/DynamicTable.cpp b/src/nwb/hdmf/table/DynamicTable.cpp index 8c2dec7f..8743967e 100644 --- a/src/nwb/hdmf/table/DynamicTable.cpp +++ b/src/nwb/hdmf/table/DynamicTable.cpp @@ -38,8 +38,8 @@ void DynamicTable::addColumn(const std::string& name, // write in loop because variable length string for (SizeType i = 0; i < values.size(); i++) vectorData->dataset->writeDataBlock(std::vector(1, 1), - BaseDataType::STR(values[i].size()), - &values[i]); + BaseDataType::STR(values[i].size() + 1), + values[i].c_str()); // TODO - add tests for this io->createCommonNWBAttributes( path + name, "hdmf-common", "VectorData", colDescription); } From 109d0068c12ea3a68ffdadf758e555e212fbf886 Mon Sep 17 00:00:00 2001 From: Steph Prince <40640337+stephprince@users.noreply.github.com> Date: Wed, 28 Aug 2024 09:44:02 -0700 Subject: [PATCH 07/22] update recording filename creation --- include/aqnwb/nwb/NWBRecording.hpp | 9 ++------- src/nwb/NWBRecording.cpp | 11 ++++++----- tests/testNWBRecording.cpp | 9 +++------ 3 files changed, 11 insertions(+), 18 deletions(-) diff --git a/include/aqnwb/nwb/NWBRecording.hpp b/include/aqnwb/nwb/NWBRecording.hpp index 69268636..e78f28ff 100644 --- a/include/aqnwb/nwb/NWBRecording.hpp +++ b/include/aqnwb/nwb/NWBRecording.hpp @@ -34,17 +34,12 @@ class NWBRecording /** * @brief Opens the file for recording. - * @param rootFolder The root folder where the file will be stored. - * @param baseName The base name of the file (will be appended with - * experiment number). - * @param experimentNumber The experiment number. + * @param filename The name of the file to open. * @param recordingArrays ChannelVector objects indicating the electrodes to * use for ElectricalSeries recordings * @param IOType Type of backend IO to use */ - Status openFile(const std::string& rootFolder, - const std::string& baseName, - int experimentNumber, + Status openFile(const std::string& filename, std::vector recordingArrays, const std::string& IOType = "HDF5"); diff --git a/src/nwb/NWBRecording.cpp b/src/nwb/NWBRecording.cpp index 9247542f..9f4178d7 100644 --- a/src/nwb/NWBRecording.cpp +++ b/src/nwb/NWBRecording.cpp @@ -15,14 +15,14 @@ NWBRecording::~NWBRecording() } } -Status NWBRecording::openFile(const std::string& rootFolder, - const std::string& baseName, - int experimentNumber, +Status NWBRecording::openFile(const std::string& filename, std::vector recordingArrays, const std::string& IOType) { - std::string filename = - rootFolder + baseName + std::to_string(experimentNumber) + ".nwb"; + // close any existing files + if (nwbfile != nullptr){ + nwbfile->finalize(); + } // initialize nwbfile object and create base structure nwbfile = std::make_unique(generateUuid(), @@ -38,6 +38,7 @@ Status NWBRecording::openFile(const std::string& rootFolder, void NWBRecording::closeFile() { + nwbfile->stopRecording(); nwbfile->finalize(); } diff --git a/tests/testNWBRecording.cpp b/tests/testNWBRecording.cpp index 0856345b..9de7e20b 100644 --- a/tests/testNWBRecording.cpp +++ b/tests/testNWBRecording.cpp @@ -19,10 +19,7 @@ TEST_CASE("writeContinuousData", "[recording]") SECTION("test data and timestamps stream") { // get file path and remove if exists - std::string path = getTestFilePath("testContinuous"); - if (fs::exists(path + "Recording1.nwb")) { - fs::remove(path + "Recording1.nwb"); - } + std::string path = getTestFilePath("testContinuousRecording1.nwb"); // setup mock data SizeType numChannels = 4; @@ -40,7 +37,7 @@ TEST_CASE("writeContinuousData", "[recording]") // open files NWB::NWBRecording nwbRecording; - nwbRecording.openFile(path, "Recording", 1, mockRecordingArrays); + nwbRecording.openFile(path, mockRecordingArrays); // run recording bool isRecording = true; @@ -85,7 +82,7 @@ TEST_CASE("writeContinuousData", "[recording]") // check contents of data std::string dataPath = "/acquisition/array0/data"; std::unique_ptr file = - std::make_unique(path + "Recording1.nwb", H5F_ACC_RDONLY); + std::make_unique(path, H5F_ACC_RDONLY); std::unique_ptr dataset = std::make_unique(file->openDataSet(dataPath)); SizeType numChannelsToRead = numChannels / 2; From 6b9f81496f13fc87b770bb198f234707ceb9e4a2 Mon Sep 17 00:00:00 2001 From: Steph Prince <40640337+stephprince@users.noreply.github.com> Date: Wed, 28 Aug 2024 10:16:25 -0700 Subject: [PATCH 08/22] revert folder structure --- CMakeLists.txt | 3 +++ include/aqnwb/aqnwb.hpp | 7 ------- src/BaseIO.cpp | 4 ++-- {include/aqnwb => src}/BaseIO.hpp | 2 +- src/Channel.cpp | 2 +- {include/aqnwb => src}/Channel.hpp | 4 ++-- {include/aqnwb => src}/Types.hpp | 0 {include/aqnwb => src}/Utils.hpp | 5 ++--- src/aqnwb.hpp | 3 +++ src/hdf5/HDF5IO.cpp | 5 +++-- {include/aqnwb => src}/hdf5/HDF5IO.hpp | 4 ++-- src/nwb/NWBFile.cpp | 18 +++++++++--------- {include/aqnwb => src}/nwb/NWBFile.hpp | 6 +++--- src/nwb/NWBRecording.cpp | 13 +++++++------ {include/aqnwb => src}/nwb/NWBRecording.hpp | 4 ++-- src/nwb/base/TimeSeries.cpp | 2 +- {include/aqnwb => src}/nwb/base/TimeSeries.hpp | 4 ++-- src/nwb/device/Device.cpp | 2 +- {include/aqnwb => src}/nwb/device/Device.hpp | 4 ++-- src/nwb/ecephys/ElectricalSeries.cpp | 5 +++-- .../nwb/ecephys/ElectricalSeries.hpp | 6 +++--- src/nwb/file/ElectrodeGroup.cpp | 2 +- .../aqnwb => src}/nwb/file/ElectrodeGroup.hpp | 6 +++--- src/nwb/file/ElectrodeTable.cpp | 5 +++-- .../aqnwb => src}/nwb/file/ElectrodeTable.hpp | 8 ++++---- src/nwb/hdmf/base/Container.cpp | 2 +- .../aqnwb => src}/nwb/hdmf/base/Container.hpp | 2 +- {include/aqnwb => src}/nwb/hdmf/base/Data.hpp | 2 +- src/nwb/hdmf/table/DynamicTable.cpp | 9 +++++---- .../nwb/hdmf/table/DynamicTable.hpp | 8 ++++---- .../nwb/hdmf/table/ElementIdentifiers.hpp | 2 +- src/nwb/hdmf/table/VectorData.cpp | 2 +- .../nwb/hdmf/table/VectorData.hpp | 2 +- tests/examples/test_HDF5IO_examples.cpp | 6 +++--- tests/examples/test_example.cpp | 2 +- tests/testBase.cpp | 8 ++++---- tests/testEcephys.cpp | 18 +++++++++--------- tests/testFile.cpp | 10 +++++----- tests/testHDF5IO.cpp | 12 ++++++------ tests/testNWBFile.cpp | 10 +++++----- tests/testNWBRecording.cpp | 14 +++++++------- tests/testUtils.hpp | 6 +++--- 42 files changed, 121 insertions(+), 118 deletions(-) delete mode 100644 include/aqnwb/aqnwb.hpp rename {include/aqnwb => src}/BaseIO.hpp (99%) rename {include/aqnwb => src}/Channel.hpp (98%) rename {include/aqnwb => src}/Types.hpp (100%) rename {include/aqnwb => src}/Utils.hpp (97%) create mode 100644 src/aqnwb.hpp rename {include/aqnwb => src}/hdf5/HDF5IO.hpp (99%) rename {include/aqnwb => src}/nwb/NWBFile.hpp (98%) rename {include/aqnwb => src}/nwb/NWBRecording.hpp (97%) rename {include/aqnwb => src}/nwb/base/TimeSeries.hpp (98%) rename {include/aqnwb => src}/nwb/device/Device.hpp (94%) rename {include/aqnwb => src}/nwb/ecephys/ElectricalSeries.hpp (97%) rename {include/aqnwb => src}/nwb/file/ElectrodeGroup.hpp (94%) rename {include/aqnwb => src}/nwb/file/ElectrodeTable.hpp (94%) rename {include/aqnwb => src}/nwb/hdmf/base/Container.hpp (96%) rename {include/aqnwb => src}/nwb/hdmf/base/Data.hpp (91%) rename {include/aqnwb => src}/nwb/hdmf/table/DynamicTable.hpp (93%) rename {include/aqnwb => src}/nwb/hdmf/table/ElementIdentifiers.hpp (84%) rename {include/aqnwb => src}/nwb/hdmf/table/VectorData.hpp (91%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5e15b9e9..49b5b765 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,6 +14,9 @@ project( include(cmake/project-is-top-level.cmake) include(cmake/variables.cmake) +include_directories( + ${CMAKE_SOURCE_DIR}/src +) # ---- Declare library ---- diff --git a/include/aqnwb/aqnwb.hpp b/include/aqnwb/aqnwb.hpp deleted file mode 100644 index 51c65944..00000000 --- a/include/aqnwb/aqnwb.hpp +++ /dev/null @@ -1,7 +0,0 @@ -#pragma once - -#include - -#include "aqnwb/aqnwb_export.hpp" -#include "aqnwb/nwb/NWBRecording.hpp" -#include "aqnwb/nwb/NWBFile.hpp" diff --git a/src/BaseIO.cpp b/src/BaseIO.cpp index 1cd0f45d..353f709d 100644 --- a/src/BaseIO.cpp +++ b/src/BaseIO.cpp @@ -1,6 +1,6 @@ -#include "aqnwb/BaseIO.hpp" +#include "BaseIO.hpp" -#include "aqnwb/Utils.hpp" +#include "Utils.hpp" using namespace AQNWB; diff --git a/include/aqnwb/BaseIO.hpp b/src/BaseIO.hpp similarity index 99% rename from include/aqnwb/BaseIO.hpp rename to src/BaseIO.hpp index 6e571a49..3dd375db 100644 --- a/include/aqnwb/BaseIO.hpp +++ b/src/BaseIO.hpp @@ -6,7 +6,7 @@ #include #include -#include "aqnwb/Types.hpp" +#include "Types.hpp" #define DEFAULT_STR_SIZE 256 #define DEFAULT_ARRAY_SIZE 1 diff --git a/src/Channel.cpp b/src/Channel.cpp index af52a929..d8f9357d 100644 --- a/src/Channel.cpp +++ b/src/Channel.cpp @@ -1,6 +1,6 @@ #include -#include "aqnwb/Channel.hpp" +#include "Channel.hpp" using namespace AQNWB; diff --git a/include/aqnwb/Channel.hpp b/src/Channel.hpp similarity index 98% rename from include/aqnwb/Channel.hpp rename to src/Channel.hpp index 1bf94c3d..fccdf227 100644 --- a/include/aqnwb/Channel.hpp +++ b/src/Channel.hpp @@ -3,7 +3,7 @@ #include #include -#include "aqnwb/Types.hpp" +#include "Types.hpp" using SizeType = AQNWB::Types::SizeType; @@ -68,7 +68,7 @@ class Channel * @brief Index of array group the channel belongs to. */ SizeType groupIndex; - + /** * @brief Index of channel within the recording array. */ diff --git a/include/aqnwb/Types.hpp b/src/Types.hpp similarity index 100% rename from include/aqnwb/Types.hpp rename to src/Types.hpp diff --git a/include/aqnwb/Utils.hpp b/src/Utils.hpp similarity index 97% rename from include/aqnwb/Utils.hpp rename to src/Utils.hpp index 31a4717f..b1a85813 100644 --- a/include/aqnwb/Utils.hpp +++ b/src/Utils.hpp @@ -8,10 +8,9 @@ #include #include +#include "BaseIO.hpp" #include "boost/date_time/c_local_time_adjustor.hpp" - -#include "aqnwb/BaseIO.hpp" -#include "aqnwb/hdf5/HDF5IO.hpp" +#include "hdf5/HDF5IO.hpp" namespace AQNWB { diff --git a/src/aqnwb.hpp b/src/aqnwb.hpp new file mode 100644 index 00000000..dad5802e --- /dev/null +++ b/src/aqnwb.hpp @@ -0,0 +1,3 @@ +#pragma once + +#include diff --git a/src/hdf5/HDF5IO.cpp b/src/hdf5/HDF5IO.cpp index 1228948d..ef7cc60e 100644 --- a/src/hdf5/HDF5IO.cpp +++ b/src/hdf5/HDF5IO.cpp @@ -4,11 +4,12 @@ #include #include +#include "HDF5IO.hpp" + #include #include -#include "aqnwb/Utils.hpp" -#include "aqnwb/hdf5/HDF5IO.hpp" +#include "../Utils.hpp" using namespace H5; using namespace AQNWB::HDF5; diff --git a/include/aqnwb/hdf5/HDF5IO.hpp b/src/hdf5/HDF5IO.hpp similarity index 99% rename from include/aqnwb/hdf5/HDF5IO.hpp rename to src/hdf5/HDF5IO.hpp index f98408c5..8eaca67c 100644 --- a/include/aqnwb/hdf5/HDF5IO.hpp +++ b/src/hdf5/HDF5IO.hpp @@ -6,8 +6,8 @@ #include -#include "aqnwb/BaseIO.hpp" -#include "aqnwb/Types.hpp" +#include "../BaseIO.hpp" +#include "../Types.hpp" namespace H5 { diff --git a/src/nwb/NWBFile.cpp b/src/nwb/NWBFile.cpp index a37bd4d5..b5e0d2d1 100644 --- a/src/nwb/NWBFile.cpp +++ b/src/nwb/NWBFile.cpp @@ -6,15 +6,15 @@ #include #include - -#include "aqnwb/BaseIO.hpp" -#include "aqnwb/Channel.hpp" -#include "aqnwb/Utils.hpp" -#include "aqnwb/nwb/device/Device.hpp" -#include "aqnwb/nwb/ecephys/ElectricalSeries.hpp" -#include "aqnwb/nwb/file/ElectrodeGroup.hpp" -#include "aqnwb/nwb/file/ElectrodeTable.hpp" -#include "aqnwb/nwb/NWBFile.hpp" +#include "NWBFile.hpp" + +#include "../BaseIO.hpp" +#include "../Channel.hpp" +#include "../Utils.hpp" +#include "device/Device.hpp" +#include "ecephys/ElectricalSeries.hpp" +#include "file/ElectrodeGroup.hpp" +#include "file/ElectrodeTable.hpp" using namespace AQNWB::NWB; diff --git a/include/aqnwb/nwb/NWBFile.hpp b/src/nwb/NWBFile.hpp similarity index 98% rename from include/aqnwb/nwb/NWBFile.hpp rename to src/nwb/NWBFile.hpp index 9d542895..3d88656d 100644 --- a/include/aqnwb/nwb/NWBFile.hpp +++ b/src/nwb/NWBFile.hpp @@ -4,9 +4,9 @@ #include #include -#include "aqnwb/BaseIO.hpp" -#include "aqnwb/Types.hpp" -#include "aqnwb/nwb/base/TimeSeries.hpp" +#include "../BaseIO.hpp" +#include "../Types.hpp" +#include "base/TimeSeries.hpp" /*! * \namespace AQNWB::NWB diff --git a/src/nwb/NWBRecording.cpp b/src/nwb/NWBRecording.cpp index 9f4178d7..bbcff44a 100644 --- a/src/nwb/NWBRecording.cpp +++ b/src/nwb/NWBRecording.cpp @@ -1,7 +1,8 @@ -#include "aqnwb/Channel.hpp" -#include "aqnwb/nwb/NWBRecording.hpp" -#include "aqnwb/Utils.hpp" -#include "aqnwb/hdf5/HDF5IO.hpp" +#include "NWBRecording.hpp" + +#include "../Channel.hpp" +#include "../Utils.hpp" +#include "../hdf5/HDF5IO.hpp" using namespace AQNWB::NWB; @@ -20,8 +21,8 @@ Status NWBRecording::openFile(const std::string& filename, const std::string& IOType) { // close any existing files - if (nwbfile != nullptr){ - nwbfile->finalize(); + if (nwbfile != nullptr) { + nwbfile->finalize(); } // initialize nwbfile object and create base structure diff --git a/include/aqnwb/nwb/NWBRecording.hpp b/src/nwb/NWBRecording.hpp similarity index 97% rename from include/aqnwb/nwb/NWBRecording.hpp rename to src/nwb/NWBRecording.hpp index e78f28ff..c844e37e 100644 --- a/include/aqnwb/nwb/NWBRecording.hpp +++ b/src/nwb/NWBRecording.hpp @@ -1,7 +1,7 @@ #pragma once -#include "aqnwb/Types.hpp" -#include "aqnwb/nwb/NWBFile.hpp" +#include "../Types.hpp" +#include "NWBFile.hpp" namespace AQNWB::NWB { diff --git a/src/nwb/base/TimeSeries.cpp b/src/nwb/base/TimeSeries.cpp index 80128aeb..254aa695 100644 --- a/src/nwb/base/TimeSeries.cpp +++ b/src/nwb/base/TimeSeries.cpp @@ -1,4 +1,4 @@ -#include "aqnwb/nwb/base/TimeSeries.hpp" +#include "TimeSeries.hpp" using namespace AQNWB::NWB; diff --git a/include/aqnwb/nwb/base/TimeSeries.hpp b/src/nwb/base/TimeSeries.hpp similarity index 98% rename from include/aqnwb/nwb/base/TimeSeries.hpp rename to src/nwb/base/TimeSeries.hpp index 004f2589..fb530244 100644 --- a/include/aqnwb/nwb/base/TimeSeries.hpp +++ b/src/nwb/base/TimeSeries.hpp @@ -2,8 +2,8 @@ #include -#include "aqnwb/BaseIO.hpp" -#include "aqnwb/nwb/hdmf/base/Container.hpp" +#include "../../BaseIO.hpp" +#include "../hdmf/base/Container.hpp" namespace AQNWB::NWB { diff --git a/src/nwb/device/Device.cpp b/src/nwb/device/Device.cpp index 5102f03c..98fc90e1 100644 --- a/src/nwb/device/Device.cpp +++ b/src/nwb/device/Device.cpp @@ -1,4 +1,4 @@ -#include "aqnwb/nwb/device/Device.hpp" +#include "Device.hpp" using namespace AQNWB::NWB; diff --git a/include/aqnwb/nwb/device/Device.hpp b/src/nwb/device/Device.hpp similarity index 94% rename from include/aqnwb/nwb/device/Device.hpp rename to src/nwb/device/Device.hpp index 31acd7fb..67eed819 100644 --- a/include/aqnwb/nwb/device/Device.hpp +++ b/src/nwb/device/Device.hpp @@ -2,8 +2,8 @@ #include -#include "aqnwb/BaseIO.hpp" -#include "aqnwb/nwb/hdmf/base/Container.hpp" +#include "../../BaseIO.hpp" +#include "../hdmf/base/Container.hpp" namespace AQNWB::NWB { diff --git a/src/nwb/ecephys/ElectricalSeries.cpp b/src/nwb/ecephys/ElectricalSeries.cpp index 3f1fb2df..9d215c1e 100644 --- a/src/nwb/ecephys/ElectricalSeries.cpp +++ b/src/nwb/ecephys/ElectricalSeries.cpp @@ -1,6 +1,7 @@ -#include "aqnwb/nwb/ecephys/ElectricalSeries.hpp" -#include "aqnwb/nwb/file/ElectrodeTable.hpp" +#include "ElectricalSeries.hpp" + +#include "../file/ElectrodeTable.hpp" using namespace AQNWB::NWB; diff --git a/include/aqnwb/nwb/ecephys/ElectricalSeries.hpp b/src/nwb/ecephys/ElectricalSeries.hpp similarity index 97% rename from include/aqnwb/nwb/ecephys/ElectricalSeries.hpp rename to src/nwb/ecephys/ElectricalSeries.hpp index 8224286c..9e594a42 100644 --- a/include/aqnwb/nwb/ecephys/ElectricalSeries.hpp +++ b/src/nwb/ecephys/ElectricalSeries.hpp @@ -2,9 +2,9 @@ #include -#include "aqnwb/BaseIO.hpp" -#include "aqnwb/Channel.hpp" -#include "aqnwb/nwb/base/TimeSeries.hpp" +#include "../../BaseIO.hpp" +#include "../../Channel.hpp" +#include "../base/TimeSeries.hpp" namespace AQNWB::NWB { diff --git a/src/nwb/file/ElectrodeGroup.cpp b/src/nwb/file/ElectrodeGroup.cpp index ac5e0171..ffe469a2 100644 --- a/src/nwb/file/ElectrodeGroup.cpp +++ b/src/nwb/file/ElectrodeGroup.cpp @@ -1,4 +1,4 @@ -#include "aqnwb/nwb/file/ElectrodeGroup.hpp" +#include "ElectrodeGroup.hpp" using namespace AQNWB::NWB; diff --git a/include/aqnwb/nwb/file/ElectrodeGroup.hpp b/src/nwb/file/ElectrodeGroup.hpp similarity index 94% rename from include/aqnwb/nwb/file/ElectrodeGroup.hpp rename to src/nwb/file/ElectrodeGroup.hpp index 7b46ee2b..352e481a 100644 --- a/include/aqnwb/nwb/file/ElectrodeGroup.hpp +++ b/src/nwb/file/ElectrodeGroup.hpp @@ -2,9 +2,9 @@ #include -#include "aqnwb/BaseIO.hpp" -#include "aqnwb/nwb/device/Device.hpp" -#include "aqnwb/nwb/hdmf/base/Container.hpp" +#include "../../BaseIO.hpp" +#include "../device/Device.hpp" +#include "../hdmf/base/Container.hpp" namespace AQNWB::NWB { diff --git a/src/nwb/file/ElectrodeTable.cpp b/src/nwb/file/ElectrodeTable.cpp index f68231cd..6f5e7e8a 100644 --- a/src/nwb/file/ElectrodeTable.cpp +++ b/src/nwb/file/ElectrodeTable.cpp @@ -1,6 +1,7 @@ -#include "aqnwb/nwb/file/ElectrodeTable.hpp" -#include "aqnwb/Channel.hpp" +#include "ElectrodeTable.hpp" + +#include "../../Channel.hpp" using namespace AQNWB::NWB; diff --git a/include/aqnwb/nwb/file/ElectrodeTable.hpp b/src/nwb/file/ElectrodeTable.hpp similarity index 94% rename from include/aqnwb/nwb/file/ElectrodeTable.hpp rename to src/nwb/file/ElectrodeTable.hpp index 6ab89ce2..01616981 100644 --- a/include/aqnwb/nwb/file/ElectrodeTable.hpp +++ b/src/nwb/file/ElectrodeTable.hpp @@ -2,10 +2,10 @@ #include -#include "aqnwb/BaseIO.hpp" -#include "aqnwb/nwb/hdmf/table/DynamicTable.hpp" -#include "aqnwb/nwb/hdmf/table/ElementIdentifiers.hpp" -#include "aqnwb/nwb/hdmf/table/VectorData.hpp" +#include "../../BaseIO.hpp" +#include "../hdmf/table/DynamicTable.hpp" +#include "../hdmf/table/ElementIdentifiers.hpp" +#include "../hdmf/table/VectorData.hpp" namespace AQNWB::NWB { diff --git a/src/nwb/hdmf/base/Container.cpp b/src/nwb/hdmf/base/Container.cpp index 8cd28657..e47d3eec 100644 --- a/src/nwb/hdmf/base/Container.cpp +++ b/src/nwb/hdmf/base/Container.cpp @@ -1,4 +1,4 @@ -#include "aqnwb/nwb/hdmf/base/Container.hpp" +#include "Container.hpp" using namespace AQNWB::NWB; diff --git a/include/aqnwb/nwb/hdmf/base/Container.hpp b/src/nwb/hdmf/base/Container.hpp similarity index 96% rename from include/aqnwb/nwb/hdmf/base/Container.hpp rename to src/nwb/hdmf/base/Container.hpp index e0e1126f..c9528b58 100644 --- a/include/aqnwb/nwb/hdmf/base/Container.hpp +++ b/src/nwb/hdmf/base/Container.hpp @@ -3,7 +3,7 @@ #include #include -#include "aqnwb/BaseIO.hpp" +#include "../../../BaseIO.hpp" namespace AQNWB::NWB { diff --git a/include/aqnwb/nwb/hdmf/base/Data.hpp b/src/nwb/hdmf/base/Data.hpp similarity index 91% rename from include/aqnwb/nwb/hdmf/base/Data.hpp rename to src/nwb/hdmf/base/Data.hpp index 36eccace..6b3f8553 100644 --- a/include/aqnwb/nwb/hdmf/base/Data.hpp +++ b/src/nwb/hdmf/base/Data.hpp @@ -2,7 +2,7 @@ #include -#include "aqnwb/BaseIO.hpp" +#include "../../../BaseIO.hpp" namespace AQNWB::NWB { diff --git a/src/nwb/hdmf/table/DynamicTable.cpp b/src/nwb/hdmf/table/DynamicTable.cpp index 8743967e..c61fae83 100644 --- a/src/nwb/hdmf/table/DynamicTable.cpp +++ b/src/nwb/hdmf/table/DynamicTable.cpp @@ -1,4 +1,4 @@ -#include "aqnwb/nwb/hdmf/table/DynamicTable.hpp" +#include "DynamicTable.hpp" using namespace AQNWB::NWB; @@ -37,9 +37,10 @@ void DynamicTable::addColumn(const std::string& name, } else { // write in loop because variable length string for (SizeType i = 0; i < values.size(); i++) - vectorData->dataset->writeDataBlock(std::vector(1, 1), - BaseDataType::STR(values[i].size() + 1), - values[i].c_str()); // TODO - add tests for this + vectorData->dataset->writeDataBlock( + std::vector(1, 1), + BaseDataType::STR(values[i].size() + 1), + values[i].c_str()); // TODO - add tests for this io->createCommonNWBAttributes( path + name, "hdmf-common", "VectorData", colDescription); } diff --git a/include/aqnwb/nwb/hdmf/table/DynamicTable.hpp b/src/nwb/hdmf/table/DynamicTable.hpp similarity index 93% rename from include/aqnwb/nwb/hdmf/table/DynamicTable.hpp rename to src/nwb/hdmf/table/DynamicTable.hpp index 7352f428..defe156b 100644 --- a/include/aqnwb/nwb/hdmf/table/DynamicTable.hpp +++ b/src/nwb/hdmf/table/DynamicTable.hpp @@ -2,10 +2,10 @@ #include -#include "aqnwb/BaseIO.hpp" -#include "aqnwb/nwb/hdmf/base/Container.hpp" -#include "aqnwb/nwb/hdmf/table/ElementIdentifiers.hpp" -#include "aqnwb/nwb/hdmf/table/VectorData.hpp" +#include "../../../BaseIO.hpp" +#include "../base/Container.hpp" +#include "ElementIdentifiers.hpp" +#include "VectorData.hpp" namespace AQNWB::NWB { diff --git a/include/aqnwb/nwb/hdmf/table/ElementIdentifiers.hpp b/src/nwb/hdmf/table/ElementIdentifiers.hpp similarity index 84% rename from include/aqnwb/nwb/hdmf/table/ElementIdentifiers.hpp rename to src/nwb/hdmf/table/ElementIdentifiers.hpp index 2f52d9e0..36ab29c1 100644 --- a/include/aqnwb/nwb/hdmf/table/ElementIdentifiers.hpp +++ b/src/nwb/hdmf/table/ElementIdentifiers.hpp @@ -1,6 +1,6 @@ #pragma once -#include "aqnwb/nwb/hdmf/base/Data.hpp" +#include "../base/Data.hpp" namespace AQNWB::NWB { diff --git a/src/nwb/hdmf/table/VectorData.cpp b/src/nwb/hdmf/table/VectorData.cpp index 5c71ebbe..ef4a40b5 100644 --- a/src/nwb/hdmf/table/VectorData.cpp +++ b/src/nwb/hdmf/table/VectorData.cpp @@ -1,4 +1,4 @@ -#include "aqnwb/nwb/hdmf/table/VectorData.hpp" +#include "VectorData.hpp" using namespace AQNWB::NWB; diff --git a/include/aqnwb/nwb/hdmf/table/VectorData.hpp b/src/nwb/hdmf/table/VectorData.hpp similarity index 91% rename from include/aqnwb/nwb/hdmf/table/VectorData.hpp rename to src/nwb/hdmf/table/VectorData.hpp index efb269f9..870696a4 100644 --- a/include/aqnwb/nwb/hdmf/table/VectorData.hpp +++ b/src/nwb/hdmf/table/VectorData.hpp @@ -2,7 +2,7 @@ #include -#include "aqnwb/nwb/hdmf/base/Data.hpp" +#include "../base/Data.hpp" namespace AQNWB::NWB { diff --git a/tests/examples/test_HDF5IO_examples.cpp b/tests/examples/test_HDF5IO_examples.cpp index 516a0764..3a978f60 100644 --- a/tests/examples/test_HDF5IO_examples.cpp +++ b/tests/examples/test_HDF5IO_examples.cpp @@ -9,9 +9,9 @@ #include -#include "aqnwb/hdf5/HDF5IO.hpp" -#include "aqnwb/nwb/NWBFile.hpp" -#include "aqnwb/nwb/file/ElectrodeTable.hpp" +#include "hdf5/HDF5IO.hpp" +#include "nwb/NWBFile.hpp" +#include "nwb/file/ElectrodeTable.hpp" #include "testUtils.hpp" using namespace AQNWB; diff --git a/tests/examples/test_example.cpp b/tests/examples/test_example.cpp index ae78ec1f..356ec41f 100644 --- a/tests/examples/test_example.cpp +++ b/tests/examples/test_example.cpp @@ -1,7 +1,7 @@ // [example_all] #include -#include "aqnwb/hdf5/HDF5IO.hpp" +#include "hdf5/HDF5IO.hpp" #include "testUtils.hpp" TEST_CASE("SimpleExamples", "[hdf5io]") diff --git a/tests/testBase.cpp b/tests/testBase.cpp index 8d34ecd7..b3f46bc1 100644 --- a/tests/testBase.cpp +++ b/tests/testBase.cpp @@ -1,10 +1,10 @@ #include #include -#include "aqnwb/BaseIO.hpp" -#include "aqnwb/Types.hpp" -#include "aqnwb/Utils.hpp" -#include "aqnwb/nwb/base/TimeSeries.hpp" +#include "BaseIO.hpp" +#include "Types.hpp" +#include "Utils.hpp" +#include "nwb/base/TimeSeries.hpp" #include "testUtils.hpp" using namespace AQNWB; diff --git a/tests/testEcephys.cpp b/tests/testEcephys.cpp index 0c017856..48737171 100644 --- a/tests/testEcephys.cpp +++ b/tests/testEcephys.cpp @@ -2,15 +2,15 @@ #include #include -#include "aqnwb/BaseIO.hpp" -#include "aqnwb/Channel.hpp" -#include "aqnwb/Types.hpp" -#include "aqnwb/Utils.hpp" -#include "aqnwb/hdf5/HDF5IO.hpp" -#include "aqnwb/nwb/device/Device.hpp" -#include "aqnwb/nwb/ecephys/ElectricalSeries.hpp" -#include "aqnwb/nwb/file/ElectrodeGroup.hpp" -#include "aqnwb/nwb/file/ElectrodeTable.hpp" +#include "BaseIO.hpp" +#include "Channel.hpp" +#include "Types.hpp" +#include "Utils.hpp" +#include "hdf5/HDF5IO.hpp" +#include "nwb/device/Device.hpp" +#include "nwb/ecephys/ElectricalSeries.hpp" +#include "nwb/file/ElectrodeGroup.hpp" +#include "nwb/file/ElectrodeTable.hpp" #include "testUtils.hpp" using namespace AQNWB; diff --git a/tests/testFile.cpp b/tests/testFile.cpp index 58c2d32b..ab52dc26 100644 --- a/tests/testFile.cpp +++ b/tests/testFile.cpp @@ -1,10 +1,10 @@ #include -#include "aqnwb/BaseIO.hpp" -#include "aqnwb/Channel.hpp" -#include "aqnwb/Types.hpp" -#include "aqnwb/hdf5/HDF5IO.hpp" -#include "aqnwb/nwb/file/ElectrodeTable.hpp" +#include "BaseIO.hpp" +#include "Channel.hpp" +#include "Types.hpp" +#include "hdf5/HDF5IO.hpp" +#include "nwb/file/ElectrodeTable.hpp" #include "testUtils.hpp" using namespace AQNWB; diff --git a/tests/testHDF5IO.cpp b/tests/testHDF5IO.cpp index 3ed9ace4..c49be19f 100644 --- a/tests/testHDF5IO.cpp +++ b/tests/testHDF5IO.cpp @@ -8,12 +8,12 @@ #include -#include "aqnwb/BaseIO.hpp" -#include "aqnwb/Channel.hpp" -#include "aqnwb/Types.hpp" -#include "aqnwb/hdf5/HDF5IO.hpp" -#include "aqnwb/nwb/NWBFile.hpp" -#include "aqnwb/nwb/file/ElectrodeTable.hpp" +#include "BaseIO.hpp" +#include "Channel.hpp" +#include "Types.hpp" +#include "hdf5/HDF5IO.hpp" +#include "nwb/NWBFile.hpp" +#include "nwb/file/ElectrodeTable.hpp" #include "testUtils.hpp" using namespace AQNWB; diff --git a/tests/testNWBFile.cpp b/tests/testNWBFile.cpp index 64831a14..bae35f42 100644 --- a/tests/testNWBFile.cpp +++ b/tests/testNWBFile.cpp @@ -1,10 +1,10 @@ #include -#include "aqnwb/BaseIO.hpp" -#include "aqnwb/Utils.hpp" -#include "aqnwb/hdf5/HDF5IO.hpp" -#include "aqnwb/nwb/NWBFile.hpp" -#include "aqnwb/nwb/base/TimeSeries.hpp" +#include "BaseIO.hpp" +#include "Utils.hpp" +#include "hdf5/HDF5IO.hpp" +#include "nwb/NWBFile.hpp" +#include "nwb/base/TimeSeries.hpp" #include "testUtils.hpp" using namespace AQNWB; diff --git a/tests/testNWBRecording.cpp b/tests/testNWBRecording.cpp index 9de7e20b..9b43d034 100644 --- a/tests/testNWBRecording.cpp +++ b/tests/testNWBRecording.cpp @@ -3,13 +3,13 @@ #include #include -#include "aqnwb/BaseIO.hpp" -#include "aqnwb/Channel.hpp" -#include "aqnwb/Types.hpp" -#include "aqnwb/Utils.hpp" -#include "aqnwb/hdf5/HDF5IO.hpp" -#include "aqnwb/nwb/NWBRecording.hpp" -#include "aqnwb/nwb/file/ElectrodeTable.hpp" +#include "BaseIO.hpp" +#include "Channel.hpp" +#include "Types.hpp" +#include "Utils.hpp" +#include "hdf5/HDF5IO.hpp" +#include "nwb/NWBRecording.hpp" +#include "nwb/file/ElectrodeTable.hpp" #include "testUtils.hpp" using namespace AQNWB; diff --git a/tests/testUtils.hpp b/tests/testUtils.hpp index eec4323b..914d8459 100644 --- a/tests/testUtils.hpp +++ b/tests/testUtils.hpp @@ -7,9 +7,9 @@ #include #include -#include "aqnwb/Channel.hpp" -#include "aqnwb/hdf5/HDF5IO.hpp" -#include "aqnwb/Types.hpp" +#include "Channel.hpp" +#include "Types.hpp" +#include "hdf5/HDF5IO.hpp" using namespace AQNWB; namespace fs = std::filesystem; From 7320054c5c81d167118f92abd2210ed367385781 Mon Sep 17 00:00:00 2001 From: Steph Prince <40640337+stephprince@users.noreply.github.com> Date: Wed, 28 Aug 2024 13:00:01 -0700 Subject: [PATCH 09/22] update spec caching --- resources/generate_spec_files.py | 24 ++++++++++++ src/nwb/NWBFile.cpp | 50 ++++++++++--------------- src/nwb/NWBFile.hpp | 21 +++-------- src/spec/core.hpp | 64 ++++++++++++++++++++++++++++++++ src/spec/hdmf_common.hpp | 28 ++++++++++++++ src/spec/hdmf_experimental.hpp | 24 ++++++++++++ 6 files changed, 164 insertions(+), 47 deletions(-) create mode 100644 src/spec/core.hpp create mode 100644 src/spec/hdmf_common.hpp create mode 100644 src/spec/hdmf_experimental.hpp diff --git a/resources/generate_spec_files.py b/resources/generate_spec_files.py index 4540b915..b3d2f8d2 100644 --- a/resources/generate_spec_files.py +++ b/resources/generate_spec_files.py @@ -1,4 +1,5 @@ import json +import os from pathlib import Path from ruamel.yaml import YAML @@ -17,7 +18,16 @@ spec_dir = Path(f"./resources/spec/{ns['name']}/{ns['version']}") spec_dir.mkdir(parents=True, exist_ok=True) + # create header file + header_file = Path(f"./src/spec/{ns['name'].replace('-', '_')}.hpp").resolve() + with open(header_file, 'w') as fo: + fo.write('#pragma once\n\n') + fo.write('#include \n\n') + fo.write(f'namespace AQNWB::spec::{ns['name'].replace('-', '_')}\n{{\n\n') + fo.write(f'const std::string version = "{ns["version"]}";\n\n') + # load and convert schema files + var_names = [] for s in ns['schema']: if 'source' in s: # load file @@ -31,6 +41,12 @@ with open(spec_file, 'w') as fo: json.dump(spec, fo, separators=(',', ':'),) + # convert to cpp string + with open(header_file, 'a') as fo: + var_name = s['source'].replace('.yaml', '').replace('.', '_') + fo.write(f'const std::string {var_name} = R"delimiter(\n{json.dumps(spec, separators=(',', ':'))})delimiter";\n\n') + var_names.append(var_name) + # reformat schema sources for namespace file schema = list() for s in ns['schema']: @@ -45,3 +61,11 @@ print(f'Generating file {ns_file}') with open(ns_file, 'w') as fo: json.dump(ns_output, fo, separators=(',', ':'),) + + # convert to cpp variables + with open(header_file, 'a') as fo: + fo.write(f'const std::string namespaces = R"delimiter(\n{json.dumps(ns_output, separators=(',', ':'))})delimiter";\n\n') + fo.write('void registerVariables(std::map& registry) {\n') + fo.write(''.join([f' registry["{name.replace('_', '.')}"] = &{name};\n' for name in var_names])) + fo.write(f' registry["namespace"] = &namespaces;\n') + fo.write(f'}};\n}} // namespace AQNWB::spec::{ns['name'].replace('-', '_')}\n') \ No newline at end of file diff --git a/src/nwb/NWBFile.cpp b/src/nwb/NWBFile.cpp index b5e0d2d1..f277a7c0 100644 --- a/src/nwb/NWBFile.cpp +++ b/src/nwb/NWBFile.cpp @@ -11,6 +11,9 @@ #include "../BaseIO.hpp" #include "../Channel.hpp" #include "../Utils.hpp" +#include "../spec/core.hpp" +#include "../spec/hdmf_common.hpp" +#include "../spec/hdmf_experimental.hpp" #include "device/Device.hpp" #include "ecephys/ElectricalSeries.hpp" #include "file/ElectrodeGroup.hpp" @@ -53,7 +56,7 @@ Status NWBFile::createFileStructure() } io->createCommonNWBAttributes("/", "core", "NWBFile", ""); - io->createAttribute(NWBVersion, "/", "nwb_version"); + io->createAttribute(AQNWB::spec::core::version, "/", "nwb_version"); io->createGroup("/acquisition"); io->createGroup("/analysis"); @@ -67,9 +70,9 @@ Status NWBFile::createFileStructure() io->createGroup("/specifications"); io->createReferenceAttribute("/specifications", "/", ".specloc"); - cacheSpecifications("core/", NWBVersion); - cacheSpecifications("hdmf-common/", HDMFVersion); - cacheSpecifications("hdmf-experimental/", HDMFExperimentalVersion); + cacheSpecifications("core", spec::core::version, spec::core::registerVariables); + cacheSpecifications("hdmf-common", spec::hdmf_common::version, spec::hdmf_common::registerVariables); + cacheSpecifications("hdmf-experimental", spec::hdmf_experimental::version, spec::hdmf_experimental::registerVariables); std::string time = getCurrentTime(); std::vector timeVec = {time}; @@ -146,34 +149,19 @@ void NWBFile::stopRecording() io->stopRecording(); } -void NWBFile::cacheSpecifications(const std::string& specPath, - const std::string& versionNumber) +void NWBFile::cacheSpecifications(const std::string& specPath, + const std::string& version, + void (*registerFunc)(std::map&)) { - io->createGroup("/specifications/" + specPath); - io->createGroup("/specifications/" + specPath + versionNumber); - - std::filesystem::path currentFile = __FILE__; - std::filesystem::path schemaDir = - currentFile.parent_path().parent_path().parent_path() / "resources/spec" - / specPath / versionNumber; - - for (auto const& entry : std::filesystem::directory_iterator {schemaDir}) - if (std::filesystem::is_regular_file(entry) - && entry.path().extension() == ".json") - { - std::string specName = - entry.path().filename().replace_extension("").string(); - if (specName.find("namespace") != std::string::npos) - specName = "namespace"; - - std::ifstream schemaFile(entry.path()); - std::stringstream buffer; - buffer << schemaFile.rdbuf(); - - io->createStringDataSet( - "/specifications/" + specPath + versionNumber + "/" + specName, - buffer.str()); - } + std::map registry; + registerFunc(registry); + + io->createGroup("/specifications/" + specPath + "/"); + io->createGroup("/specifications/" + specPath + "/" + version); + + for (const auto& [name, content] : registry) { + io->createStringDataSet("/specifications/" + specPath + "/" + version + "/" + name, *content); + } } // recording data factory method / diff --git a/src/nwb/NWBFile.hpp b/src/nwb/NWBFile.hpp index 3d88656d..d6295042 100644 --- a/src/nwb/NWBFile.hpp +++ b/src/nwb/NWBFile.hpp @@ -1,6 +1,7 @@ #pragma once #include +#include #include #include @@ -83,21 +84,6 @@ class NWBFile */ void stopRecording(); - /** - * @brief Indicates the NWB schema version. - */ - const std::string NWBVersion = "2.7.0"; - - /** - * @brief Indicates the HDMF schema version. - */ - const std::string HDMFVersion = "1.8.0"; - - /** - * @brief Indicates the HDMF experimental version. - */ - const std::string HDMFExperimentalVersion = "0.5.0"; - /** * @brief Gets the TimeSeries object from the recordingContainers * @param timeseriesInd The index of the timeseries dataset within the group. @@ -133,10 +119,13 @@ class NWBFile /** * @brief Saves the specification files for the schema. * @param specPath The location in the file to store the spec information. + * @param version The version number of the specification files. + * @param registry The registry of specification files. * @param versionNumber The version number of the specification files. */ void cacheSpecifications(const std::string& specPath, - const std::string& versionNumber); + const std::string& version, + void (*registerFunc)(std::map&)); /** * @brief Holds the Container (usually TimeSeries) objects that have been diff --git a/src/spec/core.hpp b/src/spec/core.hpp new file mode 100644 index 00000000..3bb5f313 --- /dev/null +++ b/src/spec/core.hpp @@ -0,0 +1,64 @@ +#pragma once + +#include + +namespace AQNWB::spec::core +{ + +const std::string version = "2.7.0"; + +const std::string nwb_base = R"delimiter( +{"datasets":[{"neurodata_type_def":"NWBData","neurodata_type_inc":"Data","doc":"An abstract data type for a dataset."},{"neurodata_type_def":"TimeSeriesReferenceVectorData","neurodata_type_inc":"VectorData","default_name":"timeseries","dtype":[{"name":"idx_start","dtype":"int32","doc":"Start index into the TimeSeries 'data' and 'timestamp' datasets of the referenced TimeSeries. The first dimension of those arrays is always time."},{"name":"count","dtype":"int32","doc":"Number of data samples available in this time series, during this epoch"},{"name":"timeseries","dtype":{"target_type":"TimeSeries","reftype":"object"},"doc":"The TimeSeries that this index applies to"}],"doc":"Column storing references to a TimeSeries (rows). For each TimeSeries this VectorData column stores the start_index and count to indicate the range in time to be selected as well as an object reference to the TimeSeries."},{"neurodata_type_def":"Image","neurodata_type_inc":"NWBData","dtype":"numeric","dims":[["x","y"],["x","y","r, g, b"],["x","y","r, g, b, a"]],"shape":[[null,null],[null,null,3],[null,null,4]],"doc":"An abstract data type for an image. Shape can be 2-D (x, y), or 3-D where the third dimension can have three or four elements, e.g. (x, y, (r, g, b)) or (x, y, (r, g, b, a)).","attributes":[{"name":"resolution","dtype":"float32","doc":"Pixel resolution of the image, in pixels per centimeter.","required":false},{"name":"description","dtype":"text","doc":"Description of the image.","required":false}]},{"neurodata_type_def":"ImageReferences","neurodata_type_inc":"NWBData","dtype":{"target_type":"Image","reftype":"object"},"dims":["num_images"],"shape":[null],"doc":"Ordered dataset of references to Image objects."}],"groups":[{"neurodata_type_def":"NWBContainer","neurodata_type_inc":"Container","doc":"An abstract data type for a generic container storing collections of data and metadata. Base type for all data and metadata containers."},{"neurodata_type_def":"NWBDataInterface","neurodata_type_inc":"NWBContainer","doc":"An abstract data type for a generic container storing collections of data, as opposed to metadata."},{"neurodata_type_def":"TimeSeries","neurodata_type_inc":"NWBDataInterface","doc":"General purpose time series.","attributes":[{"name":"description","dtype":"text","default_value":"no description","doc":"Description of the time series.","required":false},{"name":"comments","dtype":"text","default_value":"no comments","doc":"Human-readable comments about the TimeSeries. This second descriptive field can be used to store additional information, or descriptive information if the primary description field is populated with a computer-readable string.","required":false}],"datasets":[{"name":"data","dims":[["num_times"],["num_times","num_DIM2"],["num_times","num_DIM2","num_DIM3"],["num_times","num_DIM2","num_DIM3","num_DIM4"]],"shape":[[null],[null,null],[null,null,null],[null,null,null,null]],"doc":"Data values. Data can be in 1-D, 2-D, 3-D, or 4-D. The first dimension should always represent time. This can also be used to store binary data (e.g., image frames). This can also be a link to data stored in an external file.","attributes":[{"name":"conversion","dtype":"float32","default_value":1.0,"doc":"Scalar to multiply each element in data to convert it to the specified 'unit'. If the data are stored in acquisition system units or other units that require a conversion to be interpretable, multiply the data by 'conversion' to convert the data to the specified 'unit'. e.g. if the data acquisition system stores values in this object as signed 16-bit integers (int16 range -32,768 to 32,767) that correspond to a 5V range (-2.5V to 2.5V), and the data acquisition system gain is 8000X, then the 'conversion' multiplier to get from raw data acquisition values to recorded volts is 2.5/32768/8000 = 9.5367e-9.","required":false},{"name":"offset","dtype":"float32","default_value":0.0,"doc":"Scalar to add to the data after scaling by 'conversion' to finalize its coercion to the specified 'unit'. Two common examples of this include (a) data stored in an unsigned type that requires a shift after scaling to re-center the data, and (b) specialized recording devices that naturally cause a scalar offset with respect to the true units.","required":false},{"name":"resolution","dtype":"float32","default_value":-1.0,"doc":"Smallest meaningful difference between values in data, stored in the specified by unit, e.g., the change in value of the least significant bit, or a larger number if signal noise is known to be present. If unknown, use -1.0.","required":false},{"name":"unit","dtype":"text","doc":"Base unit of measurement for working with the data. Actual stored values are not necessarily stored in these units. To access the data in these units, multiply 'data' by 'conversion' and add 'offset'."},{"name":"continuity","dtype":"text","doc":"Optionally describe the continuity of the data. Can be \"continuous\", \"instantaneous\", or \"step\". For example, a voltage trace would be \"continuous\", because samples are recorded from a continuous process. An array of lick times would be \"instantaneous\", because the data represents distinct moments in time. Times of image presentations would be \"step\" because the picture remains the same until the next timepoint. This field is optional, but is useful in providing information about the underlying data. It may inform the way this data is interpreted, the way it is visualized, and what analysis methods are applicable.","required":false}]},{"name":"starting_time","dtype":"float64","doc":"Timestamp of the first sample in seconds. When timestamps are uniformly spaced, the timestamp of the first sample can be specified and all subsequent ones calculated from the sampling rate attribute.","quantity":"?","attributes":[{"name":"rate","dtype":"float32","doc":"Sampling rate, in Hz."},{"name":"unit","dtype":"text","value":"seconds","doc":"Unit of measurement for time, which is fixed to 'seconds'."}]},{"name":"timestamps","dtype":"float64","dims":["num_times"],"shape":[null],"doc":"Timestamps for samples stored in data, in seconds, relative to the common experiment master-clock stored in NWBFile.timestamps_reference_time.","quantity":"?","attributes":[{"name":"interval","dtype":"int32","value":1,"doc":"Value is '1'"},{"name":"unit","dtype":"text","value":"seconds","doc":"Unit of measurement for timestamps, which is fixed to 'seconds'."}]},{"name":"control","dtype":"uint8","dims":["num_times"],"shape":[null],"doc":"Numerical labels that apply to each time point in data for the purpose of querying and slicing data by these values. If present, the length of this array should be the same size as the first dimension of data.","quantity":"?"},{"name":"control_description","dtype":"text","dims":["num_control_values"],"shape":[null],"doc":"Description of each control value. Must be present if control is present. If present, control_description[0] should describe time points where control == 0.","quantity":"?"}],"groups":[{"name":"sync","doc":"Lab-specific time and sync information as provided directly from hardware devices and that is necessary for aligning all acquired time information to a common timebase. The timestamp array stores time in the common timebase. This group will usually only be populated in TimeSeries that are stored external to the NWB file, in files storing raw data. Once timestamp data is calculated, the contents of 'sync' are mostly for archival purposes.","quantity":"?"}]},{"neurodata_type_def":"ProcessingModule","neurodata_type_inc":"NWBContainer","doc":"A collection of processed data.","attributes":[{"name":"description","dtype":"text","doc":"Description of this collection of processed data."}],"groups":[{"neurodata_type_inc":"NWBDataInterface","doc":"Data objects stored in this collection.","quantity":"*"},{"neurodata_type_inc":"DynamicTable","doc":"Tables stored in this collection.","quantity":"*"}]},{"neurodata_type_def":"Images","neurodata_type_inc":"NWBDataInterface","default_name":"Images","doc":"A collection of images with an optional way to specify the order of the images using the \"order_of_images\" dataset. An order must be specified if the images are referenced by index, e.g., from an IndexSeries.","attributes":[{"name":"description","dtype":"text","doc":"Description of this collection of images."}],"datasets":[{"neurodata_type_inc":"Image","doc":"Images stored in this collection.","quantity":"+"},{"name":"order_of_images","neurodata_type_inc":"ImageReferences","doc":"Ordered dataset of references to Image objects stored in the parent group. Each Image object in the Images group should be stored once and only once, so the dataset should have the same length as the number of images.","quantity":"?"}]}]})delimiter"; + +const std::string nwb_device = R"delimiter( +{"groups":[{"neurodata_type_def":"Device","neurodata_type_inc":"NWBContainer","doc":"Metadata about a data acquisition device, e.g., recording system, electrode, microscope.","attributes":[{"name":"description","dtype":"text","doc":"Description of the device (e.g., model, firmware version, processing software version, etc.) as free-form text.","required":false},{"name":"manufacturer","dtype":"text","doc":"The name of the manufacturer of the device.","required":false}]}]})delimiter"; + +const std::string nwb_epoch = R"delimiter( +{"groups":[{"neurodata_type_def":"TimeIntervals","neurodata_type_inc":"DynamicTable","doc":"A container for aggregating epoch data and the TimeSeries that each epoch applies to.","datasets":[{"name":"start_time","neurodata_type_inc":"VectorData","dtype":"float32","doc":"Start time of epoch, in seconds."},{"name":"stop_time","neurodata_type_inc":"VectorData","dtype":"float32","doc":"Stop time of epoch, in seconds."},{"name":"tags","neurodata_type_inc":"VectorData","dtype":"text","doc":"User-defined tags that identify or categorize events.","quantity":"?"},{"name":"tags_index","neurodata_type_inc":"VectorIndex","doc":"Index for tags.","quantity":"?"},{"name":"timeseries","neurodata_type_inc":"TimeSeriesReferenceVectorData","doc":"An index into a TimeSeries object.","quantity":"?"},{"name":"timeseries_index","neurodata_type_inc":"VectorIndex","doc":"Index for timeseries.","quantity":"?"}]}]})delimiter"; + +const std::string nwb_image = R"delimiter( +{"datasets":[{"neurodata_type_def":"GrayscaleImage","neurodata_type_inc":"Image","dims":["x","y"],"shape":[null,null],"doc":"A grayscale image.","dtype":"numeric"},{"neurodata_type_def":"RGBImage","neurodata_type_inc":"Image","dims":["x","y","r, g, b"],"shape":[null,null,3],"doc":"A color image.","dtype":"numeric"},{"neurodata_type_def":"RGBAImage","neurodata_type_inc":"Image","dims":["x","y","r, g, b, a"],"shape":[null,null,4],"doc":"A color image with transparency.","dtype":"numeric"}],"groups":[{"neurodata_type_def":"ImageSeries","neurodata_type_inc":"TimeSeries","doc":"General image data that is common between acquisition and stimulus time series. Sometimes the image data is stored in the file in a raw format while other times it will be stored as a series of external image files in the host file system. The data field will either be binary data, if the data is stored in the NWB file, or empty, if the data is stored in an external image stack. [frame][x][y] or [frame][x][y][z].","datasets":[{"name":"data","dtype":"numeric","dims":[["frame","x","y"],["frame","x","y","z"]],"shape":[[null,null,null],[null,null,null,null]],"doc":"Binary data representing images across frames. If data are stored in an external file, this should be an empty 3D array."},{"name":"dimension","dtype":"int32","dims":["rank"],"shape":[null],"doc":"Number of pixels on x, y, (and z) axes.","quantity":"?"},{"name":"external_file","dtype":"text","dims":["num_files"],"shape":[null],"doc":"Paths to one or more external file(s). The field is only present if format='external'. This is only relevant if the image series is stored in the file system as one or more image file(s). This field should NOT be used if the image is stored in another NWB file and that file is linked to this file.","quantity":"?","attributes":[{"name":"starting_frame","dtype":"int32","dims":["num_files"],"shape":[null],"doc":"Each external image may contain one or more consecutive frames of the full ImageSeries. This attribute serves as an index to indicate which frames each file contains, to facilitate random access. The 'starting_frame' attribute, hence, contains a list of frame numbers within the full ImageSeries of the first frame of each file listed in the parent 'external_file' dataset. Zero-based indexing is used (hence, the first element will always be zero). For example, if the 'external_file' dataset has three paths to files and the first file has 5 frames, the second file has 10 frames, and the third file has 20 frames, then this attribute will have values [0, 5, 15]. If there is a single external file that holds all of the frames of the ImageSeries (and so there is a single element in the 'external_file' dataset), then this attribute should have value [0]."}]},{"name":"format","dtype":"text","default_value":"raw","doc":"Format of image. If this is 'external', then the attribute 'external_file' contains the path information to the image files. If this is 'raw', then the raw (single-channel) binary data is stored in the 'data' dataset. If this attribute is not present, then the default format='raw' case is assumed.","quantity":"?"}],"links":[{"name":"device","target_type":"Device","doc":"Link to the Device object that was used to capture these images.","quantity":"?"}]},{"neurodata_type_def":"ImageMaskSeries","neurodata_type_inc":"ImageSeries","doc":"An alpha mask that is applied to a presented visual stimulus. The 'data' array contains an array of mask values that are applied to the displayed image. Mask values are stored as RGBA. Mask can vary with time. The timestamps array indicates the starting time of a mask, and that mask pattern continues until it's explicitly changed.","links":[{"name":"masked_imageseries","target_type":"ImageSeries","doc":"Link to ImageSeries object that this image mask is applied to."}]},{"neurodata_type_def":"OpticalSeries","neurodata_type_inc":"ImageSeries","doc":"Image data that is presented or recorded. A stimulus template movie will be stored only as an image. When the image is presented as stimulus, additional data is required, such as field of view (e.g., how much of the visual field the image covers, or how what is the area of the target being imaged). If the OpticalSeries represents acquired imaging data, orientation is also important.","datasets":[{"name":"distance","dtype":"float32","doc":"Distance from camera/monitor to target/eye.","quantity":"?"},{"name":"field_of_view","dtype":"float32","dims":[["width, height"],["width, height, depth"]],"shape":[[2],[3]],"doc":"Width, height and depth of image, or imaged area, in meters.","quantity":"?"},{"name":"data","dtype":"numeric","dims":[["frame","x","y"],["frame","x","y","r, g, b"]],"shape":[[null,null,null],[null,null,null,3]],"doc":"Images presented to subject, either grayscale or RGB"},{"name":"orientation","dtype":"text","doc":"Description of image relative to some reference frame (e.g., which way is up). Must also specify frame of reference.","quantity":"?"}]},{"neurodata_type_def":"IndexSeries","neurodata_type_inc":"TimeSeries","doc":"Stores indices to image frames stored in an ImageSeries. The purpose of the IndexSeries is to allow a static image stack to be stored in an Images object, and the images in the stack to be referenced out-of-order. This can be for the display of individual images, or of movie segments (as a movie is simply a series of images). The data field stores the index of the frame in the referenced Images object, and the timestamps array indicates when that image was displayed.","datasets":[{"name":"data","dtype":"uint32","dims":["num_times"],"shape":[null],"doc":"Index of the image (using zero-indexing) in the linked Images object.","attributes":[{"name":"conversion","dtype":"float32","doc":"This field is unused by IndexSeries.","required":false},{"name":"resolution","dtype":"float32","doc":"This field is unused by IndexSeries.","required":false},{"name":"offset","dtype":"float32","doc":"This field is unused by IndexSeries.","required":false},{"name":"unit","dtype":"text","value":"N/A","doc":"This field is unused by IndexSeries and has the value N/A."}]}],"links":[{"name":"indexed_timeseries","target_type":"ImageSeries","doc":"Link to ImageSeries object containing images that are indexed. Use of this link is discouraged and will be deprecated. Link to an Images type instead.","quantity":"?"},{"name":"indexed_images","target_type":"Images","doc":"Link to Images object containing an ordered set of images that are indexed. The Images object must contain a 'ordered_images' dataset specifying the order of the images in the Images type.","quantity":"?"}]}]})delimiter"; + +const std::string nwb_file = R"delimiter( +{"groups":[{"neurodata_type_def":"NWBFile","neurodata_type_inc":"NWBContainer","name":"root","doc":"An NWB file storing cellular-based neurophysiology data from a single experimental session.","attributes":[{"name":"nwb_version","dtype":"text","value":"2.7.0-alpha","doc":"File version string. Use semantic versioning, e.g. 1.2.1. This will be the name of the format with trailing major, minor and patch numbers."}],"datasets":[{"name":"file_create_date","dtype":"isodatetime","dims":["num_modifications"],"shape":[null],"doc":"A record of the date the file was created and of subsequent modifications. The date is stored in UTC with local timezone offset as ISO 8601 extended formatted strings: 2018-09-28T14:43:54.123+02:00. Dates stored in UTC end in \"Z\" with no timezone offset. Date accuracy is up to milliseconds. The file can be created after the experiment was run, so this may differ from the experiment start time. Each modification to the nwb file adds a new entry to the array."},{"name":"identifier","dtype":"text","doc":"A unique text identifier for the file. For example, concatenated lab name, file creation date/time and experimentalist, or a hash of these and/or other values. The goal is that the string should be unique to all other files."},{"name":"session_description","dtype":"text","doc":"A description of the experimental session and data in the file."},{"name":"session_start_time","dtype":"isodatetime","doc":"Date and time of the experiment/session start. The date is stored in UTC with local timezone offset as ISO 8601 extended formatted string: 2018-09-28T14:43:54.123+02:00. Dates stored in UTC end in \"Z\" with no timezone offset. Date accuracy is up to milliseconds."},{"name":"timestamps_reference_time","dtype":"isodatetime","doc":"Date and time corresponding to time zero of all timestamps. The date is stored in UTC with local timezone offset as ISO 8601 extended formatted string: 2018-09-28T14:43:54.123+02:00. Dates stored in UTC end in \"Z\" with no timezone offset. Date accuracy is up to milliseconds. All times stored in the file use this time as reference (i.e., time zero)."}],"groups":[{"name":"acquisition","doc":"Data streams recorded from the system, including ephys, ophys, tracking, etc. This group should be read-only after the experiment is completed and timestamps are corrected to a common timebase. The data stored here may be links to raw data stored in external NWB files. This will allow keeping bulky raw data out of the file while preserving the option of keeping some/all in the file. Acquired data includes tracking and experimental data streams (i.e., everything measured from the system). If bulky data is stored in the /acquisition group, the data can exist in a separate NWB file that is linked to by the file being used for processing and analysis.","groups":[{"neurodata_type_inc":"NWBDataInterface","doc":"Acquired, raw data.","quantity":"*"},{"neurodata_type_inc":"DynamicTable","doc":"Tabular data that is relevant to acquisition","quantity":"*"}]},{"name":"analysis","doc":"Lab-specific and custom scientific analysis of data. There is no defined format for the content of this group - the format is up to the individual user/lab. To facilitate sharing analysis data between labs, the contents here should be stored in standard types (e.g., neurodata_types) and appropriately documented. The file can store lab-specific and custom data analysis without restriction on its form or schema, reducing data formatting restrictions on end users. Such data should be placed in the analysis group. The analysis data should be documented so that it could be shared with other labs.","groups":[{"neurodata_type_inc":"NWBContainer","doc":"Custom analysis results.","quantity":"*"},{"neurodata_type_inc":"DynamicTable","doc":"Tabular data that is relevant to data stored in analysis","quantity":"*"}]},{"name":"scratch","doc":"A place to store one-off analysis results. Data placed here is not intended for sharing. By placing data here, users acknowledge that there is no guarantee that their data meets any standard.","quantity":"?","groups":[{"neurodata_type_inc":"NWBContainer","doc":"Any one-off containers","quantity":"*"},{"neurodata_type_inc":"DynamicTable","doc":"Any one-off tables","quantity":"*"}],"datasets":[{"neurodata_type_inc":"ScratchData","doc":"Any one-off datasets","quantity":"*"}]},{"name":"processing","doc":"The home for ProcessingModules. These modules perform intermediate analysis of data that is necessary to perform before scientific analysis. Examples include spike clustering, extracting position from tracking data, stitching together image slices. ProcessingModules can be large and express many data sets from relatively complex analysis (e.g., spike detection and clustering) or small, representing extraction of position information from tracking video, or even binary lick/no-lick decisions. Common software tools (e.g., klustakwik, MClust) are expected to read/write data here. 'Processing' refers to intermediate analysis of the acquired data to make it more amenable to scientific analysis.","groups":[{"neurodata_type_inc":"ProcessingModule","doc":"Intermediate analysis of acquired data.","quantity":"*"}]},{"name":"stimulus","doc":"Data pushed into the system (eg, video stimulus, sound, voltage, etc) and secondary representations of that data (eg, measurements of something used as a stimulus). This group should be made read-only after experiment complete and timestamps are corrected to common timebase. Stores both presented stimuli and stimulus templates, the latter in case the same stimulus is presented multiple times, or is pulled from an external stimulus library. Stimuli are here defined as any signal that is pushed into the system as part of the experiment (eg, sound, video, voltage, etc). Many different experiments can use the same stimuli, and stimuli can be re-used during an experiment. The stimulus group is organized so that one version of template stimuli can be stored and these be used multiple times. These templates can exist in the present file or can be linked to a remote library file.","groups":[{"name":"presentation","doc":"Stimuli presented during the experiment.","groups":[{"neurodata_type_inc":"TimeSeries","doc":"TimeSeries objects containing data of presented stimuli.","quantity":"*"}]},{"name":"templates","doc":"Template stimuli. Timestamps in templates are based on stimulus design and are relative to the beginning of the stimulus. When templates are used, the stimulus instances must convert presentation times to the experiment`s time reference frame.","groups":[{"neurodata_type_inc":"TimeSeries","doc":"TimeSeries objects containing template data of presented stimuli.","quantity":"*"},{"neurodata_type_inc":"Images","doc":"Images objects containing images of presented stimuli.","quantity":"*"}]}]},{"name":"general","doc":"Experimental metadata, including protocol, notes and description of hardware device(s). The metadata stored in this section should be used to describe the experiment. Metadata necessary for interpreting the data is stored with the data. General experimental metadata, including animal strain, experimental protocols, experimenter, devices, etc, are stored under 'general'. Core metadata (e.g., that required to interpret data fields) is stored with the data itself, and implicitly defined by the file specification (e.g., time is in seconds). The strategy used here for storing non-core metadata is to use free-form text fields, such as would appear in sentences or paragraphs from a Methods section. Metadata fields are text to enable them to be more general, for example to represent ranges instead of numerical values. Machine-readable metadata is stored as attributes to these free-form datasets. All entries in the below table are to be included when data is present. Unused groups (e.g., intracellular_ephys in an optophysiology experiment) should not be created unless there is data to store within them.","datasets":[{"name":"data_collection","dtype":"text","doc":"Notes about data collection and analysis.","quantity":"?"},{"name":"experiment_description","dtype":"text","doc":"General description of the experiment.","quantity":"?"},{"name":"experimenter","dtype":"text","doc":"Name of person(s) who performed the experiment. Can also specify roles of different people involved.","quantity":"?","dims":["num_experimenters"],"shape":[null]},{"name":"institution","dtype":"text","doc":"Institution(s) where experiment was performed.","quantity":"?"},{"name":"keywords","dtype":"text","dims":["num_keywords"],"shape":[null],"doc":"Terms to search over.","quantity":"?"},{"name":"lab","dtype":"text","doc":"Laboratory where experiment was performed.","quantity":"?"},{"name":"notes","dtype":"text","doc":"Notes about the experiment.","quantity":"?"},{"name":"pharmacology","dtype":"text","doc":"Description of drugs used, including how and when they were administered. Anesthesia(s), painkiller(s), etc., plus dosage, concentration, etc.","quantity":"?"},{"name":"protocol","dtype":"text","doc":"Experimental protocol, if applicable. e.g., include IACUC protocol number.","quantity":"?"},{"name":"related_publications","dtype":"text","doc":"Publication information. PMID, DOI, URL, etc.","dims":["num_publications"],"shape":[null],"quantity":"?"},{"name":"session_id","dtype":"text","doc":"Lab-specific ID for the session.","quantity":"?"},{"name":"slices","dtype":"text","doc":"Description of slices, including information about preparation thickness, orientation, temperature, and bath solution.","quantity":"?"},{"name":"source_script","dtype":"text","doc":"Script file or link to public source code used to create this NWB file.","quantity":"?","attributes":[{"name":"file_name","dtype":"text","doc":"Name of script file."}]},{"name":"stimulus","dtype":"text","doc":"Notes about stimuli, such as how and where they were presented.","quantity":"?"},{"name":"surgery","dtype":"text","doc":"Narrative description about surgery/surgeries, including date(s) and who performed surgery.","quantity":"?"},{"name":"virus","dtype":"text","doc":"Information about virus(es) used in experiments, including virus ID, source, date made, injection location, volume, etc.","quantity":"?"}],"groups":[{"neurodata_type_inc":"LabMetaData","doc":"Place-holder than can be extended so that lab-specific meta-data can be placed in /general.","quantity":"*"},{"name":"devices","doc":"Description of hardware devices used during experiment, e.g., monitors, ADC boards, microscopes, etc.","quantity":"?","groups":[{"neurodata_type_inc":"Device","doc":"Data acquisition devices.","quantity":"*"}]},{"name":"subject","neurodata_type_inc":"Subject","doc":"Information about the animal or person from which the data was measured.","quantity":"?"},{"name":"extracellular_ephys","doc":"Metadata related to extracellular electrophysiology.","quantity":"?","groups":[{"neurodata_type_inc":"ElectrodeGroup","doc":"Physical group of electrodes.","quantity":"*"},{"name":"electrodes","neurodata_type_inc":"DynamicTable","doc":"A table of all electrodes (i.e. channels) used for recording.","quantity":"?","datasets":[{"name":"x","neurodata_type_inc":"VectorData","dtype":"float32","doc":"x coordinate of the channel location in the brain (+x is posterior).","quantity":"?"},{"name":"y","neurodata_type_inc":"VectorData","dtype":"float32","doc":"y coordinate of the channel location in the brain (+y is inferior).","quantity":"?"},{"name":"z","neurodata_type_inc":"VectorData","dtype":"float32","doc":"z coordinate of the channel location in the brain (+z is right).","quantity":"?"},{"name":"imp","neurodata_type_inc":"VectorData","dtype":"float32","doc":"Impedance of the channel, in ohms.","quantity":"?"},{"name":"location","neurodata_type_inc":"VectorData","dtype":"text","doc":"Location of the electrode (channel). Specify the area, layer, comments on estimation of area/layer, stereotaxic coordinates if in vivo, etc. Use standard atlas names for anatomical regions when possible."},{"name":"filtering","neurodata_type_inc":"VectorData","dtype":"text","doc":"Description of hardware filtering, including the filter name and frequency cutoffs.","quantity":"?"},{"name":"group","neurodata_type_inc":"VectorData","dtype":{"target_type":"ElectrodeGroup","reftype":"object"},"doc":"Reference to the ElectrodeGroup this electrode is a part of."},{"name":"group_name","neurodata_type_inc":"VectorData","dtype":"text","doc":"Name of the ElectrodeGroup this electrode is a part of."},{"name":"rel_x","neurodata_type_inc":"VectorData","dtype":"float32","doc":"x coordinate in electrode group","quantity":"?"},{"name":"rel_y","neurodata_type_inc":"VectorData","dtype":"float32","doc":"y coordinate in electrode group","quantity":"?"},{"name":"rel_z","neurodata_type_inc":"VectorData","dtype":"float32","doc":"z coordinate in electrode group","quantity":"?"},{"name":"reference","neurodata_type_inc":"VectorData","dtype":"text","doc":"Description of the reference electrode and/or reference scheme used for this electrode, e.g., \"stainless steel skull screw\" or \"online common average referencing\".","quantity":"?"}]}]},{"name":"intracellular_ephys","doc":"Metadata related to intracellular electrophysiology.","quantity":"?","datasets":[{"name":"filtering","dtype":"text","doc":"[DEPRECATED] Use IntracellularElectrode.filtering instead. Description of filtering used. Includes filtering type and parameters, frequency fall-off, etc. If this changes between TimeSeries, filter description should be stored as a text attribute for each TimeSeries.","quantity":"?"}],"groups":[{"neurodata_type_inc":"IntracellularElectrode","doc":"An intracellular electrode.","quantity":"*"},{"name":"sweep_table","neurodata_type_inc":"SweepTable","doc":"[DEPRECATED] Table used to group different PatchClampSeries. SweepTable is being replaced by IntracellularRecordingsTable and SimultaneousRecordingsTable tables. Additional SequentialRecordingsTable, RepetitionsTable and ExperimentalConditions tables provide enhanced support for experiment metadata.","quantity":"?"},{"name":"intracellular_recordings","neurodata_type_inc":"IntracellularRecordingsTable","doc":"A table to group together a stimulus and response from a single electrode and a single simultaneous recording. Each row in the table represents a single recording consisting typically of a stimulus and a corresponding response. In some cases, however, only a stimulus or a response are recorded as as part of an experiment. In this case both, the stimulus and response will point to the same TimeSeries while the idx_start and count of the invalid column will be set to -1, thus, indicating that no values have been recorded for the stimulus or response, respectively. Note, a recording MUST contain at least a stimulus or a response. Typically the stimulus and response are PatchClampSeries. However, the use of AD/DA channels that are not associated to an electrode is also common in intracellular electrophysiology, in which case other TimeSeries may be used.","quantity":"?"},{"name":"simultaneous_recordings","neurodata_type_inc":"SimultaneousRecordingsTable","doc":"A table for grouping different intracellular recordings from the IntracellularRecordingsTable table together that were recorded simultaneously from different electrodes","quantity":"?"},{"name":"sequential_recordings","neurodata_type_inc":"SequentialRecordingsTable","doc":"A table for grouping different sequential recordings from the SimultaneousRecordingsTable table together. This is typically used to group together sequential recordings where the a sequence of stimuli of the same type with varying parameters have been presented in a sequence.","quantity":"?"},{"name":"repetitions","neurodata_type_inc":"RepetitionsTable","doc":"A table for grouping different sequential intracellular recordings together. With each SequentialRecording typically representing a particular type of stimulus, the RepetitionsTable table is typically used to group sets of stimuli applied in sequence.","quantity":"?"},{"name":"experimental_conditions","neurodata_type_inc":"ExperimentalConditionsTable","doc":"A table for grouping different intracellular recording repetitions together that belong to the same experimental experimental_conditions.","quantity":"?"}]},{"name":"optogenetics","doc":"Metadata describing optogenetic stimuluation.","quantity":"?","groups":[{"neurodata_type_inc":"OptogeneticStimulusSite","doc":"An optogenetic stimulation site.","quantity":"*"}]},{"name":"optophysiology","doc":"Metadata related to optophysiology.","quantity":"?","groups":[{"neurodata_type_inc":"ImagingPlane","doc":"An imaging plane.","quantity":"*"}]}]},{"name":"intervals","doc":"Experimental intervals, whether that be logically distinct sub-experiments having a particular scientific goal, trials (see trials subgroup) during an experiment, or epochs (see epochs subgroup) deriving from analysis of data.","quantity":"?","groups":[{"name":"epochs","neurodata_type_inc":"TimeIntervals","doc":"Divisions in time marking experimental stages or sub-divisions of a single recording session.","quantity":"?"},{"name":"trials","neurodata_type_inc":"TimeIntervals","doc":"Repeated experimental events that have a logical grouping.","quantity":"?"},{"name":"invalid_times","neurodata_type_inc":"TimeIntervals","doc":"Time intervals that should be removed from analysis.","quantity":"?"},{"neurodata_type_inc":"TimeIntervals","doc":"Optional additional table(s) for describing other experimental time intervals.","quantity":"*"}]},{"name":"units","neurodata_type_inc":"Units","doc":"Data about sorted spike units.","quantity":"?"}]},{"neurodata_type_def":"LabMetaData","neurodata_type_inc":"NWBContainer","doc":"Lab-specific meta-data."},{"neurodata_type_def":"Subject","neurodata_type_inc":"NWBContainer","doc":"Information about the animal or person from which the data was measured.","datasets":[{"name":"age","dtype":"text","doc":"Age of subject. Can be supplied instead of 'date_of_birth'.","quantity":"?","attributes":[{"name":"reference","doc":"Age is with reference to this event. Can be 'birth' or 'gestational'. If reference is omitted, 'birth' is implied.","dtype":"text","required":false,"default_value":"birth"}]},{"name":"date_of_birth","dtype":"isodatetime","doc":"Date of birth of subject. Can be supplied instead of 'age'.","quantity":"?"},{"name":"description","dtype":"text","doc":"Description of subject and where subject came from (e.g., breeder, if animal).","quantity":"?"},{"name":"genotype","dtype":"text","doc":"Genetic strain. If absent, assume Wild Type (WT).","quantity":"?"},{"name":"sex","dtype":"text","doc":"Gender of subject.","quantity":"?"},{"name":"species","dtype":"text","doc":"Species of subject.","quantity":"?"},{"name":"strain","dtype":"text","doc":"Strain of subject.","quantity":"?"},{"name":"subject_id","dtype":"text","doc":"ID of animal/person used/participating in experiment (lab convention).","quantity":"?"},{"name":"weight","dtype":"text","doc":"Weight at time of experiment, at time of surgery and at other important times.","quantity":"?"}]}],"datasets":[{"neurodata_type_def":"ScratchData","neurodata_type_inc":"NWBData","doc":"Any one-off datasets","attributes":[{"name":"notes","doc":"Any notes the user has about the dataset being stored","dtype":"text"}]}]})delimiter"; + +const std::string nwb_misc = R"delimiter( +{"groups":[{"neurodata_type_def":"AbstractFeatureSeries","neurodata_type_inc":"TimeSeries","doc":"Abstract features, such as quantitative descriptions of sensory stimuli. The TimeSeries::data field is a 2D array, storing those features (e.g., for visual grating stimulus this might be orientation, spatial frequency and contrast). Null stimuli (eg, uniform gray) can be marked as being an independent feature (eg, 1.0 for gray, 0.0 for actual stimulus) or by storing NaNs for feature values, or through use of the TimeSeries::control fields. A set of features is considered to persist until the next set of features is defined. The final set of features stored should be the null set. This is useful when storing the raw stimulus is impractical.","datasets":[{"name":"data","dtype":"numeric","dims":[["num_times"],["num_times","num_features"]],"shape":[[null],[null,null]],"doc":"Values of each feature at each time.","attributes":[{"name":"unit","dtype":"text","default_value":"see 'feature_units'","doc":"Since there can be different units for different features, store the units in 'feature_units'. The default value for this attribute is \"see 'feature_units'\".","required":false}]},{"name":"feature_units","dtype":"text","dims":["num_features"],"shape":[null],"doc":"Units of each feature.","quantity":"?"},{"name":"features","dtype":"text","dims":["num_features"],"shape":[null],"doc":"Description of the features represented in TimeSeries::data."}]},{"neurodata_type_def":"AnnotationSeries","neurodata_type_inc":"TimeSeries","doc":"Stores user annotations made during an experiment. The data[] field stores a text array, and timestamps are stored for each annotation (ie, interval=1). This is largely an alias to a standard TimeSeries storing a text array but that is identifiable as storing annotations in a machine-readable way.","datasets":[{"name":"data","dtype":"text","dims":["num_times"],"shape":[null],"doc":"Annotations made during an experiment.","attributes":[{"name":"resolution","dtype":"float32","value":-1.0,"doc":"Smallest meaningful difference between values in data. Annotations have no units, so the value is fixed to -1.0."},{"name":"unit","dtype":"text","value":"n/a","doc":"Base unit of measurement for working with the data. Annotations have no units, so the value is fixed to 'n/a'."}]}]},{"neurodata_type_def":"IntervalSeries","neurodata_type_inc":"TimeSeries","doc":"Stores intervals of data. The timestamps field stores the beginning and end of intervals. The data field stores whether the interval just started (>0 value) or ended (<0 value). Different interval types can be represented in the same series by using multiple key values (eg, 1 for feature A, 2 for feature B, 3 for feature C, etc). The field data stores an 8-bit integer. This is largely an alias of a standard TimeSeries but that is identifiable as representing time intervals in a machine-readable way.","datasets":[{"name":"data","dtype":"int8","dims":["num_times"],"shape":[null],"doc":"Use values >0 if interval started, <0 if interval ended.","attributes":[{"name":"resolution","dtype":"float32","value":-1.0,"doc":"Smallest meaningful difference between values in data. Annotations have no units, so the value is fixed to -1.0."},{"name":"unit","dtype":"text","value":"n/a","doc":"Base unit of measurement for working with the data. Annotations have no units, so the value is fixed to 'n/a'."}]}]},{"neurodata_type_def":"DecompositionSeries","neurodata_type_inc":"TimeSeries","doc":"Spectral analysis of a time series, e.g. of an LFP or a speech signal.","datasets":[{"name":"data","dtype":"numeric","dims":["num_times","num_channels","num_bands"],"shape":[null,null,null],"doc":"Data decomposed into frequency bands.","attributes":[{"name":"unit","dtype":"text","default_value":"no unit","doc":"Base unit of measurement for working with the data. Actual stored values are not necessarily stored in these units. To access the data in these units, multiply 'data' by 'conversion'."}]},{"name":"metric","dtype":"text","doc":"The metric used, e.g. phase, amplitude, power."},{"name":"source_channels","neurodata_type_inc":"DynamicTableRegion","doc":"DynamicTableRegion pointer to the channels that this decomposition series was generated from.","quantity":"?"}],"groups":[{"name":"bands","neurodata_type_inc":"DynamicTable","doc":"Table for describing the bands that this series was generated from. There should be one row in this table for each band.","datasets":[{"name":"band_name","neurodata_type_inc":"VectorData","dtype":"text","doc":"Name of the band, e.g. theta."},{"name":"band_limits","neurodata_type_inc":"VectorData","dtype":"float32","dims":["num_bands","low, high"],"shape":[null,2],"doc":"Low and high limit of each band in Hz. If it is a Gaussian filter, use 2 SD on either side of the center."},{"name":"band_mean","neurodata_type_inc":"VectorData","dtype":"float32","dims":["num_bands"],"shape":[null],"doc":"The mean Gaussian filters, in Hz."},{"name":"band_stdev","neurodata_type_inc":"VectorData","dtype":"float32","dims":["num_bands"],"shape":[null],"doc":"The standard deviation of Gaussian filters, in Hz."}]}],"links":[{"name":"source_timeseries","target_type":"TimeSeries","doc":"Link to TimeSeries object that this data was calculated from. Metadata about electrodes and their position can be read from that ElectricalSeries so it is not necessary to store that information here.","quantity":"?"}]},{"neurodata_type_def":"Units","neurodata_type_inc":"DynamicTable","default_name":"Units","doc":"Data about spiking units. Event times of observed units (e.g. cell, synapse, etc.) should be concatenated and stored in spike_times.","datasets":[{"name":"spike_times_index","neurodata_type_inc":"VectorIndex","doc":"Index into the spike_times dataset.","quantity":"?"},{"name":"spike_times","neurodata_type_inc":"VectorData","dtype":"float64","doc":"Spike times for each unit in seconds.","quantity":"?","attributes":[{"name":"resolution","dtype":"float64","doc":"The smallest possible difference between two spike times. Usually 1 divided by the acquisition sampling rate from which spike times were extracted, but could be larger if the acquisition time series was downsampled or smaller if the acquisition time series was smoothed/interpolated and it is possible for the spike time to be between samples.","required":false}]},{"name":"obs_intervals_index","neurodata_type_inc":"VectorIndex","doc":"Index into the obs_intervals dataset.","quantity":"?"},{"name":"obs_intervals","neurodata_type_inc":"VectorData","dtype":"float64","dims":["num_intervals","start|end"],"shape":[null,2],"doc":"Observation intervals for each unit.","quantity":"?"},{"name":"electrodes_index","neurodata_type_inc":"VectorIndex","doc":"Index into electrodes.","quantity":"?"},{"name":"electrodes","neurodata_type_inc":"DynamicTableRegion","doc":"Electrode that each spike unit came from, specified using a DynamicTableRegion.","quantity":"?"},{"name":"electrode_group","neurodata_type_inc":"VectorData","dtype":{"target_type":"ElectrodeGroup","reftype":"object"},"doc":"Electrode group that each spike unit came from.","quantity":"?"},{"name":"waveform_mean","neurodata_type_inc":"VectorData","dtype":"float32","dims":[["num_units","num_samples"],["num_units","num_samples","num_electrodes"]],"shape":[[null,null],[null,null,null]],"doc":"Spike waveform mean for each spike unit.","quantity":"?","attributes":[{"name":"sampling_rate","dtype":"float32","doc":"Sampling rate, in hertz.","required":false},{"name":"unit","dtype":"text","value":"volts","doc":"Unit of measurement. This value is fixed to 'volts'.","required":false}]},{"name":"waveform_sd","neurodata_type_inc":"VectorData","dtype":"float32","dims":[["num_units","num_samples"],["num_units","num_samples","num_electrodes"]],"shape":[[null,null],[null,null,null]],"doc":"Spike waveform standard deviation for each spike unit.","quantity":"?","attributes":[{"name":"sampling_rate","dtype":"float32","doc":"Sampling rate, in hertz.","required":false},{"name":"unit","dtype":"text","value":"volts","doc":"Unit of measurement. This value is fixed to 'volts'.","required":false}]},{"name":"waveforms","neurodata_type_inc":"VectorData","dtype":"numeric","dims":["num_waveforms","num_samples"],"shape":[null,null],"doc":"Individual waveforms for each spike on each electrode. This is a doubly indexed column. The 'waveforms_index' column indexes which waveforms in this column belong to the same spike event for a given unit, where each waveform was recorded from a different electrode. The 'waveforms_index_index' column indexes the 'waveforms_index' column to indicate which spike events belong to a given unit. For example, if the 'waveforms_index_index' column has values [2, 5, 6], then the first 2 elements of the 'waveforms_index' column correspond to the 2 spike events of the first unit, the next 3 elements of the 'waveforms_index' column correspond to the 3 spike events of the second unit, and the next 1 element of the 'waveforms_index' column corresponds to the 1 spike event of the third unit. If the 'waveforms_index' column has values [3, 6, 8, 10, 12, 13], then the first 3 elements of the 'waveforms' column contain the 3 spike waveforms that were recorded from 3 different electrodes for the first spike time of the first unit. See https://nwb-schema.readthedocs.io/en/stable/format_description.html#doubly-ragged-arrays for a graphical representation of this example. When there is only one electrode for each unit (i.e., each spike time is associated with a single waveform), then the 'waveforms_index' column will have values 1, 2, ..., N, where N is the number of spike events. The number of electrodes for each spike event should be the same within a given unit. The 'electrodes' column should be used to indicate which electrodes are associated with each unit, and the order of the waveforms within a given unit x spike event should be in the same order as the electrodes referenced in the 'electrodes' column of this table. The number of samples for each waveform must be the same.","quantity":"?","attributes":[{"name":"sampling_rate","dtype":"float32","doc":"Sampling rate, in hertz.","required":false},{"name":"unit","dtype":"text","value":"volts","doc":"Unit of measurement. This value is fixed to 'volts'.","required":false}]},{"name":"waveforms_index","neurodata_type_inc":"VectorIndex","doc":"Index into the waveforms dataset. One value for every spike event. See 'waveforms' for more detail.","quantity":"?"},{"name":"waveforms_index_index","neurodata_type_inc":"VectorIndex","doc":"Index into the waveforms_index dataset. One value for every unit (row in the table). See 'waveforms' for more detail.","quantity":"?"}]}]})delimiter"; + +const std::string nwb_behavior = R"delimiter( +{"groups":[{"neurodata_type_def":"SpatialSeries","neurodata_type_inc":"TimeSeries","doc":"Direction, e.g., of gaze or travel, or position. The TimeSeries::data field is a 2D array storing position or direction relative to some reference frame. Array structure: [num measurements] [num dimensions]. Each SpatialSeries has a text dataset reference_frame that indicates the zero-position, or the zero-axes for direction. For example, if representing gaze direction, 'straight-ahead' might be a specific pixel on the monitor, or some other point in space. For position data, the 0,0 point might be the top-left corner of an enclosure, as viewed from the tracking camera. The unit of data will indicate how to interpret SpatialSeries values.","datasets":[{"name":"data","dtype":"numeric","dims":[["num_times"],["num_times","x"],["num_times","x,y"],["num_times","x,y,z"]],"shape":[[null],[null,1],[null,2],[null,3]],"doc":"1-D or 2-D array storing position or direction relative to some reference frame.","attributes":[{"name":"unit","dtype":"text","default_value":"meters","doc":"Base unit of measurement for working with the data. The default value is 'meters'. Actual stored values are not necessarily stored in these units. To access the data in these units, multiply 'data' by 'conversion' and add 'offset'.","required":false}]},{"name":"reference_frame","dtype":"text","doc":"Description defining what exactly 'straight-ahead' means.","quantity":"?"}]},{"neurodata_type_def":"BehavioralEpochs","neurodata_type_inc":"NWBDataInterface","default_name":"BehavioralEpochs","doc":"TimeSeries for storing behavioral epochs. The objective of this and the other two Behavioral interfaces (e.g. BehavioralEvents and BehavioralTimeSeries) is to provide generic hooks for software tools/scripts. This allows a tool/script to take the output one specific interface (e.g., UnitTimes) and plot that data relative to another data modality (e.g., behavioral events) without having to define all possible modalities in advance. Declaring one of these interfaces means that one or more TimeSeries of the specified type is published. These TimeSeries should reside in a group having the same name as the interface. For example, if a BehavioralTimeSeries interface is declared, the module will have one or more TimeSeries defined in the module sub-group 'BehavioralTimeSeries'. BehavioralEpochs should use IntervalSeries. BehavioralEvents is used for irregular events. BehavioralTimeSeries is for continuous data.","groups":[{"neurodata_type_inc":"IntervalSeries","doc":"IntervalSeries object containing start and stop times of epochs.","quantity":"*"}]},{"neurodata_type_def":"BehavioralEvents","neurodata_type_inc":"NWBDataInterface","default_name":"BehavioralEvents","doc":"TimeSeries for storing behavioral events. See description of BehavioralEpochs for more details.","groups":[{"neurodata_type_inc":"TimeSeries","doc":"TimeSeries object containing behavioral events.","quantity":"*"}]},{"neurodata_type_def":"BehavioralTimeSeries","neurodata_type_inc":"NWBDataInterface","default_name":"BehavioralTimeSeries","doc":"TimeSeries for storing Behavoioral time series data. See description of BehavioralEpochs for more details.","groups":[{"neurodata_type_inc":"TimeSeries","doc":"TimeSeries object containing continuous behavioral data.","quantity":"*"}]},{"neurodata_type_def":"PupilTracking","neurodata_type_inc":"NWBDataInterface","default_name":"PupilTracking","doc":"Eye-tracking data, representing pupil size.","groups":[{"neurodata_type_inc":"TimeSeries","doc":"TimeSeries object containing time series data on pupil size.","quantity":"+"}]},{"neurodata_type_def":"EyeTracking","neurodata_type_inc":"NWBDataInterface","default_name":"EyeTracking","doc":"Eye-tracking data, representing direction of gaze.","groups":[{"neurodata_type_inc":"SpatialSeries","doc":"SpatialSeries object containing data measuring direction of gaze.","quantity":"*"}]},{"neurodata_type_def":"CompassDirection","neurodata_type_inc":"NWBDataInterface","default_name":"CompassDirection","doc":"With a CompassDirection interface, a module publishes a SpatialSeries object representing a floating point value for theta. The SpatialSeries::reference_frame field should indicate what direction corresponds to 0 and which is the direction of rotation (this should be clockwise). The si_unit for the SpatialSeries should be radians or degrees.","groups":[{"neurodata_type_inc":"SpatialSeries","doc":"SpatialSeries object containing direction of gaze travel.","quantity":"*"}]},{"neurodata_type_def":"Position","neurodata_type_inc":"NWBDataInterface","default_name":"Position","doc":"Position data, whether along the x, x/y or x/y/z axis.","groups":[{"neurodata_type_inc":"SpatialSeries","doc":"SpatialSeries object containing position data.","quantity":"+"}]}]})delimiter"; + +const std::string nwb_ecephys = R"delimiter( +{"groups":[{"neurodata_type_def":"ElectricalSeries","neurodata_type_inc":"TimeSeries","doc":"A time series of acquired voltage data from extracellular recordings. The data field is an int or float array storing data in volts. The first dimension should always represent time. The second dimension, if present, should represent channels.","attributes":[{"name":"filtering","dtype":"text","doc":"Filtering applied to all channels of the data. For example, if this ElectricalSeries represents high-pass-filtered data (also known as AP Band), then this value could be \"High-pass 4-pole Bessel filter at 500 Hz\". If this ElectricalSeries represents low-pass-filtered LFP data and the type of filter is unknown, then this value could be \"Low-pass filter at 300 Hz\". If a non-standard filter type is used, provide as much detail about the filter properties as possible.","required":false}],"datasets":[{"name":"data","dtype":"numeric","dims":[["num_times"],["num_times","num_channels"],["num_times","num_channels","num_samples"]],"shape":[[null],[null,null],[null,null,null]],"doc":"Recorded voltage data.","attributes":[{"name":"unit","dtype":"text","value":"volts","doc":"Base unit of measurement for working with the data. This value is fixed to 'volts'. Actual stored values are not necessarily stored in these units. To access the data in these units, multiply 'data' by 'conversion', followed by 'channel_conversion' (if present), and then add 'offset'."}]},{"name":"electrodes","neurodata_type_inc":"DynamicTableRegion","doc":"DynamicTableRegion pointer to the electrodes that this time series was generated from."},{"name":"channel_conversion","dtype":"float32","dims":["num_channels"],"shape":[null],"doc":"Channel-specific conversion factor. Multiply the data in the 'data' dataset by these values along the channel axis (as indicated by axis attribute) AND by the global conversion factor in the 'conversion' attribute of 'data' to get the data values in Volts, i.e, data in Volts = data * data.conversion * channel_conversion. This approach allows for both global and per-channel data conversion factors needed to support the storage of electrical recordings as native values generated by data acquisition systems. If this dataset is not present, then there is no channel-specific conversion factor, i.e. it is 1 for all channels.","quantity":"?","attributes":[{"name":"axis","dtype":"int32","value":1,"doc":"The zero-indexed axis of the 'data' dataset that the channel-specific conversion factor corresponds to. This value is fixed to 1."}]}]},{"neurodata_type_def":"SpikeEventSeries","neurodata_type_inc":"ElectricalSeries","doc":"Stores snapshots/snippets of recorded spike events (i.e., threshold crossings). This may also be raw data, as reported by ephys hardware. If so, the TimeSeries::description field should describe how events were detected. All SpikeEventSeries should reside in a module (under EventWaveform interface) even if the spikes were reported and stored by hardware. All events span the same recording channels and store snapshots of equal duration. TimeSeries::data array structure: [num events] [num channels] [num samples] (or [num events] [num samples] for single electrode).","datasets":[{"name":"data","dtype":"numeric","dims":[["num_events","num_samples"],["num_events","num_channels","num_samples"]],"shape":[[null,null],[null,null,null]],"doc":"Spike waveforms.","attributes":[{"name":"unit","dtype":"text","value":"volts","doc":"Unit of measurement for waveforms, which is fixed to 'volts'."}]},{"name":"timestamps","dtype":"float64","dims":["num_times"],"shape":[null],"doc":"Timestamps for samples stored in data, in seconds, relative to the common experiment master-clock stored in NWBFile.timestamps_reference_time. Timestamps are required for the events. Unlike for TimeSeries, timestamps are required for SpikeEventSeries and are thus re-specified here.","attributes":[{"name":"interval","dtype":"int32","value":1,"doc":"Value is '1'"},{"name":"unit","dtype":"text","value":"seconds","doc":"Unit of measurement for timestamps, which is fixed to 'seconds'."}]}]},{"neurodata_type_def":"FeatureExtraction","neurodata_type_inc":"NWBDataInterface","default_name":"FeatureExtraction","doc":"Features, such as PC1 and PC2, that are extracted from signals stored in a SpikeEventSeries or other source.","datasets":[{"name":"description","dtype":"text","dims":["num_features"],"shape":[null],"doc":"Description of features (eg, ''PC1'') for each of the extracted features."},{"name":"features","dtype":"float32","dims":["num_events","num_channels","num_features"],"shape":[null,null,null],"doc":"Multi-dimensional array of features extracted from each event."},{"name":"times","dtype":"float64","dims":["num_events"],"shape":[null],"doc":"Times of events that features correspond to (can be a link)."},{"name":"electrodes","neurodata_type_inc":"DynamicTableRegion","doc":"DynamicTableRegion pointer to the electrodes that this time series was generated from."}]},{"neurodata_type_def":"EventDetection","neurodata_type_inc":"NWBDataInterface","default_name":"EventDetection","doc":"Detected spike events from voltage trace(s).","datasets":[{"name":"detection_method","dtype":"text","doc":"Description of how events were detected, such as voltage threshold, or dV/dT threshold, as well as relevant values."},{"name":"source_idx","dtype":"int32","dims":["num_events"],"shape":[null],"doc":"Indices (zero-based) into source ElectricalSeries::data array corresponding to time of event. ''description'' should define what is meant by time of event (e.g., .25 ms before action potential peak, zero-crossing time, etc). The index points to each event from the raw data."},{"name":"times","dtype":"float64","dims":["num_events"],"shape":[null],"doc":"Timestamps of events, in seconds.","attributes":[{"name":"unit","dtype":"text","value":"seconds","doc":"Unit of measurement for event times, which is fixed to 'seconds'."}]}],"links":[{"name":"source_electricalseries","target_type":"ElectricalSeries","doc":"Link to the ElectricalSeries that this data was calculated from. Metadata about electrodes and their position can be read from that ElectricalSeries so it's not necessary to include that information here."}]},{"neurodata_type_def":"EventWaveform","neurodata_type_inc":"NWBDataInterface","default_name":"EventWaveform","doc":"Represents either the waveforms of detected events, as extracted from a raw data trace in /acquisition, or the event waveforms that were stored during experiment acquisition.","groups":[{"neurodata_type_inc":"SpikeEventSeries","doc":"SpikeEventSeries object(s) containing detected spike event waveforms.","quantity":"*"}]},{"neurodata_type_def":"FilteredEphys","neurodata_type_inc":"NWBDataInterface","default_name":"FilteredEphys","doc":"Electrophysiology data from one or more channels that has been subjected to filtering. Examples of filtered data include Theta and Gamma (LFP has its own interface). FilteredEphys modules publish an ElectricalSeries for each filtered channel or set of channels. The name of each ElectricalSeries is arbitrary but should be informative. The source of the filtered data, whether this is from analysis of another time series or as acquired by hardware, should be noted in each's TimeSeries::description field. There is no assumed 1::1 correspondence between filtered ephys signals and electrodes, as a single signal can apply to many nearby electrodes, and one electrode may have different filtered (e.g., theta and/or gamma) signals represented. Filter properties should be noted in the ElectricalSeries 'filtering' attribute.","groups":[{"neurodata_type_inc":"ElectricalSeries","doc":"ElectricalSeries object(s) containing filtered electrophysiology data.","quantity":"+"}]},{"neurodata_type_def":"LFP","neurodata_type_inc":"NWBDataInterface","default_name":"LFP","doc":"LFP data from one or more channels. The electrode map in each published ElectricalSeries will identify which channels are providing LFP data. Filter properties should be noted in the ElectricalSeries 'filtering' attribute.","groups":[{"neurodata_type_inc":"ElectricalSeries","doc":"ElectricalSeries object(s) containing LFP data for one or more channels.","quantity":"+"}]},{"neurodata_type_def":"ElectrodeGroup","neurodata_type_inc":"NWBContainer","doc":"A physical grouping of electrodes, e.g. a shank of an array.","attributes":[{"name":"description","dtype":"text","doc":"Description of this electrode group."},{"name":"location","dtype":"text","doc":"Location of electrode group. Specify the area, layer, comments on estimation of area/layer, etc. Use standard atlas names for anatomical regions when possible."}],"datasets":[{"name":"position","dtype":[{"name":"x","dtype":"float32","doc":"x coordinate"},{"name":"y","dtype":"float32","doc":"y coordinate"},{"name":"z","dtype":"float32","doc":"z coordinate"}],"doc":"stereotaxic or common framework coordinates","quantity":"?"}],"links":[{"name":"device","target_type":"Device","doc":"Link to the device that was used to record from this electrode group."}]},{"neurodata_type_def":"ClusterWaveforms","neurodata_type_inc":"NWBDataInterface","default_name":"ClusterWaveforms","doc":"DEPRECATED The mean waveform shape, including standard deviation, of the different clusters. Ideally, the waveform analysis should be performed on data that is only high-pass filtered. This is a separate module because it is expected to require updating. For example, IMEC probes may require different storage requirements to store/display mean waveforms, requiring a new interface or an extension of this one.","datasets":[{"name":"waveform_filtering","dtype":"text","doc":"Filtering applied to data before generating mean/sd"},{"name":"waveform_mean","dtype":"float32","dims":["num_clusters","num_samples"],"shape":[null,null],"doc":"The mean waveform for each cluster, using the same indices for each wave as cluster numbers in the associated Clustering module (i.e, cluster 3 is in array slot [3]). Waveforms corresponding to gaps in cluster sequence should be empty (e.g., zero- filled)"},{"name":"waveform_sd","dtype":"float32","dims":["num_clusters","num_samples"],"shape":[null,null],"doc":"Stdev of waveforms for each cluster, using the same indices as in mean"}],"links":[{"name":"clustering_interface","target_type":"Clustering","doc":"Link to Clustering interface that was the source of the clustered data"}]},{"neurodata_type_def":"Clustering","neurodata_type_inc":"NWBDataInterface","default_name":"Clustering","doc":"DEPRECATED Clustered spike data, whether from automatic clustering tools (e.g., klustakwik) or as a result of manual sorting.","datasets":[{"name":"description","dtype":"text","doc":"Description of clusters or clustering, (e.g. cluster 0 is noise, clusters curated using Klusters, etc)"},{"name":"num","dtype":"int32","dims":["num_events"],"shape":[null],"doc":"Cluster number of each event"},{"name":"peak_over_rms","dtype":"float32","dims":["num_clusters"],"shape":[null],"doc":"Maximum ratio of waveform peak to RMS on any channel in the cluster (provides a basic clustering metric)."},{"name":"times","dtype":"float64","dims":["num_events"],"shape":[null],"doc":"Times of clustered events, in seconds. This may be a link to times field in associated FeatureExtraction module."}]}]})delimiter"; + +const std::string nwb_icephys = R"delimiter( +{"groups":[{"neurodata_type_def":"PatchClampSeries","neurodata_type_inc":"TimeSeries","doc":"An abstract base class for patch-clamp data - stimulus or response, current or voltage.","attributes":[{"name":"stimulus_description","dtype":"text","doc":"Protocol/stimulus name for this patch-clamp dataset."},{"name":"sweep_number","dtype":"uint32","doc":"Sweep number, allows to group different PatchClampSeries together.","required":false}],"datasets":[{"name":"data","dtype":"numeric","dims":["num_times"],"shape":[null],"doc":"Recorded voltage or current.","attributes":[{"name":"unit","dtype":"text","doc":"Base unit of measurement for working with the data. Actual stored values are not necessarily stored in these units. To access the data in these units, multiply 'data' by 'conversion' and add 'offset'."}]},{"name":"gain","dtype":"float32","doc":"Gain of the recording, in units Volt/Amp (v-clamp) or Volt/Volt (c-clamp).","quantity":"?"}],"links":[{"name":"electrode","target_type":"IntracellularElectrode","doc":"Link to IntracellularElectrode object that describes the electrode that was used to apply or record this data."}]},{"neurodata_type_def":"CurrentClampSeries","neurodata_type_inc":"PatchClampSeries","doc":"Voltage data from an intracellular current-clamp recording. A corresponding CurrentClampStimulusSeries (stored separately as a stimulus) is used to store the current injected.","datasets":[{"name":"data","doc":"Recorded voltage.","attributes":[{"name":"unit","dtype":"text","value":"volts","doc":"Base unit of measurement for working with the data. which is fixed to 'volts'. Actual stored values are not necessarily stored in these units. To access the data in these units, multiply 'data' by 'conversion' and add 'offset'."}]},{"name":"bias_current","dtype":"float32","doc":"Bias current, in amps.","quantity":"?"},{"name":"bridge_balance","dtype":"float32","doc":"Bridge balance, in ohms.","quantity":"?"},{"name":"capacitance_compensation","dtype":"float32","doc":"Capacitance compensation, in farads.","quantity":"?"}]},{"neurodata_type_def":"IZeroClampSeries","neurodata_type_inc":"CurrentClampSeries","doc":"Voltage data from an intracellular recording when all current and amplifier settings are off (i.e., CurrentClampSeries fields will be zero). There is no CurrentClampStimulusSeries associated with an IZero series because the amplifier is disconnected and no stimulus can reach the cell.","attributes":[{"name":"stimulus_description","dtype":"text","doc":"An IZeroClampSeries has no stimulus, so this attribute is automatically set to \"N/A\"","value":"N/A"}],"datasets":[{"name":"bias_current","dtype":"float32","value":0.0,"doc":"Bias current, in amps, fixed to 0.0."},{"name":"bridge_balance","dtype":"float32","value":0.0,"doc":"Bridge balance, in ohms, fixed to 0.0."},{"name":"capacitance_compensation","dtype":"float32","value":0.0,"doc":"Capacitance compensation, in farads, fixed to 0.0."}]},{"neurodata_type_def":"CurrentClampStimulusSeries","neurodata_type_inc":"PatchClampSeries","doc":"Stimulus current applied during current clamp recording.","datasets":[{"name":"data","doc":"Stimulus current applied.","attributes":[{"name":"unit","dtype":"text","value":"amperes","doc":"Base unit of measurement for working with the data. which is fixed to 'amperes'. Actual stored values are not necessarily stored in these units. To access the data in these units, multiply 'data' by 'conversion' and add 'offset'."}]}]},{"neurodata_type_def":"VoltageClampSeries","neurodata_type_inc":"PatchClampSeries","doc":"Current data from an intracellular voltage-clamp recording. A corresponding VoltageClampStimulusSeries (stored separately as a stimulus) is used to store the voltage injected.","datasets":[{"name":"data","doc":"Recorded current.","attributes":[{"name":"unit","dtype":"text","value":"amperes","doc":"Base unit of measurement for working with the data. which is fixed to 'amperes'. Actual stored values are not necessarily stored in these units. To access the data in these units, multiply 'data' by 'conversion' and add 'offset'."}]},{"name":"capacitance_fast","dtype":"float32","doc":"Fast capacitance, in farads.","quantity":"?","attributes":[{"name":"unit","dtype":"text","value":"farads","doc":"Unit of measurement for capacitance_fast, which is fixed to 'farads'."}]},{"name":"capacitance_slow","dtype":"float32","doc":"Slow capacitance, in farads.","quantity":"?","attributes":[{"name":"unit","dtype":"text","value":"farads","doc":"Unit of measurement for capacitance_fast, which is fixed to 'farads'."}]},{"name":"resistance_comp_bandwidth","dtype":"float32","doc":"Resistance compensation bandwidth, in hertz.","quantity":"?","attributes":[{"name":"unit","dtype":"text","value":"hertz","doc":"Unit of measurement for resistance_comp_bandwidth, which is fixed to 'hertz'."}]},{"name":"resistance_comp_correction","dtype":"float32","doc":"Resistance compensation correction, in percent.","quantity":"?","attributes":[{"name":"unit","dtype":"text","value":"percent","doc":"Unit of measurement for resistance_comp_correction, which is fixed to 'percent'."}]},{"name":"resistance_comp_prediction","dtype":"float32","doc":"Resistance compensation prediction, in percent.","quantity":"?","attributes":[{"name":"unit","dtype":"text","value":"percent","doc":"Unit of measurement for resistance_comp_prediction, which is fixed to 'percent'."}]},{"name":"whole_cell_capacitance_comp","dtype":"float32","doc":"Whole cell capacitance compensation, in farads.","quantity":"?","attributes":[{"name":"unit","dtype":"text","value":"farads","doc":"Unit of measurement for whole_cell_capacitance_comp, which is fixed to 'farads'."}]},{"name":"whole_cell_series_resistance_comp","dtype":"float32","doc":"Whole cell series resistance compensation, in ohms.","quantity":"?","attributes":[{"name":"unit","dtype":"text","value":"ohms","doc":"Unit of measurement for whole_cell_series_resistance_comp, which is fixed to 'ohms'."}]}]},{"neurodata_type_def":"VoltageClampStimulusSeries","neurodata_type_inc":"PatchClampSeries","doc":"Stimulus voltage applied during a voltage clamp recording.","datasets":[{"name":"data","doc":"Stimulus voltage applied.","attributes":[{"name":"unit","dtype":"text","value":"volts","doc":"Base unit of measurement for working with the data. which is fixed to 'volts'. Actual stored values are not necessarily stored in these units. To access the data in these units, multiply 'data' by 'conversion' and add 'offset'."}]}]},{"neurodata_type_def":"IntracellularElectrode","neurodata_type_inc":"NWBContainer","doc":"An intracellular electrode and its metadata.","datasets":[{"name":"cell_id","dtype":"text","doc":"unique ID of the cell","quantity":"?"},{"name":"description","dtype":"text","doc":"Description of electrode (e.g., whole-cell, sharp, etc.)."},{"name":"filtering","dtype":"text","doc":"Electrode specific filtering.","quantity":"?"},{"name":"initial_access_resistance","dtype":"text","doc":"Initial access resistance.","quantity":"?"},{"name":"location","dtype":"text","doc":"Location of the electrode. Specify the area, layer, comments on estimation of area/layer, stereotaxic coordinates if in vivo, etc. Use standard atlas names for anatomical regions when possible.","quantity":"?"},{"name":"resistance","dtype":"text","doc":"Electrode resistance, in ohms.","quantity":"?"},{"name":"seal","dtype":"text","doc":"Information about seal used for recording.","quantity":"?"},{"name":"slice","dtype":"text","doc":"Information about slice used for recording.","quantity":"?"}],"links":[{"name":"device","target_type":"Device","doc":"Device that was used to record from this electrode."}]},{"neurodata_type_def":"SweepTable","neurodata_type_inc":"DynamicTable","doc":"[DEPRECATED] Table used to group different PatchClampSeries. SweepTable is being replaced by IntracellularRecordingsTable and SimultaneousRecordingsTable tables. Additional SequentialRecordingsTable, RepetitionsTable, and ExperimentalConditions tables provide enhanced support for experiment metadata.","datasets":[{"name":"sweep_number","neurodata_type_inc":"VectorData","dtype":"uint32","doc":"Sweep number of the PatchClampSeries in that row."},{"name":"series","neurodata_type_inc":"VectorData","dtype":{"target_type":"PatchClampSeries","reftype":"object"},"doc":"The PatchClampSeries with the sweep number in that row."},{"name":"series_index","neurodata_type_inc":"VectorIndex","doc":"Index for series."}]},{"neurodata_type_def":"IntracellularElectrodesTable","neurodata_type_inc":"DynamicTable","doc":"Table for storing intracellular electrode related metadata.","attributes":[{"name":"description","dtype":"text","value":"Table for storing intracellular electrode related metadata.","doc":"Description of what is in this dynamic table."}],"datasets":[{"name":"electrode","neurodata_type_inc":"VectorData","dtype":{"target_type":"IntracellularElectrode","reftype":"object"},"doc":"Column for storing the reference to the intracellular electrode."}]},{"neurodata_type_def":"IntracellularStimuliTable","neurodata_type_inc":"DynamicTable","doc":"Table for storing intracellular stimulus related metadata.","attributes":[{"name":"description","dtype":"text","value":"Table for storing intracellular stimulus related metadata.","doc":"Description of what is in this dynamic table."}],"datasets":[{"name":"stimulus","neurodata_type_inc":"TimeSeriesReferenceVectorData","doc":"Column storing the reference to the recorded stimulus for the recording (rows)."},{"name":"stimulus_template","neurodata_type_inc":"TimeSeriesReferenceVectorData","doc":"Column storing the reference to the stimulus template for the recording (rows).","quantity":"?"}]},{"neurodata_type_def":"IntracellularResponsesTable","neurodata_type_inc":"DynamicTable","doc":"Table for storing intracellular response related metadata.","attributes":[{"name":"description","dtype":"text","value":"Table for storing intracellular response related metadata.","doc":"Description of what is in this dynamic table."}],"datasets":[{"name":"response","neurodata_type_inc":"TimeSeriesReferenceVectorData","doc":"Column storing the reference to the recorded response for the recording (rows)"}]},{"neurodata_type_def":"IntracellularRecordingsTable","neurodata_type_inc":"AlignedDynamicTable","name":"intracellular_recordings","doc":"A table to group together a stimulus and response from a single electrode and a single simultaneous recording. Each row in the table represents a single recording consisting typically of a stimulus and a corresponding response. In some cases, however, only a stimulus or a response is recorded as part of an experiment. In this case, both the stimulus and response will point to the same TimeSeries while the idx_start and count of the invalid column will be set to -1, thus, indicating that no values have been recorded for the stimulus or response, respectively. Note, a recording MUST contain at least a stimulus or a response. Typically the stimulus and response are PatchClampSeries. However, the use of AD/DA channels that are not associated to an electrode is also common in intracellular electrophysiology, in which case other TimeSeries may be used.","attributes":[{"name":"description","dtype":"text","value":"A table to group together a stimulus and response from a single electrode and a single simultaneous recording and for storing metadata about the intracellular recording.","doc":"Description of the contents of this table. Inherited from AlignedDynamicTable and overwritten here to fix the value of the attribute."}],"groups":[{"name":"electrodes","neurodata_type_inc":"IntracellularElectrodesTable","doc":"Table for storing intracellular electrode related metadata."},{"name":"stimuli","neurodata_type_inc":"IntracellularStimuliTable","doc":"Table for storing intracellular stimulus related metadata."},{"name":"responses","neurodata_type_inc":"IntracellularResponsesTable","doc":"Table for storing intracellular response related metadata."}]},{"neurodata_type_def":"SimultaneousRecordingsTable","neurodata_type_inc":"DynamicTable","name":"simultaneous_recordings","doc":"A table for grouping different intracellular recordings from the IntracellularRecordingsTable table together that were recorded simultaneously from different electrodes.","datasets":[{"name":"recordings","neurodata_type_inc":"DynamicTableRegion","doc":"A reference to one or more rows in the IntracellularRecordingsTable table.","attributes":[{"name":"table","dtype":{"target_type":"IntracellularRecordingsTable","reftype":"object"},"doc":"Reference to the IntracellularRecordingsTable table that this table region applies to. This specializes the attribute inherited from DynamicTableRegion to fix the type of table that can be referenced here."}]},{"name":"recordings_index","neurodata_type_inc":"VectorIndex","doc":"Index dataset for the recordings column."}]},{"neurodata_type_def":"SequentialRecordingsTable","neurodata_type_inc":"DynamicTable","name":"sequential_recordings","doc":"A table for grouping different sequential recordings from the SimultaneousRecordingsTable table together. This is typically used to group together sequential recordings where a sequence of stimuli of the same type with varying parameters have been presented in a sequence.","datasets":[{"name":"simultaneous_recordings","neurodata_type_inc":"DynamicTableRegion","doc":"A reference to one or more rows in the SimultaneousRecordingsTable table.","attributes":[{"name":"table","dtype":{"target_type":"SimultaneousRecordingsTable","reftype":"object"},"doc":"Reference to the SimultaneousRecordingsTable table that this table region applies to. This specializes the attribute inherited from DynamicTableRegion to fix the type of table that can be referenced here."}]},{"name":"simultaneous_recordings_index","neurodata_type_inc":"VectorIndex","doc":"Index dataset for the simultaneous_recordings column."},{"name":"stimulus_type","neurodata_type_inc":"VectorData","dtype":"text","doc":"The type of stimulus used for the sequential recording."}]},{"neurodata_type_def":"RepetitionsTable","neurodata_type_inc":"DynamicTable","name":"repetitions","doc":"A table for grouping different sequential intracellular recordings together. With each SequentialRecording typically representing a particular type of stimulus, the RepetitionsTable table is typically used to group sets of stimuli applied in sequence.","datasets":[{"name":"sequential_recordings","neurodata_type_inc":"DynamicTableRegion","doc":"A reference to one or more rows in the SequentialRecordingsTable table.","attributes":[{"name":"table","dtype":{"target_type":"SequentialRecordingsTable","reftype":"object"},"doc":"Reference to the SequentialRecordingsTable table that this table region applies to. This specializes the attribute inherited from DynamicTableRegion to fix the type of table that can be referenced here."}]},{"name":"sequential_recordings_index","neurodata_type_inc":"VectorIndex","doc":"Index dataset for the sequential_recordings column."}]},{"neurodata_type_def":"ExperimentalConditionsTable","neurodata_type_inc":"DynamicTable","name":"experimental_conditions","doc":"A table for grouping different intracellular recording repetitions together that belong to the same experimental condition.","datasets":[{"name":"repetitions","neurodata_type_inc":"DynamicTableRegion","doc":"A reference to one or more rows in the RepetitionsTable table.","attributes":[{"name":"table","dtype":{"target_type":"RepetitionsTable","reftype":"object"},"doc":"Reference to the RepetitionsTable table that this table region applies to. This specializes the attribute inherited from DynamicTableRegion to fix the type of table that can be referenced here."}]},{"name":"repetitions_index","neurodata_type_inc":"VectorIndex","doc":"Index dataset for the repetitions column."}]}]})delimiter"; + +const std::string nwb_ogen = R"delimiter( +{"groups":[{"neurodata_type_def":"OptogeneticSeries","neurodata_type_inc":"TimeSeries","doc":"An optogenetic stimulus.","datasets":[{"name":"data","dtype":"numeric","dims":[["num_times"],["num_times","num_rois"]],"shape":[[null],[null,null]],"doc":"Applied power for optogenetic stimulus, in watts. Shape can be 1D or 2D. 2D data is meant to be used in an extension of OptogeneticSeries that defines what the second dimension represents.","attributes":[{"name":"unit","dtype":"text","value":"watts","doc":"Unit of measurement for data, which is fixed to 'watts'."}]}],"links":[{"name":"site","target_type":"OptogeneticStimulusSite","doc":"Link to OptogeneticStimulusSite object that describes the site to which this stimulus was applied."}]},{"neurodata_type_def":"OptogeneticStimulusSite","neurodata_type_inc":"NWBContainer","doc":"A site of optogenetic stimulation.","datasets":[{"name":"description","dtype":"text","doc":"Description of stimulation site."},{"name":"excitation_lambda","dtype":"float32","doc":"Excitation wavelength, in nm."},{"name":"location","dtype":"text","doc":"Location of the stimulation site. Specify the area, layer, comments on estimation of area/layer, stereotaxic coordinates if in vivo, etc. Use standard atlas names for anatomical regions when possible."}],"links":[{"name":"device","target_type":"Device","doc":"Device that generated the stimulus."}]}]})delimiter"; + +const std::string nwb_ophys = R"delimiter( +{"groups":[{"neurodata_type_def":"OnePhotonSeries","neurodata_type_inc":"ImageSeries","doc":"Image stack recorded over time from 1-photon microscope.","attributes":[{"name":"pmt_gain","dtype":"float32","doc":"Photomultiplier gain.","required":false},{"name":"scan_line_rate","dtype":"float32","doc":"Lines imaged per second. This is also stored in /general/optophysiology but is kept here as it is useful information for analysis, and so good to be stored w/ the actual data.","required":false},{"name":"exposure_time","dtype":"float32","doc":"Exposure time of the sample; often the inverse of the frequency.","required":false},{"name":"binning","dtype":"uint8","doc":"Amount of pixels combined into 'bins'; could be 1, 2, 4, 8, etc.","required":false},{"name":"power","dtype":"float32","doc":"Power of the excitation in mW, if known.","required":false},{"name":"intensity","dtype":"float32","doc":"Intensity of the excitation in mW/mm^2, if known.","required":false}],"links":[{"name":"imaging_plane","target_type":"ImagingPlane","doc":"Link to ImagingPlane object from which this TimeSeries data was generated."}]},{"neurodata_type_def":"TwoPhotonSeries","neurodata_type_inc":"ImageSeries","doc":"Image stack recorded over time from 2-photon microscope.","attributes":[{"name":"pmt_gain","dtype":"float32","doc":"Photomultiplier gain.","required":false},{"name":"scan_line_rate","dtype":"float32","doc":"Lines imaged per second. This is also stored in /general/optophysiology but is kept here as it is useful information for analysis, and so good to be stored w/ the actual data.","required":false}],"datasets":[{"name":"field_of_view","dtype":"float32","dims":[["width|height"],["width|height|depth"]],"shape":[[2],[3]],"doc":"Width, height and depth of image, or imaged area, in meters.","quantity":"?"}],"links":[{"name":"imaging_plane","target_type":"ImagingPlane","doc":"Link to ImagingPlane object from which this TimeSeries data was generated."}]},{"neurodata_type_def":"RoiResponseSeries","neurodata_type_inc":"TimeSeries","doc":"ROI responses over an imaging plane. The first dimension represents time. The second dimension, if present, represents ROIs.","datasets":[{"name":"data","dtype":"numeric","dims":[["num_times"],["num_times","num_ROIs"]],"shape":[[null],[null,null]],"doc":"Signals from ROIs."},{"name":"rois","neurodata_type_inc":"DynamicTableRegion","doc":"DynamicTableRegion referencing into an ROITable containing information on the ROIs stored in this timeseries."}]},{"neurodata_type_def":"DfOverF","neurodata_type_inc":"NWBDataInterface","default_name":"DfOverF","doc":"dF/F information about a region of interest (ROI). Storage hierarchy of dF/F should be the same as for segmentation (i.e., same names for ROIs and for image planes).","groups":[{"neurodata_type_inc":"RoiResponseSeries","doc":"RoiResponseSeries object(s) containing dF/F for a ROI.","quantity":"+"}]},{"neurodata_type_def":"Fluorescence","neurodata_type_inc":"NWBDataInterface","default_name":"Fluorescence","doc":"Fluorescence information about a region of interest (ROI). Storage hierarchy of fluorescence should be the same as for segmentation (ie, same names for ROIs and for image planes).","groups":[{"neurodata_type_inc":"RoiResponseSeries","doc":"RoiResponseSeries object(s) containing fluorescence data for a ROI.","quantity":"+"}]},{"neurodata_type_def":"ImageSegmentation","neurodata_type_inc":"NWBDataInterface","default_name":"ImageSegmentation","doc":"Stores pixels in an image that represent different regions of interest (ROIs) or masks. All segmentation for a given imaging plane is stored together, with storage for multiple imaging planes (masks) supported. Each ROI is stored in its own subgroup, with the ROI group containing both a 2D mask and a list of pixels that make up this mask. Segments can also be used for masking neuropil. If segmentation is allowed to change with time, a new imaging plane (or module) is required and ROI names should remain consistent between them.","groups":[{"neurodata_type_inc":"PlaneSegmentation","doc":"Results from image segmentation of a specific imaging plane.","quantity":"+"}]},{"neurodata_type_def":"PlaneSegmentation","neurodata_type_inc":"DynamicTable","doc":"Results from image segmentation of a specific imaging plane.","datasets":[{"name":"image_mask","neurodata_type_inc":"VectorData","dims":[["num_roi","num_x","num_y"],["num_roi","num_x","num_y","num_z"]],"shape":[[null,null,null],[null,null,null,null]],"doc":"ROI masks for each ROI. Each image mask is the size of the original imaging plane (or volume) and members of the ROI are finite non-zero.","quantity":"?"},{"name":"pixel_mask_index","neurodata_type_inc":"VectorIndex","doc":"Index into pixel_mask.","quantity":"?"},{"name":"pixel_mask","neurodata_type_inc":"VectorData","dtype":[{"name":"x","dtype":"uint32","doc":"Pixel x-coordinate."},{"name":"y","dtype":"uint32","doc":"Pixel y-coordinate."},{"name":"weight","dtype":"float32","doc":"Weight of the pixel."}],"doc":"Pixel masks for each ROI: a list of indices and weights for the ROI. Pixel masks are concatenated and parsing of this dataset is maintained by the PlaneSegmentation","quantity":"?"},{"name":"voxel_mask_index","neurodata_type_inc":"VectorIndex","doc":"Index into voxel_mask.","quantity":"?"},{"name":"voxel_mask","neurodata_type_inc":"VectorData","dtype":[{"name":"x","dtype":"uint32","doc":"Voxel x-coordinate."},{"name":"y","dtype":"uint32","doc":"Voxel y-coordinate."},{"name":"z","dtype":"uint32","doc":"Voxel z-coordinate."},{"name":"weight","dtype":"float32","doc":"Weight of the voxel."}],"doc":"Voxel masks for each ROI: a list of indices and weights for the ROI. Voxel masks are concatenated and parsing of this dataset is maintained by the PlaneSegmentation","quantity":"?"}],"groups":[{"name":"reference_images","doc":"Image stacks that the segmentation masks apply to.","groups":[{"neurodata_type_inc":"ImageSeries","doc":"One or more image stacks that the masks apply to (can be one-element stack).","quantity":"*"}]}],"links":[{"name":"imaging_plane","target_type":"ImagingPlane","doc":"Link to ImagingPlane object from which this data was generated."}]},{"neurodata_type_def":"ImagingPlane","neurodata_type_inc":"NWBContainer","doc":"An imaging plane and its metadata.","datasets":[{"name":"description","dtype":"text","doc":"Description of the imaging plane.","quantity":"?"},{"name":"excitation_lambda","dtype":"float32","doc":"Excitation wavelength, in nm."},{"name":"imaging_rate","dtype":"float32","doc":"Rate that images are acquired, in Hz. If the corresponding TimeSeries is present, the rate should be stored there instead.","quantity":"?"},{"name":"indicator","dtype":"text","doc":"Calcium indicator."},{"name":"location","dtype":"text","doc":"Location of the imaging plane. Specify the area, layer, comments on estimation of area/layer, stereotaxic coordinates if in vivo, etc. Use standard atlas names for anatomical regions when possible."},{"name":"manifold","dtype":"float32","dims":[["height","width","x, y, z"],["height","width","depth","x, y, z"]],"shape":[[null,null,3],[null,null,null,3]],"doc":"DEPRECATED Physical position of each pixel. 'xyz' represents the position of the pixel relative to the defined coordinate space. Deprecated in favor of origin_coords and grid_spacing.","quantity":"?","attributes":[{"name":"conversion","dtype":"float32","default_value":1.0,"doc":"Scalar to multiply each element in data to convert it to the specified 'unit'. If the data are stored in acquisition system units or other units that require a conversion to be interpretable, multiply the data by 'conversion' to convert the data to the specified 'unit'. e.g. if the data acquisition system stores values in this object as pixels from x = -500 to 499, y = -500 to 499 that correspond to a 2 m x 2 m range, then the 'conversion' multiplier to get from raw data acquisition pixel units to meters is 2/1000.","required":false},{"name":"unit","dtype":"text","default_value":"meters","doc":"Base unit of measurement for working with the data. The default value is 'meters'.","required":false}]},{"name":"origin_coords","dtype":"float32","dims":[["x, y"],["x, y, z"]],"shape":[[2],[3]],"doc":"Physical location of the first element of the imaging plane (0, 0) for 2-D data or (0, 0, 0) for 3-D data. See also reference_frame for what the physical location is relative to (e.g., bregma).","quantity":"?","attributes":[{"name":"unit","dtype":"text","default_value":"meters","doc":"Measurement units for origin_coords. The default value is 'meters'."}]},{"name":"grid_spacing","dtype":"float32","dims":[["x, y"],["x, y, z"]],"shape":[[2],[3]],"doc":"Space between pixels in (x, y) or voxels in (x, y, z) directions, in the specified unit. Assumes imaging plane is a regular grid. See also reference_frame to interpret the grid.","quantity":"?","attributes":[{"name":"unit","dtype":"text","default_value":"meters","doc":"Measurement units for grid_spacing. The default value is 'meters'."}]},{"name":"reference_frame","dtype":"text","doc":"Describes reference frame of origin_coords and grid_spacing. For example, this can be a text description of the anatomical location and orientation of the grid defined by origin_coords and grid_spacing or the vectors needed to transform or rotate the grid to a common anatomical axis (e.g., AP/DV/ML). This field is necessary to interpret origin_coords and grid_spacing. If origin_coords and grid_spacing are not present, then this field is not required. For example, if the microscope takes 10 x 10 x 2 images, where the first value of the data matrix (index (0, 0, 0)) corresponds to (-1.2, -0.6, -2) mm relative to bregma, the spacing between pixels is 0.2 mm in x, 0.2 mm in y and 0.5 mm in z, and larger numbers in x means more anterior, larger numbers in y means more rightward, and larger numbers in z means more ventral, then enter the following -- origin_coords = (-1.2, -0.6, -2) grid_spacing = (0.2, 0.2, 0.5) reference_frame = \"Origin coordinates are relative to bregma. First dimension corresponds to anterior-posterior axis (larger index = more anterior). Second dimension corresponds to medial-lateral axis (larger index = more rightward). Third dimension corresponds to dorsal-ventral axis (larger index = more ventral).\"","quantity":"?"}],"groups":[{"neurodata_type_inc":"OpticalChannel","doc":"An optical channel used to record from an imaging plane.","quantity":"+"}],"links":[{"name":"device","target_type":"Device","doc":"Link to the Device object that was used to record from this electrode."}]},{"neurodata_type_def":"OpticalChannel","neurodata_type_inc":"NWBContainer","doc":"An optical channel used to record from an imaging plane.","datasets":[{"name":"description","dtype":"text","doc":"Description or other notes about the channel."},{"name":"emission_lambda","dtype":"float32","doc":"Emission wavelength for channel, in nm."}]},{"neurodata_type_def":"MotionCorrection","neurodata_type_inc":"NWBDataInterface","default_name":"MotionCorrection","doc":"An image stack where all frames are shifted (registered) to a common coordinate system, to account for movement and drift between frames. Note: each frame at each point in time is assumed to be 2-D (has only x & y dimensions).","groups":[{"neurodata_type_inc":"CorrectedImageStack","doc":"Results from motion correction of an image stack.","quantity":"+"}]},{"neurodata_type_def":"CorrectedImageStack","neurodata_type_inc":"NWBDataInterface","doc":"Results from motion correction of an image stack.","groups":[{"name":"corrected","neurodata_type_inc":"ImageSeries","doc":"Image stack with frames shifted to the common coordinates."},{"name":"xy_translation","neurodata_type_inc":"TimeSeries","doc":"Stores the x,y delta necessary to align each frame to the common coordinates, for example, to align each frame to a reference image."}],"links":[{"name":"original","target_type":"ImageSeries","doc":"Link to ImageSeries object that is being registered."}]}]})delimiter"; + +const std::string nwb_retinotopy = R"delimiter( +{"groups":[{"neurodata_type_def":"ImagingRetinotopy","neurodata_type_inc":"NWBDataInterface","default_name":"ImagingRetinotopy","doc":"DEPRECATED. Intrinsic signal optical imaging or widefield imaging for measuring retinotopy. Stores orthogonal maps (e.g., altitude/azimuth; radius/theta) of responses to specific stimuli and a combined polarity map from which to identify visual areas. This group does not store the raw responses imaged during retinotopic mapping or the stimuli presented, but rather the resulting phase and power maps after applying a Fourier transform on the averaged responses. Note: for data consistency, all images and arrays are stored in the format [row][column] and [row, col], which equates to [y][x]. Field of view and dimension arrays may appear backward (i.e., y before x).","datasets":[{"name":"axis_1_phase_map","dtype":"float32","dims":["num_rows","num_cols"],"shape":[null,null],"doc":"Phase response to stimulus on the first measured axis.","attributes":[{"name":"dimension","dtype":"int32","dims":["num_rows, num_cols"],"shape":[2],"doc":"Number of rows and columns in the image. NOTE: row, column representation is equivalent to height, width."},{"name":"field_of_view","dtype":"float32","dims":["height, width"],"shape":[2],"doc":"Size of viewing area, in meters."},{"name":"unit","dtype":"text","doc":"Unit that axis data is stored in (e.g., degrees)."}]},{"name":"axis_1_power_map","dtype":"float32","dims":["num_rows","num_cols"],"shape":[null,null],"doc":"Power response on the first measured axis. Response is scaled so 0.0 is no power in the response and 1.0 is maximum relative power.","quantity":"?","attributes":[{"name":"dimension","dtype":"int32","dims":["num_rows, num_cols"],"shape":[2],"doc":"Number of rows and columns in the image. NOTE: row, column representation is equivalent to height, width."},{"name":"field_of_view","dtype":"float32","dims":["height, width"],"shape":[2],"doc":"Size of viewing area, in meters."},{"name":"unit","dtype":"text","doc":"Unit that axis data is stored in (e.g., degrees)."}]},{"name":"axis_2_phase_map","dtype":"float32","dims":["num_rows","num_cols"],"shape":[null,null],"doc":"Phase response to stimulus on the second measured axis.","attributes":[{"name":"dimension","dtype":"int32","dims":["num_rows, num_cols"],"shape":[2],"doc":"Number of rows and columns in the image. NOTE: row, column representation is equivalent to height, width."},{"name":"field_of_view","dtype":"float32","dims":["height, width"],"shape":[2],"doc":"Size of viewing area, in meters."},{"name":"unit","dtype":"text","doc":"Unit that axis data is stored in (e.g., degrees)."}]},{"name":"axis_2_power_map","dtype":"float32","dims":["num_rows","num_cols"],"shape":[null,null],"doc":"Power response on the second measured axis. Response is scaled so 0.0 is no power in the response and 1.0 is maximum relative power.","quantity":"?","attributes":[{"name":"dimension","dtype":"int32","dims":["num_rows, num_cols"],"shape":[2],"doc":"Number of rows and columns in the image. NOTE: row, column representation is equivalent to height, width."},{"name":"field_of_view","dtype":"float32","dims":["height, width"],"shape":[2],"doc":"Size of viewing area, in meters."},{"name":"unit","dtype":"text","doc":"Unit that axis data is stored in (e.g., degrees)."}]},{"name":"axis_descriptions","dtype":"text","dims":["axis_1, axis_2"],"shape":[2],"doc":"Two-element array describing the contents of the two response axis fields. Description should be something like ['altitude', 'azimuth'] or '['radius', 'theta']."},{"name":"focal_depth_image","dtype":"uint16","dims":["num_rows","num_cols"],"shape":[null,null],"doc":"Gray-scale image taken with same settings/parameters (e.g., focal depth, wavelength) as data collection. Array format: [rows][columns].","quantity":"?","attributes":[{"name":"bits_per_pixel","dtype":"int32","doc":"Number of bits used to represent each value. This is necessary to determine maximum (white) pixel value."},{"name":"dimension","dtype":"int32","dims":["num_rows, num_cols"],"shape":[2],"doc":"Number of rows and columns in the image. NOTE: row, column representation is equivalent to height, width."},{"name":"field_of_view","dtype":"float32","dims":["height, width"],"shape":[2],"doc":"Size of viewing area, in meters."},{"name":"focal_depth","dtype":"float32","doc":"Focal depth offset, in meters."},{"name":"format","dtype":"text","doc":"Format of image. Right now only 'raw' is supported."}]},{"name":"sign_map","dtype":"float32","dims":["num_rows","num_cols"],"shape":[null,null],"doc":"Sine of the angle between the direction of the gradient in axis_1 and axis_2.","quantity":"?","attributes":[{"name":"dimension","dtype":"int32","dims":["num_rows, num_cols"],"shape":[2],"doc":"Number of rows and columns in the image. NOTE: row, column representation is equivalent to height, width."},{"name":"field_of_view","dtype":"float32","dims":["height, width"],"shape":[2],"doc":"Size of viewing area, in meters."}]},{"name":"vasculature_image","dtype":"uint16","dims":["num_rows","num_cols"],"shape":[null,null],"doc":"Gray-scale anatomical image of cortical surface. Array structure: [rows][columns]","attributes":[{"name":"bits_per_pixel","dtype":"int32","doc":"Number of bits used to represent each value. This is necessary to determine maximum (white) pixel value"},{"name":"dimension","dtype":"int32","dims":["num_rows, num_cols"],"shape":[2],"doc":"Number of rows and columns in the image. NOTE: row, column representation is equivalent to height, width."},{"name":"field_of_view","dtype":"float32","dims":["height, width"],"shape":[2],"doc":"Size of viewing area, in meters."},{"name":"format","dtype":"text","doc":"Format of image. Right now only 'raw' is supported."}]}]}]})delimiter"; + +const std::string namespaces = R"delimiter( +{"namespaces":[{"name":"core","doc":"NWB namespace","author":["Andrew Tritt","Oliver Ruebel","Ryan Ly","Ben Dichter","Keith Godfrey","Jeff Teeters"],"contact":["ajtritt@lbl.gov","oruebel@lbl.gov","rly@lbl.gov","bdichter@lbl.gov","keithg@alleninstitute.org","jteeters@berkeley.edu"],"full_name":"NWB core","schema":[{"namespace":"hdmf-common"},{"source":"nwb.base"},{"source":"nwb.device"},{"source":"nwb.epoch"},{"source":"nwb.image"},{"source":"nwb.file"},{"source":"nwb.misc"},{"source":"nwb.behavior"},{"source":"nwb.ecephys"},{"source":"nwb.icephys"},{"source":"nwb.ogen"},{"source":"nwb.ophys"},{"source":"nwb.retinotopy"}],"version":"2.7.0"}]})delimiter"; + +void registerVariables(std::map& registry) { + registry["nwb.base"] = &nwb_base; + registry["nwb.device"] = &nwb_device; + registry["nwb.epoch"] = &nwb_epoch; + registry["nwb.image"] = &nwb_image; + registry["nwb.file"] = &nwb_file; + registry["nwb.misc"] = &nwb_misc; + registry["nwb.behavior"] = &nwb_behavior; + registry["nwb.ecephys"] = &nwb_ecephys; + registry["nwb.icephys"] = &nwb_icephys; + registry["nwb.ogen"] = &nwb_ogen; + registry["nwb.ophys"] = &nwb_ophys; + registry["nwb.retinotopy"] = &nwb_retinotopy; + registry["namespace"] = &namespaces; +}; +} // namespace AQNWB::spec::core diff --git a/src/spec/hdmf_common.hpp b/src/spec/hdmf_common.hpp new file mode 100644 index 00000000..90ea9261 --- /dev/null +++ b/src/spec/hdmf_common.hpp @@ -0,0 +1,28 @@ +#pragma once + +#include + +namespace AQNWB::spec::hdmf_common +{ + +const std::string version = "1.8.0"; + +const std::string base = R"delimiter( +{"datasets":[{"data_type_def":"Data","doc":"An abstract data type for a dataset."}],"groups":[{"data_type_def":"Container","doc":"An abstract data type for a group storing collections of data and metadata. Base type for all data and metadata containers."},{"data_type_def":"SimpleMultiContainer","data_type_inc":"Container","doc":"A simple Container for holding onto multiple containers.","datasets":[{"data_type_inc":"Data","quantity":"*","doc":"Data objects held within this SimpleMultiContainer."}],"groups":[{"data_type_inc":"Container","quantity":"*","doc":"Container objects held within this SimpleMultiContainer."}]}]})delimiter"; + +const std::string table = R"delimiter( +{"datasets":[{"data_type_def":"VectorData","data_type_inc":"Data","doc":"An n-dimensional dataset representing a column of a DynamicTable. If used without an accompanying VectorIndex, first dimension is along the rows of the DynamicTable and each step along the first dimension is a cell of the larger table. VectorData can also be used to represent a ragged array if paired with a VectorIndex. This allows for storing arrays of varying length in a single cell of the DynamicTable by indexing into this VectorData. The first vector is at VectorData[0:VectorIndex[0]]. The second vector is at VectorData[VectorIndex[0]:VectorIndex[1]], and so on.","dims":[["dim0"],["dim0","dim1"],["dim0","dim1","dim2"],["dim0","dim1","dim2","dim3"]],"shape":[[null],[null,null],[null,null,null],[null,null,null,null]],"attributes":[{"name":"description","dtype":"text","doc":"Description of what these vectors represent."}]},{"data_type_def":"VectorIndex","data_type_inc":"VectorData","dtype":"uint8","doc":"Used with VectorData to encode a ragged array. An array of indices into the first dimension of the target VectorData, and forming a map between the rows of a DynamicTable and the indices of the VectorData. The name of the VectorIndex is expected to be the name of the target VectorData object followed by \"_index\".","dims":["num_rows"],"shape":[null],"attributes":[{"name":"target","dtype":{"target_type":"VectorData","reftype":"object"},"doc":"Reference to the target dataset that this index applies to."}]},{"data_type_def":"ElementIdentifiers","data_type_inc":"Data","default_name":"element_id","dtype":"int","dims":["num_elements"],"shape":[null],"doc":"A list of unique identifiers for values within a dataset, e.g. rows of a DynamicTable."},{"data_type_def":"DynamicTableRegion","data_type_inc":"VectorData","dtype":"int","doc":"DynamicTableRegion provides a link from one table to an index or region of another. The `table` attribute is a link to another `DynamicTable`, indicating which table is referenced, and the data is int(s) indicating the row(s) (0-indexed) of the target array. `DynamicTableRegion`s can be used to associate rows with repeated meta-data without data duplication. They can also be used to create hierarchical relationships between multiple `DynamicTable`s. `DynamicTableRegion` objects may be paired with a `VectorIndex` object to create ragged references, so a single cell of a `DynamicTable` can reference many rows of another `DynamicTable`.","dims":["num_rows"],"shape":[null],"attributes":[{"name":"table","dtype":{"target_type":"DynamicTable","reftype":"object"},"doc":"Reference to the DynamicTable object that this region applies to."},{"name":"description","dtype":"text","doc":"Description of what this table region points to."}]}],"groups":[{"data_type_def":"DynamicTable","data_type_inc":"Container","doc":"A group containing multiple datasets that are aligned on the first dimension (Currently, this requirement if left up to APIs to check and enforce). These datasets represent different columns in the table. Apart from a column that contains unique identifiers for each row, there are no other required datasets. Users are free to add any number of custom VectorData objects (columns) here. DynamicTable also supports ragged array columns, where each element can be of a different size. To add a ragged array column, use a VectorIndex type to index the corresponding VectorData type. See documentation for VectorData and VectorIndex for more details. Unlike a compound data type, which is analogous to storing an array-of-structs, a DynamicTable can be thought of as a struct-of-arrays. This provides an alternative structure to choose from when optimizing storage for anticipated access patterns. Additionally, this type provides a way of creating a table without having to define a compound type up front. Although this convenience may be attractive, users should think carefully about how data will be accessed. DynamicTable is more appropriate for column-centric access, whereas a dataset with a compound type would be more appropriate for row-centric access. Finally, data size should also be taken into account. For small tables, performance loss may be an acceptable trade-off for the flexibility of a DynamicTable.","attributes":[{"name":"colnames","dtype":"text","dims":["num_columns"],"shape":[null],"doc":"The names of the columns in this table. This should be used to specify an order to the columns."},{"name":"description","dtype":"text","doc":"Description of what is in this dynamic table."}],"datasets":[{"name":"id","data_type_inc":"ElementIdentifiers","dtype":"int","dims":["num_rows"],"shape":[null],"doc":"Array of unique identifiers for the rows of this dynamic table."},{"data_type_inc":"VectorData","doc":"Vector columns, including index columns, of this dynamic table.","quantity":"*"}]},{"data_type_def":"AlignedDynamicTable","data_type_inc":"DynamicTable","doc":"DynamicTable container that supports storing a collection of sub-tables. Each sub-table is a DynamicTable itself that is aligned with the main table by row index. I.e., all DynamicTables stored in this group MUST have the same number of rows. This type effectively defines a 2-level table in which the main data is stored in the main table implemented by this type and additional columns of the table are grouped into categories, with each category being represented by a separate DynamicTable stored within the group.","attributes":[{"name":"categories","dtype":"text","dims":["num_categories"],"shape":[null],"doc":"The names of the categories in this AlignedDynamicTable. Each category is represented by one DynamicTable stored in the parent group. This attribute should be used to specify an order of categories and the category names must match the names of the corresponding DynamicTable in the group."}],"groups":[{"data_type_inc":"DynamicTable","doc":"A DynamicTable representing a particular category for columns in the AlignedDynamicTable parent container. The table MUST be aligned with (i.e., have the same number of rows) as all other DynamicTables stored in the AlignedDynamicTable parent container. The name of the category is given by the name of the DynamicTable and its description by the description attribute of the DynamicTable.","quantity":"*"}]}]})delimiter"; + +const std::string sparse = R"delimiter( +{"groups":[{"data_type_def":"CSRMatrix","data_type_inc":"Container","doc":"A compressed sparse row matrix. Data are stored in the standard CSR format, where column indices for row i are stored in indices[indptr[i]:indptr[i+1]] and their corresponding values are stored in data[indptr[i]:indptr[i+1]].","attributes":[{"name":"shape","dtype":"uint","dims":["number of rows, number of columns"],"shape":[2],"doc":"The shape (number of rows, number of columns) of this sparse matrix."}],"datasets":[{"name":"indices","dtype":"uint","dims":["number of non-zero values"],"shape":[null],"doc":"The column indices."},{"name":"indptr","dtype":"uint","dims":["number of rows in the matrix + 1"],"shape":[null],"doc":"The row index pointer."},{"name":"data","dims":["number of non-zero values"],"shape":[null],"doc":"The non-zero values in the matrix."}]}]})delimiter"; + +const std::string namespaces = R"delimiter( +{"namespaces":[{"name":"hdmf-common","doc":"Common data structures provided by HDMF","author":["Andrew Tritt","Oliver Ruebel","Ryan Ly","Ben Dichter"],"contact":["ajtritt@lbl.gov","oruebel@lbl.gov","rly@lbl.gov","bdichter@lbl.gov"],"full_name":"HDMF Common","schema":[{"source":"base"},{"source":"table"},{"source":"sparse"}],"version":"1.8.0"}]})delimiter"; + +void registerVariables(std::map& registry) { + registry["base"] = &base; + registry["table"] = &table; + registry["sparse"] = &sparse; + registry["namespace"] = &namespaces; +}; +} // namespace AQNWB::spec::hdmf_common diff --git a/src/spec/hdmf_experimental.hpp b/src/spec/hdmf_experimental.hpp new file mode 100644 index 00000000..ef20ca5b --- /dev/null +++ b/src/spec/hdmf_experimental.hpp @@ -0,0 +1,24 @@ +#pragma once + +#include + +namespace AQNWB::spec::hdmf_experimental +{ + +const std::string version = "0.5.0"; + +const std::string experimental = R"delimiter( +{"groups":[],"datasets":[{"data_type_def":"EnumData","data_type_inc":"VectorData","dtype":"uint8","doc":"Data that come from a fixed set of values. A data value of i corresponds to the i-th value in the VectorData referenced by the 'elements' attribute.","attributes":[{"name":"elements","dtype":{"target_type":"VectorData","reftype":"object"},"doc":"Reference to the VectorData object that contains the enumerable elements"}]}]})delimiter"; + +const std::string resources = R"delimiter( +{"groups":[{"data_type_def":"HERD","data_type_inc":"Container","doc":"HDMF External Resources Data Structure. A set of six tables for tracking external resource references in a file or across multiple files.","datasets":[{"data_type_inc":"Data","name":"keys","doc":"A table for storing user terms that are used to refer to external resources.","dtype":[{"name":"key","dtype":"text","doc":"The user term that maps to one or more resources in the `resources` table, e.g., \"human\"."}],"dims":["num_rows"],"shape":[null]},{"data_type_inc":"Data","name":"files","doc":"A table for storing object ids of files used in external resources.","dtype":[{"name":"file_object_id","dtype":"text","doc":"The object id (UUID) of a file that contains objects that refers to external resources."}],"dims":["num_rows"],"shape":[null]},{"data_type_inc":"Data","name":"entities","doc":"A table for mapping user terms (i.e., keys) to resource entities.","dtype":[{"name":"entity_id","dtype":"text","doc":"The compact uniform resource identifier (CURIE) of the entity, in the form [prefix]:[unique local identifier], e.g., 'NCBI_TAXON:9606'."},{"name":"entity_uri","dtype":"text","doc":"The URI for the entity this reference applies to. This can be an empty string. e.g., https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=9606"}],"dims":["num_rows"],"shape":[null]},{"data_type_inc":"Data","name":"objects","doc":"A table for identifying which objects in a file contain references to external resources.","dtype":[{"name":"files_idx","dtype":"uint","doc":"The row index to the file in the `files` table containing the object."},{"name":"object_id","dtype":"text","doc":"The object id (UUID) of the object."},{"name":"object_type","dtype":"text","doc":"The data type of the object."},{"name":"relative_path","dtype":"text","doc":"The relative path from the data object with the `object_id` to the dataset or attribute with the value(s) that is associated with an external resource. This can be an empty string if the object is a dataset that contains the value(s) that is associated with an external resource."},{"name":"field","dtype":"text","doc":"The field within the compound data type using an external resource. This is used only if the dataset or attribute is a compound data type; otherwise this should be an empty string."}],"dims":["num_rows"],"shape":[null]},{"data_type_inc":"Data","name":"object_keys","doc":"A table for identifying which objects use which keys.","dtype":[{"name":"objects_idx","dtype":"uint","doc":"The row index to the object in the `objects` table that holds the key"},{"name":"keys_idx","dtype":"uint","doc":"The row index to the key in the `keys` table."}],"dims":["num_rows"],"shape":[null]},{"data_type_inc":"Data","name":"entity_keys","doc":"A table for identifying which keys use which entity.","dtype":[{"name":"entities_idx","dtype":"uint","doc":"The row index to the entity in the `entities` table."},{"name":"keys_idx","dtype":"uint","doc":"The row index to the key in the `keys` table."}],"dims":["num_rows"],"shape":[null]}]}]})delimiter"; + +const std::string namespaces = R"delimiter( +{"namespaces":[{"name":"hdmf-experimental","doc":"Experimental data structures provided by HDMF. These are not guaranteed to be available in the future.","author":["Andrew Tritt","Oliver Ruebel","Ryan Ly","Ben Dichter","Matthew Avaylon"],"contact":["ajtritt@lbl.gov","oruebel@lbl.gov","rly@lbl.gov","bdichter@lbl.gov","mavaylon@lbl.gov"],"full_name":"HDMF Experimental","schema":[{"namespace":"hdmf-common"},{"source":"experimental"},{"source":"resources"}],"version":"0.5.0"}]})delimiter"; + +void registerVariables(std::map& registry) { + registry["experimental"] = &experimental; + registry["resources"] = &resources; + registry["namespace"] = &namespaces; +}; +} // namespace AQNWB::spec::hdmf_experimental From 871a6c1cb8ddd1687ca00bffcfb0ea0981d8176a Mon Sep 17 00:00:00 2001 From: Steph Prince <40640337+stephprince@users.noreply.github.com> Date: Wed, 28 Aug 2024 13:29:48 -0700 Subject: [PATCH 10/22] update cmake files --- CMakeLists.txt | 9 ++-- cmake/install-config.cmake | 2 +- python_scripts/make_test_table.py | 68 ------------------------------- src/aqnwb.hpp | 3 -- 4 files changed, 7 insertions(+), 75 deletions(-) delete mode 100644 python_scripts/make_test_table.py delete mode 100644 src/aqnwb.hpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 49b5b765..bf84abc2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,9 +14,6 @@ project( include(cmake/project-is-top-level.cmake) include(cmake/variables.cmake) -include_directories( - ${CMAKE_SOURCE_DIR}/src -) # ---- Declare library ---- @@ -66,6 +63,12 @@ target_include_directories( "\$" ) +target_include_directories( + aqnwb_aqnwb ${warning_guard} + PUBLIC + "\$" +) + target_include_directories( aqnwb_aqnwb SYSTEM PUBLIC diff --git a/cmake/install-config.cmake b/cmake/install-config.cmake index 3335168b..2d783a27 100644 --- a/cmake/install-config.cmake +++ b/cmake/install-config.cmake @@ -1 +1 @@ -include("${CMAKE_CURRENT_LIST_DIR}/aqnwbTsargets.cmake") \ No newline at end of file +include("${CMAKE_CURRENT_LIST_DIR}/aqnwbTargets.cmake") \ No newline at end of file diff --git a/python_scripts/make_test_table.py b/python_scripts/make_test_table.py deleted file mode 100644 index b7241b9c..00000000 --- a/python_scripts/make_test_table.py +++ /dev/null @@ -1,68 +0,0 @@ -from datetime import datetime -from uuid import uuid4 - -import numpy as np -from dateutil.tz import tzlocal - -from pynwb import NWBHDF5IO, NWBFile -from pynwb.ecephys import LFP, ElectricalSeries - -nwbfile = NWBFile( - session_description="my first synthetic recording", - identifier=str(uuid4()), - session_start_time=datetime.now(tzlocal()), - experimenter=[ - "Baggins, Bilbo", - ], - lab="Bag End Laboratory", - institution="University of Middle Earth at the Shire", - experiment_description="I went on an adventure to reclaim vast treasures.", - session_id="LONELYMTN001", -) - -device = nwbfile.create_device( - name="array", description="the best array", manufacturer="Probe Company 9000" -) - -nwbfile.add_electrode_column(name="label", description="label of electrode") - -nshanks = 4 -nchannels_per_shank = 3 -electrode_counter = 0 - -for ishank in range(nshanks): - # create an electrode group for this shank - electrode_group = nwbfile.create_electrode_group( - name="shank{}".format(ishank), - description="electrode group for shank {}".format(ishank), - device=device, - location="brain area", - ) - # add electrodes to the electrode table - for ielec in range(nchannels_per_shank): - nwbfile.add_electrode( - group=electrode_group, - label="shank{}elec{}".format(ishank, ielec), - location="brain area", - ) - electrode_counter += 1 - - -all_table_region = nwbfile.create_electrode_table_region( - region=list(range(electrode_counter)), # reference row indices 0 to N-1 - description="all electrodes", -) - - -raw_data = np.random.randn(50, 12) -raw_electrical_series = ElectricalSeries( - name="ElectricalSeries", - data=raw_data, - electrodes=all_table_region, - timestamps=[0.0, 0.1, 0.2, 0.3, 0.4], # in Hz -) - -nwbfile.add_acquisition(raw_electrical_series) - -with NWBHDF5IO("ecephys_tutorial.nwb", "w") as io: - io.write(nwbfile) \ No newline at end of file diff --git a/src/aqnwb.hpp b/src/aqnwb.hpp deleted file mode 100644 index dad5802e..00000000 --- a/src/aqnwb.hpp +++ /dev/null @@ -1,3 +0,0 @@ -#pragma once - -#include From 4d8d50491693d597900ddd52a397bb96d86295a7 Mon Sep 17 00:00:00 2001 From: Steph Prince <40640337+stephprince@users.noreply.github.com> Date: Wed, 28 Aug 2024 15:07:35 -0700 Subject: [PATCH 11/22] update codespell ignore --- .codespellrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.codespellrc b/.codespellrc index d1d483a5..0637f772 100644 --- a/.codespellrc +++ b/.codespellrc @@ -2,6 +2,6 @@ builtin = clear,rare,en-GB_to_en-US,names,informal,code check-filenames = check-hidden = -skip = */.git,*/build,*/prefix,*/resources,*/.vscode,*/libs +skip = */.git,*/build,*/prefix,*/resources,*/.vscode,*/libs,*/spec, quiet-level = 2 ignore-words=./.codespell_ignore From 7a18056a58b171bd5c6237e3758a8b4bc7e0fbb0 Mon Sep 17 00:00:00 2001 From: Steph Prince <40640337+stephprince@users.noreply.github.com> Date: Wed, 28 Aug 2024 15:09:34 -0700 Subject: [PATCH 12/22] update source directory for installation --- cmake/install-rules.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/install-rules.cmake b/cmake/install-rules.cmake index e7a03161..fb3b526b 100644 --- a/cmake/install-rules.cmake +++ b/cmake/install-rules.cmake @@ -13,7 +13,7 @@ set(package aqnwb) install( DIRECTORY - include/ + src/ "${PROJECT_BINARY_DIR}/export/" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" COMPONENT aqnwb_Development From e3549612c70ecffac5116140f204260693963f4b Mon Sep 17 00:00:00 2001 From: Steph Prince <40640337+stephprince@users.noreply.github.com> Date: Wed, 28 Aug 2024 15:11:57 -0700 Subject: [PATCH 13/22] fix formatting --- resources/generate_spec_files.py | 4 ++-- src/nwb/NWBFile.cpp | 21 ++++++++++++++------- src/nwb/NWBFile.hpp | 7 ++++--- src/spec/core.hpp | 29 +++++++++++++++-------------- src/spec/hdmf_common.hpp | 11 ++++++----- src/spec/hdmf_experimental.hpp | 9 +++++---- 6 files changed, 46 insertions(+), 35 deletions(-) diff --git a/resources/generate_spec_files.py b/resources/generate_spec_files.py index b3d2f8d2..6e44994f 100644 --- a/resources/generate_spec_files.py +++ b/resources/generate_spec_files.py @@ -66,6 +66,6 @@ with open(header_file, 'a') as fo: fo.write(f'const std::string namespaces = R"delimiter(\n{json.dumps(ns_output, separators=(',', ':'))})delimiter";\n\n') fo.write('void registerVariables(std::map& registry) {\n') - fo.write(''.join([f' registry["{name.replace('_', '.')}"] = &{name};\n' for name in var_names])) - fo.write(f' registry["namespace"] = &namespaces;\n') + fo.write(''.join([f' registry["{name.replace('_', '.')}"] = &{name};\n' for name in var_names])) + fo.write(f' registry["namespace"] = &namespaces;\n') fo.write(f'}};\n}} // namespace AQNWB::spec::{ns['name'].replace('-', '_')}\n') \ No newline at end of file diff --git a/src/nwb/NWBFile.cpp b/src/nwb/NWBFile.cpp index f277a7c0..ab4ef82d 100644 --- a/src/nwb/NWBFile.cpp +++ b/src/nwb/NWBFile.cpp @@ -70,9 +70,14 @@ Status NWBFile::createFileStructure() io->createGroup("/specifications"); io->createReferenceAttribute("/specifications", "/", ".specloc"); - cacheSpecifications("core", spec::core::version, spec::core::registerVariables); - cacheSpecifications("hdmf-common", spec::hdmf_common::version, spec::hdmf_common::registerVariables); - cacheSpecifications("hdmf-experimental", spec::hdmf_experimental::version, spec::hdmf_experimental::registerVariables); + cacheSpecifications( + "core", spec::core::version, spec::core::registerVariables); + cacheSpecifications("hdmf-common", + spec::hdmf_common::version, + spec::hdmf_common::registerVariables); + cacheSpecifications("hdmf-experimental", + spec::hdmf_experimental::version, + spec::hdmf_experimental::registerVariables); std::string time = getCurrentTime(); std::vector timeVec = {time}; @@ -149,9 +154,10 @@ void NWBFile::stopRecording() io->stopRecording(); } -void NWBFile::cacheSpecifications(const std::string& specPath, - const std::string& version, - void (*registerFunc)(std::map&)) +void NWBFile::cacheSpecifications( + const std::string& specPath, + const std::string& version, + void (*registerFunc)(std::map&)) { std::map registry; registerFunc(registry); @@ -160,7 +166,8 @@ void NWBFile::cacheSpecifications(const std::string& specPath, io->createGroup("/specifications/" + specPath + "/" + version); for (const auto& [name, content] : registry) { - io->createStringDataSet("/specifications/" + specPath + "/" + version + "/" + name, *content); + io->createStringDataSet( + "/specifications/" + specPath + "/" + version + "/" + name, *content); } } diff --git a/src/nwb/NWBFile.hpp b/src/nwb/NWBFile.hpp index d6295042..c7d55e7b 100644 --- a/src/nwb/NWBFile.hpp +++ b/src/nwb/NWBFile.hpp @@ -123,9 +123,10 @@ class NWBFile * @param registry The registry of specification files. * @param versionNumber The version number of the specification files. */ - void cacheSpecifications(const std::string& specPath, - const std::string& version, - void (*registerFunc)(std::map&)); + void cacheSpecifications( + const std::string& specPath, + const std::string& version, + void (*registerFunc)(std::map&)); /** * @brief Holds the Container (usually TimeSeries) objects that have been diff --git a/src/spec/core.hpp b/src/spec/core.hpp index 3bb5f313..89408ba9 100644 --- a/src/spec/core.hpp +++ b/src/spec/core.hpp @@ -46,19 +46,20 @@ const std::string nwb_retinotopy = R"delimiter( const std::string namespaces = R"delimiter( {"namespaces":[{"name":"core","doc":"NWB namespace","author":["Andrew Tritt","Oliver Ruebel","Ryan Ly","Ben Dichter","Keith Godfrey","Jeff Teeters"],"contact":["ajtritt@lbl.gov","oruebel@lbl.gov","rly@lbl.gov","bdichter@lbl.gov","keithg@alleninstitute.org","jteeters@berkeley.edu"],"full_name":"NWB core","schema":[{"namespace":"hdmf-common"},{"source":"nwb.base"},{"source":"nwb.device"},{"source":"nwb.epoch"},{"source":"nwb.image"},{"source":"nwb.file"},{"source":"nwb.misc"},{"source":"nwb.behavior"},{"source":"nwb.ecephys"},{"source":"nwb.icephys"},{"source":"nwb.ogen"},{"source":"nwb.ophys"},{"source":"nwb.retinotopy"}],"version":"2.7.0"}]})delimiter"; -void registerVariables(std::map& registry) { - registry["nwb.base"] = &nwb_base; - registry["nwb.device"] = &nwb_device; - registry["nwb.epoch"] = &nwb_epoch; - registry["nwb.image"] = &nwb_image; - registry["nwb.file"] = &nwb_file; - registry["nwb.misc"] = &nwb_misc; - registry["nwb.behavior"] = &nwb_behavior; - registry["nwb.ecephys"] = &nwb_ecephys; - registry["nwb.icephys"] = &nwb_icephys; - registry["nwb.ogen"] = &nwb_ogen; - registry["nwb.ophys"] = &nwb_ophys; - registry["nwb.retinotopy"] = &nwb_retinotopy; - registry["namespace"] = &namespaces; +void registerVariables(std::map& registry) +{ + registry["nwb.base"] = &nwb_base; + registry["nwb.device"] = &nwb_device; + registry["nwb.epoch"] = &nwb_epoch; + registry["nwb.image"] = &nwb_image; + registry["nwb.file"] = &nwb_file; + registry["nwb.misc"] = &nwb_misc; + registry["nwb.behavior"] = &nwb_behavior; + registry["nwb.ecephys"] = &nwb_ecephys; + registry["nwb.icephys"] = &nwb_icephys; + registry["nwb.ogen"] = &nwb_ogen; + registry["nwb.ophys"] = &nwb_ophys; + registry["nwb.retinotopy"] = &nwb_retinotopy; + registry["namespace"] = &namespaces; }; } // namespace AQNWB::spec::core diff --git a/src/spec/hdmf_common.hpp b/src/spec/hdmf_common.hpp index 90ea9261..b6659701 100644 --- a/src/spec/hdmf_common.hpp +++ b/src/spec/hdmf_common.hpp @@ -19,10 +19,11 @@ const std::string sparse = R"delimiter( const std::string namespaces = R"delimiter( {"namespaces":[{"name":"hdmf-common","doc":"Common data structures provided by HDMF","author":["Andrew Tritt","Oliver Ruebel","Ryan Ly","Ben Dichter"],"contact":["ajtritt@lbl.gov","oruebel@lbl.gov","rly@lbl.gov","bdichter@lbl.gov"],"full_name":"HDMF Common","schema":[{"source":"base"},{"source":"table"},{"source":"sparse"}],"version":"1.8.0"}]})delimiter"; -void registerVariables(std::map& registry) { - registry["base"] = &base; - registry["table"] = &table; - registry["sparse"] = &sparse; - registry["namespace"] = &namespaces; +void registerVariables(std::map& registry) +{ + registry["base"] = &base; + registry["table"] = &table; + registry["sparse"] = &sparse; + registry["namespace"] = &namespaces; }; } // namespace AQNWB::spec::hdmf_common diff --git a/src/spec/hdmf_experimental.hpp b/src/spec/hdmf_experimental.hpp index ef20ca5b..c9319532 100644 --- a/src/spec/hdmf_experimental.hpp +++ b/src/spec/hdmf_experimental.hpp @@ -16,9 +16,10 @@ const std::string resources = R"delimiter( const std::string namespaces = R"delimiter( {"namespaces":[{"name":"hdmf-experimental","doc":"Experimental data structures provided by HDMF. These are not guaranteed to be available in the future.","author":["Andrew Tritt","Oliver Ruebel","Ryan Ly","Ben Dichter","Matthew Avaylon"],"contact":["ajtritt@lbl.gov","oruebel@lbl.gov","rly@lbl.gov","bdichter@lbl.gov","mavaylon@lbl.gov"],"full_name":"HDMF Experimental","schema":[{"namespace":"hdmf-common"},{"source":"experimental"},{"source":"resources"}],"version":"0.5.0"}]})delimiter"; -void registerVariables(std::map& registry) { - registry["experimental"] = &experimental; - registry["resources"] = &resources; - registry["namespace"] = &namespaces; +void registerVariables(std::map& registry) +{ + registry["experimental"] = &experimental; + registry["resources"] = &resources; + registry["namespace"] = &namespaces; }; } // namespace AQNWB::spec::hdmf_experimental From 7de90ec7630d0a1b887df362486cf5f6cc9476bf Mon Sep 17 00:00:00 2001 From: Steph Prince <40640337+stephprince@users.noreply.github.com> Date: Wed, 28 Aug 2024 15:17:03 -0700 Subject: [PATCH 14/22] update spec caching docstring --- src/nwb/NWBFile.cpp | 7 ++++--- src/nwb/NWBFile.hpp | 5 ++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/nwb/NWBFile.cpp b/src/nwb/NWBFile.cpp index ab4ef82d..d4a953b8 100644 --- a/src/nwb/NWBFile.cpp +++ b/src/nwb/NWBFile.cpp @@ -156,18 +156,19 @@ void NWBFile::stopRecording() void NWBFile::cacheSpecifications( const std::string& specPath, - const std::string& version, + const std::string& versionNumber, void (*registerFunc)(std::map&)) { std::map registry; registerFunc(registry); io->createGroup("/specifications/" + specPath + "/"); - io->createGroup("/specifications/" + specPath + "/" + version); + io->createGroup("/specifications/" + specPath + "/" + versionNumber); for (const auto& [name, content] : registry) { io->createStringDataSet( - "/specifications/" + specPath + "/" + version + "/" + name, *content); + "/specifications/" + specPath + "/" + versionNumber + "/" + name, + *content); } } diff --git a/src/nwb/NWBFile.hpp b/src/nwb/NWBFile.hpp index c7d55e7b..f447707b 100644 --- a/src/nwb/NWBFile.hpp +++ b/src/nwb/NWBFile.hpp @@ -119,13 +119,12 @@ class NWBFile /** * @brief Saves the specification files for the schema. * @param specPath The location in the file to store the spec information. - * @param version The version number of the specification files. - * @param registry The registry of specification files. * @param versionNumber The version number of the specification files. + * @param registry The registry of specification files. */ void cacheSpecifications( const std::string& specPath, - const std::string& version, + const std::string& versionNumber, void (*registerFunc)(std::map&)); /** From 6b9ff814aca11acb4a23d2b83b087211e30fe5c8 Mon Sep 17 00:00:00 2001 From: Steph Prince <40640337+stephprince@users.noreply.github.com> Date: Wed, 28 Aug 2024 18:32:54 -0700 Subject: [PATCH 15/22] update spec caching to use arrays of pairs of strings --- resources/generate_spec_files.py | 31 ++++++----------- src/nwb/NWBFile.cpp | 54 ++++++++++++++--------------- src/nwb/NWBFile.hpp | 11 +++--- src/spec/core.hpp | 59 ++++++++++++++++---------------- src/spec/hdmf_common.hpp | 23 +++++++------ src/spec/hdmf_experimental.hpp | 19 +++++----- 6 files changed, 94 insertions(+), 103 deletions(-) diff --git a/resources/generate_spec_files.py b/resources/generate_spec_files.py index 6e44994f..f43d6a98 100644 --- a/resources/generate_spec_files.py +++ b/resources/generate_spec_files.py @@ -22,7 +22,7 @@ header_file = Path(f"./src/spec/{ns['name'].replace('-', '_')}.hpp").resolve() with open(header_file, 'w') as fo: fo.write('#pragma once\n\n') - fo.write('#include \n\n') + fo.write('#include \n#include \n#include \n\n') fo.write(f'namespace AQNWB::spec::{ns['name'].replace('-', '_')}\n{{\n\n') fo.write(f'const std::string version = "{ns["version"]}";\n\n') @@ -34,17 +34,12 @@ schema_file = file.parent / s['source'] with open(schema_file) as f: spec = yaml.load(schema_file) - - # convert to json - spec_file = (spec_dir / s['source']).with_suffix('.json') - print(f'Generating file {spec_file}') - with open(spec_file, 'w') as fo: - json.dump(spec, fo, separators=(',', ':'),) # convert to cpp string + print(f'Generating file {header_file} - {s["source"]}') with open(header_file, 'a') as fo: var_name = s['source'].replace('.yaml', '').replace('.', '_') - fo.write(f'const std::string {var_name} = R"delimiter(\n{json.dumps(spec, separators=(',', ':'))})delimiter";\n\n') + fo.write(f'constexpr std::string_view {var_name} = R"delimiter(\n{json.dumps(spec, separators=(',', ':'))})delimiter";\n\n') var_names.append(var_name) # reformat schema sources for namespace file @@ -54,18 +49,12 @@ s = {'source': s['source'].split('.yaml')[0]} schema.append(s) ns['schema'] = schema - - # convert namespace json - ns_file = (spec_dir / file.name).with_suffix('.json') - ns_output = {'namespaces': [ns]} - print(f'Generating file {ns_file}') - with open(ns_file, 'w') as fo: - json.dump(ns_output, fo, separators=(',', ':'),) - + # convert to cpp variables + ns_output = {'namespaces': [ns]} with open(header_file, 'a') as fo: - fo.write(f'const std::string namespaces = R"delimiter(\n{json.dumps(ns_output, separators=(',', ':'))})delimiter";\n\n') - fo.write('void registerVariables(std::map& registry) {\n') - fo.write(''.join([f' registry["{name.replace('_', '.')}"] = &{name};\n' for name in var_names])) - fo.write(f' registry["namespace"] = &namespaces;\n') - fo.write(f'}};\n}} // namespace AQNWB::spec::{ns['name'].replace('-', '_')}\n') \ No newline at end of file + fo.write(f'constexpr std::string_view namespaces = R"delimiter(\n{json.dumps(ns_output, separators=(',', ':'))})delimiter";\n\n') + fo.write(f'constexpr std::array, {len(var_names) + 1}> specVariables {{{{\n') + fo.write(''.join([f' {{"{name.replace('_', '.')}", {name}}},\n' for name in var_names])) + fo.write(' {"namespace", namespaces}\n') + fo.write(f'}}}};\n}} // namespace AQNWB::spec::{ns['name'].replace('-', '_')}\n') \ No newline at end of file diff --git a/src/nwb/NWBFile.cpp b/src/nwb/NWBFile.cpp index d4a953b8..bce72eea 100644 --- a/src/nwb/NWBFile.cpp +++ b/src/nwb/NWBFile.cpp @@ -6,18 +6,17 @@ #include #include -#include "NWBFile.hpp" - -#include "../BaseIO.hpp" -#include "../Channel.hpp" -#include "../Utils.hpp" -#include "../spec/core.hpp" -#include "../spec/hdmf_common.hpp" -#include "../spec/hdmf_experimental.hpp" -#include "device/Device.hpp" -#include "ecephys/ElectricalSeries.hpp" -#include "file/ElectrodeGroup.hpp" -#include "file/ElectrodeTable.hpp" +#include "BaseIO.hpp" +#include "Channel.hpp" +#include "Utils.hpp" +#include "spec/core.hpp" +#include "spec/hdmf_common.hpp" +#include "spec/hdmf_experimental.hpp" +#include "nwb/device/Device.hpp" +#include "nwb/ecephys/ElectricalSeries.hpp" +#include "nwb/file/ElectrodeGroup.hpp" +#include "nwb/file/ElectrodeTable.hpp" +#include "nwb/NWBFile.hpp" using namespace AQNWB::NWB; @@ -70,14 +69,14 @@ Status NWBFile::createFileStructure() io->createGroup("/specifications"); io->createReferenceAttribute("/specifications", "/", ".specloc"); - cacheSpecifications( - "core", spec::core::version, spec::core::registerVariables); + + cacheSpecifications("core", spec::core::version, spec::core::specVariables); cacheSpecifications("hdmf-common", spec::hdmf_common::version, - spec::hdmf_common::registerVariables); + spec::hdmf_common::specVariables); cacheSpecifications("hdmf-experimental", spec::hdmf_experimental::version, - spec::hdmf_experimental::registerVariables); + spec::hdmf_experimental::specVariables); std::string time = getCurrentTime(); std::vector timeVec = {time}; @@ -154,24 +153,23 @@ void NWBFile::stopRecording() io->stopRecording(); } +template void NWBFile::cacheSpecifications( const std::string& specPath, const std::string& versionNumber, - void (*registerFunc)(std::map&)) + const std::array, N>& specVariables) { - std::map registry; - registerFunc(registry); - - io->createGroup("/specifications/" + specPath + "/"); - io->createGroup("/specifications/" + specPath + "/" + versionNumber); - - for (const auto& [name, content] : registry) { - io->createStringDataSet( - "/specifications/" + specPath + "/" + versionNumber + "/" + name, - *content); - } + io->createGroup("/specifications/" + specPath + "/"); + io->createGroup("/specifications/" + specPath + "/" + versionNumber); + + for (const auto& [name, content] : specVariables) { + io->createStringDataSet( + "/specifications/" + specPath + "/" + versionNumber + "/" + std::string(name), + std::string(content)); + } } + // recording data factory method / std::unique_ptr NWBFile::createRecordingData( BaseDataType type, diff --git a/src/nwb/NWBFile.hpp b/src/nwb/NWBFile.hpp index f447707b..027c8858 100644 --- a/src/nwb/NWBFile.hpp +++ b/src/nwb/NWBFile.hpp @@ -5,9 +5,9 @@ #include #include -#include "../BaseIO.hpp" -#include "../Types.hpp" -#include "base/TimeSeries.hpp" +#include "BaseIO.hpp" +#include "Types.hpp" +#include "nwb/base/TimeSeries.hpp" /*! * \namespace AQNWB::NWB @@ -120,12 +120,13 @@ class NWBFile * @brief Saves the specification files for the schema. * @param specPath The location in the file to store the spec information. * @param versionNumber The version number of the specification files. - * @param registry The registry of specification files. + * @param specVariables The variables from the specification files. */ + template void cacheSpecifications( const std::string& specPath, const std::string& versionNumber, - void (*registerFunc)(std::map&)); + const std::array, N>& specVariables); /** * @brief Holds the Container (usually TimeSeries) objects that have been diff --git a/src/spec/core.hpp b/src/spec/core.hpp index 89408ba9..c5930d24 100644 --- a/src/spec/core.hpp +++ b/src/spec/core.hpp @@ -1,65 +1,66 @@ #pragma once #include +#include +#include namespace AQNWB::spec::core { const std::string version = "2.7.0"; -const std::string nwb_base = R"delimiter( +constexpr std::string_view nwb_base = R"delimiter( {"datasets":[{"neurodata_type_def":"NWBData","neurodata_type_inc":"Data","doc":"An abstract data type for a dataset."},{"neurodata_type_def":"TimeSeriesReferenceVectorData","neurodata_type_inc":"VectorData","default_name":"timeseries","dtype":[{"name":"idx_start","dtype":"int32","doc":"Start index into the TimeSeries 'data' and 'timestamp' datasets of the referenced TimeSeries. The first dimension of those arrays is always time."},{"name":"count","dtype":"int32","doc":"Number of data samples available in this time series, during this epoch"},{"name":"timeseries","dtype":{"target_type":"TimeSeries","reftype":"object"},"doc":"The TimeSeries that this index applies to"}],"doc":"Column storing references to a TimeSeries (rows). For each TimeSeries this VectorData column stores the start_index and count to indicate the range in time to be selected as well as an object reference to the TimeSeries."},{"neurodata_type_def":"Image","neurodata_type_inc":"NWBData","dtype":"numeric","dims":[["x","y"],["x","y","r, g, b"],["x","y","r, g, b, a"]],"shape":[[null,null],[null,null,3],[null,null,4]],"doc":"An abstract data type for an image. Shape can be 2-D (x, y), or 3-D where the third dimension can have three or four elements, e.g. (x, y, (r, g, b)) or (x, y, (r, g, b, a)).","attributes":[{"name":"resolution","dtype":"float32","doc":"Pixel resolution of the image, in pixels per centimeter.","required":false},{"name":"description","dtype":"text","doc":"Description of the image.","required":false}]},{"neurodata_type_def":"ImageReferences","neurodata_type_inc":"NWBData","dtype":{"target_type":"Image","reftype":"object"},"dims":["num_images"],"shape":[null],"doc":"Ordered dataset of references to Image objects."}],"groups":[{"neurodata_type_def":"NWBContainer","neurodata_type_inc":"Container","doc":"An abstract data type for a generic container storing collections of data and metadata. Base type for all data and metadata containers."},{"neurodata_type_def":"NWBDataInterface","neurodata_type_inc":"NWBContainer","doc":"An abstract data type for a generic container storing collections of data, as opposed to metadata."},{"neurodata_type_def":"TimeSeries","neurodata_type_inc":"NWBDataInterface","doc":"General purpose time series.","attributes":[{"name":"description","dtype":"text","default_value":"no description","doc":"Description of the time series.","required":false},{"name":"comments","dtype":"text","default_value":"no comments","doc":"Human-readable comments about the TimeSeries. This second descriptive field can be used to store additional information, or descriptive information if the primary description field is populated with a computer-readable string.","required":false}],"datasets":[{"name":"data","dims":[["num_times"],["num_times","num_DIM2"],["num_times","num_DIM2","num_DIM3"],["num_times","num_DIM2","num_DIM3","num_DIM4"]],"shape":[[null],[null,null],[null,null,null],[null,null,null,null]],"doc":"Data values. Data can be in 1-D, 2-D, 3-D, or 4-D. The first dimension should always represent time. This can also be used to store binary data (e.g., image frames). This can also be a link to data stored in an external file.","attributes":[{"name":"conversion","dtype":"float32","default_value":1.0,"doc":"Scalar to multiply each element in data to convert it to the specified 'unit'. If the data are stored in acquisition system units or other units that require a conversion to be interpretable, multiply the data by 'conversion' to convert the data to the specified 'unit'. e.g. if the data acquisition system stores values in this object as signed 16-bit integers (int16 range -32,768 to 32,767) that correspond to a 5V range (-2.5V to 2.5V), and the data acquisition system gain is 8000X, then the 'conversion' multiplier to get from raw data acquisition values to recorded volts is 2.5/32768/8000 = 9.5367e-9.","required":false},{"name":"offset","dtype":"float32","default_value":0.0,"doc":"Scalar to add to the data after scaling by 'conversion' to finalize its coercion to the specified 'unit'. Two common examples of this include (a) data stored in an unsigned type that requires a shift after scaling to re-center the data, and (b) specialized recording devices that naturally cause a scalar offset with respect to the true units.","required":false},{"name":"resolution","dtype":"float32","default_value":-1.0,"doc":"Smallest meaningful difference between values in data, stored in the specified by unit, e.g., the change in value of the least significant bit, or a larger number if signal noise is known to be present. If unknown, use -1.0.","required":false},{"name":"unit","dtype":"text","doc":"Base unit of measurement for working with the data. Actual stored values are not necessarily stored in these units. To access the data in these units, multiply 'data' by 'conversion' and add 'offset'."},{"name":"continuity","dtype":"text","doc":"Optionally describe the continuity of the data. Can be \"continuous\", \"instantaneous\", or \"step\". For example, a voltage trace would be \"continuous\", because samples are recorded from a continuous process. An array of lick times would be \"instantaneous\", because the data represents distinct moments in time. Times of image presentations would be \"step\" because the picture remains the same until the next timepoint. This field is optional, but is useful in providing information about the underlying data. It may inform the way this data is interpreted, the way it is visualized, and what analysis methods are applicable.","required":false}]},{"name":"starting_time","dtype":"float64","doc":"Timestamp of the first sample in seconds. When timestamps are uniformly spaced, the timestamp of the first sample can be specified and all subsequent ones calculated from the sampling rate attribute.","quantity":"?","attributes":[{"name":"rate","dtype":"float32","doc":"Sampling rate, in Hz."},{"name":"unit","dtype":"text","value":"seconds","doc":"Unit of measurement for time, which is fixed to 'seconds'."}]},{"name":"timestamps","dtype":"float64","dims":["num_times"],"shape":[null],"doc":"Timestamps for samples stored in data, in seconds, relative to the common experiment master-clock stored in NWBFile.timestamps_reference_time.","quantity":"?","attributes":[{"name":"interval","dtype":"int32","value":1,"doc":"Value is '1'"},{"name":"unit","dtype":"text","value":"seconds","doc":"Unit of measurement for timestamps, which is fixed to 'seconds'."}]},{"name":"control","dtype":"uint8","dims":["num_times"],"shape":[null],"doc":"Numerical labels that apply to each time point in data for the purpose of querying and slicing data by these values. If present, the length of this array should be the same size as the first dimension of data.","quantity":"?"},{"name":"control_description","dtype":"text","dims":["num_control_values"],"shape":[null],"doc":"Description of each control value. Must be present if control is present. If present, control_description[0] should describe time points where control == 0.","quantity":"?"}],"groups":[{"name":"sync","doc":"Lab-specific time and sync information as provided directly from hardware devices and that is necessary for aligning all acquired time information to a common timebase. The timestamp array stores time in the common timebase. This group will usually only be populated in TimeSeries that are stored external to the NWB file, in files storing raw data. Once timestamp data is calculated, the contents of 'sync' are mostly for archival purposes.","quantity":"?"}]},{"neurodata_type_def":"ProcessingModule","neurodata_type_inc":"NWBContainer","doc":"A collection of processed data.","attributes":[{"name":"description","dtype":"text","doc":"Description of this collection of processed data."}],"groups":[{"neurodata_type_inc":"NWBDataInterface","doc":"Data objects stored in this collection.","quantity":"*"},{"neurodata_type_inc":"DynamicTable","doc":"Tables stored in this collection.","quantity":"*"}]},{"neurodata_type_def":"Images","neurodata_type_inc":"NWBDataInterface","default_name":"Images","doc":"A collection of images with an optional way to specify the order of the images using the \"order_of_images\" dataset. An order must be specified if the images are referenced by index, e.g., from an IndexSeries.","attributes":[{"name":"description","dtype":"text","doc":"Description of this collection of images."}],"datasets":[{"neurodata_type_inc":"Image","doc":"Images stored in this collection.","quantity":"+"},{"name":"order_of_images","neurodata_type_inc":"ImageReferences","doc":"Ordered dataset of references to Image objects stored in the parent group. Each Image object in the Images group should be stored once and only once, so the dataset should have the same length as the number of images.","quantity":"?"}]}]})delimiter"; -const std::string nwb_device = R"delimiter( +constexpr std::string_view nwb_device = R"delimiter( {"groups":[{"neurodata_type_def":"Device","neurodata_type_inc":"NWBContainer","doc":"Metadata about a data acquisition device, e.g., recording system, electrode, microscope.","attributes":[{"name":"description","dtype":"text","doc":"Description of the device (e.g., model, firmware version, processing software version, etc.) as free-form text.","required":false},{"name":"manufacturer","dtype":"text","doc":"The name of the manufacturer of the device.","required":false}]}]})delimiter"; -const std::string nwb_epoch = R"delimiter( +constexpr std::string_view nwb_epoch = R"delimiter( {"groups":[{"neurodata_type_def":"TimeIntervals","neurodata_type_inc":"DynamicTable","doc":"A container for aggregating epoch data and the TimeSeries that each epoch applies to.","datasets":[{"name":"start_time","neurodata_type_inc":"VectorData","dtype":"float32","doc":"Start time of epoch, in seconds."},{"name":"stop_time","neurodata_type_inc":"VectorData","dtype":"float32","doc":"Stop time of epoch, in seconds."},{"name":"tags","neurodata_type_inc":"VectorData","dtype":"text","doc":"User-defined tags that identify or categorize events.","quantity":"?"},{"name":"tags_index","neurodata_type_inc":"VectorIndex","doc":"Index for tags.","quantity":"?"},{"name":"timeseries","neurodata_type_inc":"TimeSeriesReferenceVectorData","doc":"An index into a TimeSeries object.","quantity":"?"},{"name":"timeseries_index","neurodata_type_inc":"VectorIndex","doc":"Index for timeseries.","quantity":"?"}]}]})delimiter"; -const std::string nwb_image = R"delimiter( +constexpr std::string_view nwb_image = R"delimiter( {"datasets":[{"neurodata_type_def":"GrayscaleImage","neurodata_type_inc":"Image","dims":["x","y"],"shape":[null,null],"doc":"A grayscale image.","dtype":"numeric"},{"neurodata_type_def":"RGBImage","neurodata_type_inc":"Image","dims":["x","y","r, g, b"],"shape":[null,null,3],"doc":"A color image.","dtype":"numeric"},{"neurodata_type_def":"RGBAImage","neurodata_type_inc":"Image","dims":["x","y","r, g, b, a"],"shape":[null,null,4],"doc":"A color image with transparency.","dtype":"numeric"}],"groups":[{"neurodata_type_def":"ImageSeries","neurodata_type_inc":"TimeSeries","doc":"General image data that is common between acquisition and stimulus time series. Sometimes the image data is stored in the file in a raw format while other times it will be stored as a series of external image files in the host file system. The data field will either be binary data, if the data is stored in the NWB file, or empty, if the data is stored in an external image stack. [frame][x][y] or [frame][x][y][z].","datasets":[{"name":"data","dtype":"numeric","dims":[["frame","x","y"],["frame","x","y","z"]],"shape":[[null,null,null],[null,null,null,null]],"doc":"Binary data representing images across frames. If data are stored in an external file, this should be an empty 3D array."},{"name":"dimension","dtype":"int32","dims":["rank"],"shape":[null],"doc":"Number of pixels on x, y, (and z) axes.","quantity":"?"},{"name":"external_file","dtype":"text","dims":["num_files"],"shape":[null],"doc":"Paths to one or more external file(s). The field is only present if format='external'. This is only relevant if the image series is stored in the file system as one or more image file(s). This field should NOT be used if the image is stored in another NWB file and that file is linked to this file.","quantity":"?","attributes":[{"name":"starting_frame","dtype":"int32","dims":["num_files"],"shape":[null],"doc":"Each external image may contain one or more consecutive frames of the full ImageSeries. This attribute serves as an index to indicate which frames each file contains, to facilitate random access. The 'starting_frame' attribute, hence, contains a list of frame numbers within the full ImageSeries of the first frame of each file listed in the parent 'external_file' dataset. Zero-based indexing is used (hence, the first element will always be zero). For example, if the 'external_file' dataset has three paths to files and the first file has 5 frames, the second file has 10 frames, and the third file has 20 frames, then this attribute will have values [0, 5, 15]. If there is a single external file that holds all of the frames of the ImageSeries (and so there is a single element in the 'external_file' dataset), then this attribute should have value [0]."}]},{"name":"format","dtype":"text","default_value":"raw","doc":"Format of image. If this is 'external', then the attribute 'external_file' contains the path information to the image files. If this is 'raw', then the raw (single-channel) binary data is stored in the 'data' dataset. If this attribute is not present, then the default format='raw' case is assumed.","quantity":"?"}],"links":[{"name":"device","target_type":"Device","doc":"Link to the Device object that was used to capture these images.","quantity":"?"}]},{"neurodata_type_def":"ImageMaskSeries","neurodata_type_inc":"ImageSeries","doc":"An alpha mask that is applied to a presented visual stimulus. The 'data' array contains an array of mask values that are applied to the displayed image. Mask values are stored as RGBA. Mask can vary with time. The timestamps array indicates the starting time of a mask, and that mask pattern continues until it's explicitly changed.","links":[{"name":"masked_imageseries","target_type":"ImageSeries","doc":"Link to ImageSeries object that this image mask is applied to."}]},{"neurodata_type_def":"OpticalSeries","neurodata_type_inc":"ImageSeries","doc":"Image data that is presented or recorded. A stimulus template movie will be stored only as an image. When the image is presented as stimulus, additional data is required, such as field of view (e.g., how much of the visual field the image covers, or how what is the area of the target being imaged). If the OpticalSeries represents acquired imaging data, orientation is also important.","datasets":[{"name":"distance","dtype":"float32","doc":"Distance from camera/monitor to target/eye.","quantity":"?"},{"name":"field_of_view","dtype":"float32","dims":[["width, height"],["width, height, depth"]],"shape":[[2],[3]],"doc":"Width, height and depth of image, or imaged area, in meters.","quantity":"?"},{"name":"data","dtype":"numeric","dims":[["frame","x","y"],["frame","x","y","r, g, b"]],"shape":[[null,null,null],[null,null,null,3]],"doc":"Images presented to subject, either grayscale or RGB"},{"name":"orientation","dtype":"text","doc":"Description of image relative to some reference frame (e.g., which way is up). Must also specify frame of reference.","quantity":"?"}]},{"neurodata_type_def":"IndexSeries","neurodata_type_inc":"TimeSeries","doc":"Stores indices to image frames stored in an ImageSeries. The purpose of the IndexSeries is to allow a static image stack to be stored in an Images object, and the images in the stack to be referenced out-of-order. This can be for the display of individual images, or of movie segments (as a movie is simply a series of images). The data field stores the index of the frame in the referenced Images object, and the timestamps array indicates when that image was displayed.","datasets":[{"name":"data","dtype":"uint32","dims":["num_times"],"shape":[null],"doc":"Index of the image (using zero-indexing) in the linked Images object.","attributes":[{"name":"conversion","dtype":"float32","doc":"This field is unused by IndexSeries.","required":false},{"name":"resolution","dtype":"float32","doc":"This field is unused by IndexSeries.","required":false},{"name":"offset","dtype":"float32","doc":"This field is unused by IndexSeries.","required":false},{"name":"unit","dtype":"text","value":"N/A","doc":"This field is unused by IndexSeries and has the value N/A."}]}],"links":[{"name":"indexed_timeseries","target_type":"ImageSeries","doc":"Link to ImageSeries object containing images that are indexed. Use of this link is discouraged and will be deprecated. Link to an Images type instead.","quantity":"?"},{"name":"indexed_images","target_type":"Images","doc":"Link to Images object containing an ordered set of images that are indexed. The Images object must contain a 'ordered_images' dataset specifying the order of the images in the Images type.","quantity":"?"}]}]})delimiter"; -const std::string nwb_file = R"delimiter( +constexpr std::string_view nwb_file = R"delimiter( {"groups":[{"neurodata_type_def":"NWBFile","neurodata_type_inc":"NWBContainer","name":"root","doc":"An NWB file storing cellular-based neurophysiology data from a single experimental session.","attributes":[{"name":"nwb_version","dtype":"text","value":"2.7.0-alpha","doc":"File version string. Use semantic versioning, e.g. 1.2.1. This will be the name of the format with trailing major, minor and patch numbers."}],"datasets":[{"name":"file_create_date","dtype":"isodatetime","dims":["num_modifications"],"shape":[null],"doc":"A record of the date the file was created and of subsequent modifications. The date is stored in UTC with local timezone offset as ISO 8601 extended formatted strings: 2018-09-28T14:43:54.123+02:00. Dates stored in UTC end in \"Z\" with no timezone offset. Date accuracy is up to milliseconds. The file can be created after the experiment was run, so this may differ from the experiment start time. Each modification to the nwb file adds a new entry to the array."},{"name":"identifier","dtype":"text","doc":"A unique text identifier for the file. For example, concatenated lab name, file creation date/time and experimentalist, or a hash of these and/or other values. The goal is that the string should be unique to all other files."},{"name":"session_description","dtype":"text","doc":"A description of the experimental session and data in the file."},{"name":"session_start_time","dtype":"isodatetime","doc":"Date and time of the experiment/session start. The date is stored in UTC with local timezone offset as ISO 8601 extended formatted string: 2018-09-28T14:43:54.123+02:00. Dates stored in UTC end in \"Z\" with no timezone offset. Date accuracy is up to milliseconds."},{"name":"timestamps_reference_time","dtype":"isodatetime","doc":"Date and time corresponding to time zero of all timestamps. The date is stored in UTC with local timezone offset as ISO 8601 extended formatted string: 2018-09-28T14:43:54.123+02:00. Dates stored in UTC end in \"Z\" with no timezone offset. Date accuracy is up to milliseconds. All times stored in the file use this time as reference (i.e., time zero)."}],"groups":[{"name":"acquisition","doc":"Data streams recorded from the system, including ephys, ophys, tracking, etc. This group should be read-only after the experiment is completed and timestamps are corrected to a common timebase. The data stored here may be links to raw data stored in external NWB files. This will allow keeping bulky raw data out of the file while preserving the option of keeping some/all in the file. Acquired data includes tracking and experimental data streams (i.e., everything measured from the system). If bulky data is stored in the /acquisition group, the data can exist in a separate NWB file that is linked to by the file being used for processing and analysis.","groups":[{"neurodata_type_inc":"NWBDataInterface","doc":"Acquired, raw data.","quantity":"*"},{"neurodata_type_inc":"DynamicTable","doc":"Tabular data that is relevant to acquisition","quantity":"*"}]},{"name":"analysis","doc":"Lab-specific and custom scientific analysis of data. There is no defined format for the content of this group - the format is up to the individual user/lab. To facilitate sharing analysis data between labs, the contents here should be stored in standard types (e.g., neurodata_types) and appropriately documented. The file can store lab-specific and custom data analysis without restriction on its form or schema, reducing data formatting restrictions on end users. Such data should be placed in the analysis group. The analysis data should be documented so that it could be shared with other labs.","groups":[{"neurodata_type_inc":"NWBContainer","doc":"Custom analysis results.","quantity":"*"},{"neurodata_type_inc":"DynamicTable","doc":"Tabular data that is relevant to data stored in analysis","quantity":"*"}]},{"name":"scratch","doc":"A place to store one-off analysis results. Data placed here is not intended for sharing. By placing data here, users acknowledge that there is no guarantee that their data meets any standard.","quantity":"?","groups":[{"neurodata_type_inc":"NWBContainer","doc":"Any one-off containers","quantity":"*"},{"neurodata_type_inc":"DynamicTable","doc":"Any one-off tables","quantity":"*"}],"datasets":[{"neurodata_type_inc":"ScratchData","doc":"Any one-off datasets","quantity":"*"}]},{"name":"processing","doc":"The home for ProcessingModules. These modules perform intermediate analysis of data that is necessary to perform before scientific analysis. Examples include spike clustering, extracting position from tracking data, stitching together image slices. ProcessingModules can be large and express many data sets from relatively complex analysis (e.g., spike detection and clustering) or small, representing extraction of position information from tracking video, or even binary lick/no-lick decisions. Common software tools (e.g., klustakwik, MClust) are expected to read/write data here. 'Processing' refers to intermediate analysis of the acquired data to make it more amenable to scientific analysis.","groups":[{"neurodata_type_inc":"ProcessingModule","doc":"Intermediate analysis of acquired data.","quantity":"*"}]},{"name":"stimulus","doc":"Data pushed into the system (eg, video stimulus, sound, voltage, etc) and secondary representations of that data (eg, measurements of something used as a stimulus). This group should be made read-only after experiment complete and timestamps are corrected to common timebase. Stores both presented stimuli and stimulus templates, the latter in case the same stimulus is presented multiple times, or is pulled from an external stimulus library. Stimuli are here defined as any signal that is pushed into the system as part of the experiment (eg, sound, video, voltage, etc). Many different experiments can use the same stimuli, and stimuli can be re-used during an experiment. The stimulus group is organized so that one version of template stimuli can be stored and these be used multiple times. These templates can exist in the present file or can be linked to a remote library file.","groups":[{"name":"presentation","doc":"Stimuli presented during the experiment.","groups":[{"neurodata_type_inc":"TimeSeries","doc":"TimeSeries objects containing data of presented stimuli.","quantity":"*"}]},{"name":"templates","doc":"Template stimuli. Timestamps in templates are based on stimulus design and are relative to the beginning of the stimulus. When templates are used, the stimulus instances must convert presentation times to the experiment`s time reference frame.","groups":[{"neurodata_type_inc":"TimeSeries","doc":"TimeSeries objects containing template data of presented stimuli.","quantity":"*"},{"neurodata_type_inc":"Images","doc":"Images objects containing images of presented stimuli.","quantity":"*"}]}]},{"name":"general","doc":"Experimental metadata, including protocol, notes and description of hardware device(s). The metadata stored in this section should be used to describe the experiment. Metadata necessary for interpreting the data is stored with the data. General experimental metadata, including animal strain, experimental protocols, experimenter, devices, etc, are stored under 'general'. Core metadata (e.g., that required to interpret data fields) is stored with the data itself, and implicitly defined by the file specification (e.g., time is in seconds). The strategy used here for storing non-core metadata is to use free-form text fields, such as would appear in sentences or paragraphs from a Methods section. Metadata fields are text to enable them to be more general, for example to represent ranges instead of numerical values. Machine-readable metadata is stored as attributes to these free-form datasets. All entries in the below table are to be included when data is present. Unused groups (e.g., intracellular_ephys in an optophysiology experiment) should not be created unless there is data to store within them.","datasets":[{"name":"data_collection","dtype":"text","doc":"Notes about data collection and analysis.","quantity":"?"},{"name":"experiment_description","dtype":"text","doc":"General description of the experiment.","quantity":"?"},{"name":"experimenter","dtype":"text","doc":"Name of person(s) who performed the experiment. Can also specify roles of different people involved.","quantity":"?","dims":["num_experimenters"],"shape":[null]},{"name":"institution","dtype":"text","doc":"Institution(s) where experiment was performed.","quantity":"?"},{"name":"keywords","dtype":"text","dims":["num_keywords"],"shape":[null],"doc":"Terms to search over.","quantity":"?"},{"name":"lab","dtype":"text","doc":"Laboratory where experiment was performed.","quantity":"?"},{"name":"notes","dtype":"text","doc":"Notes about the experiment.","quantity":"?"},{"name":"pharmacology","dtype":"text","doc":"Description of drugs used, including how and when they were administered. Anesthesia(s), painkiller(s), etc., plus dosage, concentration, etc.","quantity":"?"},{"name":"protocol","dtype":"text","doc":"Experimental protocol, if applicable. e.g., include IACUC protocol number.","quantity":"?"},{"name":"related_publications","dtype":"text","doc":"Publication information. PMID, DOI, URL, etc.","dims":["num_publications"],"shape":[null],"quantity":"?"},{"name":"session_id","dtype":"text","doc":"Lab-specific ID for the session.","quantity":"?"},{"name":"slices","dtype":"text","doc":"Description of slices, including information about preparation thickness, orientation, temperature, and bath solution.","quantity":"?"},{"name":"source_script","dtype":"text","doc":"Script file or link to public source code used to create this NWB file.","quantity":"?","attributes":[{"name":"file_name","dtype":"text","doc":"Name of script file."}]},{"name":"stimulus","dtype":"text","doc":"Notes about stimuli, such as how and where they were presented.","quantity":"?"},{"name":"surgery","dtype":"text","doc":"Narrative description about surgery/surgeries, including date(s) and who performed surgery.","quantity":"?"},{"name":"virus","dtype":"text","doc":"Information about virus(es) used in experiments, including virus ID, source, date made, injection location, volume, etc.","quantity":"?"}],"groups":[{"neurodata_type_inc":"LabMetaData","doc":"Place-holder than can be extended so that lab-specific meta-data can be placed in /general.","quantity":"*"},{"name":"devices","doc":"Description of hardware devices used during experiment, e.g., monitors, ADC boards, microscopes, etc.","quantity":"?","groups":[{"neurodata_type_inc":"Device","doc":"Data acquisition devices.","quantity":"*"}]},{"name":"subject","neurodata_type_inc":"Subject","doc":"Information about the animal or person from which the data was measured.","quantity":"?"},{"name":"extracellular_ephys","doc":"Metadata related to extracellular electrophysiology.","quantity":"?","groups":[{"neurodata_type_inc":"ElectrodeGroup","doc":"Physical group of electrodes.","quantity":"*"},{"name":"electrodes","neurodata_type_inc":"DynamicTable","doc":"A table of all electrodes (i.e. channels) used for recording.","quantity":"?","datasets":[{"name":"x","neurodata_type_inc":"VectorData","dtype":"float32","doc":"x coordinate of the channel location in the brain (+x is posterior).","quantity":"?"},{"name":"y","neurodata_type_inc":"VectorData","dtype":"float32","doc":"y coordinate of the channel location in the brain (+y is inferior).","quantity":"?"},{"name":"z","neurodata_type_inc":"VectorData","dtype":"float32","doc":"z coordinate of the channel location in the brain (+z is right).","quantity":"?"},{"name":"imp","neurodata_type_inc":"VectorData","dtype":"float32","doc":"Impedance of the channel, in ohms.","quantity":"?"},{"name":"location","neurodata_type_inc":"VectorData","dtype":"text","doc":"Location of the electrode (channel). Specify the area, layer, comments on estimation of area/layer, stereotaxic coordinates if in vivo, etc. Use standard atlas names for anatomical regions when possible."},{"name":"filtering","neurodata_type_inc":"VectorData","dtype":"text","doc":"Description of hardware filtering, including the filter name and frequency cutoffs.","quantity":"?"},{"name":"group","neurodata_type_inc":"VectorData","dtype":{"target_type":"ElectrodeGroup","reftype":"object"},"doc":"Reference to the ElectrodeGroup this electrode is a part of."},{"name":"group_name","neurodata_type_inc":"VectorData","dtype":"text","doc":"Name of the ElectrodeGroup this electrode is a part of."},{"name":"rel_x","neurodata_type_inc":"VectorData","dtype":"float32","doc":"x coordinate in electrode group","quantity":"?"},{"name":"rel_y","neurodata_type_inc":"VectorData","dtype":"float32","doc":"y coordinate in electrode group","quantity":"?"},{"name":"rel_z","neurodata_type_inc":"VectorData","dtype":"float32","doc":"z coordinate in electrode group","quantity":"?"},{"name":"reference","neurodata_type_inc":"VectorData","dtype":"text","doc":"Description of the reference electrode and/or reference scheme used for this electrode, e.g., \"stainless steel skull screw\" or \"online common average referencing\".","quantity":"?"}]}]},{"name":"intracellular_ephys","doc":"Metadata related to intracellular electrophysiology.","quantity":"?","datasets":[{"name":"filtering","dtype":"text","doc":"[DEPRECATED] Use IntracellularElectrode.filtering instead. Description of filtering used. Includes filtering type and parameters, frequency fall-off, etc. If this changes between TimeSeries, filter description should be stored as a text attribute for each TimeSeries.","quantity":"?"}],"groups":[{"neurodata_type_inc":"IntracellularElectrode","doc":"An intracellular electrode.","quantity":"*"},{"name":"sweep_table","neurodata_type_inc":"SweepTable","doc":"[DEPRECATED] Table used to group different PatchClampSeries. SweepTable is being replaced by IntracellularRecordingsTable and SimultaneousRecordingsTable tables. Additional SequentialRecordingsTable, RepetitionsTable and ExperimentalConditions tables provide enhanced support for experiment metadata.","quantity":"?"},{"name":"intracellular_recordings","neurodata_type_inc":"IntracellularRecordingsTable","doc":"A table to group together a stimulus and response from a single electrode and a single simultaneous recording. Each row in the table represents a single recording consisting typically of a stimulus and a corresponding response. In some cases, however, only a stimulus or a response are recorded as as part of an experiment. In this case both, the stimulus and response will point to the same TimeSeries while the idx_start and count of the invalid column will be set to -1, thus, indicating that no values have been recorded for the stimulus or response, respectively. Note, a recording MUST contain at least a stimulus or a response. Typically the stimulus and response are PatchClampSeries. However, the use of AD/DA channels that are not associated to an electrode is also common in intracellular electrophysiology, in which case other TimeSeries may be used.","quantity":"?"},{"name":"simultaneous_recordings","neurodata_type_inc":"SimultaneousRecordingsTable","doc":"A table for grouping different intracellular recordings from the IntracellularRecordingsTable table together that were recorded simultaneously from different electrodes","quantity":"?"},{"name":"sequential_recordings","neurodata_type_inc":"SequentialRecordingsTable","doc":"A table for grouping different sequential recordings from the SimultaneousRecordingsTable table together. This is typically used to group together sequential recordings where the a sequence of stimuli of the same type with varying parameters have been presented in a sequence.","quantity":"?"},{"name":"repetitions","neurodata_type_inc":"RepetitionsTable","doc":"A table for grouping different sequential intracellular recordings together. With each SequentialRecording typically representing a particular type of stimulus, the RepetitionsTable table is typically used to group sets of stimuli applied in sequence.","quantity":"?"},{"name":"experimental_conditions","neurodata_type_inc":"ExperimentalConditionsTable","doc":"A table for grouping different intracellular recording repetitions together that belong to the same experimental experimental_conditions.","quantity":"?"}]},{"name":"optogenetics","doc":"Metadata describing optogenetic stimuluation.","quantity":"?","groups":[{"neurodata_type_inc":"OptogeneticStimulusSite","doc":"An optogenetic stimulation site.","quantity":"*"}]},{"name":"optophysiology","doc":"Metadata related to optophysiology.","quantity":"?","groups":[{"neurodata_type_inc":"ImagingPlane","doc":"An imaging plane.","quantity":"*"}]}]},{"name":"intervals","doc":"Experimental intervals, whether that be logically distinct sub-experiments having a particular scientific goal, trials (see trials subgroup) during an experiment, or epochs (see epochs subgroup) deriving from analysis of data.","quantity":"?","groups":[{"name":"epochs","neurodata_type_inc":"TimeIntervals","doc":"Divisions in time marking experimental stages or sub-divisions of a single recording session.","quantity":"?"},{"name":"trials","neurodata_type_inc":"TimeIntervals","doc":"Repeated experimental events that have a logical grouping.","quantity":"?"},{"name":"invalid_times","neurodata_type_inc":"TimeIntervals","doc":"Time intervals that should be removed from analysis.","quantity":"?"},{"neurodata_type_inc":"TimeIntervals","doc":"Optional additional table(s) for describing other experimental time intervals.","quantity":"*"}]},{"name":"units","neurodata_type_inc":"Units","doc":"Data about sorted spike units.","quantity":"?"}]},{"neurodata_type_def":"LabMetaData","neurodata_type_inc":"NWBContainer","doc":"Lab-specific meta-data."},{"neurodata_type_def":"Subject","neurodata_type_inc":"NWBContainer","doc":"Information about the animal or person from which the data was measured.","datasets":[{"name":"age","dtype":"text","doc":"Age of subject. Can be supplied instead of 'date_of_birth'.","quantity":"?","attributes":[{"name":"reference","doc":"Age is with reference to this event. Can be 'birth' or 'gestational'. If reference is omitted, 'birth' is implied.","dtype":"text","required":false,"default_value":"birth"}]},{"name":"date_of_birth","dtype":"isodatetime","doc":"Date of birth of subject. Can be supplied instead of 'age'.","quantity":"?"},{"name":"description","dtype":"text","doc":"Description of subject and where subject came from (e.g., breeder, if animal).","quantity":"?"},{"name":"genotype","dtype":"text","doc":"Genetic strain. If absent, assume Wild Type (WT).","quantity":"?"},{"name":"sex","dtype":"text","doc":"Gender of subject.","quantity":"?"},{"name":"species","dtype":"text","doc":"Species of subject.","quantity":"?"},{"name":"strain","dtype":"text","doc":"Strain of subject.","quantity":"?"},{"name":"subject_id","dtype":"text","doc":"ID of animal/person used/participating in experiment (lab convention).","quantity":"?"},{"name":"weight","dtype":"text","doc":"Weight at time of experiment, at time of surgery and at other important times.","quantity":"?"}]}],"datasets":[{"neurodata_type_def":"ScratchData","neurodata_type_inc":"NWBData","doc":"Any one-off datasets","attributes":[{"name":"notes","doc":"Any notes the user has about the dataset being stored","dtype":"text"}]}]})delimiter"; -const std::string nwb_misc = R"delimiter( +constexpr std::string_view nwb_misc = R"delimiter( {"groups":[{"neurodata_type_def":"AbstractFeatureSeries","neurodata_type_inc":"TimeSeries","doc":"Abstract features, such as quantitative descriptions of sensory stimuli. The TimeSeries::data field is a 2D array, storing those features (e.g., for visual grating stimulus this might be orientation, spatial frequency and contrast). Null stimuli (eg, uniform gray) can be marked as being an independent feature (eg, 1.0 for gray, 0.0 for actual stimulus) or by storing NaNs for feature values, or through use of the TimeSeries::control fields. A set of features is considered to persist until the next set of features is defined. The final set of features stored should be the null set. This is useful when storing the raw stimulus is impractical.","datasets":[{"name":"data","dtype":"numeric","dims":[["num_times"],["num_times","num_features"]],"shape":[[null],[null,null]],"doc":"Values of each feature at each time.","attributes":[{"name":"unit","dtype":"text","default_value":"see 'feature_units'","doc":"Since there can be different units for different features, store the units in 'feature_units'. The default value for this attribute is \"see 'feature_units'\".","required":false}]},{"name":"feature_units","dtype":"text","dims":["num_features"],"shape":[null],"doc":"Units of each feature.","quantity":"?"},{"name":"features","dtype":"text","dims":["num_features"],"shape":[null],"doc":"Description of the features represented in TimeSeries::data."}]},{"neurodata_type_def":"AnnotationSeries","neurodata_type_inc":"TimeSeries","doc":"Stores user annotations made during an experiment. The data[] field stores a text array, and timestamps are stored for each annotation (ie, interval=1). This is largely an alias to a standard TimeSeries storing a text array but that is identifiable as storing annotations in a machine-readable way.","datasets":[{"name":"data","dtype":"text","dims":["num_times"],"shape":[null],"doc":"Annotations made during an experiment.","attributes":[{"name":"resolution","dtype":"float32","value":-1.0,"doc":"Smallest meaningful difference between values in data. Annotations have no units, so the value is fixed to -1.0."},{"name":"unit","dtype":"text","value":"n/a","doc":"Base unit of measurement for working with the data. Annotations have no units, so the value is fixed to 'n/a'."}]}]},{"neurodata_type_def":"IntervalSeries","neurodata_type_inc":"TimeSeries","doc":"Stores intervals of data. The timestamps field stores the beginning and end of intervals. The data field stores whether the interval just started (>0 value) or ended (<0 value). Different interval types can be represented in the same series by using multiple key values (eg, 1 for feature A, 2 for feature B, 3 for feature C, etc). The field data stores an 8-bit integer. This is largely an alias of a standard TimeSeries but that is identifiable as representing time intervals in a machine-readable way.","datasets":[{"name":"data","dtype":"int8","dims":["num_times"],"shape":[null],"doc":"Use values >0 if interval started, <0 if interval ended.","attributes":[{"name":"resolution","dtype":"float32","value":-1.0,"doc":"Smallest meaningful difference between values in data. Annotations have no units, so the value is fixed to -1.0."},{"name":"unit","dtype":"text","value":"n/a","doc":"Base unit of measurement for working with the data. Annotations have no units, so the value is fixed to 'n/a'."}]}]},{"neurodata_type_def":"DecompositionSeries","neurodata_type_inc":"TimeSeries","doc":"Spectral analysis of a time series, e.g. of an LFP or a speech signal.","datasets":[{"name":"data","dtype":"numeric","dims":["num_times","num_channels","num_bands"],"shape":[null,null,null],"doc":"Data decomposed into frequency bands.","attributes":[{"name":"unit","dtype":"text","default_value":"no unit","doc":"Base unit of measurement for working with the data. Actual stored values are not necessarily stored in these units. To access the data in these units, multiply 'data' by 'conversion'."}]},{"name":"metric","dtype":"text","doc":"The metric used, e.g. phase, amplitude, power."},{"name":"source_channels","neurodata_type_inc":"DynamicTableRegion","doc":"DynamicTableRegion pointer to the channels that this decomposition series was generated from.","quantity":"?"}],"groups":[{"name":"bands","neurodata_type_inc":"DynamicTable","doc":"Table for describing the bands that this series was generated from. There should be one row in this table for each band.","datasets":[{"name":"band_name","neurodata_type_inc":"VectorData","dtype":"text","doc":"Name of the band, e.g. theta."},{"name":"band_limits","neurodata_type_inc":"VectorData","dtype":"float32","dims":["num_bands","low, high"],"shape":[null,2],"doc":"Low and high limit of each band in Hz. If it is a Gaussian filter, use 2 SD on either side of the center."},{"name":"band_mean","neurodata_type_inc":"VectorData","dtype":"float32","dims":["num_bands"],"shape":[null],"doc":"The mean Gaussian filters, in Hz."},{"name":"band_stdev","neurodata_type_inc":"VectorData","dtype":"float32","dims":["num_bands"],"shape":[null],"doc":"The standard deviation of Gaussian filters, in Hz."}]}],"links":[{"name":"source_timeseries","target_type":"TimeSeries","doc":"Link to TimeSeries object that this data was calculated from. Metadata about electrodes and their position can be read from that ElectricalSeries so it is not necessary to store that information here.","quantity":"?"}]},{"neurodata_type_def":"Units","neurodata_type_inc":"DynamicTable","default_name":"Units","doc":"Data about spiking units. Event times of observed units (e.g. cell, synapse, etc.) should be concatenated and stored in spike_times.","datasets":[{"name":"spike_times_index","neurodata_type_inc":"VectorIndex","doc":"Index into the spike_times dataset.","quantity":"?"},{"name":"spike_times","neurodata_type_inc":"VectorData","dtype":"float64","doc":"Spike times for each unit in seconds.","quantity":"?","attributes":[{"name":"resolution","dtype":"float64","doc":"The smallest possible difference between two spike times. Usually 1 divided by the acquisition sampling rate from which spike times were extracted, but could be larger if the acquisition time series was downsampled or smaller if the acquisition time series was smoothed/interpolated and it is possible for the spike time to be between samples.","required":false}]},{"name":"obs_intervals_index","neurodata_type_inc":"VectorIndex","doc":"Index into the obs_intervals dataset.","quantity":"?"},{"name":"obs_intervals","neurodata_type_inc":"VectorData","dtype":"float64","dims":["num_intervals","start|end"],"shape":[null,2],"doc":"Observation intervals for each unit.","quantity":"?"},{"name":"electrodes_index","neurodata_type_inc":"VectorIndex","doc":"Index into electrodes.","quantity":"?"},{"name":"electrodes","neurodata_type_inc":"DynamicTableRegion","doc":"Electrode that each spike unit came from, specified using a DynamicTableRegion.","quantity":"?"},{"name":"electrode_group","neurodata_type_inc":"VectorData","dtype":{"target_type":"ElectrodeGroup","reftype":"object"},"doc":"Electrode group that each spike unit came from.","quantity":"?"},{"name":"waveform_mean","neurodata_type_inc":"VectorData","dtype":"float32","dims":[["num_units","num_samples"],["num_units","num_samples","num_electrodes"]],"shape":[[null,null],[null,null,null]],"doc":"Spike waveform mean for each spike unit.","quantity":"?","attributes":[{"name":"sampling_rate","dtype":"float32","doc":"Sampling rate, in hertz.","required":false},{"name":"unit","dtype":"text","value":"volts","doc":"Unit of measurement. This value is fixed to 'volts'.","required":false}]},{"name":"waveform_sd","neurodata_type_inc":"VectorData","dtype":"float32","dims":[["num_units","num_samples"],["num_units","num_samples","num_electrodes"]],"shape":[[null,null],[null,null,null]],"doc":"Spike waveform standard deviation for each spike unit.","quantity":"?","attributes":[{"name":"sampling_rate","dtype":"float32","doc":"Sampling rate, in hertz.","required":false},{"name":"unit","dtype":"text","value":"volts","doc":"Unit of measurement. This value is fixed to 'volts'.","required":false}]},{"name":"waveforms","neurodata_type_inc":"VectorData","dtype":"numeric","dims":["num_waveforms","num_samples"],"shape":[null,null],"doc":"Individual waveforms for each spike on each electrode. This is a doubly indexed column. The 'waveforms_index' column indexes which waveforms in this column belong to the same spike event for a given unit, where each waveform was recorded from a different electrode. The 'waveforms_index_index' column indexes the 'waveforms_index' column to indicate which spike events belong to a given unit. For example, if the 'waveforms_index_index' column has values [2, 5, 6], then the first 2 elements of the 'waveforms_index' column correspond to the 2 spike events of the first unit, the next 3 elements of the 'waveforms_index' column correspond to the 3 spike events of the second unit, and the next 1 element of the 'waveforms_index' column corresponds to the 1 spike event of the third unit. If the 'waveforms_index' column has values [3, 6, 8, 10, 12, 13], then the first 3 elements of the 'waveforms' column contain the 3 spike waveforms that were recorded from 3 different electrodes for the first spike time of the first unit. See https://nwb-schema.readthedocs.io/en/stable/format_description.html#doubly-ragged-arrays for a graphical representation of this example. When there is only one electrode for each unit (i.e., each spike time is associated with a single waveform), then the 'waveforms_index' column will have values 1, 2, ..., N, where N is the number of spike events. The number of electrodes for each spike event should be the same within a given unit. The 'electrodes' column should be used to indicate which electrodes are associated with each unit, and the order of the waveforms within a given unit x spike event should be in the same order as the electrodes referenced in the 'electrodes' column of this table. The number of samples for each waveform must be the same.","quantity":"?","attributes":[{"name":"sampling_rate","dtype":"float32","doc":"Sampling rate, in hertz.","required":false},{"name":"unit","dtype":"text","value":"volts","doc":"Unit of measurement. This value is fixed to 'volts'.","required":false}]},{"name":"waveforms_index","neurodata_type_inc":"VectorIndex","doc":"Index into the waveforms dataset. One value for every spike event. See 'waveforms' for more detail.","quantity":"?"},{"name":"waveforms_index_index","neurodata_type_inc":"VectorIndex","doc":"Index into the waveforms_index dataset. One value for every unit (row in the table). See 'waveforms' for more detail.","quantity":"?"}]}]})delimiter"; -const std::string nwb_behavior = R"delimiter( +constexpr std::string_view nwb_behavior = R"delimiter( {"groups":[{"neurodata_type_def":"SpatialSeries","neurodata_type_inc":"TimeSeries","doc":"Direction, e.g., of gaze or travel, or position. The TimeSeries::data field is a 2D array storing position or direction relative to some reference frame. Array structure: [num measurements] [num dimensions]. Each SpatialSeries has a text dataset reference_frame that indicates the zero-position, or the zero-axes for direction. For example, if representing gaze direction, 'straight-ahead' might be a specific pixel on the monitor, or some other point in space. For position data, the 0,0 point might be the top-left corner of an enclosure, as viewed from the tracking camera. The unit of data will indicate how to interpret SpatialSeries values.","datasets":[{"name":"data","dtype":"numeric","dims":[["num_times"],["num_times","x"],["num_times","x,y"],["num_times","x,y,z"]],"shape":[[null],[null,1],[null,2],[null,3]],"doc":"1-D or 2-D array storing position or direction relative to some reference frame.","attributes":[{"name":"unit","dtype":"text","default_value":"meters","doc":"Base unit of measurement for working with the data. The default value is 'meters'. Actual stored values are not necessarily stored in these units. To access the data in these units, multiply 'data' by 'conversion' and add 'offset'.","required":false}]},{"name":"reference_frame","dtype":"text","doc":"Description defining what exactly 'straight-ahead' means.","quantity":"?"}]},{"neurodata_type_def":"BehavioralEpochs","neurodata_type_inc":"NWBDataInterface","default_name":"BehavioralEpochs","doc":"TimeSeries for storing behavioral epochs. The objective of this and the other two Behavioral interfaces (e.g. BehavioralEvents and BehavioralTimeSeries) is to provide generic hooks for software tools/scripts. This allows a tool/script to take the output one specific interface (e.g., UnitTimes) and plot that data relative to another data modality (e.g., behavioral events) without having to define all possible modalities in advance. Declaring one of these interfaces means that one or more TimeSeries of the specified type is published. These TimeSeries should reside in a group having the same name as the interface. For example, if a BehavioralTimeSeries interface is declared, the module will have one or more TimeSeries defined in the module sub-group 'BehavioralTimeSeries'. BehavioralEpochs should use IntervalSeries. BehavioralEvents is used for irregular events. BehavioralTimeSeries is for continuous data.","groups":[{"neurodata_type_inc":"IntervalSeries","doc":"IntervalSeries object containing start and stop times of epochs.","quantity":"*"}]},{"neurodata_type_def":"BehavioralEvents","neurodata_type_inc":"NWBDataInterface","default_name":"BehavioralEvents","doc":"TimeSeries for storing behavioral events. See description of BehavioralEpochs for more details.","groups":[{"neurodata_type_inc":"TimeSeries","doc":"TimeSeries object containing behavioral events.","quantity":"*"}]},{"neurodata_type_def":"BehavioralTimeSeries","neurodata_type_inc":"NWBDataInterface","default_name":"BehavioralTimeSeries","doc":"TimeSeries for storing Behavoioral time series data. See description of BehavioralEpochs for more details.","groups":[{"neurodata_type_inc":"TimeSeries","doc":"TimeSeries object containing continuous behavioral data.","quantity":"*"}]},{"neurodata_type_def":"PupilTracking","neurodata_type_inc":"NWBDataInterface","default_name":"PupilTracking","doc":"Eye-tracking data, representing pupil size.","groups":[{"neurodata_type_inc":"TimeSeries","doc":"TimeSeries object containing time series data on pupil size.","quantity":"+"}]},{"neurodata_type_def":"EyeTracking","neurodata_type_inc":"NWBDataInterface","default_name":"EyeTracking","doc":"Eye-tracking data, representing direction of gaze.","groups":[{"neurodata_type_inc":"SpatialSeries","doc":"SpatialSeries object containing data measuring direction of gaze.","quantity":"*"}]},{"neurodata_type_def":"CompassDirection","neurodata_type_inc":"NWBDataInterface","default_name":"CompassDirection","doc":"With a CompassDirection interface, a module publishes a SpatialSeries object representing a floating point value for theta. The SpatialSeries::reference_frame field should indicate what direction corresponds to 0 and which is the direction of rotation (this should be clockwise). The si_unit for the SpatialSeries should be radians or degrees.","groups":[{"neurodata_type_inc":"SpatialSeries","doc":"SpatialSeries object containing direction of gaze travel.","quantity":"*"}]},{"neurodata_type_def":"Position","neurodata_type_inc":"NWBDataInterface","default_name":"Position","doc":"Position data, whether along the x, x/y or x/y/z axis.","groups":[{"neurodata_type_inc":"SpatialSeries","doc":"SpatialSeries object containing position data.","quantity":"+"}]}]})delimiter"; -const std::string nwb_ecephys = R"delimiter( +constexpr std::string_view nwb_ecephys = R"delimiter( {"groups":[{"neurodata_type_def":"ElectricalSeries","neurodata_type_inc":"TimeSeries","doc":"A time series of acquired voltage data from extracellular recordings. The data field is an int or float array storing data in volts. The first dimension should always represent time. The second dimension, if present, should represent channels.","attributes":[{"name":"filtering","dtype":"text","doc":"Filtering applied to all channels of the data. For example, if this ElectricalSeries represents high-pass-filtered data (also known as AP Band), then this value could be \"High-pass 4-pole Bessel filter at 500 Hz\". If this ElectricalSeries represents low-pass-filtered LFP data and the type of filter is unknown, then this value could be \"Low-pass filter at 300 Hz\". If a non-standard filter type is used, provide as much detail about the filter properties as possible.","required":false}],"datasets":[{"name":"data","dtype":"numeric","dims":[["num_times"],["num_times","num_channels"],["num_times","num_channels","num_samples"]],"shape":[[null],[null,null],[null,null,null]],"doc":"Recorded voltage data.","attributes":[{"name":"unit","dtype":"text","value":"volts","doc":"Base unit of measurement for working with the data. This value is fixed to 'volts'. Actual stored values are not necessarily stored in these units. To access the data in these units, multiply 'data' by 'conversion', followed by 'channel_conversion' (if present), and then add 'offset'."}]},{"name":"electrodes","neurodata_type_inc":"DynamicTableRegion","doc":"DynamicTableRegion pointer to the electrodes that this time series was generated from."},{"name":"channel_conversion","dtype":"float32","dims":["num_channels"],"shape":[null],"doc":"Channel-specific conversion factor. Multiply the data in the 'data' dataset by these values along the channel axis (as indicated by axis attribute) AND by the global conversion factor in the 'conversion' attribute of 'data' to get the data values in Volts, i.e, data in Volts = data * data.conversion * channel_conversion. This approach allows for both global and per-channel data conversion factors needed to support the storage of electrical recordings as native values generated by data acquisition systems. If this dataset is not present, then there is no channel-specific conversion factor, i.e. it is 1 for all channels.","quantity":"?","attributes":[{"name":"axis","dtype":"int32","value":1,"doc":"The zero-indexed axis of the 'data' dataset that the channel-specific conversion factor corresponds to. This value is fixed to 1."}]}]},{"neurodata_type_def":"SpikeEventSeries","neurodata_type_inc":"ElectricalSeries","doc":"Stores snapshots/snippets of recorded spike events (i.e., threshold crossings). This may also be raw data, as reported by ephys hardware. If so, the TimeSeries::description field should describe how events were detected. All SpikeEventSeries should reside in a module (under EventWaveform interface) even if the spikes were reported and stored by hardware. All events span the same recording channels and store snapshots of equal duration. TimeSeries::data array structure: [num events] [num channels] [num samples] (or [num events] [num samples] for single electrode).","datasets":[{"name":"data","dtype":"numeric","dims":[["num_events","num_samples"],["num_events","num_channels","num_samples"]],"shape":[[null,null],[null,null,null]],"doc":"Spike waveforms.","attributes":[{"name":"unit","dtype":"text","value":"volts","doc":"Unit of measurement for waveforms, which is fixed to 'volts'."}]},{"name":"timestamps","dtype":"float64","dims":["num_times"],"shape":[null],"doc":"Timestamps for samples stored in data, in seconds, relative to the common experiment master-clock stored in NWBFile.timestamps_reference_time. Timestamps are required for the events. Unlike for TimeSeries, timestamps are required for SpikeEventSeries and are thus re-specified here.","attributes":[{"name":"interval","dtype":"int32","value":1,"doc":"Value is '1'"},{"name":"unit","dtype":"text","value":"seconds","doc":"Unit of measurement for timestamps, which is fixed to 'seconds'."}]}]},{"neurodata_type_def":"FeatureExtraction","neurodata_type_inc":"NWBDataInterface","default_name":"FeatureExtraction","doc":"Features, such as PC1 and PC2, that are extracted from signals stored in a SpikeEventSeries or other source.","datasets":[{"name":"description","dtype":"text","dims":["num_features"],"shape":[null],"doc":"Description of features (eg, ''PC1'') for each of the extracted features."},{"name":"features","dtype":"float32","dims":["num_events","num_channels","num_features"],"shape":[null,null,null],"doc":"Multi-dimensional array of features extracted from each event."},{"name":"times","dtype":"float64","dims":["num_events"],"shape":[null],"doc":"Times of events that features correspond to (can be a link)."},{"name":"electrodes","neurodata_type_inc":"DynamicTableRegion","doc":"DynamicTableRegion pointer to the electrodes that this time series was generated from."}]},{"neurodata_type_def":"EventDetection","neurodata_type_inc":"NWBDataInterface","default_name":"EventDetection","doc":"Detected spike events from voltage trace(s).","datasets":[{"name":"detection_method","dtype":"text","doc":"Description of how events were detected, such as voltage threshold, or dV/dT threshold, as well as relevant values."},{"name":"source_idx","dtype":"int32","dims":["num_events"],"shape":[null],"doc":"Indices (zero-based) into source ElectricalSeries::data array corresponding to time of event. ''description'' should define what is meant by time of event (e.g., .25 ms before action potential peak, zero-crossing time, etc). The index points to each event from the raw data."},{"name":"times","dtype":"float64","dims":["num_events"],"shape":[null],"doc":"Timestamps of events, in seconds.","attributes":[{"name":"unit","dtype":"text","value":"seconds","doc":"Unit of measurement for event times, which is fixed to 'seconds'."}]}],"links":[{"name":"source_electricalseries","target_type":"ElectricalSeries","doc":"Link to the ElectricalSeries that this data was calculated from. Metadata about electrodes and their position can be read from that ElectricalSeries so it's not necessary to include that information here."}]},{"neurodata_type_def":"EventWaveform","neurodata_type_inc":"NWBDataInterface","default_name":"EventWaveform","doc":"Represents either the waveforms of detected events, as extracted from a raw data trace in /acquisition, or the event waveforms that were stored during experiment acquisition.","groups":[{"neurodata_type_inc":"SpikeEventSeries","doc":"SpikeEventSeries object(s) containing detected spike event waveforms.","quantity":"*"}]},{"neurodata_type_def":"FilteredEphys","neurodata_type_inc":"NWBDataInterface","default_name":"FilteredEphys","doc":"Electrophysiology data from one or more channels that has been subjected to filtering. Examples of filtered data include Theta and Gamma (LFP has its own interface). FilteredEphys modules publish an ElectricalSeries for each filtered channel or set of channels. The name of each ElectricalSeries is arbitrary but should be informative. The source of the filtered data, whether this is from analysis of another time series or as acquired by hardware, should be noted in each's TimeSeries::description field. There is no assumed 1::1 correspondence between filtered ephys signals and electrodes, as a single signal can apply to many nearby electrodes, and one electrode may have different filtered (e.g., theta and/or gamma) signals represented. Filter properties should be noted in the ElectricalSeries 'filtering' attribute.","groups":[{"neurodata_type_inc":"ElectricalSeries","doc":"ElectricalSeries object(s) containing filtered electrophysiology data.","quantity":"+"}]},{"neurodata_type_def":"LFP","neurodata_type_inc":"NWBDataInterface","default_name":"LFP","doc":"LFP data from one or more channels. The electrode map in each published ElectricalSeries will identify which channels are providing LFP data. Filter properties should be noted in the ElectricalSeries 'filtering' attribute.","groups":[{"neurodata_type_inc":"ElectricalSeries","doc":"ElectricalSeries object(s) containing LFP data for one or more channels.","quantity":"+"}]},{"neurodata_type_def":"ElectrodeGroup","neurodata_type_inc":"NWBContainer","doc":"A physical grouping of electrodes, e.g. a shank of an array.","attributes":[{"name":"description","dtype":"text","doc":"Description of this electrode group."},{"name":"location","dtype":"text","doc":"Location of electrode group. Specify the area, layer, comments on estimation of area/layer, etc. Use standard atlas names for anatomical regions when possible."}],"datasets":[{"name":"position","dtype":[{"name":"x","dtype":"float32","doc":"x coordinate"},{"name":"y","dtype":"float32","doc":"y coordinate"},{"name":"z","dtype":"float32","doc":"z coordinate"}],"doc":"stereotaxic or common framework coordinates","quantity":"?"}],"links":[{"name":"device","target_type":"Device","doc":"Link to the device that was used to record from this electrode group."}]},{"neurodata_type_def":"ClusterWaveforms","neurodata_type_inc":"NWBDataInterface","default_name":"ClusterWaveforms","doc":"DEPRECATED The mean waveform shape, including standard deviation, of the different clusters. Ideally, the waveform analysis should be performed on data that is only high-pass filtered. This is a separate module because it is expected to require updating. For example, IMEC probes may require different storage requirements to store/display mean waveforms, requiring a new interface or an extension of this one.","datasets":[{"name":"waveform_filtering","dtype":"text","doc":"Filtering applied to data before generating mean/sd"},{"name":"waveform_mean","dtype":"float32","dims":["num_clusters","num_samples"],"shape":[null,null],"doc":"The mean waveform for each cluster, using the same indices for each wave as cluster numbers in the associated Clustering module (i.e, cluster 3 is in array slot [3]). Waveforms corresponding to gaps in cluster sequence should be empty (e.g., zero- filled)"},{"name":"waveform_sd","dtype":"float32","dims":["num_clusters","num_samples"],"shape":[null,null],"doc":"Stdev of waveforms for each cluster, using the same indices as in mean"}],"links":[{"name":"clustering_interface","target_type":"Clustering","doc":"Link to Clustering interface that was the source of the clustered data"}]},{"neurodata_type_def":"Clustering","neurodata_type_inc":"NWBDataInterface","default_name":"Clustering","doc":"DEPRECATED Clustered spike data, whether from automatic clustering tools (e.g., klustakwik) or as a result of manual sorting.","datasets":[{"name":"description","dtype":"text","doc":"Description of clusters or clustering, (e.g. cluster 0 is noise, clusters curated using Klusters, etc)"},{"name":"num","dtype":"int32","dims":["num_events"],"shape":[null],"doc":"Cluster number of each event"},{"name":"peak_over_rms","dtype":"float32","dims":["num_clusters"],"shape":[null],"doc":"Maximum ratio of waveform peak to RMS on any channel in the cluster (provides a basic clustering metric)."},{"name":"times","dtype":"float64","dims":["num_events"],"shape":[null],"doc":"Times of clustered events, in seconds. This may be a link to times field in associated FeatureExtraction module."}]}]})delimiter"; -const std::string nwb_icephys = R"delimiter( +constexpr std::string_view nwb_icephys = R"delimiter( {"groups":[{"neurodata_type_def":"PatchClampSeries","neurodata_type_inc":"TimeSeries","doc":"An abstract base class for patch-clamp data - stimulus or response, current or voltage.","attributes":[{"name":"stimulus_description","dtype":"text","doc":"Protocol/stimulus name for this patch-clamp dataset."},{"name":"sweep_number","dtype":"uint32","doc":"Sweep number, allows to group different PatchClampSeries together.","required":false}],"datasets":[{"name":"data","dtype":"numeric","dims":["num_times"],"shape":[null],"doc":"Recorded voltage or current.","attributes":[{"name":"unit","dtype":"text","doc":"Base unit of measurement for working with the data. Actual stored values are not necessarily stored in these units. To access the data in these units, multiply 'data' by 'conversion' and add 'offset'."}]},{"name":"gain","dtype":"float32","doc":"Gain of the recording, in units Volt/Amp (v-clamp) or Volt/Volt (c-clamp).","quantity":"?"}],"links":[{"name":"electrode","target_type":"IntracellularElectrode","doc":"Link to IntracellularElectrode object that describes the electrode that was used to apply or record this data."}]},{"neurodata_type_def":"CurrentClampSeries","neurodata_type_inc":"PatchClampSeries","doc":"Voltage data from an intracellular current-clamp recording. A corresponding CurrentClampStimulusSeries (stored separately as a stimulus) is used to store the current injected.","datasets":[{"name":"data","doc":"Recorded voltage.","attributes":[{"name":"unit","dtype":"text","value":"volts","doc":"Base unit of measurement for working with the data. which is fixed to 'volts'. Actual stored values are not necessarily stored in these units. To access the data in these units, multiply 'data' by 'conversion' and add 'offset'."}]},{"name":"bias_current","dtype":"float32","doc":"Bias current, in amps.","quantity":"?"},{"name":"bridge_balance","dtype":"float32","doc":"Bridge balance, in ohms.","quantity":"?"},{"name":"capacitance_compensation","dtype":"float32","doc":"Capacitance compensation, in farads.","quantity":"?"}]},{"neurodata_type_def":"IZeroClampSeries","neurodata_type_inc":"CurrentClampSeries","doc":"Voltage data from an intracellular recording when all current and amplifier settings are off (i.e., CurrentClampSeries fields will be zero). There is no CurrentClampStimulusSeries associated with an IZero series because the amplifier is disconnected and no stimulus can reach the cell.","attributes":[{"name":"stimulus_description","dtype":"text","doc":"An IZeroClampSeries has no stimulus, so this attribute is automatically set to \"N/A\"","value":"N/A"}],"datasets":[{"name":"bias_current","dtype":"float32","value":0.0,"doc":"Bias current, in amps, fixed to 0.0."},{"name":"bridge_balance","dtype":"float32","value":0.0,"doc":"Bridge balance, in ohms, fixed to 0.0."},{"name":"capacitance_compensation","dtype":"float32","value":0.0,"doc":"Capacitance compensation, in farads, fixed to 0.0."}]},{"neurodata_type_def":"CurrentClampStimulusSeries","neurodata_type_inc":"PatchClampSeries","doc":"Stimulus current applied during current clamp recording.","datasets":[{"name":"data","doc":"Stimulus current applied.","attributes":[{"name":"unit","dtype":"text","value":"amperes","doc":"Base unit of measurement for working with the data. which is fixed to 'amperes'. Actual stored values are not necessarily stored in these units. To access the data in these units, multiply 'data' by 'conversion' and add 'offset'."}]}]},{"neurodata_type_def":"VoltageClampSeries","neurodata_type_inc":"PatchClampSeries","doc":"Current data from an intracellular voltage-clamp recording. A corresponding VoltageClampStimulusSeries (stored separately as a stimulus) is used to store the voltage injected.","datasets":[{"name":"data","doc":"Recorded current.","attributes":[{"name":"unit","dtype":"text","value":"amperes","doc":"Base unit of measurement for working with the data. which is fixed to 'amperes'. Actual stored values are not necessarily stored in these units. To access the data in these units, multiply 'data' by 'conversion' and add 'offset'."}]},{"name":"capacitance_fast","dtype":"float32","doc":"Fast capacitance, in farads.","quantity":"?","attributes":[{"name":"unit","dtype":"text","value":"farads","doc":"Unit of measurement for capacitance_fast, which is fixed to 'farads'."}]},{"name":"capacitance_slow","dtype":"float32","doc":"Slow capacitance, in farads.","quantity":"?","attributes":[{"name":"unit","dtype":"text","value":"farads","doc":"Unit of measurement for capacitance_fast, which is fixed to 'farads'."}]},{"name":"resistance_comp_bandwidth","dtype":"float32","doc":"Resistance compensation bandwidth, in hertz.","quantity":"?","attributes":[{"name":"unit","dtype":"text","value":"hertz","doc":"Unit of measurement for resistance_comp_bandwidth, which is fixed to 'hertz'."}]},{"name":"resistance_comp_correction","dtype":"float32","doc":"Resistance compensation correction, in percent.","quantity":"?","attributes":[{"name":"unit","dtype":"text","value":"percent","doc":"Unit of measurement for resistance_comp_correction, which is fixed to 'percent'."}]},{"name":"resistance_comp_prediction","dtype":"float32","doc":"Resistance compensation prediction, in percent.","quantity":"?","attributes":[{"name":"unit","dtype":"text","value":"percent","doc":"Unit of measurement for resistance_comp_prediction, which is fixed to 'percent'."}]},{"name":"whole_cell_capacitance_comp","dtype":"float32","doc":"Whole cell capacitance compensation, in farads.","quantity":"?","attributes":[{"name":"unit","dtype":"text","value":"farads","doc":"Unit of measurement for whole_cell_capacitance_comp, which is fixed to 'farads'."}]},{"name":"whole_cell_series_resistance_comp","dtype":"float32","doc":"Whole cell series resistance compensation, in ohms.","quantity":"?","attributes":[{"name":"unit","dtype":"text","value":"ohms","doc":"Unit of measurement for whole_cell_series_resistance_comp, which is fixed to 'ohms'."}]}]},{"neurodata_type_def":"VoltageClampStimulusSeries","neurodata_type_inc":"PatchClampSeries","doc":"Stimulus voltage applied during a voltage clamp recording.","datasets":[{"name":"data","doc":"Stimulus voltage applied.","attributes":[{"name":"unit","dtype":"text","value":"volts","doc":"Base unit of measurement for working with the data. which is fixed to 'volts'. Actual stored values are not necessarily stored in these units. To access the data in these units, multiply 'data' by 'conversion' and add 'offset'."}]}]},{"neurodata_type_def":"IntracellularElectrode","neurodata_type_inc":"NWBContainer","doc":"An intracellular electrode and its metadata.","datasets":[{"name":"cell_id","dtype":"text","doc":"unique ID of the cell","quantity":"?"},{"name":"description","dtype":"text","doc":"Description of electrode (e.g., whole-cell, sharp, etc.)."},{"name":"filtering","dtype":"text","doc":"Electrode specific filtering.","quantity":"?"},{"name":"initial_access_resistance","dtype":"text","doc":"Initial access resistance.","quantity":"?"},{"name":"location","dtype":"text","doc":"Location of the electrode. Specify the area, layer, comments on estimation of area/layer, stereotaxic coordinates if in vivo, etc. Use standard atlas names for anatomical regions when possible.","quantity":"?"},{"name":"resistance","dtype":"text","doc":"Electrode resistance, in ohms.","quantity":"?"},{"name":"seal","dtype":"text","doc":"Information about seal used for recording.","quantity":"?"},{"name":"slice","dtype":"text","doc":"Information about slice used for recording.","quantity":"?"}],"links":[{"name":"device","target_type":"Device","doc":"Device that was used to record from this electrode."}]},{"neurodata_type_def":"SweepTable","neurodata_type_inc":"DynamicTable","doc":"[DEPRECATED] Table used to group different PatchClampSeries. SweepTable is being replaced by IntracellularRecordingsTable and SimultaneousRecordingsTable tables. Additional SequentialRecordingsTable, RepetitionsTable, and ExperimentalConditions tables provide enhanced support for experiment metadata.","datasets":[{"name":"sweep_number","neurodata_type_inc":"VectorData","dtype":"uint32","doc":"Sweep number of the PatchClampSeries in that row."},{"name":"series","neurodata_type_inc":"VectorData","dtype":{"target_type":"PatchClampSeries","reftype":"object"},"doc":"The PatchClampSeries with the sweep number in that row."},{"name":"series_index","neurodata_type_inc":"VectorIndex","doc":"Index for series."}]},{"neurodata_type_def":"IntracellularElectrodesTable","neurodata_type_inc":"DynamicTable","doc":"Table for storing intracellular electrode related metadata.","attributes":[{"name":"description","dtype":"text","value":"Table for storing intracellular electrode related metadata.","doc":"Description of what is in this dynamic table."}],"datasets":[{"name":"electrode","neurodata_type_inc":"VectorData","dtype":{"target_type":"IntracellularElectrode","reftype":"object"},"doc":"Column for storing the reference to the intracellular electrode."}]},{"neurodata_type_def":"IntracellularStimuliTable","neurodata_type_inc":"DynamicTable","doc":"Table for storing intracellular stimulus related metadata.","attributes":[{"name":"description","dtype":"text","value":"Table for storing intracellular stimulus related metadata.","doc":"Description of what is in this dynamic table."}],"datasets":[{"name":"stimulus","neurodata_type_inc":"TimeSeriesReferenceVectorData","doc":"Column storing the reference to the recorded stimulus for the recording (rows)."},{"name":"stimulus_template","neurodata_type_inc":"TimeSeriesReferenceVectorData","doc":"Column storing the reference to the stimulus template for the recording (rows).","quantity":"?"}]},{"neurodata_type_def":"IntracellularResponsesTable","neurodata_type_inc":"DynamicTable","doc":"Table for storing intracellular response related metadata.","attributes":[{"name":"description","dtype":"text","value":"Table for storing intracellular response related metadata.","doc":"Description of what is in this dynamic table."}],"datasets":[{"name":"response","neurodata_type_inc":"TimeSeriesReferenceVectorData","doc":"Column storing the reference to the recorded response for the recording (rows)"}]},{"neurodata_type_def":"IntracellularRecordingsTable","neurodata_type_inc":"AlignedDynamicTable","name":"intracellular_recordings","doc":"A table to group together a stimulus and response from a single electrode and a single simultaneous recording. Each row in the table represents a single recording consisting typically of a stimulus and a corresponding response. In some cases, however, only a stimulus or a response is recorded as part of an experiment. In this case, both the stimulus and response will point to the same TimeSeries while the idx_start and count of the invalid column will be set to -1, thus, indicating that no values have been recorded for the stimulus or response, respectively. Note, a recording MUST contain at least a stimulus or a response. Typically the stimulus and response are PatchClampSeries. However, the use of AD/DA channels that are not associated to an electrode is also common in intracellular electrophysiology, in which case other TimeSeries may be used.","attributes":[{"name":"description","dtype":"text","value":"A table to group together a stimulus and response from a single electrode and a single simultaneous recording and for storing metadata about the intracellular recording.","doc":"Description of the contents of this table. Inherited from AlignedDynamicTable and overwritten here to fix the value of the attribute."}],"groups":[{"name":"electrodes","neurodata_type_inc":"IntracellularElectrodesTable","doc":"Table for storing intracellular electrode related metadata."},{"name":"stimuli","neurodata_type_inc":"IntracellularStimuliTable","doc":"Table for storing intracellular stimulus related metadata."},{"name":"responses","neurodata_type_inc":"IntracellularResponsesTable","doc":"Table for storing intracellular response related metadata."}]},{"neurodata_type_def":"SimultaneousRecordingsTable","neurodata_type_inc":"DynamicTable","name":"simultaneous_recordings","doc":"A table for grouping different intracellular recordings from the IntracellularRecordingsTable table together that were recorded simultaneously from different electrodes.","datasets":[{"name":"recordings","neurodata_type_inc":"DynamicTableRegion","doc":"A reference to one or more rows in the IntracellularRecordingsTable table.","attributes":[{"name":"table","dtype":{"target_type":"IntracellularRecordingsTable","reftype":"object"},"doc":"Reference to the IntracellularRecordingsTable table that this table region applies to. This specializes the attribute inherited from DynamicTableRegion to fix the type of table that can be referenced here."}]},{"name":"recordings_index","neurodata_type_inc":"VectorIndex","doc":"Index dataset for the recordings column."}]},{"neurodata_type_def":"SequentialRecordingsTable","neurodata_type_inc":"DynamicTable","name":"sequential_recordings","doc":"A table for grouping different sequential recordings from the SimultaneousRecordingsTable table together. This is typically used to group together sequential recordings where a sequence of stimuli of the same type with varying parameters have been presented in a sequence.","datasets":[{"name":"simultaneous_recordings","neurodata_type_inc":"DynamicTableRegion","doc":"A reference to one or more rows in the SimultaneousRecordingsTable table.","attributes":[{"name":"table","dtype":{"target_type":"SimultaneousRecordingsTable","reftype":"object"},"doc":"Reference to the SimultaneousRecordingsTable table that this table region applies to. This specializes the attribute inherited from DynamicTableRegion to fix the type of table that can be referenced here."}]},{"name":"simultaneous_recordings_index","neurodata_type_inc":"VectorIndex","doc":"Index dataset for the simultaneous_recordings column."},{"name":"stimulus_type","neurodata_type_inc":"VectorData","dtype":"text","doc":"The type of stimulus used for the sequential recording."}]},{"neurodata_type_def":"RepetitionsTable","neurodata_type_inc":"DynamicTable","name":"repetitions","doc":"A table for grouping different sequential intracellular recordings together. With each SequentialRecording typically representing a particular type of stimulus, the RepetitionsTable table is typically used to group sets of stimuli applied in sequence.","datasets":[{"name":"sequential_recordings","neurodata_type_inc":"DynamicTableRegion","doc":"A reference to one or more rows in the SequentialRecordingsTable table.","attributes":[{"name":"table","dtype":{"target_type":"SequentialRecordingsTable","reftype":"object"},"doc":"Reference to the SequentialRecordingsTable table that this table region applies to. This specializes the attribute inherited from DynamicTableRegion to fix the type of table that can be referenced here."}]},{"name":"sequential_recordings_index","neurodata_type_inc":"VectorIndex","doc":"Index dataset for the sequential_recordings column."}]},{"neurodata_type_def":"ExperimentalConditionsTable","neurodata_type_inc":"DynamicTable","name":"experimental_conditions","doc":"A table for grouping different intracellular recording repetitions together that belong to the same experimental condition.","datasets":[{"name":"repetitions","neurodata_type_inc":"DynamicTableRegion","doc":"A reference to one or more rows in the RepetitionsTable table.","attributes":[{"name":"table","dtype":{"target_type":"RepetitionsTable","reftype":"object"},"doc":"Reference to the RepetitionsTable table that this table region applies to. This specializes the attribute inherited from DynamicTableRegion to fix the type of table that can be referenced here."}]},{"name":"repetitions_index","neurodata_type_inc":"VectorIndex","doc":"Index dataset for the repetitions column."}]}]})delimiter"; -const std::string nwb_ogen = R"delimiter( +constexpr std::string_view nwb_ogen = R"delimiter( {"groups":[{"neurodata_type_def":"OptogeneticSeries","neurodata_type_inc":"TimeSeries","doc":"An optogenetic stimulus.","datasets":[{"name":"data","dtype":"numeric","dims":[["num_times"],["num_times","num_rois"]],"shape":[[null],[null,null]],"doc":"Applied power for optogenetic stimulus, in watts. Shape can be 1D or 2D. 2D data is meant to be used in an extension of OptogeneticSeries that defines what the second dimension represents.","attributes":[{"name":"unit","dtype":"text","value":"watts","doc":"Unit of measurement for data, which is fixed to 'watts'."}]}],"links":[{"name":"site","target_type":"OptogeneticStimulusSite","doc":"Link to OptogeneticStimulusSite object that describes the site to which this stimulus was applied."}]},{"neurodata_type_def":"OptogeneticStimulusSite","neurodata_type_inc":"NWBContainer","doc":"A site of optogenetic stimulation.","datasets":[{"name":"description","dtype":"text","doc":"Description of stimulation site."},{"name":"excitation_lambda","dtype":"float32","doc":"Excitation wavelength, in nm."},{"name":"location","dtype":"text","doc":"Location of the stimulation site. Specify the area, layer, comments on estimation of area/layer, stereotaxic coordinates if in vivo, etc. Use standard atlas names for anatomical regions when possible."}],"links":[{"name":"device","target_type":"Device","doc":"Device that generated the stimulus."}]}]})delimiter"; -const std::string nwb_ophys = R"delimiter( +constexpr std::string_view nwb_ophys = R"delimiter( {"groups":[{"neurodata_type_def":"OnePhotonSeries","neurodata_type_inc":"ImageSeries","doc":"Image stack recorded over time from 1-photon microscope.","attributes":[{"name":"pmt_gain","dtype":"float32","doc":"Photomultiplier gain.","required":false},{"name":"scan_line_rate","dtype":"float32","doc":"Lines imaged per second. This is also stored in /general/optophysiology but is kept here as it is useful information for analysis, and so good to be stored w/ the actual data.","required":false},{"name":"exposure_time","dtype":"float32","doc":"Exposure time of the sample; often the inverse of the frequency.","required":false},{"name":"binning","dtype":"uint8","doc":"Amount of pixels combined into 'bins'; could be 1, 2, 4, 8, etc.","required":false},{"name":"power","dtype":"float32","doc":"Power of the excitation in mW, if known.","required":false},{"name":"intensity","dtype":"float32","doc":"Intensity of the excitation in mW/mm^2, if known.","required":false}],"links":[{"name":"imaging_plane","target_type":"ImagingPlane","doc":"Link to ImagingPlane object from which this TimeSeries data was generated."}]},{"neurodata_type_def":"TwoPhotonSeries","neurodata_type_inc":"ImageSeries","doc":"Image stack recorded over time from 2-photon microscope.","attributes":[{"name":"pmt_gain","dtype":"float32","doc":"Photomultiplier gain.","required":false},{"name":"scan_line_rate","dtype":"float32","doc":"Lines imaged per second. This is also stored in /general/optophysiology but is kept here as it is useful information for analysis, and so good to be stored w/ the actual data.","required":false}],"datasets":[{"name":"field_of_view","dtype":"float32","dims":[["width|height"],["width|height|depth"]],"shape":[[2],[3]],"doc":"Width, height and depth of image, or imaged area, in meters.","quantity":"?"}],"links":[{"name":"imaging_plane","target_type":"ImagingPlane","doc":"Link to ImagingPlane object from which this TimeSeries data was generated."}]},{"neurodata_type_def":"RoiResponseSeries","neurodata_type_inc":"TimeSeries","doc":"ROI responses over an imaging plane. The first dimension represents time. The second dimension, if present, represents ROIs.","datasets":[{"name":"data","dtype":"numeric","dims":[["num_times"],["num_times","num_ROIs"]],"shape":[[null],[null,null]],"doc":"Signals from ROIs."},{"name":"rois","neurodata_type_inc":"DynamicTableRegion","doc":"DynamicTableRegion referencing into an ROITable containing information on the ROIs stored in this timeseries."}]},{"neurodata_type_def":"DfOverF","neurodata_type_inc":"NWBDataInterface","default_name":"DfOverF","doc":"dF/F information about a region of interest (ROI). Storage hierarchy of dF/F should be the same as for segmentation (i.e., same names for ROIs and for image planes).","groups":[{"neurodata_type_inc":"RoiResponseSeries","doc":"RoiResponseSeries object(s) containing dF/F for a ROI.","quantity":"+"}]},{"neurodata_type_def":"Fluorescence","neurodata_type_inc":"NWBDataInterface","default_name":"Fluorescence","doc":"Fluorescence information about a region of interest (ROI). Storage hierarchy of fluorescence should be the same as for segmentation (ie, same names for ROIs and for image planes).","groups":[{"neurodata_type_inc":"RoiResponseSeries","doc":"RoiResponseSeries object(s) containing fluorescence data for a ROI.","quantity":"+"}]},{"neurodata_type_def":"ImageSegmentation","neurodata_type_inc":"NWBDataInterface","default_name":"ImageSegmentation","doc":"Stores pixels in an image that represent different regions of interest (ROIs) or masks. All segmentation for a given imaging plane is stored together, with storage for multiple imaging planes (masks) supported. Each ROI is stored in its own subgroup, with the ROI group containing both a 2D mask and a list of pixels that make up this mask. Segments can also be used for masking neuropil. If segmentation is allowed to change with time, a new imaging plane (or module) is required and ROI names should remain consistent between them.","groups":[{"neurodata_type_inc":"PlaneSegmentation","doc":"Results from image segmentation of a specific imaging plane.","quantity":"+"}]},{"neurodata_type_def":"PlaneSegmentation","neurodata_type_inc":"DynamicTable","doc":"Results from image segmentation of a specific imaging plane.","datasets":[{"name":"image_mask","neurodata_type_inc":"VectorData","dims":[["num_roi","num_x","num_y"],["num_roi","num_x","num_y","num_z"]],"shape":[[null,null,null],[null,null,null,null]],"doc":"ROI masks for each ROI. Each image mask is the size of the original imaging plane (or volume) and members of the ROI are finite non-zero.","quantity":"?"},{"name":"pixel_mask_index","neurodata_type_inc":"VectorIndex","doc":"Index into pixel_mask.","quantity":"?"},{"name":"pixel_mask","neurodata_type_inc":"VectorData","dtype":[{"name":"x","dtype":"uint32","doc":"Pixel x-coordinate."},{"name":"y","dtype":"uint32","doc":"Pixel y-coordinate."},{"name":"weight","dtype":"float32","doc":"Weight of the pixel."}],"doc":"Pixel masks for each ROI: a list of indices and weights for the ROI. Pixel masks are concatenated and parsing of this dataset is maintained by the PlaneSegmentation","quantity":"?"},{"name":"voxel_mask_index","neurodata_type_inc":"VectorIndex","doc":"Index into voxel_mask.","quantity":"?"},{"name":"voxel_mask","neurodata_type_inc":"VectorData","dtype":[{"name":"x","dtype":"uint32","doc":"Voxel x-coordinate."},{"name":"y","dtype":"uint32","doc":"Voxel y-coordinate."},{"name":"z","dtype":"uint32","doc":"Voxel z-coordinate."},{"name":"weight","dtype":"float32","doc":"Weight of the voxel."}],"doc":"Voxel masks for each ROI: a list of indices and weights for the ROI. Voxel masks are concatenated and parsing of this dataset is maintained by the PlaneSegmentation","quantity":"?"}],"groups":[{"name":"reference_images","doc":"Image stacks that the segmentation masks apply to.","groups":[{"neurodata_type_inc":"ImageSeries","doc":"One or more image stacks that the masks apply to (can be one-element stack).","quantity":"*"}]}],"links":[{"name":"imaging_plane","target_type":"ImagingPlane","doc":"Link to ImagingPlane object from which this data was generated."}]},{"neurodata_type_def":"ImagingPlane","neurodata_type_inc":"NWBContainer","doc":"An imaging plane and its metadata.","datasets":[{"name":"description","dtype":"text","doc":"Description of the imaging plane.","quantity":"?"},{"name":"excitation_lambda","dtype":"float32","doc":"Excitation wavelength, in nm."},{"name":"imaging_rate","dtype":"float32","doc":"Rate that images are acquired, in Hz. If the corresponding TimeSeries is present, the rate should be stored there instead.","quantity":"?"},{"name":"indicator","dtype":"text","doc":"Calcium indicator."},{"name":"location","dtype":"text","doc":"Location of the imaging plane. Specify the area, layer, comments on estimation of area/layer, stereotaxic coordinates if in vivo, etc. Use standard atlas names for anatomical regions when possible."},{"name":"manifold","dtype":"float32","dims":[["height","width","x, y, z"],["height","width","depth","x, y, z"]],"shape":[[null,null,3],[null,null,null,3]],"doc":"DEPRECATED Physical position of each pixel. 'xyz' represents the position of the pixel relative to the defined coordinate space. Deprecated in favor of origin_coords and grid_spacing.","quantity":"?","attributes":[{"name":"conversion","dtype":"float32","default_value":1.0,"doc":"Scalar to multiply each element in data to convert it to the specified 'unit'. If the data are stored in acquisition system units or other units that require a conversion to be interpretable, multiply the data by 'conversion' to convert the data to the specified 'unit'. e.g. if the data acquisition system stores values in this object as pixels from x = -500 to 499, y = -500 to 499 that correspond to a 2 m x 2 m range, then the 'conversion' multiplier to get from raw data acquisition pixel units to meters is 2/1000.","required":false},{"name":"unit","dtype":"text","default_value":"meters","doc":"Base unit of measurement for working with the data. The default value is 'meters'.","required":false}]},{"name":"origin_coords","dtype":"float32","dims":[["x, y"],["x, y, z"]],"shape":[[2],[3]],"doc":"Physical location of the first element of the imaging plane (0, 0) for 2-D data or (0, 0, 0) for 3-D data. See also reference_frame for what the physical location is relative to (e.g., bregma).","quantity":"?","attributes":[{"name":"unit","dtype":"text","default_value":"meters","doc":"Measurement units for origin_coords. The default value is 'meters'."}]},{"name":"grid_spacing","dtype":"float32","dims":[["x, y"],["x, y, z"]],"shape":[[2],[3]],"doc":"Space between pixels in (x, y) or voxels in (x, y, z) directions, in the specified unit. Assumes imaging plane is a regular grid. See also reference_frame to interpret the grid.","quantity":"?","attributes":[{"name":"unit","dtype":"text","default_value":"meters","doc":"Measurement units for grid_spacing. The default value is 'meters'."}]},{"name":"reference_frame","dtype":"text","doc":"Describes reference frame of origin_coords and grid_spacing. For example, this can be a text description of the anatomical location and orientation of the grid defined by origin_coords and grid_spacing or the vectors needed to transform or rotate the grid to a common anatomical axis (e.g., AP/DV/ML). This field is necessary to interpret origin_coords and grid_spacing. If origin_coords and grid_spacing are not present, then this field is not required. For example, if the microscope takes 10 x 10 x 2 images, where the first value of the data matrix (index (0, 0, 0)) corresponds to (-1.2, -0.6, -2) mm relative to bregma, the spacing between pixels is 0.2 mm in x, 0.2 mm in y and 0.5 mm in z, and larger numbers in x means more anterior, larger numbers in y means more rightward, and larger numbers in z means more ventral, then enter the following -- origin_coords = (-1.2, -0.6, -2) grid_spacing = (0.2, 0.2, 0.5) reference_frame = \"Origin coordinates are relative to bregma. First dimension corresponds to anterior-posterior axis (larger index = more anterior). Second dimension corresponds to medial-lateral axis (larger index = more rightward). Third dimension corresponds to dorsal-ventral axis (larger index = more ventral).\"","quantity":"?"}],"groups":[{"neurodata_type_inc":"OpticalChannel","doc":"An optical channel used to record from an imaging plane.","quantity":"+"}],"links":[{"name":"device","target_type":"Device","doc":"Link to the Device object that was used to record from this electrode."}]},{"neurodata_type_def":"OpticalChannel","neurodata_type_inc":"NWBContainer","doc":"An optical channel used to record from an imaging plane.","datasets":[{"name":"description","dtype":"text","doc":"Description or other notes about the channel."},{"name":"emission_lambda","dtype":"float32","doc":"Emission wavelength for channel, in nm."}]},{"neurodata_type_def":"MotionCorrection","neurodata_type_inc":"NWBDataInterface","default_name":"MotionCorrection","doc":"An image stack where all frames are shifted (registered) to a common coordinate system, to account for movement and drift between frames. Note: each frame at each point in time is assumed to be 2-D (has only x & y dimensions).","groups":[{"neurodata_type_inc":"CorrectedImageStack","doc":"Results from motion correction of an image stack.","quantity":"+"}]},{"neurodata_type_def":"CorrectedImageStack","neurodata_type_inc":"NWBDataInterface","doc":"Results from motion correction of an image stack.","groups":[{"name":"corrected","neurodata_type_inc":"ImageSeries","doc":"Image stack with frames shifted to the common coordinates."},{"name":"xy_translation","neurodata_type_inc":"TimeSeries","doc":"Stores the x,y delta necessary to align each frame to the common coordinates, for example, to align each frame to a reference image."}],"links":[{"name":"original","target_type":"ImageSeries","doc":"Link to ImageSeries object that is being registered."}]}]})delimiter"; -const std::string nwb_retinotopy = R"delimiter( +constexpr std::string_view nwb_retinotopy = R"delimiter( {"groups":[{"neurodata_type_def":"ImagingRetinotopy","neurodata_type_inc":"NWBDataInterface","default_name":"ImagingRetinotopy","doc":"DEPRECATED. Intrinsic signal optical imaging or widefield imaging for measuring retinotopy. Stores orthogonal maps (e.g., altitude/azimuth; radius/theta) of responses to specific stimuli and a combined polarity map from which to identify visual areas. This group does not store the raw responses imaged during retinotopic mapping or the stimuli presented, but rather the resulting phase and power maps after applying a Fourier transform on the averaged responses. Note: for data consistency, all images and arrays are stored in the format [row][column] and [row, col], which equates to [y][x]. Field of view and dimension arrays may appear backward (i.e., y before x).","datasets":[{"name":"axis_1_phase_map","dtype":"float32","dims":["num_rows","num_cols"],"shape":[null,null],"doc":"Phase response to stimulus on the first measured axis.","attributes":[{"name":"dimension","dtype":"int32","dims":["num_rows, num_cols"],"shape":[2],"doc":"Number of rows and columns in the image. NOTE: row, column representation is equivalent to height, width."},{"name":"field_of_view","dtype":"float32","dims":["height, width"],"shape":[2],"doc":"Size of viewing area, in meters."},{"name":"unit","dtype":"text","doc":"Unit that axis data is stored in (e.g., degrees)."}]},{"name":"axis_1_power_map","dtype":"float32","dims":["num_rows","num_cols"],"shape":[null,null],"doc":"Power response on the first measured axis. Response is scaled so 0.0 is no power in the response and 1.0 is maximum relative power.","quantity":"?","attributes":[{"name":"dimension","dtype":"int32","dims":["num_rows, num_cols"],"shape":[2],"doc":"Number of rows and columns in the image. NOTE: row, column representation is equivalent to height, width."},{"name":"field_of_view","dtype":"float32","dims":["height, width"],"shape":[2],"doc":"Size of viewing area, in meters."},{"name":"unit","dtype":"text","doc":"Unit that axis data is stored in (e.g., degrees)."}]},{"name":"axis_2_phase_map","dtype":"float32","dims":["num_rows","num_cols"],"shape":[null,null],"doc":"Phase response to stimulus on the second measured axis.","attributes":[{"name":"dimension","dtype":"int32","dims":["num_rows, num_cols"],"shape":[2],"doc":"Number of rows and columns in the image. NOTE: row, column representation is equivalent to height, width."},{"name":"field_of_view","dtype":"float32","dims":["height, width"],"shape":[2],"doc":"Size of viewing area, in meters."},{"name":"unit","dtype":"text","doc":"Unit that axis data is stored in (e.g., degrees)."}]},{"name":"axis_2_power_map","dtype":"float32","dims":["num_rows","num_cols"],"shape":[null,null],"doc":"Power response on the second measured axis. Response is scaled so 0.0 is no power in the response and 1.0 is maximum relative power.","quantity":"?","attributes":[{"name":"dimension","dtype":"int32","dims":["num_rows, num_cols"],"shape":[2],"doc":"Number of rows and columns in the image. NOTE: row, column representation is equivalent to height, width."},{"name":"field_of_view","dtype":"float32","dims":["height, width"],"shape":[2],"doc":"Size of viewing area, in meters."},{"name":"unit","dtype":"text","doc":"Unit that axis data is stored in (e.g., degrees)."}]},{"name":"axis_descriptions","dtype":"text","dims":["axis_1, axis_2"],"shape":[2],"doc":"Two-element array describing the contents of the two response axis fields. Description should be something like ['altitude', 'azimuth'] or '['radius', 'theta']."},{"name":"focal_depth_image","dtype":"uint16","dims":["num_rows","num_cols"],"shape":[null,null],"doc":"Gray-scale image taken with same settings/parameters (e.g., focal depth, wavelength) as data collection. Array format: [rows][columns].","quantity":"?","attributes":[{"name":"bits_per_pixel","dtype":"int32","doc":"Number of bits used to represent each value. This is necessary to determine maximum (white) pixel value."},{"name":"dimension","dtype":"int32","dims":["num_rows, num_cols"],"shape":[2],"doc":"Number of rows and columns in the image. NOTE: row, column representation is equivalent to height, width."},{"name":"field_of_view","dtype":"float32","dims":["height, width"],"shape":[2],"doc":"Size of viewing area, in meters."},{"name":"focal_depth","dtype":"float32","doc":"Focal depth offset, in meters."},{"name":"format","dtype":"text","doc":"Format of image. Right now only 'raw' is supported."}]},{"name":"sign_map","dtype":"float32","dims":["num_rows","num_cols"],"shape":[null,null],"doc":"Sine of the angle between the direction of the gradient in axis_1 and axis_2.","quantity":"?","attributes":[{"name":"dimension","dtype":"int32","dims":["num_rows, num_cols"],"shape":[2],"doc":"Number of rows and columns in the image. NOTE: row, column representation is equivalent to height, width."},{"name":"field_of_view","dtype":"float32","dims":["height, width"],"shape":[2],"doc":"Size of viewing area, in meters."}]},{"name":"vasculature_image","dtype":"uint16","dims":["num_rows","num_cols"],"shape":[null,null],"doc":"Gray-scale anatomical image of cortical surface. Array structure: [rows][columns]","attributes":[{"name":"bits_per_pixel","dtype":"int32","doc":"Number of bits used to represent each value. This is necessary to determine maximum (white) pixel value"},{"name":"dimension","dtype":"int32","dims":["num_rows, num_cols"],"shape":[2],"doc":"Number of rows and columns in the image. NOTE: row, column representation is equivalent to height, width."},{"name":"field_of_view","dtype":"float32","dims":["height, width"],"shape":[2],"doc":"Size of viewing area, in meters."},{"name":"format","dtype":"text","doc":"Format of image. Right now only 'raw' is supported."}]}]}]})delimiter"; -const std::string namespaces = R"delimiter( +constexpr std::string_view namespaces = R"delimiter( {"namespaces":[{"name":"core","doc":"NWB namespace","author":["Andrew Tritt","Oliver Ruebel","Ryan Ly","Ben Dichter","Keith Godfrey","Jeff Teeters"],"contact":["ajtritt@lbl.gov","oruebel@lbl.gov","rly@lbl.gov","bdichter@lbl.gov","keithg@alleninstitute.org","jteeters@berkeley.edu"],"full_name":"NWB core","schema":[{"namespace":"hdmf-common"},{"source":"nwb.base"},{"source":"nwb.device"},{"source":"nwb.epoch"},{"source":"nwb.image"},{"source":"nwb.file"},{"source":"nwb.misc"},{"source":"nwb.behavior"},{"source":"nwb.ecephys"},{"source":"nwb.icephys"},{"source":"nwb.ogen"},{"source":"nwb.ophys"},{"source":"nwb.retinotopy"}],"version":"2.7.0"}]})delimiter"; -void registerVariables(std::map& registry) -{ - registry["nwb.base"] = &nwb_base; - registry["nwb.device"] = &nwb_device; - registry["nwb.epoch"] = &nwb_epoch; - registry["nwb.image"] = &nwb_image; - registry["nwb.file"] = &nwb_file; - registry["nwb.misc"] = &nwb_misc; - registry["nwb.behavior"] = &nwb_behavior; - registry["nwb.ecephys"] = &nwb_ecephys; - registry["nwb.icephys"] = &nwb_icephys; - registry["nwb.ogen"] = &nwb_ogen; - registry["nwb.ophys"] = &nwb_ophys; - registry["nwb.retinotopy"] = &nwb_retinotopy; - registry["namespace"] = &namespaces; -}; +constexpr std::array, 13> specVariables {{ + {"nwb.base", nwb_base}, + {"nwb.device", nwb_device}, + {"nwb.epoch", nwb_epoch}, + {"nwb.image", nwb_image}, + {"nwb.file", nwb_file}, + {"nwb.misc", nwb_misc}, + {"nwb.behavior", nwb_behavior}, + {"nwb.ecephys", nwb_ecephys}, + {"nwb.icephys", nwb_icephys}, + {"nwb.ogen", nwb_ogen}, + {"nwb.ophys", nwb_ophys}, + {"nwb.retinotopy", nwb_retinotopy}, + {"namespace", namespaces} +}}; } // namespace AQNWB::spec::core diff --git a/src/spec/hdmf_common.hpp b/src/spec/hdmf_common.hpp index b6659701..9e26297f 100644 --- a/src/spec/hdmf_common.hpp +++ b/src/spec/hdmf_common.hpp @@ -1,29 +1,30 @@ #pragma once #include +#include +#include namespace AQNWB::spec::hdmf_common { const std::string version = "1.8.0"; -const std::string base = R"delimiter( +constexpr std::string_view base = R"delimiter( {"datasets":[{"data_type_def":"Data","doc":"An abstract data type for a dataset."}],"groups":[{"data_type_def":"Container","doc":"An abstract data type for a group storing collections of data and metadata. Base type for all data and metadata containers."},{"data_type_def":"SimpleMultiContainer","data_type_inc":"Container","doc":"A simple Container for holding onto multiple containers.","datasets":[{"data_type_inc":"Data","quantity":"*","doc":"Data objects held within this SimpleMultiContainer."}],"groups":[{"data_type_inc":"Container","quantity":"*","doc":"Container objects held within this SimpleMultiContainer."}]}]})delimiter"; -const std::string table = R"delimiter( +constexpr std::string_view table = R"delimiter( {"datasets":[{"data_type_def":"VectorData","data_type_inc":"Data","doc":"An n-dimensional dataset representing a column of a DynamicTable. If used without an accompanying VectorIndex, first dimension is along the rows of the DynamicTable and each step along the first dimension is a cell of the larger table. VectorData can also be used to represent a ragged array if paired with a VectorIndex. This allows for storing arrays of varying length in a single cell of the DynamicTable by indexing into this VectorData. The first vector is at VectorData[0:VectorIndex[0]]. The second vector is at VectorData[VectorIndex[0]:VectorIndex[1]], and so on.","dims":[["dim0"],["dim0","dim1"],["dim0","dim1","dim2"],["dim0","dim1","dim2","dim3"]],"shape":[[null],[null,null],[null,null,null],[null,null,null,null]],"attributes":[{"name":"description","dtype":"text","doc":"Description of what these vectors represent."}]},{"data_type_def":"VectorIndex","data_type_inc":"VectorData","dtype":"uint8","doc":"Used with VectorData to encode a ragged array. An array of indices into the first dimension of the target VectorData, and forming a map between the rows of a DynamicTable and the indices of the VectorData. The name of the VectorIndex is expected to be the name of the target VectorData object followed by \"_index\".","dims":["num_rows"],"shape":[null],"attributes":[{"name":"target","dtype":{"target_type":"VectorData","reftype":"object"},"doc":"Reference to the target dataset that this index applies to."}]},{"data_type_def":"ElementIdentifiers","data_type_inc":"Data","default_name":"element_id","dtype":"int","dims":["num_elements"],"shape":[null],"doc":"A list of unique identifiers for values within a dataset, e.g. rows of a DynamicTable."},{"data_type_def":"DynamicTableRegion","data_type_inc":"VectorData","dtype":"int","doc":"DynamicTableRegion provides a link from one table to an index or region of another. The `table` attribute is a link to another `DynamicTable`, indicating which table is referenced, and the data is int(s) indicating the row(s) (0-indexed) of the target array. `DynamicTableRegion`s can be used to associate rows with repeated meta-data without data duplication. They can also be used to create hierarchical relationships between multiple `DynamicTable`s. `DynamicTableRegion` objects may be paired with a `VectorIndex` object to create ragged references, so a single cell of a `DynamicTable` can reference many rows of another `DynamicTable`.","dims":["num_rows"],"shape":[null],"attributes":[{"name":"table","dtype":{"target_type":"DynamicTable","reftype":"object"},"doc":"Reference to the DynamicTable object that this region applies to."},{"name":"description","dtype":"text","doc":"Description of what this table region points to."}]}],"groups":[{"data_type_def":"DynamicTable","data_type_inc":"Container","doc":"A group containing multiple datasets that are aligned on the first dimension (Currently, this requirement if left up to APIs to check and enforce). These datasets represent different columns in the table. Apart from a column that contains unique identifiers for each row, there are no other required datasets. Users are free to add any number of custom VectorData objects (columns) here. DynamicTable also supports ragged array columns, where each element can be of a different size. To add a ragged array column, use a VectorIndex type to index the corresponding VectorData type. See documentation for VectorData and VectorIndex for more details. Unlike a compound data type, which is analogous to storing an array-of-structs, a DynamicTable can be thought of as a struct-of-arrays. This provides an alternative structure to choose from when optimizing storage for anticipated access patterns. Additionally, this type provides a way of creating a table without having to define a compound type up front. Although this convenience may be attractive, users should think carefully about how data will be accessed. DynamicTable is more appropriate for column-centric access, whereas a dataset with a compound type would be more appropriate for row-centric access. Finally, data size should also be taken into account. For small tables, performance loss may be an acceptable trade-off for the flexibility of a DynamicTable.","attributes":[{"name":"colnames","dtype":"text","dims":["num_columns"],"shape":[null],"doc":"The names of the columns in this table. This should be used to specify an order to the columns."},{"name":"description","dtype":"text","doc":"Description of what is in this dynamic table."}],"datasets":[{"name":"id","data_type_inc":"ElementIdentifiers","dtype":"int","dims":["num_rows"],"shape":[null],"doc":"Array of unique identifiers for the rows of this dynamic table."},{"data_type_inc":"VectorData","doc":"Vector columns, including index columns, of this dynamic table.","quantity":"*"}]},{"data_type_def":"AlignedDynamicTable","data_type_inc":"DynamicTable","doc":"DynamicTable container that supports storing a collection of sub-tables. Each sub-table is a DynamicTable itself that is aligned with the main table by row index. I.e., all DynamicTables stored in this group MUST have the same number of rows. This type effectively defines a 2-level table in which the main data is stored in the main table implemented by this type and additional columns of the table are grouped into categories, with each category being represented by a separate DynamicTable stored within the group.","attributes":[{"name":"categories","dtype":"text","dims":["num_categories"],"shape":[null],"doc":"The names of the categories in this AlignedDynamicTable. Each category is represented by one DynamicTable stored in the parent group. This attribute should be used to specify an order of categories and the category names must match the names of the corresponding DynamicTable in the group."}],"groups":[{"data_type_inc":"DynamicTable","doc":"A DynamicTable representing a particular category for columns in the AlignedDynamicTable parent container. The table MUST be aligned with (i.e., have the same number of rows) as all other DynamicTables stored in the AlignedDynamicTable parent container. The name of the category is given by the name of the DynamicTable and its description by the description attribute of the DynamicTable.","quantity":"*"}]}]})delimiter"; -const std::string sparse = R"delimiter( +constexpr std::string_view sparse = R"delimiter( {"groups":[{"data_type_def":"CSRMatrix","data_type_inc":"Container","doc":"A compressed sparse row matrix. Data are stored in the standard CSR format, where column indices for row i are stored in indices[indptr[i]:indptr[i+1]] and their corresponding values are stored in data[indptr[i]:indptr[i+1]].","attributes":[{"name":"shape","dtype":"uint","dims":["number of rows, number of columns"],"shape":[2],"doc":"The shape (number of rows, number of columns) of this sparse matrix."}],"datasets":[{"name":"indices","dtype":"uint","dims":["number of non-zero values"],"shape":[null],"doc":"The column indices."},{"name":"indptr","dtype":"uint","dims":["number of rows in the matrix + 1"],"shape":[null],"doc":"The row index pointer."},{"name":"data","dims":["number of non-zero values"],"shape":[null],"doc":"The non-zero values in the matrix."}]}]})delimiter"; -const std::string namespaces = R"delimiter( +constexpr std::string_view namespaces = R"delimiter( {"namespaces":[{"name":"hdmf-common","doc":"Common data structures provided by HDMF","author":["Andrew Tritt","Oliver Ruebel","Ryan Ly","Ben Dichter"],"contact":["ajtritt@lbl.gov","oruebel@lbl.gov","rly@lbl.gov","bdichter@lbl.gov"],"full_name":"HDMF Common","schema":[{"source":"base"},{"source":"table"},{"source":"sparse"}],"version":"1.8.0"}]})delimiter"; -void registerVariables(std::map& registry) -{ - registry["base"] = &base; - registry["table"] = &table; - registry["sparse"] = &sparse; - registry["namespace"] = &namespaces; -}; +constexpr std::array, 4> specVariables {{ + {"base", base}, + {"table", table}, + {"sparse", sparse}, + {"namespace", namespaces} +}}; } // namespace AQNWB::spec::hdmf_common diff --git a/src/spec/hdmf_experimental.hpp b/src/spec/hdmf_experimental.hpp index c9319532..7f2cfff2 100644 --- a/src/spec/hdmf_experimental.hpp +++ b/src/spec/hdmf_experimental.hpp @@ -1,25 +1,26 @@ #pragma once #include +#include +#include namespace AQNWB::spec::hdmf_experimental { const std::string version = "0.5.0"; -const std::string experimental = R"delimiter( +constexpr std::string_view experimental = R"delimiter( {"groups":[],"datasets":[{"data_type_def":"EnumData","data_type_inc":"VectorData","dtype":"uint8","doc":"Data that come from a fixed set of values. A data value of i corresponds to the i-th value in the VectorData referenced by the 'elements' attribute.","attributes":[{"name":"elements","dtype":{"target_type":"VectorData","reftype":"object"},"doc":"Reference to the VectorData object that contains the enumerable elements"}]}]})delimiter"; -const std::string resources = R"delimiter( +constexpr std::string_view resources = R"delimiter( {"groups":[{"data_type_def":"HERD","data_type_inc":"Container","doc":"HDMF External Resources Data Structure. A set of six tables for tracking external resource references in a file or across multiple files.","datasets":[{"data_type_inc":"Data","name":"keys","doc":"A table for storing user terms that are used to refer to external resources.","dtype":[{"name":"key","dtype":"text","doc":"The user term that maps to one or more resources in the `resources` table, e.g., \"human\"."}],"dims":["num_rows"],"shape":[null]},{"data_type_inc":"Data","name":"files","doc":"A table for storing object ids of files used in external resources.","dtype":[{"name":"file_object_id","dtype":"text","doc":"The object id (UUID) of a file that contains objects that refers to external resources."}],"dims":["num_rows"],"shape":[null]},{"data_type_inc":"Data","name":"entities","doc":"A table for mapping user terms (i.e., keys) to resource entities.","dtype":[{"name":"entity_id","dtype":"text","doc":"The compact uniform resource identifier (CURIE) of the entity, in the form [prefix]:[unique local identifier], e.g., 'NCBI_TAXON:9606'."},{"name":"entity_uri","dtype":"text","doc":"The URI for the entity this reference applies to. This can be an empty string. e.g., https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=9606"}],"dims":["num_rows"],"shape":[null]},{"data_type_inc":"Data","name":"objects","doc":"A table for identifying which objects in a file contain references to external resources.","dtype":[{"name":"files_idx","dtype":"uint","doc":"The row index to the file in the `files` table containing the object."},{"name":"object_id","dtype":"text","doc":"The object id (UUID) of the object."},{"name":"object_type","dtype":"text","doc":"The data type of the object."},{"name":"relative_path","dtype":"text","doc":"The relative path from the data object with the `object_id` to the dataset or attribute with the value(s) that is associated with an external resource. This can be an empty string if the object is a dataset that contains the value(s) that is associated with an external resource."},{"name":"field","dtype":"text","doc":"The field within the compound data type using an external resource. This is used only if the dataset or attribute is a compound data type; otherwise this should be an empty string."}],"dims":["num_rows"],"shape":[null]},{"data_type_inc":"Data","name":"object_keys","doc":"A table for identifying which objects use which keys.","dtype":[{"name":"objects_idx","dtype":"uint","doc":"The row index to the object in the `objects` table that holds the key"},{"name":"keys_idx","dtype":"uint","doc":"The row index to the key in the `keys` table."}],"dims":["num_rows"],"shape":[null]},{"data_type_inc":"Data","name":"entity_keys","doc":"A table for identifying which keys use which entity.","dtype":[{"name":"entities_idx","dtype":"uint","doc":"The row index to the entity in the `entities` table."},{"name":"keys_idx","dtype":"uint","doc":"The row index to the key in the `keys` table."}],"dims":["num_rows"],"shape":[null]}]}]})delimiter"; -const std::string namespaces = R"delimiter( +constexpr std::string_view namespaces = R"delimiter( {"namespaces":[{"name":"hdmf-experimental","doc":"Experimental data structures provided by HDMF. These are not guaranteed to be available in the future.","author":["Andrew Tritt","Oliver Ruebel","Ryan Ly","Ben Dichter","Matthew Avaylon"],"contact":["ajtritt@lbl.gov","oruebel@lbl.gov","rly@lbl.gov","bdichter@lbl.gov","mavaylon@lbl.gov"],"full_name":"HDMF Experimental","schema":[{"namespace":"hdmf-common"},{"source":"experimental"},{"source":"resources"}],"version":"0.5.0"}]})delimiter"; -void registerVariables(std::map& registry) -{ - registry["experimental"] = &experimental; - registry["resources"] = &resources; - registry["namespace"] = &namespaces; -}; +constexpr std::array, 3> specVariables {{ + {"experimental", experimental}, + {"resources", resources}, + {"namespace", namespaces} +}}; } // namespace AQNWB::spec::hdmf_experimental From 1d20e3a909cb4540da1b9c5d000061de29603fe0 Mon Sep 17 00:00:00 2001 From: Steph Prince <40640337+stephprince@users.noreply.github.com> Date: Wed, 28 Aug 2024 18:33:11 -0700 Subject: [PATCH 16/22] revert relative imports --- src/hdf5/HDF5IO.cpp | 5 ++--- src/hdf5/HDF5IO.hpp | 4 ++-- src/nwb/NWBRecording.cpp | 8 ++++---- src/nwb/NWBRecording.hpp | 4 ++-- src/nwb/base/TimeSeries.cpp | 2 +- src/nwb/base/TimeSeries.hpp | 4 ++-- src/nwb/device/Device.cpp | 2 +- src/nwb/device/Device.hpp | 4 ++-- src/nwb/ecephys/ElectricalSeries.cpp | 5 ++--- src/nwb/ecephys/ElectricalSeries.hpp | 6 +++--- src/nwb/file/ElectrodeGroup.cpp | 2 +- src/nwb/file/ElectrodeGroup.hpp | 6 +++--- src/nwb/file/ElectrodeTable.cpp | 6 ++---- src/nwb/file/ElectrodeTable.hpp | 8 ++++---- src/nwb/hdmf/base/Container.cpp | 2 +- src/nwb/hdmf/base/Container.hpp | 2 +- src/nwb/hdmf/base/Data.hpp | 2 +- src/nwb/hdmf/table/DynamicTable.cpp | 2 +- src/nwb/hdmf/table/DynamicTable.hpp | 8 ++++---- src/nwb/hdmf/table/VectorData.cpp | 2 +- src/nwb/hdmf/table/VectorData.hpp | 2 +- 21 files changed, 41 insertions(+), 45 deletions(-) diff --git a/src/hdf5/HDF5IO.cpp b/src/hdf5/HDF5IO.cpp index ef7cc60e..18decc21 100644 --- a/src/hdf5/HDF5IO.cpp +++ b/src/hdf5/HDF5IO.cpp @@ -4,12 +4,11 @@ #include #include -#include "HDF5IO.hpp" - #include #include -#include "../Utils.hpp" +#include "hdf5/HDF5IO.hpp" +#include "Utils.hpp" using namespace H5; using namespace AQNWB::HDF5; diff --git a/src/hdf5/HDF5IO.hpp b/src/hdf5/HDF5IO.hpp index 8eaca67c..2a94aef2 100644 --- a/src/hdf5/HDF5IO.hpp +++ b/src/hdf5/HDF5IO.hpp @@ -6,8 +6,8 @@ #include -#include "../BaseIO.hpp" -#include "../Types.hpp" +#include "BaseIO.hpp" +#include "Types.hpp" namespace H5 { diff --git a/src/nwb/NWBRecording.cpp b/src/nwb/NWBRecording.cpp index bbcff44a..93844a9c 100644 --- a/src/nwb/NWBRecording.cpp +++ b/src/nwb/NWBRecording.cpp @@ -1,8 +1,8 @@ -#include "NWBRecording.hpp" -#include "../Channel.hpp" -#include "../Utils.hpp" -#include "../hdf5/HDF5IO.hpp" +#include "Channel.hpp" +#include "Utils.hpp" +#include "hdf5/HDF5IO.hpp" +#include "nwb/NWBRecording.hpp" using namespace AQNWB::NWB; diff --git a/src/nwb/NWBRecording.hpp b/src/nwb/NWBRecording.hpp index c844e37e..c24edd3b 100644 --- a/src/nwb/NWBRecording.hpp +++ b/src/nwb/NWBRecording.hpp @@ -1,7 +1,7 @@ #pragma once -#include "../Types.hpp" -#include "NWBFile.hpp" +#include "Types.hpp" +#include "nwb/NWBFile.hpp" namespace AQNWB::NWB { diff --git a/src/nwb/base/TimeSeries.cpp b/src/nwb/base/TimeSeries.cpp index 254aa695..a9c008b3 100644 --- a/src/nwb/base/TimeSeries.cpp +++ b/src/nwb/base/TimeSeries.cpp @@ -1,4 +1,4 @@ -#include "TimeSeries.hpp" +#include "nwb/base/TimeSeries.hpp" using namespace AQNWB::NWB; diff --git a/src/nwb/base/TimeSeries.hpp b/src/nwb/base/TimeSeries.hpp index fb530244..08537856 100644 --- a/src/nwb/base/TimeSeries.hpp +++ b/src/nwb/base/TimeSeries.hpp @@ -2,8 +2,8 @@ #include -#include "../../BaseIO.hpp" -#include "../hdmf/base/Container.hpp" +#include "BaseIO.hpp" +#include "nwb/hdmf/base/Container.hpp" namespace AQNWB::NWB { diff --git a/src/nwb/device/Device.cpp b/src/nwb/device/Device.cpp index 98fc90e1..262d9207 100644 --- a/src/nwb/device/Device.cpp +++ b/src/nwb/device/Device.cpp @@ -1,4 +1,4 @@ -#include "Device.hpp" +#include "nwb/device/Device.hpp" using namespace AQNWB::NWB; diff --git a/src/nwb/device/Device.hpp b/src/nwb/device/Device.hpp index 67eed819..74ae7062 100644 --- a/src/nwb/device/Device.hpp +++ b/src/nwb/device/Device.hpp @@ -2,8 +2,8 @@ #include -#include "../../BaseIO.hpp" -#include "../hdmf/base/Container.hpp" +#include "BaseIO.hpp" +#include "nwb/hdmf/base/Container.hpp" namespace AQNWB::NWB { diff --git a/src/nwb/ecephys/ElectricalSeries.cpp b/src/nwb/ecephys/ElectricalSeries.cpp index 9d215c1e..2941673a 100644 --- a/src/nwb/ecephys/ElectricalSeries.cpp +++ b/src/nwb/ecephys/ElectricalSeries.cpp @@ -1,7 +1,6 @@ -#include "ElectricalSeries.hpp" - -#include "../file/ElectrodeTable.hpp" +#include "nwb/ecephys/ElectricalSeries.hpp" +#include "nwb/file/ElectrodeTable.hpp" using namespace AQNWB::NWB; diff --git a/src/nwb/ecephys/ElectricalSeries.hpp b/src/nwb/ecephys/ElectricalSeries.hpp index 9e594a42..597669be 100644 --- a/src/nwb/ecephys/ElectricalSeries.hpp +++ b/src/nwb/ecephys/ElectricalSeries.hpp @@ -2,9 +2,9 @@ #include -#include "../../BaseIO.hpp" -#include "../../Channel.hpp" -#include "../base/TimeSeries.hpp" +#include "BaseIO.hpp" +#include "Channel.hpp" +#include "nwb/base/TimeSeries.hpp" namespace AQNWB::NWB { diff --git a/src/nwb/file/ElectrodeGroup.cpp b/src/nwb/file/ElectrodeGroup.cpp index ffe469a2..b5beaa03 100644 --- a/src/nwb/file/ElectrodeGroup.cpp +++ b/src/nwb/file/ElectrodeGroup.cpp @@ -1,4 +1,4 @@ -#include "ElectrodeGroup.hpp" +#include "nwb/file/ElectrodeGroup.hpp" using namespace AQNWB::NWB; diff --git a/src/nwb/file/ElectrodeGroup.hpp b/src/nwb/file/ElectrodeGroup.hpp index 352e481a..4f4c55ca 100644 --- a/src/nwb/file/ElectrodeGroup.hpp +++ b/src/nwb/file/ElectrodeGroup.hpp @@ -2,9 +2,9 @@ #include -#include "../../BaseIO.hpp" -#include "../device/Device.hpp" -#include "../hdmf/base/Container.hpp" +#include "BaseIO.hpp" +#include "nwb/device/Device.hpp" +#include "nwb/hdmf/base/Container.hpp" namespace AQNWB::NWB { diff --git a/src/nwb/file/ElectrodeTable.cpp b/src/nwb/file/ElectrodeTable.cpp index 6f5e7e8a..2e711bb3 100644 --- a/src/nwb/file/ElectrodeTable.cpp +++ b/src/nwb/file/ElectrodeTable.cpp @@ -1,7 +1,5 @@ - -#include "ElectrodeTable.hpp" - -#include "../../Channel.hpp" +#include "Channel.hpp" +#include "nwb/file/ElectrodeTable.hpp" using namespace AQNWB::NWB; diff --git a/src/nwb/file/ElectrodeTable.hpp b/src/nwb/file/ElectrodeTable.hpp index 01616981..b8611a32 100644 --- a/src/nwb/file/ElectrodeTable.hpp +++ b/src/nwb/file/ElectrodeTable.hpp @@ -2,10 +2,10 @@ #include -#include "../../BaseIO.hpp" -#include "../hdmf/table/DynamicTable.hpp" -#include "../hdmf/table/ElementIdentifiers.hpp" -#include "../hdmf/table/VectorData.hpp" +#include "BaseIO.hpp" +#include "nwb/hdmf/table/DynamicTable.hpp" +#include "nwb/hdmf/table/ElementIdentifiers.hpp" +#include "nwb/hdmf/table/VectorData.hpp" namespace AQNWB::NWB { diff --git a/src/nwb/hdmf/base/Container.cpp b/src/nwb/hdmf/base/Container.cpp index e47d3eec..525d82ed 100644 --- a/src/nwb/hdmf/base/Container.cpp +++ b/src/nwb/hdmf/base/Container.cpp @@ -1,4 +1,4 @@ -#include "Container.hpp" +#include "nwb/hdmf/base/Container.hpp" using namespace AQNWB::NWB; diff --git a/src/nwb/hdmf/base/Container.hpp b/src/nwb/hdmf/base/Container.hpp index c9528b58..1d89c875 100644 --- a/src/nwb/hdmf/base/Container.hpp +++ b/src/nwb/hdmf/base/Container.hpp @@ -3,7 +3,7 @@ #include #include -#include "../../../BaseIO.hpp" +#include "BaseIO.hpp" namespace AQNWB::NWB { diff --git a/src/nwb/hdmf/base/Data.hpp b/src/nwb/hdmf/base/Data.hpp index 6b3f8553..ef146485 100644 --- a/src/nwb/hdmf/base/Data.hpp +++ b/src/nwb/hdmf/base/Data.hpp @@ -2,7 +2,7 @@ #include -#include "../../../BaseIO.hpp" +#include "BaseIO.hpp" namespace AQNWB::NWB { diff --git a/src/nwb/hdmf/table/DynamicTable.cpp b/src/nwb/hdmf/table/DynamicTable.cpp index c61fae83..d8b8c989 100644 --- a/src/nwb/hdmf/table/DynamicTable.cpp +++ b/src/nwb/hdmf/table/DynamicTable.cpp @@ -1,4 +1,4 @@ -#include "DynamicTable.hpp" +#include "nwb/hdmf/table/DynamicTable.hpp" using namespace AQNWB::NWB; diff --git a/src/nwb/hdmf/table/DynamicTable.hpp b/src/nwb/hdmf/table/DynamicTable.hpp index defe156b..6cd8c2a5 100644 --- a/src/nwb/hdmf/table/DynamicTable.hpp +++ b/src/nwb/hdmf/table/DynamicTable.hpp @@ -2,10 +2,10 @@ #include -#include "../../../BaseIO.hpp" -#include "../base/Container.hpp" -#include "ElementIdentifiers.hpp" -#include "VectorData.hpp" +#include "BaseIO.hpp" +#include "nwb/hdmf/base/Container.hpp" +#include "nwb/hdmf/table/ElementIdentifiers.hpp" +#include "nwb/hdmf/table/VectorData.hpp" namespace AQNWB::NWB { diff --git a/src/nwb/hdmf/table/VectorData.cpp b/src/nwb/hdmf/table/VectorData.cpp index ef4a40b5..1438387e 100644 --- a/src/nwb/hdmf/table/VectorData.cpp +++ b/src/nwb/hdmf/table/VectorData.cpp @@ -1,4 +1,4 @@ -#include "VectorData.hpp" +#include "nwb/hdmf/table/VectorData.hpp" using namespace AQNWB::NWB; diff --git a/src/nwb/hdmf/table/VectorData.hpp b/src/nwb/hdmf/table/VectorData.hpp index 870696a4..7ee93f09 100644 --- a/src/nwb/hdmf/table/VectorData.hpp +++ b/src/nwb/hdmf/table/VectorData.hpp @@ -2,7 +2,7 @@ #include -#include "../base/Data.hpp" +#include "nwb/hdmf/base/Data.hpp" namespace AQNWB::NWB { From 2a796c7bc7c8d3575a4e1d53ad2d279a570ee155 Mon Sep 17 00:00:00 2001 From: Steph Prince <40640337+stephprince@users.noreply.github.com> Date: Wed, 28 Aug 2024 18:42:41 -0700 Subject: [PATCH 17/22] update docstrings and formatting --- src/hdf5/HDF5IO.cpp | 3 ++- src/nwb/NWBFile.cpp | 33 ++++++++++++++-------------- src/nwb/NWBFile.hpp | 9 +++++--- src/nwb/NWBRecording.cpp | 5 +++-- src/nwb/ecephys/ElectricalSeries.cpp | 1 + src/nwb/file/ElectrodeTable.cpp | 3 ++- src/spec/core.hpp | 31 +++++++++++++------------- src/spec/hdmf_common.hpp | 13 +++++------ src/spec/hdmf_experimental.hpp | 11 +++++----- 9 files changed, 57 insertions(+), 52 deletions(-) diff --git a/src/hdf5/HDF5IO.cpp b/src/hdf5/HDF5IO.cpp index 18decc21..bf4b69a8 100644 --- a/src/hdf5/HDF5IO.cpp +++ b/src/hdf5/HDF5IO.cpp @@ -4,10 +4,11 @@ #include #include +#include "hdf5/HDF5IO.hpp" + #include #include -#include "hdf5/HDF5IO.hpp" #include "Utils.hpp" using namespace H5; diff --git a/src/nwb/NWBFile.cpp b/src/nwb/NWBFile.cpp index bce72eea..23deb200 100644 --- a/src/nwb/NWBFile.cpp +++ b/src/nwb/NWBFile.cpp @@ -6,17 +6,18 @@ #include #include +#include "nwb/NWBFile.hpp" + #include "BaseIO.hpp" #include "Channel.hpp" #include "Utils.hpp" -#include "spec/core.hpp" -#include "spec/hdmf_common.hpp" -#include "spec/hdmf_experimental.hpp" #include "nwb/device/Device.hpp" #include "nwb/ecephys/ElectricalSeries.hpp" #include "nwb/file/ElectrodeGroup.hpp" #include "nwb/file/ElectrodeTable.hpp" -#include "nwb/NWBFile.hpp" +#include "spec/core.hpp" +#include "spec/hdmf_common.hpp" +#include "spec/hdmf_experimental.hpp" using namespace AQNWB::NWB; @@ -69,7 +70,7 @@ Status NWBFile::createFileStructure() io->createGroup("/specifications"); io->createReferenceAttribute("/specifications", "/", ".specloc"); - + cacheSpecifications("core", spec::core::version, spec::core::specVariables); cacheSpecifications("hdmf-common", spec::hdmf_common::version, @@ -153,22 +154,22 @@ void NWBFile::stopRecording() io->stopRecording(); } -template +template void NWBFile::cacheSpecifications( const std::string& specPath, const std::string& versionNumber, - const std::array, N>& specVariables) + const std::array, N>& + specVariables) { - io->createGroup("/specifications/" + specPath + "/"); - io->createGroup("/specifications/" + specPath + "/" + versionNumber); - - for (const auto& [name, content] : specVariables) { - io->createStringDataSet( - "/specifications/" + specPath + "/" + versionNumber + "/" + std::string(name), - std::string(content)); - } -} + io->createGroup("/specifications/" + specPath + "/"); + io->createGroup("/specifications/" + specPath + "/" + versionNumber); + for (const auto& [name, content] : specVariables) { + io->createStringDataSet("/specifications/" + specPath + "/" + versionNumber + + "/" + std::string(name), + std::string(content)); + } +} // recording data factory method / std::unique_ptr NWBFile::createRecordingData( diff --git a/src/nwb/NWBFile.hpp b/src/nwb/NWBFile.hpp index 027c8858..2201f3d0 100644 --- a/src/nwb/NWBFile.hpp +++ b/src/nwb/NWBFile.hpp @@ -120,13 +120,16 @@ class NWBFile * @brief Saves the specification files for the schema. * @param specPath The location in the file to store the spec information. * @param versionNumber The version number of the specification files. - * @param specVariables The variables from the specification files. + * @param specVariables The contents of the specification files. + * These values are generated from the nwb schema by + * `resources/generate_spec_files.py` */ - template + template void cacheSpecifications( const std::string& specPath, const std::string& versionNumber, - const std::array, N>& specVariables); + const std::array, N>& + specVariables); /** * @brief Holds the Container (usually TimeSeries) objects that have been diff --git a/src/nwb/NWBRecording.cpp b/src/nwb/NWBRecording.cpp index 93844a9c..1747471b 100644 --- a/src/nwb/NWBRecording.cpp +++ b/src/nwb/NWBRecording.cpp @@ -1,8 +1,9 @@ +#include "nwb/NWBRecording.hpp" + #include "Channel.hpp" #include "Utils.hpp" #include "hdf5/HDF5IO.hpp" -#include "nwb/NWBRecording.hpp" using namespace AQNWB::NWB; @@ -22,7 +23,7 @@ Status NWBRecording::openFile(const std::string& filename, { // close any existing files if (nwbfile != nullptr) { - nwbfile->finalize(); + this->closeFile(); } // initialize nwbfile object and create base structure diff --git a/src/nwb/ecephys/ElectricalSeries.cpp b/src/nwb/ecephys/ElectricalSeries.cpp index 2941673a..ec3a3bb2 100644 --- a/src/nwb/ecephys/ElectricalSeries.cpp +++ b/src/nwb/ecephys/ElectricalSeries.cpp @@ -1,5 +1,6 @@ #include "nwb/ecephys/ElectricalSeries.hpp" + #include "nwb/file/ElectrodeTable.hpp" using namespace AQNWB::NWB; diff --git a/src/nwb/file/ElectrodeTable.cpp b/src/nwb/file/ElectrodeTable.cpp index 2e711bb3..027c9f6a 100644 --- a/src/nwb/file/ElectrodeTable.cpp +++ b/src/nwb/file/ElectrodeTable.cpp @@ -1,6 +1,7 @@ -#include "Channel.hpp" #include "nwb/file/ElectrodeTable.hpp" +#include "Channel.hpp" + using namespace AQNWB::NWB; // ElectrodeTable diff --git a/src/spec/core.hpp b/src/spec/core.hpp index c5930d24..44ee79e8 100644 --- a/src/spec/core.hpp +++ b/src/spec/core.hpp @@ -1,8 +1,8 @@ #pragma once +#include #include #include -#include namespace AQNWB::spec::core { @@ -48,19 +48,18 @@ constexpr std::string_view nwb_retinotopy = R"delimiter( constexpr std::string_view namespaces = R"delimiter( {"namespaces":[{"name":"core","doc":"NWB namespace","author":["Andrew Tritt","Oliver Ruebel","Ryan Ly","Ben Dichter","Keith Godfrey","Jeff Teeters"],"contact":["ajtritt@lbl.gov","oruebel@lbl.gov","rly@lbl.gov","bdichter@lbl.gov","keithg@alleninstitute.org","jteeters@berkeley.edu"],"full_name":"NWB core","schema":[{"namespace":"hdmf-common"},{"source":"nwb.base"},{"source":"nwb.device"},{"source":"nwb.epoch"},{"source":"nwb.image"},{"source":"nwb.file"},{"source":"nwb.misc"},{"source":"nwb.behavior"},{"source":"nwb.ecephys"},{"source":"nwb.icephys"},{"source":"nwb.ogen"},{"source":"nwb.ophys"},{"source":"nwb.retinotopy"}],"version":"2.7.0"}]})delimiter"; -constexpr std::array, 13> specVariables {{ - {"nwb.base", nwb_base}, - {"nwb.device", nwb_device}, - {"nwb.epoch", nwb_epoch}, - {"nwb.image", nwb_image}, - {"nwb.file", nwb_file}, - {"nwb.misc", nwb_misc}, - {"nwb.behavior", nwb_behavior}, - {"nwb.ecephys", nwb_ecephys}, - {"nwb.icephys", nwb_icephys}, - {"nwb.ogen", nwb_ogen}, - {"nwb.ophys", nwb_ophys}, - {"nwb.retinotopy", nwb_retinotopy}, - {"namespace", namespaces} -}}; +constexpr std::array, 13> + specVariables {{{"nwb.base", nwb_base}, + {"nwb.device", nwb_device}, + {"nwb.epoch", nwb_epoch}, + {"nwb.image", nwb_image}, + {"nwb.file", nwb_file}, + {"nwb.misc", nwb_misc}, + {"nwb.behavior", nwb_behavior}, + {"nwb.ecephys", nwb_ecephys}, + {"nwb.icephys", nwb_icephys}, + {"nwb.ogen", nwb_ogen}, + {"nwb.ophys", nwb_ophys}, + {"nwb.retinotopy", nwb_retinotopy}, + {"namespace", namespaces}}}; } // namespace AQNWB::spec::core diff --git a/src/spec/hdmf_common.hpp b/src/spec/hdmf_common.hpp index 9e26297f..5ddea985 100644 --- a/src/spec/hdmf_common.hpp +++ b/src/spec/hdmf_common.hpp @@ -1,8 +1,8 @@ #pragma once +#include #include #include -#include namespace AQNWB::spec::hdmf_common { @@ -21,10 +21,9 @@ constexpr std::string_view sparse = R"delimiter( constexpr std::string_view namespaces = R"delimiter( {"namespaces":[{"name":"hdmf-common","doc":"Common data structures provided by HDMF","author":["Andrew Tritt","Oliver Ruebel","Ryan Ly","Ben Dichter"],"contact":["ajtritt@lbl.gov","oruebel@lbl.gov","rly@lbl.gov","bdichter@lbl.gov"],"full_name":"HDMF Common","schema":[{"source":"base"},{"source":"table"},{"source":"sparse"}],"version":"1.8.0"}]})delimiter"; -constexpr std::array, 4> specVariables {{ - {"base", base}, - {"table", table}, - {"sparse", sparse}, - {"namespace", namespaces} -}}; +constexpr std::array, 4> + specVariables {{{"base", base}, + {"table", table}, + {"sparse", sparse}, + {"namespace", namespaces}}}; } // namespace AQNWB::spec::hdmf_common diff --git a/src/spec/hdmf_experimental.hpp b/src/spec/hdmf_experimental.hpp index 7f2cfff2..c2eb28f2 100644 --- a/src/spec/hdmf_experimental.hpp +++ b/src/spec/hdmf_experimental.hpp @@ -1,8 +1,8 @@ #pragma once +#include #include #include -#include namespace AQNWB::spec::hdmf_experimental { @@ -18,9 +18,8 @@ constexpr std::string_view resources = R"delimiter( constexpr std::string_view namespaces = R"delimiter( {"namespaces":[{"name":"hdmf-experimental","doc":"Experimental data structures provided by HDMF. These are not guaranteed to be available in the future.","author":["Andrew Tritt","Oliver Ruebel","Ryan Ly","Ben Dichter","Matthew Avaylon"],"contact":["ajtritt@lbl.gov","oruebel@lbl.gov","rly@lbl.gov","bdichter@lbl.gov","mavaylon@lbl.gov"],"full_name":"HDMF Experimental","schema":[{"namespace":"hdmf-common"},{"source":"experimental"},{"source":"resources"}],"version":"0.5.0"}]})delimiter"; -constexpr std::array, 3> specVariables {{ - {"experimental", experimental}, - {"resources", resources}, - {"namespace", namespaces} -}}; +constexpr std::array, 3> + specVariables {{{"experimental", experimental}, + {"resources", resources}, + {"namespace", namespaces}}}; } // namespace AQNWB::spec::hdmf_experimental From ebd2d5dc4f6a157ebd28790cd0eef3cc07eb4ddf Mon Sep 17 00:00:00 2001 From: Steph Prince <40640337+stephprince@users.noreply.github.com> Date: Wed, 28 Aug 2024 19:34:02 -0700 Subject: [PATCH 18/22] add documentation about the spec files --- docs/pages/2_devdocs.dox | 1 + docs/pages/devdocs/nwb_schema.dox | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 docs/pages/devdocs/nwb_schema.dox diff --git a/docs/pages/2_devdocs.dox b/docs/pages/2_devdocs.dox index 7b868d38..7100968a 100644 --- a/docs/pages/2_devdocs.dox +++ b/docs/pages/2_devdocs.dox @@ -6,6 +6,7 @@ * - @subpage dev_install_page * - @subpage testing * - @subpage dev_docs_page + * - @subpage nwb_schema_page * - @subpage code_of_conduct_page * - @subpage license_page * - @subpage copyright_page diff --git a/docs/pages/devdocs/nwb_schema.dox b/docs/pages/devdocs/nwb_schema.dox new file mode 100644 index 00000000..8ba53c1e --- /dev/null +++ b/docs/pages/devdocs/nwb_schema.dox @@ -0,0 +1,22 @@ +/** + * @page nwb_schema_page NWB Schema + * + * The NWB file format is formally described by the [NWB Format Specifiation Schema](https://nwb-schema.readthedocs.io/en/latest/). + * The data organization of NWB files and the core NWB format is described by these nwb-schema format specification documents. + * + * \section dev_docs_generating_nwb_schema_headers_section Generating the schema header files + * + * AqNWB is linked to a specific version of the nwb-schema, and the schema version is written to the `nwb_version` field of the NWB File during acquisition. + * The full specification documentation for that schema version is also cached in the `specifications` group of the NWB File to facilitate compatibility with + * other NWB-related software. + * + * The contents of the `specifications` group are defined using the header files in the `spec` subfolder, which are in turn generated from the nwb-schema documentation files. + * To regenerate these header files, developers can run `resources/generate_spec_files.py`. + * + * \section dev_docs_updating_nwb_schema_section Updating the schema + * + * Currently, the version of the schema being used for development is fixed and stored in the `/resources/schema` folder. + * At a later date, these folders will be updated to git submodules, and we will add further instructions on coordinating schema updates with AqNWB API updates. + * + */ + From 8dfbfc7f6facbe971dc9830c65134f6cb703eeef Mon Sep 17 00:00:00 2001 From: Steph Prince <40640337+stephprince@users.noreply.github.com> Date: Wed, 28 Aug 2024 19:34:44 -0700 Subject: [PATCH 19/22] fix spelling --- docs/pages/devdocs/nwb_schema.dox | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/pages/devdocs/nwb_schema.dox b/docs/pages/devdocs/nwb_schema.dox index 8ba53c1e..70e107d7 100644 --- a/docs/pages/devdocs/nwb_schema.dox +++ b/docs/pages/devdocs/nwb_schema.dox @@ -1,7 +1,7 @@ /** * @page nwb_schema_page NWB Schema * - * The NWB file format is formally described by the [NWB Format Specifiation Schema](https://nwb-schema.readthedocs.io/en/latest/). + * The NWB file format is formally described by the [NWB Format Specification Schema](https://nwb-schema.readthedocs.io/en/latest/). * The data organization of NWB files and the core NWB format is described by these nwb-schema format specification documents. * * \section dev_docs_generating_nwb_schema_headers_section Generating the schema header files From 5b6b5c063ef0356393a3a69e19ac7e1ee33bb41e Mon Sep 17 00:00:00 2001 From: Steph Prince <40640337+stephprince@users.noreply.github.com> Date: Thu, 29 Aug 2024 09:35:28 -0700 Subject: [PATCH 20/22] apply suggestions from code review --- docs/pages/devdocs/nwb_schema.dox | 5 ++++- resources/generate_spec_files.py | 2 +- src/nwb/NWBFile.cpp | 12 ++++++------ src/nwb/NWBFile.hpp | 4 +++- src/spec/core.hpp | 2 +- src/spec/hdmf_common.hpp | 2 +- src/spec/hdmf_experimental.hpp | 2 +- 7 files changed, 17 insertions(+), 12 deletions(-) diff --git a/docs/pages/devdocs/nwb_schema.dox b/docs/pages/devdocs/nwb_schema.dox index 70e107d7..7da451cc 100644 --- a/docs/pages/devdocs/nwb_schema.dox +++ b/docs/pages/devdocs/nwb_schema.dox @@ -16,7 +16,10 @@ * \section dev_docs_updating_nwb_schema_section Updating the schema * * Currently, the version of the schema being used for development is fixed and stored in the `/resources/schema` folder. - * At a later date, these folders will be updated to git submodules, and we will add further instructions on coordinating schema updates with AqNWB API updates. + * Updating to a newer version of the schema requires: + * - Regeneration of the `spec` header files via `resources/generate_spec_files.py` + * - Update of existing `Container` classes and unit tests in AqNWB to match changes in the new schema compared to the previous schema + * - Successful completion of all unit-test and round-trip testing with PyNWB and MatNWB * */ diff --git a/resources/generate_spec_files.py b/resources/generate_spec_files.py index f43d6a98..ccad96da 100644 --- a/resources/generate_spec_files.py +++ b/resources/generate_spec_files.py @@ -23,7 +23,7 @@ with open(header_file, 'w') as fo: fo.write('#pragma once\n\n') fo.write('#include \n#include \n#include \n\n') - fo.write(f'namespace AQNWB::spec::{ns['name'].replace('-', '_')}\n{{\n\n') + fo.write(f'namespace AQNWB::SPEC::{ns['name'].upper().replace('-', '_')}\n{{\n\n') fo.write(f'const std::string version = "{ns["version"]}";\n\n') # load and convert schema files diff --git a/src/nwb/NWBFile.cpp b/src/nwb/NWBFile.cpp index 23deb200..10ba8907 100644 --- a/src/nwb/NWBFile.cpp +++ b/src/nwb/NWBFile.cpp @@ -56,7 +56,7 @@ Status NWBFile::createFileStructure() } io->createCommonNWBAttributes("/", "core", "NWBFile", ""); - io->createAttribute(AQNWB::spec::core::version, "/", "nwb_version"); + io->createAttribute(AQNWB::SPEC::CORE::version, "/", "nwb_version"); io->createGroup("/acquisition"); io->createGroup("/analysis"); @@ -71,13 +71,13 @@ Status NWBFile::createFileStructure() io->createGroup("/specifications"); io->createReferenceAttribute("/specifications", "/", ".specloc"); - cacheSpecifications("core", spec::core::version, spec::core::specVariables); + cacheSpecifications("core", AQNWB::SPEC::CORE::version, AQNWB::SPEC::CORE::specVariables); cacheSpecifications("hdmf-common", - spec::hdmf_common::version, - spec::hdmf_common::specVariables); + AQNWB::SPEC::HDMF_COMMON::version, + AQNWB::SPEC::HDMF_COMMON::specVariables); cacheSpecifications("hdmf-experimental", - spec::hdmf_experimental::version, - spec::hdmf_experimental::specVariables); + AQNWB::SPEC::HDMF_EXPERIMENTAL::version, + AQNWB::SPEC::HDMF_EXPERIMENTAL::specVariables); std::string time = getCurrentTime(); std::vector timeVec = {time}; diff --git a/src/nwb/NWBFile.hpp b/src/nwb/NWBFile.hpp index 2201f3d0..08a22d41 100644 --- a/src/nwb/NWBFile.hpp +++ b/src/nwb/NWBFile.hpp @@ -1,8 +1,10 @@ #pragma once +#include #include -#include #include +#include +#include #include #include "BaseIO.hpp" diff --git a/src/spec/core.hpp b/src/spec/core.hpp index 44ee79e8..983ad1d6 100644 --- a/src/spec/core.hpp +++ b/src/spec/core.hpp @@ -4,7 +4,7 @@ #include #include -namespace AQNWB::spec::core +namespace AQNWB::SPEC::CORE { const std::string version = "2.7.0"; diff --git a/src/spec/hdmf_common.hpp b/src/spec/hdmf_common.hpp index 5ddea985..d58f0c62 100644 --- a/src/spec/hdmf_common.hpp +++ b/src/spec/hdmf_common.hpp @@ -4,7 +4,7 @@ #include #include -namespace AQNWB::spec::hdmf_common +namespace AQNWB::SPEC::HDMF_COMMON { const std::string version = "1.8.0"; diff --git a/src/spec/hdmf_experimental.hpp b/src/spec/hdmf_experimental.hpp index c2eb28f2..bdfa14f2 100644 --- a/src/spec/hdmf_experimental.hpp +++ b/src/spec/hdmf_experimental.hpp @@ -4,7 +4,7 @@ #include #include -namespace AQNWB::spec::hdmf_experimental +namespace AQNWB::SPEC::HDMF_EXPERIMENTAL { const std::string version = "0.5.0"; From ea55ef46065041e3387b873c3c008ad1934800fd Mon Sep 17 00:00:00 2001 From: Steph Prince <40640337+stephprince@users.noreply.github.com> Date: Thu, 29 Aug 2024 09:39:43 -0700 Subject: [PATCH 21/22] fix formatting --- src/nwb/NWBFile.cpp | 3 ++- src/spec/core.hpp | 2 +- src/spec/hdmf_common.hpp | 2 +- src/spec/hdmf_experimental.hpp | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/nwb/NWBFile.cpp b/src/nwb/NWBFile.cpp index 10ba8907..132840ca 100644 --- a/src/nwb/NWBFile.cpp +++ b/src/nwb/NWBFile.cpp @@ -71,7 +71,8 @@ Status NWBFile::createFileStructure() io->createGroup("/specifications"); io->createReferenceAttribute("/specifications", "/", ".specloc"); - cacheSpecifications("core", AQNWB::SPEC::CORE::version, AQNWB::SPEC::CORE::specVariables); + cacheSpecifications( + "core", AQNWB::SPEC::CORE::version, AQNWB::SPEC::CORE::specVariables); cacheSpecifications("hdmf-common", AQNWB::SPEC::HDMF_COMMON::version, AQNWB::SPEC::HDMF_COMMON::specVariables); diff --git a/src/spec/core.hpp b/src/spec/core.hpp index 983ad1d6..0a67f80a 100644 --- a/src/spec/core.hpp +++ b/src/spec/core.hpp @@ -62,4 +62,4 @@ constexpr std::array, 13> {"nwb.ophys", nwb_ophys}, {"nwb.retinotopy", nwb_retinotopy}, {"namespace", namespaces}}}; -} // namespace AQNWB::spec::core +} // namespace AQNWB::SPEC::CORE diff --git a/src/spec/hdmf_common.hpp b/src/spec/hdmf_common.hpp index d58f0c62..54e1f1da 100644 --- a/src/spec/hdmf_common.hpp +++ b/src/spec/hdmf_common.hpp @@ -26,4 +26,4 @@ constexpr std::array, 4> {"table", table}, {"sparse", sparse}, {"namespace", namespaces}}}; -} // namespace AQNWB::spec::hdmf_common +} // namespace AQNWB::SPEC::HDMF_COMMON diff --git a/src/spec/hdmf_experimental.hpp b/src/spec/hdmf_experimental.hpp index bdfa14f2..d671e05c 100644 --- a/src/spec/hdmf_experimental.hpp +++ b/src/spec/hdmf_experimental.hpp @@ -22,4 +22,4 @@ constexpr std::array, 3> specVariables {{{"experimental", experimental}, {"resources", resources}, {"namespace", namespaces}}}; -} // namespace AQNWB::spec::hdmf_experimental +} // namespace AQNWB::SPEC::HDMF_EXPERIMENTAL From a6402f24eb0d51023895db4821fee70328025dd9 Mon Sep 17 00:00:00 2001 From: Steph Prince <40640337+stephprince@users.noreply.github.com> Date: Thu, 29 Aug 2024 09:41:59 -0700 Subject: [PATCH 22/22] update spec generation file --- resources/generate_spec_files.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/generate_spec_files.py b/resources/generate_spec_files.py index ccad96da..d83fd9db 100644 --- a/resources/generate_spec_files.py +++ b/resources/generate_spec_files.py @@ -57,4 +57,4 @@ fo.write(f'constexpr std::array, {len(var_names) + 1}> specVariables {{{{\n') fo.write(''.join([f' {{"{name.replace('_', '.')}", {name}}},\n' for name in var_names])) fo.write(' {"namespace", namespaces}\n') - fo.write(f'}}}};\n}} // namespace AQNWB::spec::{ns['name'].replace('-', '_')}\n') \ No newline at end of file + fo.write(f'}}}};\n}} // namespace AQNWB::SPEC::{ns['name'].upper().replace('-', '_')}\n') \ No newline at end of file