prjemian/punx

only link shown for data field

Closed this issue · 4 comments

When using punx tree S-some_file.h5, the /entry/data/data field is shown linked:

    data:NXdata
      @NX_class = "NXdata"
      @signal = "data"
      data --> b'/entry/instrument/detector/data'

but later, in NXinstrument, the data field is only described by its link and not by its content (as expected):

        data --> /entry/instrument/detector/data

Should be easy to test.

The problem file is written incorrectly for NeXus. There is a circular NeXus reference between /entry/data/data and /entry/instrument/detector/data`.

/entry/instrument/detector/data
            DATASET "data" {
               HARDLINK "/entry/data/data"
            }

This looks fine by HDF5 and by NeXus.

/entry/data/data
            ATTRIBUTE "target" {
               DATATYPE  H5T_STRING {
                  STRSIZE 32;
                  STRPAD H5T_STR_NULLTERM;
                  CSET H5T_CSET_ASCII;
                  CTYPE H5T_C_S1;
               }
               DATASPACE  SCALAR
               DATA {
               (0): "/entry/instrument/detector/data"
               }
            }

Since /entry/instrument/detector/data is a hard link pointing to /entry/data/data, the value of the /entry/data/data@target attribute (here) should be /entry/data/data.

Something else going on with that file. Such as no image data found.

Still not reproducing that situation. Might need the original file.

Here is h5dump structure of target attribute constructed in punx/tests/test_issue210.py:test_create_user_file_structure():

            ATTRIBUTE "target" {
               DATATYPE  H5T_STRING {
                  STRSIZE H5T_VARIABLE;
                  STRPAD H5T_STR_NULLTERM;
                  CSET H5T_CSET_UTF8;
                  CTYPE H5T_C_S1;
               }
               DATASPACE  SCALAR
               DATA {
               (0): "/entry/instrument/detector/data"
               }
            }

Differences from the user-supplied example:

parameter user file test file
STRSIZE 32 H5T_VARIABLE
CSET H5T_CSET_ASCII H5T_CSET_UTF8