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

Guard against length-1 arrays used for scalar detector metadata #460

Merged
merged 7 commits into from
Jan 25, 2022

Conversation

benjaminhwilliams
Copy link

@benjaminhwilliams benjaminhwilliams commented Jan 12, 2022

Some NXmx data sources write single-valued data as length-1 1-d arrays, rather than as scalar data sets. A key offender is Dectris, who write lots of their Eiger metadata in this way. Squeeze all NXdetector properties to guard against malformed values.

Tests to follow in about a week's time when we can collect appropriate data.

Some NXmx data sources write single-valued data as length-1 1-d arrays,
rather than as scalar data sets.  A key offender is Dectris, who write
lots of their Eiger metadata in this way.  Squeeze all NXdetector
properties to guard against malformed values.
@codecov
Copy link

codecov bot commented Jan 12, 2022

Codecov Report

Merging #460 (13fe50b) into main (927539e) will decrease coverage by 0.13%.
The diff coverage is 68.18%.

@@            Coverage Diff             @@
##             main     #460      +/-   ##
==========================================
- Coverage   66.42%   66.28%   -0.14%     
==========================================
  Files         185      185              
  Lines       17011    17109      +98     
  Branches     2381     2423      +42     
==========================================
+ Hits        11299    11341      +42     
- Misses       5144     5194      +50     
- Partials      568      574       +6     

@benjaminhwilliams benjaminhwilliams changed the title Guard against length-1 arrays used for scalar data Guard against length-1 arrays used for scalar detector metadata Jan 12, 2022
@ndevenish ndevenish marked this pull request as ready for review January 25, 2022 15:27
@ndevenish
Copy link
Collaborator

After discussion we'd like to get this in here now so that we can test and refine against live data. Tests will follow once we know that it's working for its intended purpose.

@ndevenish ndevenish merged commit 591dde9 into main Jan 25, 2022
@ndevenish ndevenish deleted the handle-nonscalar-scalars branch January 25, 2022 15:57
ndevenish pushed a commit that referenced this pull request Feb 7, 2022
Some NXmx data sources write single-valued data as length-1 1-d arrays,
rather than as scalar data sets. Dectris writes lots of their Eiger
metadata in this way. Squeeze all NXdetector properties to guard against
malformed values.
benjaminhwilliams added a commit that referenced this pull request Mar 14, 2022
Adds a test for changes introduced in #460.
benjaminhwilliams added a commit that referenced this pull request Mar 14, 2022
Adds a test for changes introduced in #460.
benjaminhwilliams added a commit that referenced this pull request Mar 15, 2022
According to the NeXus specification, we currently represent as ints or 
floats some quantities that have, or can have, measurement units.  
Ensure that these data are represented as pint.Quantity instances 
instead, so that we can retain any units defined in the corresponding 
HDF5 data set attributes.

As a side-effect, this introduces a test for the changes in #460.

Co-authored-by: DiamondLightSource-build-server <DiamondLightSource-build-server@users.noreply.github.com>
Co-authored-by: Richard Gildea <richard.gildea@diamond.ac.uk>
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.

2 participants