-
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
Move ElectrodesTable creation #161
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 #161 +/- ##
==========================================
- Coverage 93.98% 93.96% -0.02%
==========================================
Files 64 64
Lines 4952 5118 +166
Branches 273 274 +1
==========================================
+ Hits 4654 4809 +155
- Misses 288 299 +11
Partials 10 10 ☔ View full report in Codecov by Sentry. |
src/io/BaseIO.hpp
Outdated
/** | ||
* @brief Returns the size of the dataset for each dimension. | ||
* @param path The location in the file of the dataset. | ||
* @return The dataset size. | ||
*/ | ||
virtual std::vector<SizeType> getDatasetSize(const std::string path) = 0; |
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.
- It would be nice to have this function support both datasets and attributes. In that case, I would rename it to
getStorageObjectShape
. - It would be nice to also add the following function to
ReadDataWrapper
to make this new function convenient to use on read
inline std::vector<SizeType> getShape() const
{
return m_io->getShape(m_path);
}
- We should be consistent in how we use `shape` and `size`. I think we should use `shape` to refer to the sizes along all dimensions and `size` to refer to the total number of elements.
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.
It would be nice to have this function support both datasets and attributes. In that case, I would rename it to getStorageObjectShape.
It would be nice to also add the following function to ReadDataWrapper to make this new function convenient to use on read
That makes sense, I will add functionality for attributes and use shape
to refer to sizes along all dimensions
src/nwb/NWBFile.cpp
Outdated
@@ -28,7 +28,7 @@ constexpr SizeType CHUNK_XSIZE = | |||
constexpr SizeType SPIKE_CHUNK_XSIZE = | |||
8; // TODO - replace with io settings input | |||
|
|||
std::vector<SizeType> NWBFile::emptyContainerIndexes = {}; | |||
std::vector<SizeType> NWBFile::m_emptyContainerIndexes = {}; |
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.
Maybe Types.h
is a better place for this. Alternatively, it seems that m_emptyContainerIndexes
is only used to set default arguments of functions, so we could be explicit and just use "std::vector()" as default argument, i.e., use:
Status createAnnotationSeries(
std::vector<std::string> recordingNames,
RecordingContainers* recordingContainers = nullptr,
std::vector<SizeType>& containerIndexes = std::vector<SizeType>());
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.
If I remember correctly, I think I set this up this way because you cannot pass a temporary empty initializer list as a default argument to a non constant reference parameter. Creating the empty vector in advance was a solution for that. Another potential option is to change the parameter to an rvalue reference, but then I think there might be additional complications in terms of transferring ownership.
Co-authored-by: Oliver Ruebel <[email protected]>
Co-authored-by: Oliver Ruebel <[email protected]>
Based on our discussion, I made These changes will now also fix #162, if we want to take a different approach or discuss that particular issue more I can move the changes to |
@oruebel this is ready for you to re-review |
@@ -14,12 +14,15 @@ | |||
* used for managing \ref AQNWB::NWB::Container "Container" objects for storing recordings. | |||
* 3. Create the \ref AQNWB::NWB::NWBFile "NWBFile" object used for managing and creating NWB | |||
* file contents. | |||
* 4. Create the \ref AQNWB::NWB::Container "Container" objects (e.g., | |||
* 4. Create the recording metadata stored in ``\general`` in NWB, e.g., the |
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.
* 4. Create the recording metadata stored in ``\general`` in NWB, e.g., the | |
* 4. Create the recording metadata stored in ``/general`` in NWB, e.g., the |
* @brief Returns the size of the dataset for each dimension. | ||
* @param path The location in the file of the dataset. | ||
* @return The dataset shape. |
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.
* @brief Returns the size of the dataset for each dimension. | |
* @param path The location in the file of the dataset. | |
* @return The dataset shape. | |
* @brief Returns the size of the dataset or attribute for each dimension. | |
* @param path The location of the dataset or attribute in the file | |
* @return The shape of the dataset or attribute. |
/** | ||
* @brief Returns the size of the dataset for each dimension. | ||
* @param path The location in the file of the dataset. | ||
* @return The dataset shape. | ||
*/ |
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.
/** | |
* @brief Returns the size of the dataset for each dimension. | |
* @param path The location in the file of the dataset. | |
* @return The dataset shape. | |
*/ | |
* @brief Returns the size of the dataset or attribute for each dimension. | |
* @param path The location of the dataset or attribute in the file | |
* @return The shape of the dataset or attribute. |
} | ||
|
||
// write electrodes information to datasets | ||
// (requires that ElectrodeGroup data is written) |
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.
If the ElectrodeGroup data must be written, should this function then call m_io->flush()
here first?
I added a couple of minor comments (mostly updates to docs), but otherwise this looks good. Note, there will be conflicts with #163 |
Fix #155 by moving the creation of ElectrodesTable to a separate convenience function.
As part of these changes, I added some additional tests, a helper function for getting the size of a dataset, and a check for creating ElectricalSeries with electrodes indices outside of the possible range of the ElectrodesTable.