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

Support Writing Dynamic Filters with DataPipe #428

Merged
merged 29 commits into from
Jul 22, 2022

Conversation

lawrence-mbf
Copy link
Collaborator

Fixes #421

Motivation

Support writing Dynamic Filters with DataPipes.

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?

@lawrence-mbf lawrence-mbf requested a review from bendichter May 5, 2022 13:30
@lawrence-mbf lawrence-mbf self-assigned this May 5, 2022
@lawrence-mbf lawrence-mbf marked this pull request as draft May 5, 2022 13:30
@codecov
Copy link

codecov bot commented May 5, 2022

Codecov Report

Merging #428 (c40ebf8) into master (1836b93) will decrease coverage by 0.96%.
The diff coverage is 17.10%.

❗ Current head c40ebf8 differs from pull request most recent head 1d17bcc. Consider uploading reports for the commit 1d17bcc to get more accurate results

@@            Coverage Diff             @@
##           master     #428      +/-   ##
==========================================
- Coverage   86.00%   85.04%   -0.97%     
==========================================
  Files         125      126       +1     
  Lines        5067     5195     +128     
==========================================
+ Hits         4358     4418      +60     
- Misses        709      777      +68     
Impacted Files Coverage Δ
...pes/+untyped/+datapipe/+properties/DynamicFilter.m 0.00% <0.00%> (ø)
+tests/+unit/dataPipeTest.m 60.75% <3.22%> (-37.16%) ⬇️
+types/+untyped/DataPipe.m 68.54% <66.66%> (-0.36%) ⬇️
+types/+untyped/+datapipe/BlueprintPipe.m 75.00% <71.42%> (-0.52%) ⬇️
+file/fillProps.m 95.08% <100.00%> (-0.08%) ⬇️
+types/+util/+dynamictable/nwbToTable.m 90.00% <0.00%> (-4.60%) ⬇️
+io/writeCompound.m 79.16% <0.00%> (-2.32%) ⬇️
+types/+util/+dynamictable/checkConfig.m 92.85% <0.00%> (-0.48%) ⬇️
+tests/+system/DynamicTableTest.m 89.15% <0.00%> (+0.16%) ⬆️
+types/+untyped/DataStub.m 91.90% <0.00%> (+0.27%) ⬆️
... and 3 more

Help us with your feedback. Take ten seconds to tell us how you rate us.

@bendichter
Copy link
Contributor

This looks like a good start. Did you forget to commit other files?

@lawrence-mbf
Copy link
Collaborator Author

This looks like a good start. Did you forget to commit other files?

This was supposed to be a draft lol, sorry for having it notify you.

@bendichter
Copy link
Contributor

Well looks good so far! Let me know when you have a demo ready

- Dynamic Filter now checks if the filter is available before being created.
- The parameters property is now an array like it should be when writing properties. it is still
up to the user to format their arguments correctly.
Allows for integration of dynamic filters without using blueprint pipe.
Updated tutorials to reflect changes.
azure pipelines now also export the default HDF5 plugins like BZIP2 and others.
@lawrence-mbf lawrence-mbf marked this pull request as ready for review June 3, 2022 21:20
@lawrence-mbf
Copy link
Collaborator Author

@bendichter I have a barebones tutorial in tutorials/dynamically_loaded_filter_writes.mlx. It currently uses zstd but I think you could flip it to Bzip2 if needed since that's included in hdfplugins by default.

lawrence-mbf and others added 3 commits June 3, 2022 17:40
Potential azure pipeline syntax fix.
fix minor variable name error.
- Removed OPTIONAL since some optional properties are actualy readonly.
- Fix spaced parentheses for documentation.
Blueprint pipes now check specifically for dynamic filte properties.
Now set to -1 which disables the property.
- Added mention and example for multiple external filters.
- Now uses proper NWB example form.
Renamed `externalFilters` -> `extraFilters`

On construction, must specify EITHER `compressionLevel` and/or `hasShuffle` OR
`extraFilters`. Otherwise, an error will be thrown.

