prjemian / punx

Python Utilities for NeXus HDF5 files
https://prjemian.github.io/punx
5 stars 7 forks source link

fix external link bug #201

Closed woutdenolf closed 2 years ago

woutdenolf commented 2 years ago

Bug when displaying an HDF5 tree with external links.

Before the fix

  @default = "entry"
  entry:NXentry
    @NX_class = "NXentry"
    @default = "data"
    data:NXdata
      @NX_class = "NXdata"
      @axes = "two_theta"
      @signal = "counts"
      @two_theta_indices = [0]
      counts:NX_INT32[31] = [1037, 1318, 1704, '...', 1321]
        @units = "counts"

@
f
i
l
e

=

"
e
x
t
e
r
n
a
l
_
c
o
u
n
t
s
.
h
d
f
5
"
 ...

After the fix

  @default = "entry"
  entry:NXentry
    @NX_class = "NXentry"
    @default = "data"
    data:NXdata
      @NX_class = "NXdata"
      @axes = "two_theta"
      @signal = "counts"
      @two_theta_indices = [0]
      counts:NX_INT32[31] = [1037, 1318, 1704, '...', 1321]
        @units = "counts"
        @file = "external_counts.hdf5"
        @path = "/entry/instrument/detector/counts"
      two_theta:NX_FLOAT64[31] = [17.92608, 17.92591, 17.92575, '...', 17.92108]
        @units = "degrees"
        @file = "external_angles.hdf5"
        @path = "/angles"
    instrument:NXinstrument
      @NX_class = "NXinstrument"
      @file = "external_counts.hdf5"
      @path = "/entry/instrument"
      detector:NXdetector
        @NX_class = "NXdetector"
        counts:NX_INT32[31] = [1037, 1318, 1704, '...', 1321]
          @units = "counts"
        two_theta:NX_FLOAT64[31] = [17.92608, 17.92591, 17.92575, '...', 17.92108]
          @units = "degrees"
          @file = "external_angles.hdf5"
          @path = "/angles"
prjemian commented 2 years ago

Other uses

Used as string: https://github.com/prjemian/punx/blob/ec50d9afde1ee17c247940d90adf20d8c60e89dc/punx/h5tree.py#L194

Wrapped as list: https://github.com/prjemian/punx/blob/ec50d9afde1ee17c247940d90adf20d8c60e89dc/punx/h5tree.py#L148

prjemian commented 2 years ago

@woutdenolf @carterbox Thanks!

coveralls commented 2 years ago

Coverage Status

Coverage remained the same at 95.221% when pulling ec50d9afde1ee17c247940d90adf20d8c60e89dc on woutdenolf:fix_external_link_bug into 75477ab63518d8c134ebc02bf839c60042a0461e on prjemian:main.