-
Notifications
You must be signed in to change notification settings - Fork 0
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
Update handling of colnames #149
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #149 +/- ##
==========================================
+ Coverage 93.20% 93.23% +0.02%
==========================================
Files 62 64 +2
Lines 4328 4595 +267
Branches 268 271 +3
==========================================
+ Hits 4034 4284 +250
- Misses 284 301 +17
Partials 10 10 ☔ View full report in Codecov by Sentry. |
… and ElectrodeTable
Support overwrite of string array attributes
@stephprince this PR is ready for review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Thanks. I just had a question about the overwriting of variable length strings but all of the electrodes table and column changes look good to me.
@@ -683,17 +683,82 @@ Status HDF5IO::createAttribute(const std::string& data, | |||
|
|||
Status HDF5IO::createAttribute(const std::vector<std::string>& data, | |||
const std::string& path, | |||
const std::string& name) | |||
const std::string& name, | |||
const bool overwrite) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, I am just wondering if there was a specific reason to add the overwrite functionality on this function instead of the version of the createAttribute
function defined below:
Status HDF5IO::createAttribute(const std::vector<const char*>& data,
const std::string& path,
const std::string& name,
const SizeType& maxSize)
Since that version is used during both single string and string array attribute creation and performs similar checks for the attribute already existing?
|
||
/** | ||
* @brief Creates a string array attribute at a given location in the file. | ||
* @brief Creates a fixed-length string array attribute at a given location in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From my understanding this function writes variable length string arrays:
Line 780 in d69d55c
H5type.setSize(H5T_VARIABLE); |
However, I think it is maybe unclear since a maximum size is accepted, but this parameter is then overwritten. I'm not sure why that is the case....
@@ -40,41 +40,27 @@ class ElectrodeTable : public DynamicTable | |||
* Initializes the ElectrodeTable by creating NWB related attributes and | |||
* adding required columns. | |||
* | |||
* @param description The description of the table (default: "metadata about | |||
* @param description The description of the table (default: "metadata about |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @param description The description of the table (default: "metadata about | |
* @param description The description of the table (default: "metadata about extracellular electrodes") |
This PR updates the handling of the
DynamicTable.colNames
to: 1) avoid the need for specifyingcolNames
at the beginning and 2) to allow us to dynamically add columns to aDynamicTable
(even one that was read from a file)Related issues
Fix #107
Fix #150
Fix #129
Fixed writing of variable-length string attributes and
VectorData
columns:BaseIO.createAttribute
for string arrays to explicitly allow us to force overwrite of existing attributes and updatedHDF5IO.createAttribute
accordingly. HDF5 does not support expanding attributes in the same way it does for datasets so we need to delete the existing attribute and overwrite it with a new one with the same name.DynamicTable.add_column
to avoid unnecessary iteration and usewriteDataBlock
directlyElectrodeTable
to use variable length strings instead of fixed length stringsImproved handling of
Status
Status
forDynamicTable
functions that perform write operations (e.g,.initialize
,finalize
,add_column
etc.) as well as relevant other classes, e.g.,Data
,VectorData
,Container
...&&
and||
operator for theStatus
enum to simplify combining multipleStatus
checksUpdated handling of
colNames
to correctly handle dynamic adding of columnscolNames
to the end by addingDynamicTable.finalize
akin to the existingElectrodeTable.finalize
. This allows for columns to be added to theDynamicTable
DynamicTable.finalize
to overwrite column names to correctly support appending of columns to existing tablesDynamicTable
constructor to read the existing column names if they exist from the file so that we can append new columns to existing tablesUpdated unit tests
HDF5IO.createAttribute
DynamicTable
ElectrodeTable
unit tests to appropriately check for the status of write operations and fix existing failing tests due to missingDevice
andElectrodeGroup