Now allows generic Properties as filters to allow for setting default compression or shuffle as
extra filters.
Apparantly bzip2 is not provided in the default hdf5plugin package. Changed to LZ4.
For support with external filters array supporting default Compression and Shuffle filters.
Fixed xor case where neither properties are set (shouldn't error).
Update consistency of logical flag checks.
Test Heterogeneous filter (shuffle + lz4).
Add extra checks and validations for compressionLevel and hasShuffle properties.
@bendichter
Copy link
Contributor

@lawrence-mbf is this ready for review?

@lawrence-mbf
Copy link
Collaborator Author

@bendichter Yeah, I updated the conversation in your review but I guess that didn't notify.

The prescence of `filters` now invalidates the existence of other keyword arguments
`compressionLevel` and `hasShuffle`.
@lawrence-mbf lawrence-mbf requested a review from bendichter July 22, 2022 13:16
If a user uses "compressionLevel" and/or "hasShuffle" along with "filters", "filters" wins out and
"compressionLevel" and "hasShuffle" are not set at all.
@bendichter
Copy link
Contributor

@lawrence-mbf error when running nwbExport on the example livescript:

Error using [hdf5lib2](matlab:matlab.internal.language.introspective.errorDocCallback('hdf5lib2'))
The HDF5 library encountered an error and produced the
following stack trace information:

    H5Z__prelude_callback    error during user callback

Error in [H5D.create](matlab:matlab.internal.language.introspective.errorDocCallback('H5D.create', '/Applications/MATLAB_R2022a.app/toolbox/matlab/imagesci/+H5D/create.m', 63)) ([line 63](matlab: opentoline('/Applications/MATLAB_R2022a.app/toolbox/matlab/imagesci/+H5D/create.m',63,0)))
id = H5ML.hdf5lib2('H5Dcreate', varargin{:} );

Error in [types.untyped.datapipe.BlueprintPipe/write](matlab:matlab.internal.language.introspective.errorDocCallback('types.untyped.datapipe.BlueprintPipe/write', '/Users/bendichter/dev/matnwb/+types/+untyped/+datapipe/BlueprintPipe.m', 203)) ([line 203](matlab: opentoline('/Users/bendichter/dev/matnwb/+types/+untyped/+datapipe/BlueprintPipe.m',203,0)))
            did = H5D.create(fid, fullpath, tid, sid, lcpl, dcpl, dapl);

Error in [types.untyped.DataPipe/export](matlab:matlab.internal.language.introspective.errorDocCallback('types.untyped.DataPipe/export', '/Users/bendichter/dev/matnwb/+types/+untyped/DataPipe.m', 274)) ([line 274](matlab: opentoline('/Users/bendichter/dev/matnwb/+types/+untyped/DataPipe.m',274,0)))
            obj.internal = obj.internal.write(fid, fullpath);

Error in [indexing](matlab:matlab.internal.language.introspective.errorDocCallback('types.untyped.DataPipe/subsref', '/Users/bendichter/dev/matnwb/+types/+untyped/DataPipe.m', 293)) ([line 293](matlab: opentoline('/Users/bendichter/dev/matnwb/+types/+untyped/DataPipe.m',293,0)))
                B = builtin('subsref', obj, S);

Error in [types.core.TimeSeries/export](matlab:matlab.internal.language.introspective.errorDocCallback('types.core.TimeSeries/export', '/Users/bendichter/dev/matnwb/+types/+core/TimeSeries.m', 340)) ([line 340](matlab: opentoline('/Users/bendichter/dev/matnwb/+types/+core/TimeSeries.m',340,0)))
            refs = obj.data.export(fid, [fullpath '/data'], refs);

Error in [types.untyped.Set/export](matlab:matlab.internal.language.introspective.errorDocCallback('types.untyped.Set/export', '/Users/bendichter/dev/matnwb/+types/+untyped/Set.m', 181)) ([line 181](matlab: opentoline('/Users/bendichter/dev/matnwb/+types/+untyped/Set.m',181,0)))
                    refs = v.export(fid, propfp, refs);

Error in [types.core.NWBFile/export](matlab:matlab.internal.language.introspective.errorDocCallback('types.core.NWBFile/export', '/Users/bendichter/dev/matnwb/+types/+core/NWBFile.m', 834)) ([line 834](matlab: opentoline('/Users/bendichter/dev/matnwb/+types/+core/NWBFile.m',834,0)))
        refs = obj.acquisition.export(fid, [fullpath '/acquisition'], refs);

Error in [NwbFile/export](matlab:matlab.internal.language.introspective.errorDocCallback('NwbFile/export', '/Users/bendichter/dev/matnwb/NwbFile.m', 62)) ([line 62](matlab: opentoline('/Users/bendichter/dev/matnwb/NwbFile.m',62,0)))
                refs = [email protected](obj, output_file_id, '/', {});

Error in [nwbExport](matlab:matlab.internal.language.introspective.errorDocCallback('nwbExport', '/Users/bendichter/dev/matnwb/nwbExport.m', 36)) ([line 36](matlab: opentoline('/Users/bendichter/dev/matnwb/nwbExport.m',36,0)))
    nwb(i).export(filename);

@lawrence-mbf
Copy link
Collaborator Author

@lawrence-mbf error when running nwbExport on the example livescript:

Error using [hdf5lib2](matlab:matlab.internal.language.introspective.errorDocCallback('hdf5lib2'))
The HDF5 library encountered an error and produced the
following stack trace information:

    H5Z__prelude_callback    error during user callback

Error in [H5D.create](matlab:matlab.internal.language.introspective.errorDocCallback('H5D.create', '/Applications/MATLAB_R2022a.app/toolbox/matlab/imagesci/+H5D/create.m', 63)) ([line 63](matlab: opentoline('/Applications/MATLAB_R2022a.app/toolbox/matlab/imagesci/+H5D/create.m',63,0)))
id = H5ML.hdf5lib2('H5Dcreate', varargin{:} );

Error in [types.untyped.datapipe.BlueprintPipe/write](matlab:matlab.internal.language.introspective.errorDocCallback('types.untyped.datapipe.BlueprintPipe/write', '/Users/bendichter/dev/matnwb/+types/+untyped/+datapipe/BlueprintPipe.m', 203)) ([line 203](matlab: opentoline('/Users/bendichter/dev/matnwb/+types/+untyped/+datapipe/BlueprintPipe.m',203,0)))
            did = H5D.create(fid, fullpath, tid, sid, lcpl, dcpl, dapl);

Error in [types.untyped.DataPipe/export](matlab:matlab.internal.language.introspective.errorDocCallback('types.untyped.DataPipe/export', '/Users/bendichter/dev/matnwb/+types/+untyped/DataPipe.m', 274)) ([line 274](matlab: opentoline('/Users/bendichter/dev/matnwb/+types/+untyped/DataPipe.m',274,0)))
            obj.internal = obj.internal.write(fid, fullpath);

Error in [indexing](matlab:matlab.internal.language.introspective.errorDocCallback('types.untyped.DataPipe/subsref', '/Users/bendichter/dev/matnwb/+types/+untyped/DataPipe.m', 293)) ([line 293](matlab: opentoline('/Users/bendichter/dev/matnwb/+types/+untyped/DataPipe.m',293,0)))
                B = builtin('subsref', obj, S);

Error in [types.core.TimeSeries/export](matlab:matlab.internal.language.introspective.errorDocCallback('types.core.TimeSeries/export', '/Users/bendichter/dev/matnwb/+types/+core/TimeSeries.m', 340)) ([line 340](matlab: opentoline('/Users/bendichter/dev/matnwb/+types/+core/TimeSeries.m',340,0)))
            refs = obj.data.export(fid, [fullpath '/data'], refs);

Error in [types.untyped.Set/export](matlab:matlab.internal.language.introspective.errorDocCallback('types.untyped.Set/export', '/Users/bendichter/dev/matnwb/+types/+untyped/Set.m', 181)) ([line 181](matlab: opentoline('/Users/bendichter/dev/matnwb/+types/+untyped/Set.m',181,0)))
                    refs = v.export(fid, propfp, refs);

Error in [types.core.NWBFile/export](matlab:matlab.internal.language.introspective.errorDocCallback('types.core.NWBFile/export', '/Users/bendichter/dev/matnwb/+types/+core/NWBFile.m', 834)) ([line 834](matlab: opentoline('/Users/bendichter/dev/matnwb/+types/+core/NWBFile.m',834,0)))
        refs = obj.acquisition.export(fid, [fullpath '/acquisition'], refs);

Error in [NwbFile/export](matlab:matlab.internal.language.introspective.errorDocCallback('NwbFile/export', '/Users/bendichter/dev/matnwb/NwbFile.m', 62)) ([line 62](matlab: opentoline('/Users/bendichter/dev/matnwb/NwbFile.m',62,0)))
                refs = [email protected](obj, output_file_id, '/', {});

Error in [nwbExport](matlab:matlab.internal.language.introspective.errorDocCallback('nwbExport', '/Users/bendichter/dev/matnwb/nwbExport.m', 36)) ([line 36](matlab: opentoline('/Users/bendichter/dev/matnwb/nwbExport.m',36,0)))
    nwb(i).export(filename);

Oh that's weird. I can't recreate that at all.

@lawrence-mbf
Copy link
Collaborator Author

That looks like an error with the plugin itself maybe? I'm currently using the library here: https://github.com/aparamon/HDF5Plugin-Zstandard I don't think hdf5lib actually has this one by default.

Should now show the warning correctly.
@bendichter
Copy link
Contributor

@lawrence-mbf are you not using hdf5plugin?

@lawrence-mbf
Copy link
Collaborator Author

@bendichter Oh wait no you're right that's what I'm using.

@bendichter bendichter merged commit 1afc23c into master Jul 22, 2022
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.

[Feature]: write with dynamically loaded filters
3 participants