Skip to content

Conversation

@ehennestad
Copy link
Collaborator

@ehennestad ehennestad commented Oct 23, 2025

Fix #759

Summary

If a scalar (H5S_SCALAR) compound dataset contains booleans or references, currently parsing would not postprocess such values and they would be returned as int8.

While working on this issue, I also realized that MatNWB would not export a compound scalar dataset using HDF5 scalar dataspace, instead it would create a simple dataspace with shape 1.

Looking at PyNWB, the scalar and compound dataset ElectrodeGroup/position is exported using a scalar dataspace.

PR Changes:

  • Added a call to io.parseCompound in io.parseDataset for scalar (H5S_SCALAR) dataspace type.
  • Added a condition in io.writeCompound to export as scalar (H5S_SCALAR) if NWB dataset shape is scalar.
  • Added unittest confirming expected behavior

How to test the behavior?

runtests('tests.unit.io.ScalarCompoundTest/testScalarCompoundIO')

Todo

  • Add unittest

Checklist

  • Have you ensured the PR description clearly describes the problem and solutions?
  • Have you checked to ensure that there aren't other open or previously closed Pull Requests for the same change?
  • If this PR fixes an issue, is the first line of the PR description fix #XX where XX is the issue number?

@ehennestad ehennestad marked this pull request as draft October 23, 2025 09:58
@codecov
Copy link

codecov bot commented Oct 25, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.59%. Comparing base (541db1d) to head (4696a9a).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #761   +/-   ##
=======================================
  Coverage   95.58%   95.59%           
=======================================
  Files         182      182           
  Lines        6366     6380   +14     
=======================================
+ Hits         6085     6099   +14     
  Misses        281      281           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ehennestad ehennestad marked this pull request as ready for review October 25, 2025 15:59
@ehennestad ehennestad requested a review from bendichter October 30, 2025 13:50
@ehennestad ehennestad merged commit 42fe0f1 into main Oct 30, 2025
18 checks passed
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.

[Bug]: MatNWB does not support reading scalar compound datasets with strings/booleans/references

3 participants