Open h-mayorquin opened 5 months ago
Attention: Patch coverage is 70.37037%
with 16 lines
in your changes missing coverage. Please review.
Project coverage is 88.96%. Comparing base (
b78625b
) to head (3813723
).
Files with missing lines | Patch % | Lines |
---|---|---|
src/hdmf/container.py | 70.37% | 10 Missing and 6 partials :warning: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
OK, I added table formating for hdf5:
@stephprince Concerning the test, yes, I can do it, but, can you helmp to create a container that contains array data? I just don't have experienced with the bare bones object. This is my attempt:
from hdmf.container import Container
container = Container(name="Container")
container.__fields__ = {
"name": "data",
"description": "test data",
}
test_data = np.array([1, 2, 3, 4, 5])
setattr(container, "data", test_data)
container.fields
But the data is not added as a field. How can I move forward?
I added the handling division by zero, check this out what happens with external files (like Video):
From this example:
import remfile
import h5py
asset_path = "sub-CSHL049/sub-CSHL049_ses-c99d53e6-c317-4c53-99ba-070b26673ac4_behavior+ecephys+image.nwb"
recording_asset = dandiset.get_asset_by_path(path=asset_path)
url = recording_asset.get_content_url(follow_redirects=True, strip_query=True)
file_path = url
rfile = remfile.File(file_path)
file = h5py.File(rfile, 'r')
from pynwb import NWBHDF5IO
io = NWBHDF5IO(file=file, mode='r')
nwbfile = io.read()
nwbfile
There are still some failing tests for different python versions, it looks like one of the reasons is because h5py added the .nbytes
attribute in version 3.0 and we still have h5py==2.10
as a minimum version.
> array_size_in_bytes = array.nbytes
E AttributeError: 'Dataset' object has no attribute 'nbytes'
I'm not sure if there's another way to access that information or if we would just want to optionally display it if available.
I'm not sure if there's another way to access that information or if we would just want to optionally display it if available.
Checking if hasattr(data, "nbytes")
to optionally seems reasonable to me. In this way you can also avoid custom behavior depending on library versions.
@stephprince
I'm not sure if there's another way to access that information or if we would just want to optionally display it if available.
It can be estimated from the dtype and the number of elements. I will do that when the attribute does not exists.
@stephprince when you have time, can you review this?
Motivation
Improve the display of the data in the html representation of containers. Note that this PR is focused on datasets that were already written. For in memory representation the issue on what to do with things that are wrapped in an iterator or an
DataIO
subtype can be addressed in another PR I think.How to test the behavior?
HDF5
I have been using this script
Zarr
Checklist
CHANGELOG.md
with your changes?