Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Save electrode related information #1

Merged
merged 34 commits into from
Apr 1, 2024
Merged

Save electrode related information #1

merged 34 commits into from
Apr 1, 2024

Conversation

stephprince
Copy link
Collaborator

These changes will allow saving of electrode related information (e.g. Device, ElectrodeGroup, ElectrodeTable) to an NWB File. Some of the additional features added to support this:

  • NWBDataTypes.cpp files to support Container, DynamicTable, Data, VectorData, ElementIdentifiers, Device, and ElectrodeGroup classes. Not all methods related to the base classes have been implemented yet beyond what was required for the electrodes information saving.
  • add Links and References to HDF5 files

@stephprince stephprince requested a review from oruebel March 19, 2024 00:08
CMakeLists.txt Outdated Show resolved Hide resolved
src/BaseIO.cpp Outdated Show resolved Hide resolved
src/BaseIO.hpp Outdated Show resolved Hide resolved
src/BaseIO.hpp Outdated Show resolved Hide resolved
src/BaseIO.hpp Outdated Show resolved Hide resolved
src/BaseIO.hpp Outdated Show resolved Hide resolved
src/BaseIO.hpp Outdated Show resolved Hide resolved
src/BaseIO.hpp Outdated Show resolved Hide resolved
src/BaseIO.hpp Outdated Show resolved Hide resolved
src/HDF5IO.cpp Outdated Show resolved Hide resolved
src/HDF5IO.cpp Outdated Show resolved Hide resolved
src/HDF5IO.cpp Outdated Show resolved Hide resolved
src/HDF5IO.cpp Outdated Show resolved Hide resolved
src/HDF5IO.cpp Outdated Show resolved Hide resolved
src/HDF5IO.cpp Outdated Show resolved Hide resolved
src/HDF5IO.hpp Outdated
Comment on lines 71 to 74
/** Sets an object reference attribute for a given location in the file */
int setAttributeRef(std::string referencePath,
std::string path,
std::string name) override;
Copy link
Contributor

@oruebel oruebel Mar 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The naming of setAttributeRef and createReferenceDatasSet seems inconsistent. I would suggest either:

  1. createReferenceAttribute and createReferenceDataset or
  2. createDataSetOfReferences and createAttributeOfReferences

Since other functions are called ``createStringDataset` I guess option is probably more consistent.

If need to distinguish between Attributes that are scalars vs. arrays, we could add a bool scalar = True on the function or have separate functions for `createScalarAttributeandcreateArrayAttribute``

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, I didn't realize the naming of those was inconsistent. I updated them to Option 1. I also changed it to createAttribute instead of setAttribute to be consistent.

For the scalars vs. arrays, right now I've overloaded the Attribute function to deal with arrays vs. scalars. Is using bool scalar = True preferable?

src/NWBDataTypes.hpp Outdated Show resolved Hide resolved
src/NWBDataTypes.hpp Outdated Show resolved Hide resolved
src/NWBDataTypes.hpp Outdated Show resolved Hide resolved
src/NWBDataTypes.hpp Outdated Show resolved Hide resolved
Comment on lines +346 to +350
protected:
/**
* @brief The current position in the x dimension.
*/
int xPos;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean BaseRecordingDatat assumes appending along the first dimension x (i.e., time in most cases in NWB)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The equivalent RecordingData class in OpenEphys had methods for writing data along first dimension (time), 2D blocks (time x channels), and writing rows of data in a 2D block (time x channels). I hadn't added the 2D implementations yet.

src/io/BaseIO.hpp Outdated Show resolved Hide resolved
/**
* @brief The number of dimensions in the data block.
*/
SizeType dimension; /**< The number of dimensions in the data block. */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this variable? Wouldn't the number of dimensions be given by the size variable?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At least how it was currently set up, size is always an array of 3 values, and the dimension value is obtained by creating an H5 dataspace and retrieving its dimensions (see here). If the number of dimensions is 1, the size[1] and size[2] values are set to be 1. I'm don't think the size variable needs to necessarily work this way if we want to change the number of values it contains depending on the dimensionality of the input data.

@oruebel
Copy link
Contributor

oruebel commented Mar 24, 2024

@stephprince thanks for all the updates. The code looks overall very clean and is easy to read 👍

I've added few additional comments. Some of them are quick fixes and others are probably a bit more work. Please feel free to turn any items that you think are best addressed in separate PR's into new issues and we can work through them separately. Overall, I think this PR looks good. Once tests are passing and we have triaged the remaining items, this PR seems good to merge.

@stephprince
Copy link
Collaborator Author

@oruebel I think I addressed or responded to all the comments most relevant for this PR. And then I made issues for all the rest of the comments to address in separate PRs.

src/Types.hpp Show resolved Hide resolved
src/Types.hpp Show resolved Hide resolved
@oruebel
Copy link
Contributor

oruebel commented Apr 1, 2024

I made issues for all the rest of the comments to address in separate PRs.

Thanks for creating the issues and addressing the comments. I created a couple of additional issues to not further hold up this PR and approved. This looks good to merge and we can address the open issues in separate PRs.

@stephprince stephprince merged commit 0756797 into main Apr 1, 2024
1 of 4 checks passed
@stephprince stephprince deleted the electrode-table branch April 1, 2024 21:48
@stephprince stephprince mentioned this pull request Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants