Skip to content

Commit

Permalink
Fix spelling and complete merge
Browse files Browse the repository at this point in the history
  • Loading branch information
oruebel committed Dec 22, 2024
1 parent ddb8f50 commit 54d55da
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 39 deletions.
27 changes: 13 additions & 14 deletions src/io/hdf5/HDF5RecordingData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,19 @@ HDF5RecordingData::HDF5RecordingData(std::unique_ptr<H5::DataSet> data)
DataSpace dSpace = data->getSpace();
DSetCreatPropList prop = data->getCreatePlist();

int nDimensions = dSpace.getSimpleExtentNdims();
std::vector<hsize_t> dims(nDimensions), chunk(nDimensions);
this->nDimensions = static_cast<SizeType>(dSpace.getSimpleExtentNdims());
std::vector<hsize_t> dims(this->nDimensions), chunk(this->nDimensions);

nDimensions = dSpace.getSimpleExtentDims(
dims.data()); // TODO -redefine here or use original?
prop.getChunk(static_cast<int>(nDimensions), chunk.data());
this->nDimensions =
static_cast<SizeType>(dSpace.getSimpleExtentDims(dims.data()));
prop.getChunk(static_cast<int>(this->nDimensions), chunk.data());

this->size = std::vector<SizeType>(nDimensions);
for (int i = 0; i < nDimensions; ++i) {
this->size[i] = dims[i];
this->size = std::vector<SizeType>(this->nDimensions);
for (SizeType i = 0; i < this->nDimensions; ++i) {
this->size[i] = static_cast<SizeType>(dims[i]);
}
this->nDimensions = nDimensions;
this->position = std::vector<SizeType>(
nDimensions, 0); // Initialize position with 0 for each dimension
this->nDimensions, 0); // Initialize position with 0 for each dimension
m_dataset = std::make_unique<H5::DataSet>(*data);
}

Expand All @@ -58,7 +57,7 @@ Status HDF5RecordingData::writeDataBlock(

// Ensure that we have enough space to accommodate new data
std::vector<hsize_t> dSetDims(nDimensions), offset(nDimensions);
for (int i = 0; i < nDimensions; ++i) {
for (SizeType i = 0; i < nDimensions; ++i) {
offset[i] = static_cast<hsize_t>(positionOffset[i]);

if (dataShape[i] + offset[i] > size[i]) // TODO - do I need offset here
Expand All @@ -73,14 +72,14 @@ Status HDF5RecordingData::writeDataBlock(
// Set size to new size based on updated dimensionality
DataSpace fSpace = m_dataset->getSpace();
fSpace.getSimpleExtentDims(dSetDims.data());
for (int i = 0; i < nDimensions; ++i) {
for (SizeType i = 0; i < nDimensions; ++i) {
size[i] = dSetDims[i];
}

// Create memory space with the shape of the data
// DataSpace mSpace(dimension, dSetDim.data());
std::vector<hsize_t> dataDims(nDimensions);
for (int i = 0; i < nDimensions; ++i) {
for (SizeType i = 0; i < nDimensions; ++i) {
if (dataShape[i] == 0) {
dataDims[i] = 1;
} else {
Expand All @@ -97,7 +96,7 @@ Status HDF5RecordingData::writeDataBlock(
m_dataset->write(data, nativeType, mSpace, fSpace);

// Update position for simple extension
for (int i = 0; i < dataShape.size(); ++i) {
for (SizeType i = 0; i < dataShape.size(); ++i) {
position[i] += dataShape[i];
}
} catch (DataSetIException error) {
Expand Down
16 changes: 4 additions & 12 deletions src/nwb/file/ElectrodeTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ ElectrodeTable::ElectrodeTable(std::shared_ptr<IO::BaseIO> io)
ElectrodeTable::ElectrodeTable(const std::string& path,
std::shared_ptr<IO::BaseIO> io)
: DynamicTable(
electrodeTablePath, // use the electrodeTablePath
io) // TODO May need to initialize the colNames in DynamicTable
electrodeTablePath, // use the electrodeTablePath
io) // TODO May need to initialize the colNames in DynamicTable
, m_electrodeDataset(std::make_unique<ElementIdentifiers>(
AQNWB::mergePaths(electrodeTablePath, "id"), io))
, m_groupNamesDataset(std::make_unique<VectorData>(
Expand Down Expand Up @@ -69,20 +69,12 @@ void ElectrodeTable::initialize(const std::string& description)
void ElectrodeTable::addElectrodes(std::vector<Channel> channelsInput)
{
// create datasets
<<<<<<< HEAD
for (const auto& ch : channels) {
for (const auto& ch : channelsInput) {
m_groupReferences.push_back(
AQNWB::mergePaths(m_groupPathBase, ch.getGroupName()));
m_groupNames.push_back(ch.getGroupName());
m_electrodeNumbers.push_back(ch.getGlobalIndex());
m_electrodeNumbers.push_back(static_cast<int>(ch.getGlobalIndex()));
m_locationNames.push_back("unknown");
=======
for (const auto& ch : channelsInput) {
groupReferences.push_back(groupPathBase + ch.getGroupName());
groupNames.push_back(ch.getGroupName());
electrodeNumbers.push_back(static_cast<int>(ch.getGlobalIndex()));
locationNames.push_back("unknown");
>>>>>>> main
}
}

Expand Down
15 changes: 2 additions & 13 deletions tests/testHDF5IO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -318,14 +318,9 @@ TEST_CASE("SWMRmode", "[hdf5io]")
SECTION("useSWMRMODE")
{
// create and open file
<<<<<<< HEAD
std::string path = getTestFilePath("testSWMRmode.h5");
std::string path = getTestFilePath("testSWMRmodeEnable.h5");
std::unique_ptr<IO::HDF5::HDF5IO> hdf5io =
std::make_unique<IO::HDF5::HDF5IO>(path);
=======
std::string path = getTestFilePath("testSWMRmodeEnable.h5");
std::unique_ptr<HDF5::HDF5IO> hdf5io = std::make_unique<HDF5::HDF5IO>(path);
>>>>>>> main
hdf5io->open();

// add a dataset
Expand Down Expand Up @@ -403,15 +398,9 @@ TEST_CASE("SWMRmode", "[hdf5io]")
SECTION("disableSWMRMode")
{
// create and open file with SWMR mode disabled
<<<<<<< HEAD
std::string path = getTestFilePath("testSWMRmode.h5");
std::string path = getTestFilePath("testSWMRmodeDisable.h5");
std::unique_ptr<IO::HDF5::HDF5IO> hdf5io =
std::make_unique<IO::HDF5::HDF5IO>(path, true);
=======
std::string path = getTestFilePath("testSWMRmodeDisable.h5");
std::unique_ptr<HDF5::HDF5IO> hdf5io =
std::make_unique<HDF5::HDF5IO>(path, true);
>>>>>>> main
hdf5io->open();

// add a dataset
Expand Down

0 comments on commit 54d55da

Please sign in to comment.