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

Enhancement of NeXus file IO #2725

Merged

Conversation

ptim0626
Copy link
Contributor

@ptim0626 ptim0626 commented Apr 29, 2021

Description of the change

The PR contains some improvement and bug fixes about the IO of NeXus file.

  • set correct chunk size for lazy dataset (previously it is chunked incorrectly)
  • load NeXus dataset and HDF5 dataset consistently
  • add option to skip loading array original metadata (this is to avoid duplicating the loading of some large arrays)
hs.load('nexus_file.nxs', skip_array_metadata=True)
  • add option to load a specific dataset by specifying absolute path
hs.load('nexus_file.nxs', dataset_path='/entry/instrument/data')
  • add option to skip certain original metadata when writing new file by specifying keys
s.save('output.nxs', skip_metadata_key=['sample', 'detector'])

Besides the new options, it also adds tests to cover previously uncovered parts. Any comment is welcomed.

Progress of the PR

  • Changes implemented,
  • update docstring,
  • update user guide,
  • add entry to CHANGES.rst,
  • add tests,
  • ready for review.

@codecov
Copy link

codecov bot commented Apr 29, 2021

Codecov Report

Merging #2725 (2a206a5) into RELEASE_next_minor (9355e30) will increase coverage by 0.25%.
The diff coverage is 93.84%.

Impacted file tree graph

@@                  Coverage Diff                   @@
##           RELEASE_next_minor    #2725      +/-   ##
======================================================
+ Coverage               77.75%   78.00%   +0.25%     
======================================================
  Files                     203      203              
  Lines                   30632    30688      +56     
  Branches                 6671     6696      +25     
======================================================
+ Hits                    23817    23938     +121     
+ Misses                   5034     4995      -39     
+ Partials                 1781     1755      -26     
Impacted Files Coverage Δ
hyperspy/io_plugins/nexus.py 93.62% <93.84%> (+14.37%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9355e30...2a206a5. Read the comment docs.

Copy link
Member

@ericpre ericpre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me - see comments.

doc/user_guide/io.rst Outdated Show resolved Hide resolved
doc/user_guide/io.rst Outdated Show resolved Hide resolved
@ericpre ericpre merged commit eb093a4 into hyperspy:RELEASE_next_minor Jun 2, 2021
@ericpre ericpre added this to the v1.7 milestone Jun 2, 2021
@ptim0626 ptim0626 deleted the nexus_reader_improvement branch June 2, 2021 20:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants