diff --git a/src/BaseIO.hpp b/src/BaseIO.hpp index 737b376b..19d47cb1 100644 --- a/src/BaseIO.hpp +++ b/src/BaseIO.hpp @@ -293,7 +293,8 @@ class BaseIO const std::string& path) = 0; /** - * @brief Checks whether a Dataset, Group, or Link already exists at the location in the file. + * @brief Checks whether a Dataset, Group, or Link already exists at the + * location in the file. * @param path The location of the object in the file. * @return Whether the object exists. */ diff --git a/src/hdf5/HDF5IO.hpp b/src/hdf5/HDF5IO.hpp index 2ae1c6a8..8d2480dc 100644 --- a/src/hdf5/HDF5IO.hpp +++ b/src/hdf5/HDF5IO.hpp @@ -235,7 +235,8 @@ class HDF5IO : public BaseIO const std::string& path) override; /** - * @brief Checks whether a Dataset, Group, or Link already exists at the location in the file. + * @brief Checks whether a Dataset, Group, or Link already exists at the + * location in the file. * @param path The location of the object in the file. * @return Whether the object exists. */ diff --git a/src/nwb/NWBFile.cpp b/src/nwb/NWBFile.cpp index a832d5e3..28a56249 100644 --- a/src/nwb/NWBFile.cpp +++ b/src/nwb/NWBFile.cpp @@ -127,13 +127,14 @@ Status NWBFile::createElectricalSeries( std::string electrodePath = "/general/extracellular_ephys/" + sourceName; std::string electricalSeriesPath = acquisitionPath + "/" + groupName; - // Check if device exists for groupName, create device and electrode group if not - if (!io->objectExists(devicePath)){ + // Check if device exists for groupName, create device and electrode group + // if not + if (!io->objectExists(devicePath)) { Device device = Device(devicePath, io, "description", "unknown"); device.initialize(); ElectrodeGroup elecGroup = - ElectrodeGroup(electrodePath, io, "description", "unknown", device); + ElectrodeGroup(electrodePath, io, "description", "unknown", device); elecGroup.initialize(); } @@ -192,13 +193,14 @@ Status NWBFile::createSpikeEventSeries( std::string electrodePath = "/general/extracellular_ephys/" + sourceName; std::string spikeEventSeriesPath = acquisitionPath + "/" + groupName; - // Check if device exists for groupName, create device and electrode group if not - if (!io->objectExists(devicePath)){ + // Check if device exists for groupName, create device and electrode group + // if not + if (!io->objectExists(devicePath)) { Device device = Device(devicePath, io, "description", "unknown"); device.initialize(); ElectrodeGroup elecGroup = - ElectrodeGroup(electrodePath, io, "description", "unknown", device); + ElectrodeGroup(electrodePath, io, "description", "unknown", device); elecGroup.initialize(); } diff --git a/tests/testEcephys.cpp b/tests/testEcephys.cpp index a8d34fdd..97b9418f 100644 --- a/tests/testEcephys.cpp +++ b/tests/testEcephys.cpp @@ -172,9 +172,9 @@ TEST_CASE("SpikeEventSeries", "[ecephys]") // setup mock data SizeType numChannels = 4; std::vector mockArrays = - getMockChannelArrays(numChannels); + getMockChannelArrays(numChannels); std::vector> mockData = - getMockData2D(numSamples * numChannels, numEvents); + getMockData2D(numSamples * numChannels, numEvents); // setup io object std::string path = getTestFilePath("SpikeEventSeries3D.h5"); @@ -188,14 +188,14 @@ TEST_CASE("SpikeEventSeries", "[ecephys]") elecTable.initialize(); // setup electrical series - NWB::SpikeEventSeries ses = NWB::SpikeEventSeries( - dataPath, - io, - dataType, - mockArrays[0], - "no description", - SizeArray {0, numChannels, numSamples}, - SizeArray {8, 1, 1}); + NWB::SpikeEventSeries ses = + NWB::SpikeEventSeries(dataPath, + io, + dataType, + mockArrays[0], + "no description", + SizeArray {0, numChannels, numSamples}, + SizeArray {8, 1, 1}); ses.initialize(); // write channel data @@ -230,13 +230,12 @@ TEST_CASE("SpikeEventSeries", "[ecephys]") REQUIRE_THAT(dataOut[1], Catch::Matchers::Approx(mockData[1]).margin(1)); } -SECTION("test writing events - events x samples") + SECTION("test writing events - events x samples") { // setup mock data - std::vector mockArrays = - getMockChannelArrays(1); + std::vector mockArrays = getMockChannelArrays(1); std::vector> mockData = - getMockData2D(numSamples, numEvents); + getMockData2D(numSamples, numEvents); // setup io object std::string path = getTestFilePath("SpikeEventSeries2D.h5"); @@ -250,14 +249,13 @@ SECTION("test writing events - events x samples") elecTable.initialize(); // setup electrical series - NWB::SpikeEventSeries ses = NWB::SpikeEventSeries( - dataPath, - io, - dataType, - mockArrays[0], - "no description", - SizeArray {0, numSamples}, - SizeArray {8, 1}); + NWB::SpikeEventSeries ses = NWB::SpikeEventSeries(dataPath, + io, + dataType, + mockArrays[0], + "no description", + SizeArray {0, numSamples}, + SizeArray {8, 1}); ses.initialize(); // write channel data @@ -272,8 +270,8 @@ SECTION("test writing events - events x samples") std::make_unique(path, H5F_ACC_RDONLY); std::unique_ptr dataset = std::make_unique(file->openDataSet(dataPath + "/data")); - std::vector> dataOut( - numEvents, std::vector(numSamples)); + std::vector> dataOut(numEvents, + std::vector(numSamples)); float* buffer = new float[numEvents * numSamples]; H5::DataSpace fSpace = dataset->getSpace(); diff --git a/tests/testNWBFile.cpp b/tests/testNWBFile.cpp index 222e4f1c..a5e5d92a 100644 --- a/tests/testNWBFile.cpp +++ b/tests/testNWBFile.cpp @@ -75,12 +75,13 @@ TEST_CASE("createMultipleEcephysDatasets", "[nwb]") std::unique_ptr recordingContainers = std::make_unique(); Status resultCreateES = nwbfile.createElectricalSeries( - mockArrays, BaseDataType::F32, recordingContainers.get()); + mockArrays, BaseDataType::F32, recordingContainers.get()); REQUIRE(resultCreateES == Status::Success); // create SpikeEventSeries SizeType numSamples = 5; - std::vector mockSpikeArrays = getMockChannelArrays(1, 2, "spikedata"); + std::vector mockSpikeArrays = + getMockChannelArrays(1, 2, "spikedata"); Status resultCreateSES = nwbfile.createSpikeEventSeries( mockSpikeArrays, BaseDataType::F32, recordingContainers.get()); diff --git a/tests/testUtils.hpp b/tests/testUtils.hpp index 82b24bc9..d40b1d8b 100644 --- a/tests/testUtils.hpp +++ b/tests/testUtils.hpp @@ -33,7 +33,9 @@ inline std::string getTestFilePath(std::string filename) } inline std::vector getMockChannelArrays( - SizeType numChannels = 2, SizeType numArrays = 2, std::string groupName = "esdata") + SizeType numChannels = 2, + SizeType numArrays = 2, + std::string groupName = "esdata") { std::vector arrays(numArrays); for (SizeType i = 0; i < numArrays; i++) {